[org 0x7c00]
KERNEL_OFFSET equ 0x1000

mov [BOOT_DRIVE], dl

mov bp, 0x9000
mov sp, bp

mov bx, MSG_REAL_MODE
call print_string

call load_kernel

call switch_to_pm		;and never come back!

jmp $

%include "print_string.asm"
%include "disk_load.asm"
%include "gdt.asm"
%include "print_string_pm.asm"
%include "switch_to_pm.asm"
%include "clear_screen_pm.asm"


[bits 16]

load_kernel:
mov bx, MSG_LOAD_KERNEL
call print_string

mov bx, KERNEL_OFFSET
mov dh, 5
mov dl, [BOOT_DRIVE]
call disk_load

ret

[bits 32]

BEGIN_PM:

mov bx, MSG_PROT_MODE
call print_string_pm

call KERNEL_OFFSET

jmp $

BOOT_DRIVE    	db 0
MSG_REAL_MODE 	db "Started 16-Bit Real-Mode",0
MSG_PROT_MODE 	db "Started 32-Bit Protected-Mode",0
MSG_LOAD_KERNEL	db "Loading Kernel into Memory",0

times 510-($-$$) db 0
dw 0xaa55

times 1000-($-$$)db 0
times 1000 dw 0
