add disk loading functions (does this even work yet???)

This commit is contained in:
Conzer 2024-12-02 15:32:42 -05:00
parent 2efd024831
commit 1eb57e4ab0
2 changed files with 48 additions and 7 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
badloader.img

View file

@ -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