Relocate kernel to 0x01000 per convention

This commit is contained in:
Nero 2019-04-16 07:22:53 +00:00
parent 0094ee6b95
commit 8cdc21b596

View File

@ -44,26 +44,16 @@ fdc: ; FDC Descriptor as per ECMA-107
times (62 - ($-$$)) db " " times (62 - ($-$$)) db " "
_startup: _startup:
mov ax, 0x1050 xor ax, ax
; setup relocated stack area ; setup stack area growing down from 0x10000
mov ss, ax mov ss, ax
xor sp, sp mov sp, ax
; backup important values ; backup important values
push bx push bx
push cx push cx
push dx push dx
; setup relocated code area
mov es, ax
mov di, 0x0000
; setup start code area
xor ax, ax
mov ds, ax
mov si, 0x7C00
; relocate 256 words
mov cx, 0x0100
rep movsw
; adjust CS ; adjust CS
jmp 0x1050:main jmp 0x07C0:main
; non-fdc variables ; non-fdc variables
rootdir: rootdir:
@ -73,8 +63,8 @@ rootdir:
dw 0 dw 0
main: main:
; setup buffer area directly after the BDA ; setup buffer area directly at 4k
mov ax, 0x0050 mov ax, 0x0100
mov ds, ax mov ds, ax
mov es, ax mov es, ax
@ -94,7 +84,7 @@ main:
pop dx pop dx
pop cx pop cx
pop bx pop bx
jmp 0x0050:0000 jmp 0x0100:0000
; Write AX, a string and bail out ; Write AX, a string and bail out
; Return pointer is the string start ; Return pointer is the string start