diff --git a/boot/fatvbr.asm b/boot/fatvbr.asm index 4858eba..70059cf 100644 --- a/boot/fatvbr.asm +++ b/boot/fatvbr.asm @@ -63,6 +63,7 @@ init: mov ax, (psp >> 4) mov ss, ax xor sp, sp + push sp ; Relocate from [prog] to [self] xor ax, ax @@ -110,16 +111,25 @@ main: mov bp, 0x3332 jc error - ; setup int 19h call at 0000, and push its address to stack + ; setup int 19h call if prog returns mov WORD [psp], 0x19CD - push sp - ; clear out registers and jump into target + ; clean registers xor ax, ax xor cx, cx xor dx, dx xor bx, bx + + ; restore boot drive number mov dl, [fdc.drv] + + ; setup segment registers + push ss + pop ds + push ss + pop es + + ; jump into target jmp 0x07B0:0x0100 ; Read sectors from disk