top | item 29966630

(no title)

smoppi | 4 years ago

A hello world for an IBM PC compatible does not require much. Sadly UEFI has made everything exponentially more complex. If you want to be more minimalistic, this also works with if the BIOS is newer than 1/10/86 (written in NASM syntax):

[org 0x7c00] ; code offset

xor dx, dx ; row 0, col 0

mov ds, dx ; set data segment to 0

mov ax, 0x1300 ; ah = 0x13 (write string), al = 0x00 (write mode)

mov bx, 0x0007 ; bh = video page number (0), bl = attribute byte

mov cx, 11 ; string len: 11 bytes

mov es, dx ; ES:BP = pointer to string

mov bp, message

int 0x10 ; interrupt 0x10

end: ; do nothing to prevent crashing

jmp end ; (cli & hlt also works)

message: db "Hello world"

times 0x01FE-($-$$) db 0 ; padding

dw 0xAA55 ; boot sector signature

discuss

order

No comments yet.