fatvbr: correctly setup segment registers

This commit is contained in:
Nero 2019-09-15 19:49:58 +00:00
parent 956df75dae
commit fe42e9145a

View File

@ -63,6 +63,7 @@ init:
mov ax, (psp >> 4) mov ax, (psp >> 4)
mov ss, ax mov ss, ax
xor sp, sp xor sp, sp
push sp
; Relocate from [prog] to [self] ; Relocate from [prog] to [self]
xor ax, ax xor ax, ax
@ -110,16 +111,25 @@ main:
mov bp, 0x3332 mov bp, 0x3332
jc error 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 mov WORD [psp], 0x19CD
push sp
; clear out registers and jump into target ; clean registers
xor ax, ax xor ax, ax
xor cx, cx xor cx, cx
xor dx, dx xor dx, dx
xor bx, bx xor bx, bx
; restore boot drive number
mov dl, [fdc.drv] mov dl, [fdc.drv]
; setup segment registers
push ss
pop ds
push ss
pop es
; jump into target
jmp 0x07B0:0x0100 jmp 0x07B0:0x0100
; Read sectors from disk ; Read sectors from disk