From 8cdc21b596da102dbd4dc328e48f9333530a1b79 Mon Sep 17 00:00:00 2001 From: Ain <41307858+nero@users.noreply.github.com> Date: Tue, 16 Apr 2019 07:22:53 +0000 Subject: [PATCH] Relocate kernel to 0x01000 per convention --- boot/floppy.asm | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/boot/floppy.asm b/boot/floppy.asm index a0993f5..0cfcba1 100644 --- a/boot/floppy.asm +++ b/boot/floppy.asm @@ -44,26 +44,16 @@ fdc: ; FDC Descriptor as per ECMA-107 times (62 - ($-$$)) db " " _startup: - mov ax, 0x1050 - ; setup relocated stack area + xor ax, ax + ; setup stack area growing down from 0x10000 mov ss, ax - xor sp, sp + mov sp, ax ; backup important values push bx push cx 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 - jmp 0x1050:main + jmp 0x07C0:main ; non-fdc variables rootdir: @@ -73,8 +63,8 @@ rootdir: dw 0 main: - ; setup buffer area directly after the BDA - mov ax, 0x0050 + ; setup buffer area directly at 4k + mov ax, 0x0100 mov ds, ax mov es, ax @@ -94,7 +84,7 @@ main: pop dx pop cx pop bx - jmp 0x0050:0000 + jmp 0x0100:0000 ; Write AX, a string and bail out ; Return pointer is the string start