Rework early startup and fix bss memory reservation
This commit is contained in:
parent
4804bf28ea
commit
da41f6b0e2
@ -255,50 +255,59 @@ fputc: push ax
|
||||
pop ax
|
||||
iret
|
||||
|
||||
main: int 0x28
|
||||
jmp main
|
||||
; write CS:AX to ES:DI and advance DI
|
||||
; used for setting interrupts
|
||||
stovec: stosw
|
||||
mov ax, cs
|
||||
stosw
|
||||
ret
|
||||
|
||||
vects: dw int20h, int21h, idle, fputc
|
||||
|
||||
main: mov si, vects
|
||||
mov di, (0x20*4)
|
||||
lodsw
|
||||
call stovec
|
||||
lodsw
|
||||
call stovec
|
||||
mov di, (0x28*4)
|
||||
lodsw
|
||||
call stovec
|
||||
lodsw
|
||||
call stovec
|
||||
|
||||
mov si, banner
|
||||
mov ah, 9
|
||||
int 0x21
|
||||
|
||||
loop: int 0x28
|
||||
mov ah, 7
|
||||
int 0x21
|
||||
jz loop
|
||||
int 0x29
|
||||
jmp loop
|
||||
|
||||
init: cli
|
||||
xor ax, ax
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov ss, ax
|
||||
xor sp, sp
|
||||
mov sp, stacke
|
||||
|
||||
; relocate
|
||||
mov si, 0x7C00
|
||||
mov di, $$
|
||||
mov cx, (init-$$)
|
||||
rep movsb
|
||||
|
||||
; Set boot drive as current drive
|
||||
call dnconv
|
||||
call select
|
||||
|
||||
; Set int 0x20 to 0x2F
|
||||
mov di, (0x20*4)
|
||||
mov si, ivects+0x7C00-$$
|
||||
mov cx, 0x10
|
||||
.loop: movsw
|
||||
mov ax, cs
|
||||
stosw
|
||||
loop .loop
|
||||
|
||||
mov si, banner
|
||||
mov ah, 0x09
|
||||
int 0x21
|
||||
|
||||
jmp 0:main
|
||||
|
||||
ivects: dw int20h, int21h, iret, iret
|
||||
dw iret, iret, iret, iret
|
||||
dw idle, fputc, iret, iret
|
||||
dw iret, iret, iret, iret
|
||||
|
||||
section .bss
|
||||
bpb: times bpb_len resb 0
|
||||
drvnum: resb 0
|
||||
bpb: resb bpb_len
|
||||
drvnum: resb 1
|
||||
align 4
|
||||
drvoff: resd 0 ; partition offset
|
||||
drvpos: resd 0 ; absolute physical sector number
|
||||
buffer: times 512 resb 0
|
||||
|
||||
drvoff: resd 1; partition offset
|
||||
drvpos: resd 1; absolute physical sector number
|
||||
buffer: resb 512
|
||||
stack: resw 512
|
||||
stacke:
|
||||
|
Loading…
Reference in New Issue
Block a user