5150/readfloppy.asm

36 lines
649 B
NASM

BITS 16
org 0xff00
; actual entry point of the program, must be present
start:
; sp and all segment registers need to be saved
push bp ; and we also save bp (??)
push es
mov bp, sp ; we'll need that to access parameters
xor dx, dx ; drive 0, head 0
mov es, dx ; es = 0
mov bx, 0xf000 ; store the read sector there
mov ax, 0x0201 ; read, 1 sector
; params: head, cylinder, sector, out
mov si, [bp+14]
mov dh, [si]
mov si, [bp+12]
mov ch, [si]
mov si, [bp+10]
mov cl, [si]
int 0x13
mov si, [bp+8]
mov [si], ax
pop es
pop bp
retf 8 ; 6 is 2x the number of parameters on the stack