diff --git a/src/bootloader.asm b/src/bootloader.asm index bcf841c..b7149f9 100644 --- a/src/bootloader.asm +++ b/src/bootloader.asm @@ -1,11 +1,16 @@ [org 0x7c00] ; bootsector + KERNEL_OFFSET equ 0x1000 + ; Save the boot drive index mov [BOOT_DRIVE], dl ; Move the stack pointer somewhere safe - mov bp, 0x8000 ; move it to 0x8000 + mov bp, 0x9000 ; move it to 0x8000 mov sp, bp + ; Load kernel into memory + call load_kernel + ; Switching to PM call pm_preinit @@ -21,7 +26,23 @@ BEGIN_PM: jmp $ -welcome_string: db "e Operating-System (eOS): Version 2021 0.0", ASCII_END + +[bits 16] +load_kernel: + mov bx, KERNEL_OFFSET ; Load kernel at the kernel offset + mov dh, 15 ; Read 15 sectors + mov dl, [BOOT_DRIVE] ; Drive index + call disk_read ; Load the kernel + + ret + +welcome_string: db "e Operating-System (eOS): Version 2021 0.0", ASCII_END + +stat_realmode: db "Entering 16bit Real Mode...", ASCII_END +stat_pm_init: db "Entering 32bit Protected Mode...", ASCII_END + +stat_success: db " [OK]", ASCII_CARRIAGE_RETURN, ASCII_NEWLINE, ASCII_END + BOOT_DRIVE: db 0 ; Bootsector