From e07482adcc3fc8f3993839463262894b926faa98 Mon Sep 17 00:00:00 2001 From: nub31 Date: Fri, 22 Aug 2025 21:19:41 +0200 Subject: [PATCH] add kernel --- boot/util.asm | 34 ---------------------------------- makefile | 10 +++++----- {boot => src}/boot.asm | 0 src/kernel.c | 0 4 files changed, 5 insertions(+), 39 deletions(-) delete mode 100644 boot/util.asm rename {boot => src}/boot.asm (100%) create mode 100644 src/kernel.c diff --git a/boot/util.asm b/boot/util.asm deleted file mode 100644 index 509f299..0000000 --- a/boot/util.asm +++ /dev/null @@ -1,34 +0,0 @@ -%define cr 0x0a -%define lf 0x0d -%define endl 0x0 - -; Reads a character -; out: -; al = asci character -; ah = scan code -read_char: - mov ah, 0 - int 0x16 - ret - -; Prints a character -; in: -; al = asci character to print -print_char: - mov ah, 0x0e - int 0x10 - ret - -; Prints a null terminated string -; in: -; si = null terminated string pointer -print_line: - .loop: - cmp byte [si], 0 - je .done - mov al, [si] - call print_char - inc si - jmp .loop - .done: - ret \ No newline at end of file diff --git a/makefile b/makefile index 92be507..9713e73 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,8 @@ -boot/boot.bin: boot/boot.asm - nasm -o boot/boot.bin boot/boot.asm +src/boot.bin: src/boot.asm + nasm -o src/boot.bin src/boot.asm -run: boot/boot.bin - qemu-system-x86_64 -drive file=boot/boot.bin,format=raw,index=0,media=disk +run: src/boot.bin + qemu-system-x86_64 -drive file=src/boot.bin,format=raw,index=0,media=disk clean: - rm boot/boot.bin \ No newline at end of file + rm src/boot.bin \ No newline at end of file diff --git a/boot/boot.asm b/src/boot.asm similarity index 100% rename from boot/boot.asm rename to src/boot.asm diff --git a/src/kernel.c b/src/kernel.c new file mode 100644 index 0000000..e69de29