Skip to content

Instantly share code, notes, and snippets.

@guilload
Last active August 29, 2015 14:09
Show Gist options
  • Save guilload/67cca1c19e07a361397a to your computer and use it in GitHub Desktop.
Save guilload/67cca1c19e07a361397a to your computer and use it in GitHub Desktop.
Hello world boot loader
use16
org 0x7c00
start: jmp boot
msg db "Hello, world!", 0
print:
lodsb
or al, al
jz return
mov ah, 0eh
int 10h
jmp print
return:
ret
boot:
xor ax, ax
mov ds, ax
mov es, ax
mov si, msg
call print
xor ax, ax
cli
hlt
times 510 - ($-$$) db 0 ; padding
dw 0xAA55 ; boot signature
NASM=nasm
QEMU=qemu-system-i386 -curses
all:
nasm -f bin -o boot.bin boot.asm
dd if=/dev/zero of=floppy.img bs=512 count=1 &> /dev/null
dd if=boot.bin of=floppy.img conv=notrunc
run: floppy.img
$(QEMU) -fda $<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment