From 2ede69e8f0f0f75cff4e1f601320eb53f628fa15 Mon Sep 17 00:00:00 2001 From: lordtet Date: Wed, 21 May 2025 14:52:21 -0400 Subject: [PATCH] Commit with some sample code and a working project folder + makefile. --- .gitignore | 7 +++++++ Makefile | 22 ++++++++++++++++++++++ src/boot.asm | 15 +++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 src/boot.asm 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