Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bits 16
- org 0
- start:
- jmp short entry
- nop
- dw 'PI_10 ' ; disk name
- dw 512 ; sector size
- db 16 ; sectors per cluster
- dw 1 ; reserved sectors
- db 2 ; number of FAT copies
- dw 512 ; root entries
- dw 80*2*18 ; total # of sectors
- db 240 ; media type
- dw 1 ; sectors per FAT
- dw 18 ; sectors per track
- dw 2 ; number of heads
- times 4 dw 0
- db 0, 0 ; drive number, current head
- db 0x29 ; signature
- db 0xfd, 0x1a, 0xbe, 0xfa ; id
- db 'PI_10 ' ; volume label
- db 'FAT12 ' ; type
- entry:
- ; prepare .com-like environment
- cld
- xor ax, ax ; clear ax and dx
- cwd
- mov si, 0x100 ; initialize other registers
- mov cx, 0xff
- mov bp, 0x900
- mov di, 0xfffe
- xor sp, sp
- jmp 0x7c0:0x100 - 5
- times start + 0x100 - 5 - $ nop
- push ax
- push cs ; cs=ds=es=ss for DOS---es not needed really
- pop ds
- push cs
- pop ss
- ; here at 0x100 - based on pi_10.com
- dw 5000
- mov ch,0x7f
- mov es,cx ; es = 0x7fff
- inc ax
- mov bx,9860
- rep stosw
- .loop1:
- mov cx,es ; cx = 0x7fff
- .loop2:
- imul bp,cx,byte +0x2
- inc bp
- div bp
- xchg ax,dx
- stosw
- xchg ax,dx
- mul cx
- push dx ; dx:ax += 10 * [es:di]
- xchg ax,bp
- mov ax,10
- mul word [es:di]
- add ax,bp
- pop bp
- adc dx,bp
- loop .loop2
- div word [si]
- add al,0x30
- xchg ax,dx
- stosw
- call prch
- dec bx
- jnz .loop1
- cli
- hlt
- prch:
- pusha
- xchg ax,dx
- mov ah, 14
- mov bh, 0
- int 10h
- popa
- ret
- times start + 0x1fe - $ db 0
- db 0x55, 0xaa
Advertisement
Add Comment
Please, Sign In to add comment