could someone have a look at my load routine and tell me if theres anything conceptually wrong with it
suppose i want to load N sectors, starting from LBA sector S on floppy into memory location L, then i would do something like this:
Code: Select all
mov ax, L/010h
mov es, ax
mov bx, 0
mov si, N
mov cx, S
mov dh, 0
call loop_load
loop_load:
cmp si, 0h
je end_loop_load
call loadSector
dec si
inc cl
mov ax, es
add ax, SECTOR_SIZE/10h ; SECTOR_SIZE defined as 512
mov es, ax
jmp loop_load
end_loop_load:
ret
align 2
loadSector:
cmp cl, MAXSECTOR + 1 ; MAXSECTOR defined as 18
jne do_load_sector
mov cl, MINSECTOR ; MINSECTOR defined as 1
inc dh
cmp dh, MAXHEAD + 1 ; MAXHEAD defined as 1
jne do_load_sector
mov dh, MINHEAD ; MINHEAD defined as 1
inc ch
do_load_sector:
mov ah, 02h
mov al, 1
int 13h
jc lderr
ret