From 1eb57e4ab00b0d0d885660b0a96f34a99dffea5f Mon Sep 17 00:00:00 2001 From: Conzer Date: Mon, 2 Dec 2024 15:32:42 -0500 Subject: [PATCH] add disk loading functions (does this even work yet???) --- .gitignore | 1 + main.asm | 54 +++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8f2a01a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +badloader.img diff --git a/main.asm b/main.asm index e10cde8..5d2f1c3 100644 --- a/main.asm +++ b/main.asm @@ -13,18 +13,58 @@ start: mov dx, 0x184F int 0x10 - mov si, msg -print: + mov si, fate_msg +print_msg: lodsb cmp al, 0 - je hang + je random_dec mov ah, 0x0E int 0x10 - jmp print -hang: - jmp hang + jmp print_msg +random_dec: + mov ah, 0x00 + int 0x1A + test dx, 1 + jz boot_os + jmp crash_sys +boot_os: + ; ok fine ill tell you what this was it reads the first sector of the first disk into memory + mov ax, 0x0000 + mov es, ax + mov bx, 0x7E00 + mov ah, 0x02 + mov al, 0x01 + mov ch, 0x00 + mov cl, 0x02 + mov dh, 0x00 + mov dl, 0x80 + int 0x12 + jc disk_err -msg db "hi im the badloader", 0 + jmp 0x0000:0x7E00 +disk_err: + mov si, disk_err_msg + call print_str + jmp crash_sys +crash_sys: + mov si, crash_msg + call print_str + cli +hang: + hlt + jmp hang +print_str: + lodsb + cmp al, 0 + je .done + mov ah, 0x0E + int 0x10 + jmp print_str +.done: + ret +fate_msg db "hi im the badloader i will boot your OS if i feel like it" +disk_err_msg db "lmao ur disk failed to load hahahahaha" +crash_msg db "im gona crash your pc now byeee xoxo" times 510-($-$$) db 0 dw 0xAA55