Last active
August 29, 2015 14:09
-
-
Save guilload/67cca1c19e07a361397a to your computer and use it in GitHub Desktop.
Hello world boot loader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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