Anyway, my bootloader loads 1 track (18 sectors in fat12) but my kernel recently expanded to be more than 1 track in size so I needed to make the bootloader load more tracks:
Code: Select all
read:
pusha
mov ah,2 ; read
mov al,18 ; 1 track at a time
mov ch,0 ; start at track 0
mov cl,2 ; start sector 2 = end of bootloader and start of kernel
mov dh,0 ; head 0
mov dl,byte[bootdev] ; boot device passed to us from BIOS st startup
mov bx,0x2000 ; load segment
mov es,bx
mov bx,0
.do:
int 0x13 ; read
jc .error ; if error ...
mov cl,0 ; all other reads start from sector 0
inc ch ; next track
cmp ch,3 ; read 3 tracks just to be safe
jne .do
.done:
mov ax,0x07c0 ; set es back to 0x07c0
mov es,ax
popa
ret
.error:
mov si,.msg
call printerr ; print error message in red
jmp error ; reboot
.msg: db 10,13,'Disk read error!!!',10,13,0

