From d08f4dc2f52e61d9076682c79a1d1012d652da9d Mon Sep 17 00:00:00 2001 From: Conzer Date: Mon, 2 Dec 2024 16:00:24 -0500 Subject: [PATCH] half written kernel. gsejbhdfsgjhbkdfgshjbkdfgsjkhfgdh --- .gitignore | 1 + README.md | 4 ++-- kernel.c | 24 ++++++++++++++++++++++++ kernel_entry.asm | 22 ++++++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 kernel.c create mode 100644 kernel_entry.asm diff --git a/.gitignore b/.gitignore index 8f2a01a..3d5b43a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ badloader.img +baddos.img diff --git a/README.md b/README.md index 8e44099..5ffa168 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,6 @@ THE WORST BOOTLOADER EVER DO NOT USE THIS PLEASE # Building -install `nasm`, then run build.sh. +install `nasm`, `make` and `gcc`, then run `make` # notes -i havent tested this in qemu lol \ No newline at end of file +i have tested this in qemu \ No newline at end of file diff --git a/kernel.c b/kernel.c new file mode 100644 index 0000000..7bf7f9c --- /dev/null +++ b/kernel.c @@ -0,0 +1,24 @@ +// kernel for the bad dos. +void print(const char* str) { + while (*str) { + __asm__ __volatile__( + "mov ah, 0x0E" + "mov al, %[char];" + "int 0x10;" + : + : [char] "r" (*str) + ); + } +} + +void main() { + print("Welcome to BadDOS!\r\n"); + print("type something or die:\r\n"); + + while (1) { + print("/dev/flp/> "); + char c = get_char(); + print_char(c); + if (c == '\r') print("\r\n"); + } +} \ No newline at end of file diff --git a/kernel_entry.asm b/kernel_entry.asm new file mode 100644 index 0000000..cd7dce3 --- /dev/null +++ b/kernel_entry.asm @@ -0,0 +1,22 @@ +; wait, WHAT? we have a bad DOS now????? This is absurd! You can't just add a SECOND project into the FIRST project. + +[BITS 16] +[ORG 0x7E00] + +start: + cli + xor ax, ax + mov ds, ax + mov es, ax + mov ss, ax + mov sp, 0x7C00 + sti + + call kernel_main + + cli +hang: + hlt + jmp hang + +times 512-($-$$) db 0 \ No newline at end of file