diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..abeade1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +#build build, go away... +build/ + +#swap,tmp,etc +*.swp +*.swo +*~ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1d754c8 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +# Makefile +SRC_DIR = src +BUILD_DIR = build +BOOTLOADER_SRC = $(SRC_DIR)/boot.asm +BOOTLOADER_IMG = $(BUILD_DIR)/boot.img + +QEMU = qemu-system-i386 + +all: $(BOOTLOADER_IMG) + +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) + +$(BOOTLOADER_IMG): $(BOOTLOADER_SRC) | $(BUILD_DIR) + nasm -f bin $(BOOTLOADER_SRC) -o $(BOOTLOADER_IMG) + +run: all + $(QEMU) -drive format=raw,file=$(BOOTLOADER_IMG) -display gtk + +clean: + rm -rf $(BUILD_DIR) + diff --git a/src/boot.asm b/src/boot.asm new file mode 100644 index 0000000..c53fb71 --- /dev/null +++ b/src/boot.asm @@ -0,0 +1,15 @@ +; boot.asm - simple boot sector +BITS 16 +ORG 0x7C00 + +start: + mov ah, 0x0E + mov al, 'H' + int 0x10 + mov al, 'i' + int 0x10 + + jmp $ + +times 510 - ($ - $$) db 0 +dw 0xAA55