70 lines
1.3 KiB
NASM
70 lines
1.3 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, 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
|