From 72b1ab6035932d7edbd7cb5414e4f5f052d0b220 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 15 Jul 2020 23:33:15 +0200 Subject: [PATCH] Initial commit --- .gutctags | 5 ++ .lvimrc | 3 + .tags | 7 ++ Makefile | 56 ++++++++++++++ assets/tetrisfont.1bpp | Bin 0 -> 304 bytes assets/tetrisfont.png | Bin 0 -> 308 bytes layout.link | 12 +++ source/charmap.inc | 58 +++++++++++++++ source/defines.inc | 45 ++++++++++++ source/hardware.inc | 103 ++++++++++++++++++++++++++ source/home/audio.asm | 8 ++ source/home/joypad.asm | 58 +++++++++++++++ source/home/math.asm | 24 ++++++ source/home/memory.asm | 54 ++++++++++++++ source/home/serial.asm | 132 +++++++++++++++++++++++++++++++++ source/home/start.asm | 161 +++++++++++++++++++++++++++++++++++++++++ source/home/text.asm | 42 +++++++++++ source/home/vblank.asm | 36 +++++++++ source/home/video.asm | 54 ++++++++++++++ source/main.asm | 127 ++++++++++++++++++++++++++++++++ source/video.inc | 33 +++++++++ 21 files changed, 1018 insertions(+) create mode 100644 .gutctags create mode 100644 .lvimrc create mode 100644 .tags create mode 100644 Makefile create mode 100644 assets/tetrisfont.1bpp create mode 100644 assets/tetrisfont.png create mode 100644 layout.link create mode 100644 source/charmap.inc create mode 100644 source/defines.inc create mode 100644 source/hardware.inc create mode 100644 source/home/audio.asm create mode 100644 source/home/joypad.asm create mode 100644 source/home/math.asm create mode 100644 source/home/memory.asm create mode 100644 source/home/serial.asm create mode 100644 source/home/start.asm create mode 100644 source/home/text.asm create mode 100644 source/home/vblank.asm create mode 100644 source/home/video.asm create mode 100644 source/main.asm create mode 100644 source/video.inc diff --git a/.gutctags b/.gutctags new file mode 100644 index 0000000..a9f8923 --- /dev/null +++ b/.gutctags @@ -0,0 +1,5 @@ +--languages=asm +--langmap=asm:.asm.inc +--regex-asm=/^([a-z0-9_]+):+.*/\1/l,labels/i +--regex-asm=/^([a-z0-9_]+)\s+=.*/\1/c,constants/i +--regex-asm=/^([a-z0-9_]+)\s+[Ee][Qq][Uu][Ss]?.*/\1/c,constants/i diff --git a/.lvimrc b/.lvimrc new file mode 100644 index 0000000..e453939 --- /dev/null +++ b/.lvimrc @@ -0,0 +1,3 @@ +if expand(":e") ==? 'asm' || expand(":e") ==? 'inc' || expand(":e") ==? 'link' + setf rgbds +endif diff --git a/.tags b/.tags new file mode 100644 index 0000000..562754a --- /dev/null +++ b/.tags @@ -0,0 +1,7 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ +!_TAG_PROGRAM_AUTHOR Universal Ctags Team // +!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ +!_TAG_PROGRAM_URL https://ctags.io/ /official site/ +!_TAG_PROGRAM_VERSION 0.0.0 // diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..db67608 --- /dev/null +++ b/Makefile @@ -0,0 +1,56 @@ +name := Something + +dir_build := build +dir_source := source +dir_assets := assets + +RGBASM := rgbasm +RGBGFX := rgbgfx +RGBLINK := rgblink +RGBFIX := rgbfix + +RGBASMFLAGS := -p 0xff -L +RGBLINKFLAGS := -p 0xff -d -t +RGBFIXFLAGS := -p 0xff -j -m 0 -r 0 -n 0 -k "HB" -i "SMTH" -t "Something" + +rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2)) +objects := $(patsubst $(dir_source)/%.asm, $(dir_build)/%.o, $(call rwildcard, $(dir_source)/, *.asm)) + +RGBASMFLAGS += -DENABLE_CGB #-DENABLE_CLEAR +RGBFIXFLAGS += -c + +.SECONDEXPANSION: + +.PHONY: all +all: $(name).gb + +.PHONY: clean +clean: + rm -rf $(name).gb $(name).sym $(name).map $(dir_build) + +$(name).gb: $(objects) + +%.gb: layout.link + $(RGBLINK) $(RGBLINKFLAGS) -l $< -n $(@:.gb=.sym) -m $(@:.gb=.map) -o $@ $(filter-out $<, $^) + $(RGBFIX) $(RGBFIXFLAGS) -v $@ + +$(dir_build)/%.o: $(dir_source)/%.asm | $$(dir $$@) + $(RGBASM) $(RGBASMFLAGS) -i $(dir_build)/ -i $(dir_source)/ -M $(@:.o=.d) -o $@ $< + +$(dir_build)/%.pal: $(dir_assets)/%.png | $$(dir $$@) + $(RGBGFX) -p $@ $< + +$(dir_build)/%.tilemap: $(dir_assets)/%.png | $$(dir $$@) + $(RGBGFX) -u -t $@ $< + +$(dir_build)/%.2bpp: $(dir_assets)/%.png | $$(dir $$@) + $(RGBGFX) -u -o $@ $< + +$(dir_build)/%.1bpp: $(dir_assets)/%.png | $$(dir $$@) + $(RGBGFX) -d 1 -u -o $@ $< + +.PRECIOUS: %/ +%/: + mkdir -p $@ + +-include $(patsubst %.o, %.d, $(objects)) diff --git a/assets/tetrisfont.1bpp b/assets/tetrisfont.1bpp new file mode 100644 index 0000000000000000000000000000000000000000..be468d71d6fb7438917f4f5371b0cca19c9cb63e GIT binary patch literal 304 zcmXX?JBmXw3{3=CQOD|;tkE`Vd?6Vl(eJ*}}ZM8M>yRCb(OIdnLGw=gE>cgG>(=fp4(;fcl zJgoOUE+VR_s=%nh9>;AP1O74I?-3%-fll|lk*D$cG4lWWGi~|Z@4t^T^J6}t>)u!I jq;F-8D*JMu7QW?9zf*0GZ{!6VpkFyO{sV`;aDqxced$AC literal 0 HcmV?d00001 diff --git a/assets/tetrisfont.png b/assets/tetrisfont.png new file mode 100644 index 0000000000000000000000000000000000000000..9d3a88cf0d30b620bbb197b32906b837855a1a4d GIT binary patch literal 308 zcmV-40n7f0P)s|RLV$W?@H1AfOgeNFp*7lYPu)TnrTVr5hTj4Epd(Dve?z@=XqO?#xh^i<#uX~oN|YgxB0JflhoSPAHAdWin+4+sdW9oBT8 z{h_n?1xWdY7h^FRb2JVEXIi=nU-UXC08%1Dr)#wCyrD8`jCul2c+3m18cVi1AzdKk zzr3C$Ibd`O*{~`9=@EF%3rsj%1|D-Tu#=MTq1zGr_yF&{<$(ma26VmLwZA9mUjE@l zVB-li