Skip to content
Snippets Groups Projects
Commit 58da7e98 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

kernel loader working in 16bit mode

parent aa814a9c
No related branches found
No related tags found
No related merge requests found
......@@ -2,8 +2,31 @@
[org 0x7c00]
mov [_boot_drive_id], dl
; Load the kernel image from boot disk, disk offset 512B to 64KB.
KERN_ADDR equ 0x7e00
mov ah, 0x02
mov dl, [_boot_drive_id]
mov ch, 0
mov dh, 0
mov cl, 2 ; from the second one,
mov al, 127 ; read 127 sectors in total.
mov bx, KERN_ADDR
int 0x13 ; Set carry on error, and set AL to sectors that actual read.
jc disk_io_error
mov dl, 0x7f
cmp dl, al
jne disk_io_error
; kernel successfully loaded now!
mov bx, _motd_kern_ok
call println_bios
jmp _init_prot_mode
%include "./str.16.inc"
gdt_begin:
gdt_entry_0:
......@@ -63,25 +86,6 @@ _prot_begin:
call println_vga
; Load the kernel image from boot disk, disk offset 512B to 64KB.
KERN_ADDR equ 0x7e00
mov ah, 0x02
mov ch, 0
mov dh, 0
mov cl, 2 ; from the second one,
mov al, 127 ; read 127 sectors in total.
mov bx, KERN_ADDR
int 0x13 ; Set carry on error, and set AL to sectors that actual read.
jmp _stall
jc disk_io_error
mov dl, 0x7f
cmp dl, al
jne disk_io_error
; kernel successfully loaded now!
mov ebx, _motd_kern_ok
call println_vga
_stall:
jmp $
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment