X-Git-Url: http://git.dujemihanovic.xyz/projects?a=blobdiff_plain;f=boot%2Fx86%2Fboot.s;h=a7fe3c31ff1fb0f6cedf9a5fdd39f2718643dcac;hb=0b02cbac466992423caa450f9659b18d251a4158;hp=be6c6531d0a581d9c7b49fa91bbd977e6d52f183;hpb=63853960825f007827a79f704d291c372c807096;p=nameless-os.git diff --git a/boot/x86/boot.s b/boot/x86/boot.s index be6c653..a7fe3c3 100644 --- a/boot/x86/boot.s +++ b/boot/x86/boot.s @@ -15,7 +15,7 @@ KERNEL_OFFSET equ 1000h ; where we will load our kernel jc reset_error ; halt if controller reset fails mov ah, 2 ; instruct BIOS's interrupt 13h to read sectors - mov al, 10 ; load 10 sectors, might be excessive (for now) but it's still good to do so + mov al, 30 ; load 30 sectors, might be excessive (for now) but it's still good to do so xor ch, ch ; read from 1st cylinder mov cl, 2 ; start reading from 2nd sector, right after the boot sector xor dh, dh ; read from 1st head @@ -27,27 +27,34 @@ KERNEL_OFFSET equ 1000h ; where we will load our kernel jc read_error ; halt if read fails cmp al, 10 ; make sure we actually read 10 sectors jl read_error ; halt if we didn't - jmp switch_to_pm ; if all is good, begin the switch to 32-bit protected mode + + call check_a20 + cmp ax, 1 + jne a20_is_off + +a20_is_on + jmp switch_to_pm +a20_is_off + call enable_a20 + jmp switch_to_pm reset_error mov bx, 0B800h mov es, bx mov byte [es:di], '1' - jmp halt + jmp $ read_error mov bx, 0B800h mov es, bx mov byte [es:di], '2' - jmp halt - -halt jmp $ %include "a20.s" +%include "print.s" %include "protected.s" -BOOT_DRIVE db 0 ; reserve a spot in RAM for our boot drive variable +BOOT_DRIVE resb 1 times 510-($-$$) db 0 dw 0AA55h ; MBR signature