Show HN: An HelloWorld x86-Bootloader
github.com
github.com
[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
For example, most don't include a partition table, which is needed if you use AHCI controller instead of IDE. (so depending on your hardware of vm/emu configuration it won't work at all)