This commit is contained in:
nub31
2025-08-22 21:28:06 +02:00
parent e07482adcc
commit f219bc7fa3
4 changed files with 65 additions and 0 deletions

View File

@@ -1,6 +1,32 @@
[org 0x7c00]
[bits 16]
KERNEL_LOCATION equ 0x1000
mov [BOOT_DISK], dl
xor ax, ax
mov es, ax
mov ds, ax
mov bp, 0x8000
mov sp, bp
mov bx, KERNEL_LOCATION
mov dh, 2
mov ah, 0x02
mov al, dh
mov ch, 0x00
mov dh, 0x00
mov cl, 0x02
mov dl, [BOOT_DISK]
int 0x13
mov ah, 0x0
mov al, 0x3
int 0x10
CODE_SEG equ gdt_code - gdt_start
cli
@@ -40,6 +66,17 @@ gdt_descriptor:
[bits 32]
start_protected_mode:
mov ax, DATA_SEG
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ebp, 0x90000
mov esp, ebp
jmp KERNEL_LOCATION
jmp $

View File

@@ -0,0 +1,5 @@
int main(void)
{
*(char*)0xb8000 = 'A';
return 0;
}

5
src/kernel_entry.asm Normal file
View File

@@ -0,0 +1,5 @@
section .text
[bits 32]
[extern main]
call main
jmp $