Create GBA adventure with walkable map and NPC dialogue

This commit is contained in:
rory committed 2026-10-26 00:37:22 +00:00
commit 1307ff3d19
10 files changed
+623

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
TOOL_PREFIX ?= /opt/homebrew/bin/arm-none-eabi-
PYTHON ?= /usr/bin/python3
CC := $(TOOL_PREFIX)gcc
OBJCOPY := $(TOOL_PREFIX)objcopy
CFLAGS := -mcpu=arm7tdmi -marm -O2 -g -Wall -Wextra -Werror -ffreestanding -fno-builtin -fno-common -Wa,--noexecstack
.PHONY: all play check
all: game.gba
build:
mkdir -p build
build/start.o: source/start.s | build
$(CC) -mcpu=arm7tdmi -marm -c $< -o $@
build/main.o: source/main.c | build
$(CC) $(CFLAGS) -c $< -o $@
build/game.elf: build/start.o build/main.o gba.ld
$(CC) -mcpu=arm7tdmi -marm -nostdlib -T gba.ld -Wl,-Map,build/game.map build/start.o build/main.o -lgcc -o $@
game.gba: build/game.elf tools/rom_header.py
$(OBJCOPY) -O binary $< $@
$(PYTHON) tools/rom_header.py $@
check: game.gba
$(PYTHON) tools/rom_header.py --check game.gba
$(PYTHON) -m unittest discover -s tests -v
/usr/bin/clang -Wall -Wextra -Werror tests/test_game.c -o build/test_game
./build/test_game
play: game.gba
open -a mGBA game.gba