Badloader/main.asm

83 lines
1.7 KiB
NASM

; future note to self: WHY ARE YOU DOING THIS PLEASE STOP
; IM TELLING YOU PLS STOP
; no im not commenting this. because this is the badloader and
; its bad lol
[BITS 16]
[ORG 0x7C00]
start:
mov ax, 0x0600
mov bh, 0x07
mov cx, 0x0000
mov dx, 0x184F
int 0x10
mov si, fate_msg
print_msg:
lodsb
cmp al, 0
je random_dec
mov ah, 0x0E
int 0x10
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
jmp 0x0000:0x7E00
disk_err:
mov si, junk_msg
call print_str
call display_garbage
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
display_garbage:
mov di, 0xB800
mov cx, 2000
fill_loop:
mov al, 0x41
add al, dl
mov ah, 0x0F
mov [di], ax
add di, 2
loop fill_loop
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"
junk_msg db "DISK ERROR! jklfgjhldfgjhklgdjkhlgdfkjhgfdjklteruiohnvteryunvtoiruvgnuohvgjkhjkvdgnkvgdnhvgknhvgnhvgjknnnnnnnnnnnnnnnnndfgjkknjfnjkvdgfnkgdfnhjkdfghjkgdfjhkdgfgdfnjkdfgnjkdfgnjkvgdnjkgdnjkgvfnkvghgvhvgnjgnkjg"
times 510-($-$$) db 0
dw 0xAA55