A dungeon delver roguelike using Pathfinder 2nd edition rules

Adding boilerplate code

+185 -18
+89
gb/Makefile
··· 1 + 2 + .SUFFIXES: # Suppress a lot of useless default rules, which also provides a nice speedup. 3 + 4 + # Recursive `wildcard` function. 5 + rwildcard = $(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) 6 + 7 + # Program constants. 8 + # POSIX OSes (the sane default). 9 + RM_RF := rm -rf 10 + MKDIR_P := mkdir -p 11 + ifeq ($(strip $(shell which rm)),) 12 + # Windows *really* tries its hardest to be Special™! 13 + RM_RF := -rmdir /s /q 14 + MKDIR_P := -mkdir 15 + endif 16 + 17 + RGBDS ?= # Shortcut if you want to use a local copy of RGBDS. 18 + RGBASM := ${RGBDS}rgbasm 19 + RGBLINK := ${RGBDS}rgblink 20 + RGBFIX := ${RGBDS}rgbfix 21 + RGBGFX := ${RGBDS}rgbgfx 22 + 23 + ROM = bin/${ROMNAME}.${ROMEXT} 24 + 25 + # Argument constants 26 + INCDIRS = src/ include/ 27 + WARNINGS = all extra 28 + ASFLAGS = -p ${PADVALUE} $(addprefix -I,${INCDIRS}) $(addprefix -W,${WARNINGS}) 29 + LDFLAGS = -p ${PADVALUE} 30 + FIXFLAGS = -p ${PADVALUE} -i "${GAMEID}" -k "${LICENSEE}" -l ${OLDLIC} -m ${MBC} -n ${VERSION} -r ${SRAMSIZE} -t ${TITLE} 31 + 32 + # The list of ASM files that RGBASM will be invoked on. 33 + SRCS = $(call rwildcard,src,*.asm) 34 + 35 + ## Project-specific configuration 36 + # Use this to override the above 37 + include project.mk 38 + 39 + # `all` (Default target): build the ROM 40 + all: ${ROM} 41 + .PHONY: all 42 + 43 + # `clean`: Clean temp and bin files 44 + clean: 45 + ${RM_RF} bin obj assets 46 + .PHONY: clean 47 + 48 + # `rebuild`: Build everything from scratch 49 + # It's important to do these two in order if we're using more than one job 50 + rebuild: 51 + ${MAKE} clean 52 + ${MAKE} all 53 + .PHONY: rebuild 54 + 55 + # By default, asset recipes convert files in `assets/` into other files in `assets/`. 56 + # This line causes assets not found in `assets/` to be also looked for in `src/assets/`. 57 + # "Source" assets can thus be safely stored there without `make clean` removing them! 58 + VPATH := src 59 + 60 + # Define how to compress files using the PackBits16 codec. 61 + # (The compressor script requires Python 3.) 62 + assets/%.pb16: src/tools/pb16.py assets/% 63 + @${MKDIR_P} "${@D}" 64 + $^ $@ 65 + 66 + # How to build a ROM. 67 + # Notice that the build date is always refreshed. 68 + bin/%.${ROMEXT}: $(patsubst src/%.asm,obj/%.o,${SRCS}) 69 + @${MKDIR_P} "${@D}" 70 + ${RGBASM} ${ASFLAGS} -o obj/build_date.o src/assets/build_date.asm 71 + ${RGBLINK} ${LDFLAGS} -m bin/$*.map -n bin/$*.sym -o $@ $^ \ 72 + && ${RGBFIX} -v ${FIXFLAGS} $@ 73 + 74 + # `.mk` files are auto-generated dependency lists of the source ASM files, to save a lot of hassle. 75 + # Also add all obj dependencies to the dep file too, so Make knows to remake it. 76 + # Caution: some of these flags were added in RGBDS 0.4.0, using an earlier version WILL NOT WORK 77 + # (and produce weird errors). 78 + obj/%.mk: src/%.asm 79 + @${MKDIR_P} "${@D}" 80 + ${RGBASM} ${ASFLAGS} -M $@ -MG -MP -MQ ${@:.mk=.o} -MQ $@ -o ${@:.mk=.o} $< 81 + # DO NOT merge this with the rule above, otherwise Make will assume that the `.o` file is generated, 82 + # even when it isn't! 83 + # This causes weird issues that depend, among other things, on the version of Make. 84 + obj/%.o: obj/%.mk 85 + @touch $@ 86 + 87 + ifeq ($(filter clean,${MAKECMDGOALS}),) 88 + include $(patsubst src/%.asm,obj/%.mk,${SRCS}) 89 + endif
-18
gb/main.asm
··· 1 - INCLUDE "hardware.inc" 2 - 3 - SECTION "Header", ROM0[$100] 4 - 5 - jp EntryPoint 6 - 7 - ds $150 - @, 0 ; Make room for the header 8 - 9 - EntryPoint: 10 - ; Do not turn the LCD off outside of VBlank 11 - WaitVBlank: 12 - ld a, [rLY] 13 - cp 144 14 - jp c, WaitVBlank 15 - 16 - ; Turn the LCD off 17 - ld a, 0 18 - ld [rLCDC], a
+67
gb/project.mk
··· 1 + # This file contains project-specific configuration. 2 + # You can override variables set in the Makefile here. 3 + 4 + 5 + # Value that the ROM will be filled with. 6 + PADVALUE := 0xFF 7 + 8 + ## Header constants (passed to RGBFIX). 9 + 10 + # ROM version (typically starting at 0 and incremented for each published version). 11 + VERSION := 0 12 + 13 + # 4-ASCII letter game ID. 14 + GAMEID := DNGR 15 + 16 + # Game title, up to 11 ASCII chars. 17 + TITLE := Dungeoner 18 + 19 + # New licensee, 2 ASCII chars. 20 + # Homebrew games FTW!. 21 + LICENSEE := HB 22 + # Old licensee, please set to 0x33 (required to get SGB compatibility). 23 + OLDLIC := 0x33 24 + 25 + # MBC type, tells which hardware is in the cart. 26 + # You can get a list of valid values by running `rgbfix -m help`. 27 + # See https://gbdev.io/pandocs/MBCs for more information, or consult any copy of Pan Docs. 28 + # If using no MBC, consider enabling `-t` below. 29 + MBC := 0x00 30 + 31 + # ROM size is set automatically by RGBFIX. 32 + 33 + # Size of the on-board SRAM; MBC type should indicate the presence of RAM. 34 + # See https://gbdev.io/pandocs/The_Cartridge_Header#0149--ram-size or consult any copy of Pan Docs. 35 + # Set this to 0 when using MBC2's built-in SRAM. 36 + SRAMSIZE := 0x00 37 + 38 + # ROM name. 39 + ROMNAME := dungeoner 40 + ROMEXT := gb 41 + 42 + 43 + # Compilation parameters, uncomment to apply, comment to cancel. 44 + # "Sensible defaults" are included. 45 + # Please refer to RGBDS' documentation. 46 + # For example, offline: `man 1 rgbasm`; online: https://rgbds.gbdev.io/docs/rgbasm.1 47 + 48 + # Export all labels. 49 + # This means they must all have unique names, but they will all show up in the .sym and .map files. 50 + # ASFLAGS += -E 51 + 52 + # Game Boy Color compatible. 53 + # FIXFLAGS += -c 54 + # Game Boy Color required. 55 + # FIXFLAGS += -C 56 + 57 + # Super Game Boy compatible. 58 + # FIXFLAGS += -s 59 + 60 + # Game Boy mode. 61 + # LDFLAGS += -d 62 + 63 + # No banked WRAM mode. 64 + # LDFLAGS += -w 65 + 66 + # 32k mode. 67 + # LDFLAGS += -t
+6
gb/src/assets/build_date.asm
··· 1 + SECTION "Build date", ROM0 2 + 3 + db "Built " 4 + BuildDate:: 5 + db __ISO_8601_UTC__ 6 + db 0
+23
gb/src/main.asm
··· 1 + INCLUDE "hardware.inc/hardware.inc" 2 + rev_Check_hardware_inc 4.0 3 + 4 + SECTION "Header", ROM0[$100] 5 + 6 + ; This is your ROM's entry point 7 + ; You have 4 bytes of code to do... something 8 + di 9 + jp EntryPoint 10 + 11 + ; Make sure to allocate some space for the header, so no important 12 + ; code gets put there and later overwritten by RGBFIX. 13 + ; RGBFIX is designed to operate over a zero-filled header, so make 14 + ; sure to put zeros regarless of the padding value. (This feature 15 + ; was introduced in RGBDS 0.4.0, but the -MG etc flags were also 16 + ; introduced in that version.) 17 + ds $150 - @, 0 18 + 19 + SECTION "Entry point", ROM0 20 + 21 + EntryPoint: 22 + ; Here is where the fun begins, happy coding :) 23 + jr @