diff --git a/src/bootloader.asm b/src/bootloader.asm index 6c91be3..9815979 100644 --- a/src/bootloader.asm +++ b/src/bootloader.asm @@ -6,36 +6,23 @@ mov bp, 0x8000 ; move it to 0x8000 mov sp, bp - ; Print the welcome string - mov bx, welcome_string - call println - - ; Read second sector (outside bootsector) - mov bx, 0x9000 ; LOAD LOCATION - mov dh, 2 ; SECTOR-COUNT - mov dl, [BOOT_DRIVE] ; DISK-INDEX - call disk_read - - - ; Print out whatever bloated data that was read - mov dx, [0x9000] - call print_hex - - mov bx, [ASCII_END] - call println - - mov dx, [0x9000 + 512] ; read from second sector too - call print_hex + ; Switching to PM + call pm_preinit jmp $ ; inf loop %include "equ/ascii.asm" %include "bios.asm" +%include "pm.asm" -welcome_string: db "e Operating-System (eOS)", ASCII_CARRIAGE_RETURN, ASCII_LINEBREAK, "Version 2021 0.0", ASCII_END -BOOT_DRIVE: db 0 +BEGIN_PM: + mov ebx, welcome_string + call vga_print -%include "pm.asm" + jmp $ + +welcome_string: db "e Operating-System (eOS): Version 2021 0.0", ASCII_END +BOOT_DRIVE: db 0 ; Bootsector times 510-($-$$) db 0 diff --git a/src/pm.asm b/src/pm.asm index b74f3a4..001aeec 100644 --- a/src/pm.asm +++ b/src/pm.asm @@ -7,7 +7,7 @@ ; Switching to PM [bits 16] -switch_to_pm: +pm_preinit: cli ; Switch interupts lgdt [gdt_descriptor] ; Tell the CPU about the GDT @@ -16,9 +16,12 @@ switch_to_pm: or eax, 0x1 ; to 1 mov cr0, eax ; Update the control register + ; Initialize PM + jmp GDT_CODE_SEG:pm_init + [bits 32] ; Init registers & stack when in PM -init_pm: +pm_init: mov ax, GDT_DATA_SEG ; Point the segment registers to GDT_DATA_SEG ; Segment registers mov ds, ax