summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimponic <loganthebean222@gmail.com>2020-08-07 22:40:00 -0600
committerSimponic <loganthebean222@gmail.com>2020-08-07 22:40:00 -0600
commit6a44a34e0ebb867753df26f1cb0a38f53420a606 (patch)
tree42eef181966046e4e3108b149738e70479e48c35
downloadgeometry-dash-gba-6a44a34e0ebb867753df26f1cb0a38f53420a606.tar.gz
geometry-dash-gba-6a44a34e0ebb867753df26f1cb0a38f53420a606.zip
Added files
-rwxr-xr-xGBA-Dash.elfbin0 -> 208888 bytes
-rwxr-xr-xGBA-Dash.gbabin0 -> 1932 bytes
-rw-r--r--GBA-Dash.sav0
-rw-r--r--Makefile163
-rw-r--r--build/GBA-Dash.map499
-rw-r--r--build/main.d21
-rw-r--r--build/main.obin0 -> 6748 bytes
-rw-r--r--build/player.d1
-rw-r--r--build/player.obin0 -> 2512 bytes
-rw-r--r--build/toolbox.d11
-rw-r--r--build/toolbox.obin0 -> 4836 bytes
-rw-r--r--include/input.h135
-rw-r--r--include/memdef.h212
-rw-r--r--include/memmap.h97
-rw-r--r--include/toolbox.h154
-rw-r--r--include/types.h120
-rw-r--r--source/main.c46
-rw-r--r--sprites/player.c64
-rw-r--r--sprites/player.h24
-rw-r--r--sprites/toolbox.c65
20 files changed, 1612 insertions, 0 deletions
diff --git a/GBA-Dash.elf b/GBA-Dash.elf
new file mode 100755
index 0000000..5722245
--- /dev/null
+++ b/GBA-Dash.elf
Binary files differ
diff --git a/GBA-Dash.gba b/GBA-Dash.gba
new file mode 100755
index 0000000..67332d6
--- /dev/null
+++ b/GBA-Dash.gba
Binary files differ
diff --git a/GBA-Dash.sav b/GBA-Dash.sav
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/GBA-Dash.sav
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..98093a7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,163 @@
+#---------------------------------------------------------------------------------
+.SUFFIXES:
+#---------------------------------------------------------------------------------
+
+ifeq ($(strip $(DEVKITARM)),)
+$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
+endif
+
+include $(DEVKITARM)/gba_rules
+
+#---------------------------------------------------------------------------------
+# TARGET is the name of the output
+# BUILD is the directory where object files & intermediate files will be placed
+# SOURCES is a list of directories containing source code
+# INCLUDES is a list of directories containing extra header files
+# DATA is a list of directories containing binary data
+# GRAPHICS is a list of directories containing files to be processed by grit
+#
+# All directories are specified relative to the project directory where
+# the makefile is found
+#
+#---------------------------------------------------------------------------------
+TARGET := $(notdir $(CURDIR))
+BUILD := build
+SOURCES := source sprites
+INCLUDES := include
+DATA :=
+MUSIC :=
+
+#---------------------------------------------------------------------------------
+# options for code generation
+#---------------------------------------------------------------------------------
+ARCH := -mthumb -mthumb-interwork
+
+CFLAGS := -g -Wall -O2\
+ -mcpu=arm7tdmi -mtune=arm7tdmi\
+ $(ARCH)
+
+CFLAGS += $(INCLUDE)
+
+CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
+
+ASFLAGS := -g $(ARCH)
+LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $*.map)
+
+#---------------------------------------------------------------------------------
+# any extra libraries we wish to link with the project
+#---------------------------------------------------------------------------------
+LIBS := -lmm -lgba
+
+
+#---------------------------------------------------------------------------------
+# list of directories containing libraries, this must be the top level containing
+# include and lib
+#---------------------------------------------------------------------------------
+LIBDIRS := $(LIBGBA)
+
+#---------------------------------------------------------------------------------
+# no real need to edit anything past this point unless you need to add additional
+# rules for different file extensions
+#---------------------------------------------------------------------------------
+
+
+ifneq ($(BUILD),$(notdir $(CURDIR)))
+#---------------------------------------------------------------------------------
+
+export OUTPUT := $(CURDIR)/$(TARGET)
+
+export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
+ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
+ $(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
+
+export DEPSDIR := $(CURDIR)/$(BUILD)
+
+CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
+CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
+SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
+BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
+
+ifneq ($(strip $(MUSIC)),)
+ export AUDIOFILES := $(foreach dir,$(notdir $(wildcard $(MUSIC)/*.*)),$(CURDIR)/$(MUSIC)/$(dir))
+ BINFILES += soundbank.bin
+endif
+
+#---------------------------------------------------------------------------------
+# use CXX for linking C++ projects, CC for standard C
+#---------------------------------------------------------------------------------
+ifeq ($(strip $(CPPFILES)),)
+#---------------------------------------------------------------------------------
+ export LD := $(CC)
+#---------------------------------------------------------------------------------
+else
+#---------------------------------------------------------------------------------
+ export LD := $(CXX)
+#---------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------
+
+export OFILES_BIN := $(addsuffix .o,$(BINFILES))
+
+export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
+
+export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
+
+export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
+
+export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
+ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
+ -I$(CURDIR)/$(BUILD)
+
+export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
+
+.PHONY: $(BUILD) clean
+
+#---------------------------------------------------------------------------------
+$(BUILD):
+ @[ -d $@ ] || mkdir -p $@
+ @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
+
+#---------------------------------------------------------------------------------
+clean:
+ @echo clean ...
+ @rm -fr $(BUILD) $(TARGET).elf $(TARGET).gba
+
+
+#---------------------------------------------------------------------------------
+else
+
+#---------------------------------------------------------------------------------
+# main targets
+#---------------------------------------------------------------------------------
+
+$(OUTPUT).gba : $(OUTPUT).elf
+
+$(OUTPUT).elf : $(OFILES)
+
+$(OFILES_SOURCES) : $(HFILES)
+
+#---------------------------------------------------------------------------------
+# The bin2o rule should be copied and modified
+# for each extension used in the data directories
+#---------------------------------------------------------------------------------
+
+#---------------------------------------------------------------------------------
+# rule to build soundbank from music files
+#---------------------------------------------------------------------------------
+soundbank.bin soundbank.h : $(AUDIOFILES)
+#---------------------------------------------------------------------------------
+ @mmutil $^ -osoundbank.bin -hsoundbank.h
+
+#---------------------------------------------------------------------------------
+# This rule links in binary data with the .bin extension
+#---------------------------------------------------------------------------------
+%.bin.o %_bin.h : %.bin
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @$(bin2o)
+
+
+-include $(DEPSDIR)/*.d
+#---------------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------------
diff --git a/build/GBA-Dash.map b/build/GBA-Dash.map
new file mode 100644
index 0000000..e1b69e4
--- /dev/null
+++ b/build/GBA-Dash.map
@@ -0,0 +1,499 @@
+Archive member included to satisfy reference by file (symbol)
+
+/opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-init.o)
+ /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o (__libc_init_array)
+/opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-memcpy-stub.o)
+ main.o (memcpy)
+/opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libsysbase.a(malloc_vars.o)
+ /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o (fake_heap_end)
+
+Discarded input sections
+
+ .text 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o
+ .data 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o
+ .bss 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o
+ .text 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crti.o
+ .data 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crti.o
+ .bss 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crti.o
+ .text 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .data 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .bss 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .data.__dso_handle
+ 0x0000000000000000 0x4 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .data 0x0000000000000000 0x4 main.o
+ .text 0x0000000000000000 0x0 player.o
+ .data 0x0000000000000000 0x0 player.o
+ .bss 0x0000000000000000 0x0 player.o
+ .data 0x0000000000000000 0x0 toolbox.o
+ .text 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-init.o)
+ .data 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-init.o)
+ .bss 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-init.o)
+ .text 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-memcpy-stub.o)
+ .data 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-memcpy-stub.o)
+ .bss 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-memcpy-stub.o)
+ .text 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libsysbase.a(malloc_vars.o)
+ .data 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libsysbase.a(malloc_vars.o)
+ .bss 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libsysbase.a(malloc_vars.o)
+ .bss.fake_heap_start
+ 0x0000000000000000 0x4 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libsysbase.a(malloc_vars.o)
+ .text 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtend.o
+ .data 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtend.o
+ .bss 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtend.o
+ .text 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtn.o
+ .data 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtn.o
+ .bss 0x0000000000000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtn.o
+
+Memory Configuration
+
+Name Origin Length Attributes
+rom 0x0000000008000000 0x0000000002000000
+iwram 0x0000000003000000 0x0000000000008000
+ewram 0x0000000002000000 0x0000000000040000
+*default* 0x0000000000000000 0xffffffffffffffff
+
+Linker script and memory map
+
+ 0x0000000008000000 __text_start = ORIGIN (rom)
+ 0x0000000002040000 __eheap_end = (ORIGIN (ewram) + LENGTH (ewram))
+ 0x0000000003000000 __iwram_start = ORIGIN (iwram)
+ 0x0000000003008000 __iwram_top = (ORIGIN (iwram) + LENGTH (iwram))
+ 0x0000000003007fa0 __sp_irq = (__iwram_top - 0x60)
+ 0x0000000003007f00 __sp_usr = (__sp_irq - 0xa0)
+ 0x0000000003007ff8 __irq_flags = 0x3007ff8
+ 0x0000000008000000 . = __text_start
+
+.crt0 0x0000000008000000 0x210
+ *(.crt0)
+ .crt0 0x0000000008000000 0x210 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o
+ 0x0000000008000000 _start
+ 0x00000000080000c4 __boot_method
+ 0x00000000080000c5 __slave_number
+ 0x00000000080000e0 start_vector
+ 0x0000000008000210 . = ALIGN (0x4)
+
+.init 0x0000000008000210 0xc
+ *(SORT_NONE(.init))
+ .init 0x0000000008000210 0x4 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crti.o
+ 0x0000000008000210 _init
+ .init 0x0000000008000214 0x8 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtn.o
+
+.plt 0x000000000800021c 0x0
+ *(.plt)
+ 0x000000000800021c . = ALIGN (0x4)
+
+.text 0x000000000800021c 0x2d0
+ *(EXCLUDE_FILE(*.iwram*) .text*)
+ .text.deregister_tm_clones
+ 0x000000000800021c 0x2c /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .text.register_tm_clones
+ 0x0000000008000248 0x34 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .text.__do_global_dtors_aux
+ 0x000000000800027c 0x30 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .text.frame_dummy
+ 0x00000000080002ac 0x28 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .text 0x00000000080002d4 0x5c main.o
+ 0x00000000080002d4 obj_test
+ .text.startup 0x0000000008000330 0x44 main.o
+ 0x0000000008000330 main
+ .text 0x0000000008000374 0x80 toolbox.o
+ 0x0000000008000374 oam_init
+ 0x00000000080003b4 oam_copy
+ 0x00000000080003d4 obj_copy
+ .text.__libc_init_array
+ 0x00000000080003f4 0x50 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-init.o)
+ 0x00000000080003f4 __libc_init_array
+ .text.memcpy 0x0000000008000444 0xa8 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-memcpy-stub.o)
+ 0x0000000008000444 memcpy
+ *(.gnu.linkonce.t.*)
+ *(.text.*personality*)
+ *(.gnu.warning)
+ *(.glue_7t)
+ .glue_7t 0x00000000080004ec 0x0 linker stubs
+ *(.glue_7)
+ .glue_7 0x00000000080004ec 0x0 linker stubs
+ *(.vfp11_veneer)
+ .vfp11_veneer 0x00000000080004ec 0x0 linker stubs
+ 0x00000000080004ec . = ALIGN (0x4)
+ 0x00000000080004ec __text_end = .
+
+.v4_bx 0x00000000080004ec 0x0
+ .v4_bx 0x00000000080004ec 0x0 linker stubs
+
+.iplt 0x00000000080004ec 0x0
+ .iplt 0x00000000080004ec 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o
+
+.fini 0x00000000080004ec 0xc
+ *(.fini)
+ .fini 0x00000000080004ec 0x4 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crti.o
+ 0x00000000080004ec _fini
+ .fini 0x00000000080004f0 0x8 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtn.o
+ 0x00000000080004f8 . = ALIGN (0x4)
+
+.rodata 0x00000000080004f8 0x280
+ *(.rodata)
+ .rodata 0x00000000080004f8 0x280 player.o
+ 0x00000000080004f8 playerTiles
+ 0x0000000008000578 playerPal
+ *all.rodata*(*)
+ *(.roda)
+ *(.rodata.*)
+ *(.gnu.linkonce.r*)
+ 0x0000000008000778 . = ALIGN (0x4)
+
+.ARM.extab
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ 0x0000000008000778 __exidx_start = .
+
+.ARM.exidx
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ 0x0000000008000778 __exidx_end = .
+
+.ctors 0x0000000008000778 0x0
+ *crtbegin.o(.ctors)
+ *(EXCLUDE_FILE(*crtend.o) .ctors)
+ *(SORT_BY_NAME(.ctors.*))
+ *(.ctors)
+ 0x0000000008000778 . = ALIGN (0x4)
+
+.dtors 0x0000000008000778 0x0
+ *crtbegin.o(.dtors)
+ *(EXCLUDE_FILE(*crtend.o) .dtors)
+ *(SORT_BY_NAME(.dtors.*))
+ *(.dtors)
+ 0x0000000008000778 . = ALIGN (0x4)
+
+.eh_frame 0x0000000008000778 0x4
+ *(.eh_frame)
+ .eh_frame 0x0000000008000778 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .eh_frame 0x0000000008000778 0x4 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtend.o
+ 0x000000000800077c . = ALIGN (0x4)
+
+.rel.dyn 0x000000000800077c 0x0
+ .rel.iplt 0x000000000800077c 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o
+
+.gcc_except_table
+ 0x000000000800077c 0x0
+ *(.gcc_except_table)
+ 0x000000000800077c . = ALIGN (0x4)
+ 0x000000000800077c __iwram_lma = .
+
+.iwram 0x0000000003000000 0x0 load address 0x000000000800077c
+ 0x0000000003000000 __iwram_start__ = ABSOLUTE (.)
+ *(.iwram .iwram*)
+ *iwram.*(.text* .data*)
+ 0x0000000003000000 . = ALIGN (0x4)
+ 0x0000000003000000 __iwram_end__ = ABSOLUTE (.)
+ 0x000000000800077c __data_lma = (__iwram_lma + SIZEOF (.iwram))
+
+.bss 0x0000000003000000 0x424
+ 0x0000000003000000 __bss_start = ABSOLUTE (.)
+ 0x0000000003000000 __bss_start__ = ABSOLUTE (.)
+ *(.dynbss)
+ *(.gnu.linkonce.b*)
+ *(.bss*)
+ .bss.completed.1
+ 0x0000000003000000 0x1 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ *fill* 0x0000000003000001 0x3
+ .bss.object.0 0x0000000003000004 0x18 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .bss 0x000000000300001c 0x400 main.o
+ 0x000000000300001c obj_buffer
+ .bss 0x000000000300041c 0x4 toolbox.o
+ 0x000000000300041c __key_prev
+ 0x000000000300041e __key_curr
+ .bss.fake_heap_end
+ 0x0000000003000420 0x4 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libsysbase.a(malloc_vars.o)
+ 0x0000000003000420 fake_heap_end
+ *(COMMON)
+ 0x0000000003000424 . = ALIGN (0x4)
+ 0x0000000003000424 __bss_end__ = ABSOLUTE (.)
+
+.data 0x0000000003000424 0x0 load address 0x000000000800077c
+ 0x0000000003000424 __data_start__ = ABSOLUTE (.)
+ *(.data*)
+ *(.gnu.linkonce.d*)
+ 0x0000000003000424 . = ALIGN (0x4)
+ 0x000000000800077c __preinit_lma = (__data_lma + SIZEOF (.data))
+
+.igot.plt 0x0000000003000000 0x0
+ .igot.plt 0x0000000003000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o
+
+.tm_clone_table
+ 0x0000000003000000 0x0
+ .tm_clone_table
+ 0x0000000003000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .tm_clone_table
+ 0x0000000003000000 0x0 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtend.o
+
+.preinit_array 0x0000000003000424 0x0 load address 0x000000000800077c
+ 0x0000000003000424 __preinit_array_start = ABSOLUTE (.)
+ *(.preinit_array)
+ 0x0000000003000424 __preinit_array_end = ABSOLUTE (.)
+ 0x000000000800077c __init_lma = (__preinit_lma + SIZEOF (.preinit_array))
+
+.init_array 0x0000000003000424 0x4 load address 0x000000000800077c
+ 0x0000000003000424 __init_array_start = ABSOLUTE (.)
+ *(SORT_BY_NAME(.init_array.*))
+ *(.init_array)
+ .init_array 0x0000000003000424 0x4 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ 0x0000000003000428 __init_array_end = ABSOLUTE (.)
+ 0x0000000008000780 __fini_lma = (__init_lma + SIZEOF (.init_array))
+
+.fini_array 0x0000000003000428 0x4 load address 0x0000000008000780
+ 0x0000000003000428 __fini_array_start = ABSOLUTE (.)
+ *(SORT_BY_NAME(.fini_array.*))
+ *(.fini_array)
+ .fini_array 0x0000000003000428 0x4 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ 0x000000000300042c __fini_array_end = ABSOLUTE (.)
+ 0x0000000008000784 __jcr_lma = (__fini_lma + SIZEOF (.fini_array))
+
+.jcr 0x000000000300042c 0x0 load address 0x0000000008000784
+ *(.jcr)
+ 0x000000000300042c __data_end__ = ABSOLUTE (.)
+ 0x0000000008000784 __iwram_overlay_lma = (__jcr_lma + SIZEOF (.jcr))
+ 0x000000000300042c __iwram_overlay_start = .
+
+.iwram0 0x000000000300042c 0x0 load address 0x0000000008000784
+ *(.iwram0)
+ 0x000000000300042c . = ALIGN (0x4)
+ 0x0000000008000784 PROVIDE (__load_start_iwram0 = LOADADDR (.iwram0))
+ 0x0000000008000784 PROVIDE (__load_stop_iwram0 = (LOADADDR (.iwram0) + SIZEOF (.iwram0)))
+
+.iwram1 0x000000000300042c 0x0
+ *(.iwram1)
+ 0x000000000300042c . = ALIGN (0x4)
+ [!provide] PROVIDE (__load_start_iwram1 = LOADADDR (.iwram1))
+ [!provide] PROVIDE (__load_stop_iwram1 = (LOADADDR (.iwram1) + SIZEOF (.iwram1)))
+
+.iwram2 0x000000000300042c 0x0
+ *(.iwram2)
+ 0x000000000300042c . = ALIGN (0x4)
+ [!provide] PROVIDE (__load_start_iwram2 = LOADADDR (.iwram2))
+ [!provide] PROVIDE (__load_stop_iwram2 = (LOADADDR (.iwram2) + SIZEOF (.iwram2)))
+
+.iwram3 0x000000000300042c 0x0
+ *(.iwram3)
+ 0x000000000300042c . = ALIGN (0x4)
+ [!provide] PROVIDE (__load_start_iwram3 = LOADADDR (.iwram3))
+ [!provide] PROVIDE (__load_stop_iwram3 = (LOADADDR (.iwram3) + SIZEOF (.iwram3)))
+
+.iwram4 0x000000000300042c 0x0
+ *(.iwram4)
+ 0x000000000300042c . = ALIGN (0x4)
+ [!provide] PROVIDE (__load_start_iwram4 = LOADADDR (.iwram4))
+ [!provide] PROVIDE (__load_stop_iwram4 = (LOADADDR (.iwram4) + SIZEOF (.iwram4)))
+
+.iwram5 0x000000000300042c 0x0
+ *(.iwram5)
+ 0x000000000300042c . = ALIGN (0x4)
+ [!provide] PROVIDE (__load_start_iwram5 = LOADADDR (.iwram5))
+ [!provide] PROVIDE (__load_stop_iwram5 = (LOADADDR (.iwram5) + SIZEOF (.iwram5)))
+
+.iwram6 0x000000000300042c 0x0
+ *(.iwram6)
+ 0x000000000300042c . = ALIGN (0x4)
+ [!provide] PROVIDE (__load_start_iwram6 = LOADADDR (.iwram6))
+ [!provide] PROVIDE (__load_stop_iwram6 = (LOADADDR (.iwram6) + SIZEOF (.iwram6)))
+
+.iwram7 0x000000000300042c 0x0
+ *(.iwram7)
+ 0x000000000300042c . = ALIGN (0x4)
+ [!provide] PROVIDE (__load_start_iwram7 = LOADADDR (.iwram7))
+ [!provide] PROVIDE (__load_stop_iwram7 = (LOADADDR (.iwram7) + SIZEOF (.iwram7)))
+
+.iwram8 0x000000000300042c 0x0
+ *(.iwram8)
+ 0x000000000300042c . = ALIGN (0x4)
+ [!provide] PROVIDE (__load_start_iwram8 = LOADADDR (.iwram8))
+ [!provide] PROVIDE (__load_stop_iwram8 = (LOADADDR (.iwram8) + SIZEOF (.iwram8)))
+
+.iwram9 0x000000000300042c 0x0
+ *(.iwram9)
+ 0x000000000300042c . = ALIGN (0x4)
+ [!provide] PROVIDE (__load_start_iwram9 = LOADADDR (.iwram9))
+ [!provide] PROVIDE (__load_stop_iwram9 = (LOADADDR (.iwram9) + SIZEOF (.iwram9)))
+ 0x000000000300042c __iwram_overlay_end = .
+ 0x0000000008000784 __ewram_lma = (__iwram_overlay_lma + (__iwram_overlay_end - __iwram_overlay_start))
+ 0x000000000300042c __iheap_start = .
+ 0x0000000002000000 __ewram_start = ORIGIN (ewram)
+
+.ewram 0x0000000002000000 0x0 load address 0x0000000008000784
+ *(.ewram*)
+ 0x0000000002000000 . = ALIGN (0x4)
+ 0x0000000002000000 __ewram_end = ABSOLUTE (.)
+ 0x0000000008000784 __pad_lma = (__ewram_lma + SIZEOF (.ewram))
+
+.sbss 0x0000000002000000 0x0
+ 0x0000000002000000 __sbss_start__ = ABSOLUTE (.)
+ *(.sbss*)
+ 0x0000000002000000 . = ALIGN (0x4)
+ 0x0000000002000000 __sbss_end__ = ABSOLUTE (.)
+ 0x0000000002000000 __end__ = ABSOLUTE (.)
+ 0x0000000002000000 __eheap_start = ABSOLUTE (.)
+
+.pad 0x0000000002000000 0x8 load address 0x0000000008000784
+ 0x0000000002000000 0x4 LONG 0x52416b64
+ 0x0000000002000004 0x4 LONG 0x4d
+ 0x0000000002000008 . = ALIGN (0x4)
+ 0x000000000800078c __rom_end__ = (__pad_lma + SIZEOF (.pad))
+
+.stab
+ *(.stab)
+
+.stabstr
+ *(.stabstr)
+
+.stab.excl
+ *(.stab.excl)
+
+.stab.exclstr
+ *(.stab.exclstr)
+
+.stab.index
+ *(.stab.index)
+
+.stab.indexstr
+ *(.stab.indexstr)
+
+.comment 0x0000000000000000 0x23
+ *(.comment)
+ .comment 0x0000000000000000 0x23 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ 0x24 (size before relaxing)
+ .comment 0x0000000000000023 0x24 main.o
+ .comment 0x0000000000000023 0x24 player.o
+ .comment 0x0000000000000023 0x24 toolbox.o
+ .comment 0x0000000000000023 0x24 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-init.o)
+ .comment 0x0000000000000023 0x24 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-memcpy-stub.o)
+ .comment 0x0000000000000023 0x24 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libsysbase.a(malloc_vars.o)
+ .comment 0x0000000000000023 0x24 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtend.o
+
+.debug
+ *(.debug)
+
+.line
+ *(.line)
+
+.debug_srcinfo
+ *(.debug_srcinfo)
+
+.debug_sfnames
+ *(.debug_sfnames)
+
+.debug_aranges 0x0000000000000000 0x60
+ *(.debug_aranges)
+ .debug_aranges
+ 0x0000000000000000 0x28 main.o
+ .debug_aranges
+ 0x0000000000000028 0x18 player.o
+ .debug_aranges
+ 0x0000000000000040 0x20 toolbox.o
+
+.debug_pubnames
+ *(.debug_pubnames)
+
+.debug_info 0x0000000000000000 0x7e1
+ *(.debug_info)
+ .debug_info 0x0000000000000000 0x4d8 main.o
+ .debug_info 0x00000000000004d8 0x7f player.o
+ .debug_info 0x0000000000000557 0x28a toolbox.o
+
+.debug_abbrev 0x0000000000000000 0x3cb
+ *(.debug_abbrev)
+ .debug_abbrev 0x0000000000000000 0x22a main.o
+ .debug_abbrev 0x000000000000022a 0x47 player.o
+ .debug_abbrev 0x0000000000000271 0x15a toolbox.o
+
+.debug_line 0x0000000000000000 0x3c5
+ *(.debug_line)
+ .debug_line 0x0000000000000000 0x1f1 main.o
+ .debug_line 0x00000000000001f1 0x4a player.o
+ .debug_line 0x000000000000023b 0x18a toolbox.o
+
+.debug_frame 0x0000000000000000 0xa8
+ *(.debug_frame)
+ .debug_frame 0x0000000000000000 0x4c main.o
+ .debug_frame 0x000000000000004c 0x5c toolbox.o
+
+.debug_str 0x0000000000000000 0x274
+ *(.debug_str)
+ .debug_str 0x0000000000000000 0x210 main.o
+ 0x250 (size before relaxing)
+ .debug_str 0x0000000000000210 0x2a player.o
+ 0xdc (size before relaxing)
+ .debug_str 0x000000000000023a 0x3a toolbox.o
+ 0x167 (size before relaxing)
+
+.debug_loc 0x0000000000000000 0x36a
+ *(.debug_loc)
+ .debug_loc 0x0000000000000000 0x90 main.o
+ .debug_loc 0x0000000000000090 0x2da toolbox.o
+
+.debug_macinfo
+ *(.debug_macinfo)
+
+.debug_weaknames
+ *(.debug_weaknames)
+
+.debug_funcnames
+ *(.debug_funcnames)
+
+.debug_typenames
+ *(.debug_typenames)
+
+.debug_varnames
+ *(.debug_varnames)
+
+.stack 0x0000000000080000 0x0
+ 0x0000000000080000 _stack = .
+ *(.stack)
+
+.note.gnu.arm.ident
+ *(.note.gnu.arm.ident)
+
+.ARM.attributes
+ 0x0000000000000000 0x2c
+ *(.ARM.attributes)
+ .ARM.attributes
+ 0x0000000000000000 0x20 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o
+ .ARM.attributes
+ 0x0000000000000020 0x1c /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crti.o
+ .ARM.attributes
+ 0x000000000000003c 0x2a /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+ .ARM.attributes
+ 0x0000000000000066 0x2a main.o
+ .ARM.attributes
+ 0x0000000000000090 0x30 player.o
+ .ARM.attributes
+ 0x00000000000000c0 0x2a toolbox.o
+ .ARM.attributes
+ 0x00000000000000ea 0x2a /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-init.o)
+ .ARM.attributes
+ 0x0000000000000114 0x2a /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-memcpy-stub.o)
+ .ARM.attributes
+ 0x000000000000013e 0x30 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libsysbase.a(malloc_vars.o)
+ .ARM.attributes
+ 0x000000000000016e 0x30 /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtend.o
+ .ARM.attributes
+ 0x000000000000019e 0x1c /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtn.o
+
+/DISCARD/
+ *(.note.GNU-stack)
+LOAD /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/gba_crt0.o
+LOAD /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crti.o
+LOAD /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtbegin.o
+LOAD main.o
+LOAD player.o
+LOAD toolbox.o
+LOAD /opt/devkitpro/libgba/lib/libmm.a
+LOAD /opt/devkitpro/libgba/lib/libgba.a
+START GROUP
+LOAD /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/libgcc.a
+LOAD /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libg.a
+LOAD /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libc.a
+LOAD /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/lib/thumb/libsysbase.a
+END GROUP
+LOAD /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtend.o
+LOAD /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/10.1.0/thumb/crtn.o
+OUTPUT(/home/logan/git/GBA-Dash/GBA-Dash.elf elf32-littlearm)
+
+.debug_ranges 0x0000000000000000 0x98
+ .debug_ranges 0x0000000000000000 0x98 main.o
diff --git a/build/main.d b/build/main.d
new file mode 100644
index 0000000..78bc462
--- /dev/null
+++ b/build/main.d
@@ -0,0 +1,21 @@
+main.o: /home/logan/git/GBA-Dash/source/main.c \
+ /home/logan/git/GBA-Dash/source/../include/input.h \
+ /home/logan/git/GBA-Dash/source/../include/memmap.h \
+ /home/logan/git/GBA-Dash/source/../include/types.h \
+ /home/logan/git/GBA-Dash/source/../include/memdef.h \
+ /home/logan/git/GBA-Dash/source/../include/toolbox.h \
+ /home/logan/git/GBA-Dash/source/../include/input.h \
+ /home/logan/git/GBA-Dash/source/../include/memmap.h \
+ /home/logan/git/GBA-Dash/source/../include/types.h \
+ /home/logan/git/GBA-Dash/source/../include/memdef.h \
+ /home/logan/git/GBA-Dash/source/../sprites/player.h
+/home/logan/git/GBA-Dash/source/../include/input.h:
+/home/logan/git/GBA-Dash/source/../include/memmap.h:
+/home/logan/git/GBA-Dash/source/../include/types.h:
+/home/logan/git/GBA-Dash/source/../include/memdef.h:
+/home/logan/git/GBA-Dash/source/../include/toolbox.h:
+/home/logan/git/GBA-Dash/source/../include/input.h:
+/home/logan/git/GBA-Dash/source/../include/memmap.h:
+/home/logan/git/GBA-Dash/source/../include/types.h:
+/home/logan/git/GBA-Dash/source/../include/memdef.h:
+/home/logan/git/GBA-Dash/source/../sprites/player.h:
diff --git a/build/main.o b/build/main.o
new file mode 100644
index 0000000..fc8766d
--- /dev/null
+++ b/build/main.o
Binary files differ
diff --git a/build/player.d b/build/player.d
new file mode 100644
index 0000000..d176045
--- /dev/null
+++ b/build/player.d
@@ -0,0 +1 @@
+player.o: /home/logan/git/GBA-Dash/sprites/player.c
diff --git a/build/player.o b/build/player.o
new file mode 100644
index 0000000..1c7f918
--- /dev/null
+++ b/build/player.o
Binary files differ
diff --git a/build/toolbox.d b/build/toolbox.d
new file mode 100644
index 0000000..339b6d5
--- /dev/null
+++ b/build/toolbox.d
@@ -0,0 +1,11 @@
+toolbox.o: /home/logan/git/GBA-Dash/sprites/toolbox.c \
+ /home/logan/git/GBA-Dash/sprites/../include/toolbox.h \
+ /home/logan/git/GBA-Dash/sprites/../include/types.h \
+ /home/logan/git/GBA-Dash/sprites/../include/memmap.h \
+ /home/logan/git/GBA-Dash/sprites/../include/memdef.h \
+ /home/logan/git/GBA-Dash/sprites/../include/input.h
+/home/logan/git/GBA-Dash/sprites/../include/toolbox.h:
+/home/logan/git/GBA-Dash/sprites/../include/types.h:
+/home/logan/git/GBA-Dash/sprites/../include/memmap.h:
+/home/logan/git/GBA-Dash/sprites/../include/memdef.h:
+/home/logan/git/GBA-Dash/sprites/../include/input.h:
diff --git a/build/toolbox.o b/build/toolbox.o
new file mode 100644
index 0000000..76fa92b
--- /dev/null
+++ b/build/toolbox.o
Binary files differ
diff --git a/include/input.h b/include/input.h
new file mode 100644
index 0000000..70b7a83
--- /dev/null
+++ b/include/input.h
@@ -0,0 +1,135 @@
+//
+// Input header
+//
+//! \file tonc_input.h
+//! \author J Vijn
+//! \date 20060508 - 20060924
+//
+// === NOTES ===
+// * This is a _small_ set of typedefs, #defines and inlines that can
+// be found in tonclib, and might not represent the
+// final forms.
+
+
+#ifndef __INPUT__
+#define __INPUT__
+
+#include "memmap.h"
+#include "types.h"
+#include "memdef.h"
+
+
+INLINE int bit_tribool(u32 x, int plus, int minus);
+
+// === CONSTANTS ======================================================
+
+typedef enum eKeyIndex
+{
+ KI_A=0, KI_B, KI_SELECT, KI_START,
+ KI_RIGHT, KI_LEFT, KI_UP, KI_DOWN,
+ KI_R, KI_L, KI_MAX
+} eKeyIndex;
+
+// === MACROS =========================================================
+
+// check which of the specified keys are down or up right now
+#define KEY_DOWN_NOW(key) (~(REG_KEYINPUT) & key)
+#define KEY_UP_NOW(key) ( (REG_KEYINPUT) & key)
+
+// test whether all keys are pressed, released, whatever.
+// Example use:
+// KEY_EQ(key_hit, KEY_L | KEY_R)
+// will be true if and only if KEY_L and KEY_R are _both_ being pressed
+#define KEY_EQ(key_fun, keys) ( key_fun(keys) == (keys) )
+
+// === CLASSES ========================================================
+// === GLOBALS ========================================================
+
+extern u16 __key_curr, __key_prev; // in tonc_core.c
+
+// === PROTOTYPES =====================================================
+
+// --- synchronous key states ---
+INLINE void key_poll();
+INLINE u32 key_curr_state();
+INLINE u32 key_prev_state();
+
+INLINE u32 key_is_down(u32 key); // any of key currently down?
+INLINE u32 key_is_up(u32 key); // any of key currently up?
+
+INLINE u32 key_was_down(u32 key); // any of key previously down?
+INLINE u32 key_was_up(u32 key); // any of key previously up?
+
+INLINE u32 key_transit(u32 key); // any of key changing?
+INLINE u32 key_held(u32 key); // any of key held down?
+INLINE u32 key_hit(u32 key); // any of key being hit (going down)?
+INLINE u32 key_released(u32 key); // any of key being released?
+
+// --- tribools ---
+INLINE int key_tri_horz();
+INLINE int key_tri_vert();
+INLINE int key_tri_shoulder();
+INLINE int key_tri_fire();
+
+// === INLINES=========================================================
+
+// --- keys -----------------------------------------------------------
+
+//! Poll for keystates
+INLINE void key_poll()
+{ __key_prev= __key_curr; __key_curr= ~REG_KEYINPUT & KEY_MASK; }
+
+//! Get current keystate
+INLINE u32 key_curr_state() { return __key_curr; }
+
+//! Get previous key state
+INLINE u32 key_prev_state() { return __key_prev; }
+
+//! Gives the keys of \a key that are currently down
+INLINE u32 key_is_down(u32 key) { return __key_curr & key; }
+
+//! Gives the keys of \a key that are currently up
+INLINE u32 key_is_up(u32 key) { return ~__key_curr & key; }
+
+//! Gives the keys of \a key that were previously down
+INLINE u32 key_was_down(u32 key) { return __key_prev & key; }
+
+//! Gives the keys of \a key that were previously down
+INLINE u32 key_was_up(u32 key) { return ~__key_prev & key; }
+
+//! Gives the keys of \a key that are different from before
+INLINE u32 key_transit(u32 key)
+{ return (__key_curr^__key_prev) & key; }
+
+//! Gives the keys of \a key that are being held down
+INLINE u32 key_held(u32 key)
+{ return (__key_curr& __key_prev) & key; }
+
+//! Gives the keys of \a key that are pressed (down now but not before)
+INLINE u32 key_hit(u32 key)
+{ return (__key_curr&~__key_prev) & key; }
+
+//! Gives the keys of \a key that are being released
+INLINE u32 key_released(u32 key)
+{ return (~__key_curr&__key_prev) & key; }
+
+// --- tribools ---
+
+//! Horizontal tribool (right,left)=(+,-)
+INLINE int key_tri_horz()
+{ return bit_tribool(__key_curr, KI_RIGHT, KI_LEFT); }
+
+//! Vertical tribool (down,up)=(+,-)
+INLINE int key_tri_vert()
+{ return bit_tribool(__key_curr, KI_DOWN, KI_UP); }
+
+//! Shoulder-button tribool (R,L)=(+,-)
+INLINE int key_tri_shoulder()
+{ return bit_tribool(__key_curr, KI_R, KI_L); }
+
+//! Fire-button tribool (A,B)=(+,-)
+INLINE int key_tri_fire()
+{ return bit_tribool(__key_curr, KI_A, KI_B); }
+
+
+#endif // __INPUT__
diff --git a/include/memdef.h b/include/memdef.h
new file mode 100644
index 0000000..8fe432f
--- /dev/null
+++ b/include/memdef.h
@@ -0,0 +1,212 @@
+//
+// Memory map defines. All of them
+//
+//! \file tonc_memdef.h
+//! \author J Vijn
+//! \date 20060508 - 20060924
+//
+// === NOTES ===
+// * This is a _small_ set of typedefs, #defines and inlines that can
+// be found in tonclib, and might not represent the
+// final forms.
+// * '0'-defines are prefixed with '_', to indicate their zero-ness
+// and presents a safety from things like doing `if(x&0)'
+
+#ifndef __MEMDEF__
+#define __MEMDEF__
+
+// --- Prefixes ---
+// REG_DISPCNT : DCNT
+// REG_DISPSTAT : DSTAT
+
+// OAM attr 0 : OA0
+// OAM attr 1 : OA1
+// OAM attr 2 : OA2
+
+
+// --- REG_DISPCNT -----------------------------------------------------
+
+#define DCNT_MODE0 0 //!< Mode 0; bg 0-4: reg
+#define DCNT_MODE1 0x0001 //!< Mode 1; bg 0-1: reg; bg 2: affine
+#define DCNT_MODE2 0x0002 //!< Mode 2; bg 2-2: affine
+#define DCNT_MODE3 0x0003 //!< Mode 3; bg2: 240x160\@16 bitmap
+#define DCNT_MODE4 0x0004 //!< Mode 4; bg2: 240x160\@8 bitmap
+#define DCNT_MODE5 0x0005 //!< Mode 5; bg2: 160x128\@16 bitmap
+#define DCNT_GB 0x0008 //!< (R) GBC indicator
+#define DCNT_PAGE 0x0010 //!< Page indicator
+#define DCNT_OAM_HBL 0x0020 //!< Allow OAM updates in HBlank
+#define DCNT_OBJ_2D 0 //!< OBJ-VRAM as matrix
+#define DCNT_OBJ_1D 0x0040 //!< OBJ-VRAM as array
+#define DCNT_BLANK 0x0080 //!< Force screen blank
+#define DCNT_BG0 0x0100 //!< Enable bg 0
+#define DCNT_BG1 0x0200 //!< Enable bg 1
+#define DCNT_BG2 0x0400 //!< Enable bg 2
+#define DCNT_BG3 0x0800 //!< Enable bg 3
+#define DCNT_OBJ 0x1000 //!< Enable objects
+#define DCNT_WIN0 0x2000 //!< Enable window 0
+#define DCNT_WIN1 0x4000 //!< Enable window 1
+#define DCNT_WINOBJ 0x8000 //!< Enable object window
+
+#define DCNT_MODE_MASK 0x0007
+#define DCNT_MODE_SHIFT 0
+#define DCNT_MODE(n) ((n)<<DCNT_MODE_SHIFT)
+
+#define DCNT_LAYER_MASK 0x1F00
+#define DCNT_LAYER_SHIFT 8
+#define DCNT_LAYER(n) ((n)<<DCNT_LAYER_SHIFT)
+
+#define DCNT_WIN_MASK 0xE000
+#define DCNT_WIN_SHIFT 13
+#define DCNT_WIN(n) ((n)<<DCNT_WIN_SHIFT)
+
+#define DCNT_BUILD(mode, layer, win, obj1d, objhbl) \
+( \
+ (((win)&7)<<13) | (((layer)&31)<<8) | (((obj1d)&1)<<6) \
+ | (((oamhbl)&1)<<5) | ((mode)&7) \
+)
+
+
+// --- REG_DISPSTAT ----------------------------------------------------
+
+#define DSTAT_IN_VBL 0x0001 //!< Now in VBlank
+#define DSTAT_IN_HBL 0x0002 //!< Now in HBlank
+#define DSTAT_IN_VCT 0x0004 //!< Now in set VCount
+#define DSTAT_VBL_IRQ 0x0008 //!< Enable VBlank irq
+#define DSTAT_HBL_IRQ 0x0010 //!< Enable HBlank irq
+#define DSTAT_VCT_IRQ 0x0020 //!< Enable VCount irq
+
+#define DSTAT_VCT_MASK 0xFF00
+#define DSTAT_VCT_SHIFT 8
+#define DSTAT_VCT(n) ((n)<<DSTAT_VCT_SHIFT)
+
+
+// --- REG_KEYINPUT --------------------------------------------------------
+
+#define KEY_A 0x0001 //!< Button A
+#define KEY_B 0x0002 //!< Button B
+#define KEY_SELECT 0x0004 //!< Select button
+#define KEY_START 0x0008 //!< Start button
+#define KEY_RIGHT 0x0010 //!< Right D-pad
+#define KEY_LEFT 0x0020 //!< Left D-pad
+#define KEY_UP 0x0040 //!< Up D-pad
+#define KEY_DOWN 0x0080 //!< Down D-pad
+#define KEY_R 0x0100 //!< Shoulder R
+#define KEY_L 0x0200 //!< Shoulder L
+
+#define KEY_ANY 0x03FF //!< any key
+#define KEY_DIR 0x00F0 //!< any-dpad
+#define KEY_ACCEPT 0x0009 //!< A or start
+#define KEY_CANCEL 0x0002 //!< B (well, it usually is)
+#define KEY_SHOULDER 0x0300 //!< L or R
+
+#define KEY_RESET 0x000F //!< St+Se+A+B
+
+#define KEY_MASK 0x03FF
+
+
+// --- OAM attribute 0 -------------------------------------------------
+
+#define ATTR0_REG 0 //!< Regular object
+#define ATTR0_AFF 0x0100 //!< Affine object
+#define ATTR0_HIDE 0x0200 //!< Inactive object
+#define ATTR0_AFF_DBL 0x0300 //!< Double-size affine object
+#define ATTR0_AFF_DBL_BIT 0x0200
+#define ATTR0_BLEND 0x0400 //!< Enable blend
+#define ATTR0_WINDOW 0x0800 //!< Use for object window
+#define ATTR0_MOSAIC 0x1000 //!< Enable mosaic
+#define ATTR0_4BPP 0 //!< Use 4bpp (16 color) tiles
+#define ATTR0_8BPP 0x2000 //!< Use 8bpp (256 color) tiles
+#define ATTR0_SQUARE 0 //!< Square shape
+#define ATTR0_WIDE 0x4000 //!< Tall shape (height &gt; width)
+#define ATTR0_TALL 0x8000 //!< Wide shape (height &lt; width)
+
+#define ATTR0_Y_MASK 0x00FF
+#define ATTR0_Y_SHIFT 0
+#define ATTR0_Y(n) ((n)<<ATTR0_Y_SHIFT)
+
+#define ATTR0_MODE_MASK 0x0300
+#define ATTR0_MODE_SHIFT 8
+#define ATTR0_MODE(n) ((n)<<ATTR0_MODE_SHIFT)
+
+#define ATTR0_SHAPE_MASK 0xC000
+#define ATTR0_SHAPE_SHIFT 14
+#define ATTR0_SHAPE(n) ((n)<<ATTR0_SHAPE_SHIFT)
+
+
+#define ATTR0_BUILD(y, shape, bpp, mode, mos, bld, win) \
+( \
+ ((y)&255) | (((mode)&3)<<8) | (((bld)&1)<<10) | (((win)&1)<<11) \
+ | (((mos)&1)<<12) | (((bpp)&8)<<10)| (((shape)&3)<<14) \
+)
+
+
+// --- OAM attribute 1 -------------------------------------------------
+
+#define ATTR1_HFLIP 0x1000 //!< Horizontal flip (reg obj only)
+#define ATTR1_VFLIP 0x2000 //!< Vertical flip (reg obj only)
+// Base sizes
+#define ATTR1_SIZE_8 0
+#define ATTR1_SIZE_16 0x4000
+#define ATTR1_SIZE_32 0x8000
+#define ATTR1_SIZE_64 0xC000
+// Square sizes
+#define ATTR1_SIZE_8x8 0 //!< Size flag for 8x8 px object
+#define ATTR1_SIZE_16x16 0x4000 //!< Size flag for 16x16 px object
+#define ATTR1_SIZE_32x32 0x8000 //!< Size flag for 32x32 px object
+#define ATTR1_SIZE_64x64 0xC000 //!< Size flag for 64x64 px object
+// Tall sizes
+#define ATTR1_SIZE_8x16 0 //!< Size flag for 8x16 px object
+#define ATTR1_SIZE_8x32 0x4000 //!< Size flag for 8x32 px object
+#define ATTR1_SIZE_16x32 0x8000 //!< Size flag for 16x32 px object
+#define ATTR1_SIZE_32x64 0xC000 //!< Size flag for 32x64 px object
+// Wide sizes
+#define ATTR1_SIZE_16x8 0 //!< Size flag for 16x8 px object
+#define ATTR1_SIZE_32x8 0x4000 //!< Size flag for 32x8 px object
+#define ATTR1_SIZE_32x16 0x8000 //!< Size flag for 32x16 px object
+#define ATTR1_SIZE_64x32 0xC000 //!< Size flag for 64x64 px object
+
+
+#define ATTR1_X_MASK 0x01FF
+#define ATTR1_X_SHIFT 0
+#define ATTR1_X(n) ((n)<<ATTR1_X_SHIFT)
+
+#define ATTR1_AFF_ID_MASK 0x3E00
+#define ATTR1_AFF_ID_SHIFT 9
+#define ATTR1_AFF_ID(n) ((n)<<ATTR1_AFF_ID_SHIFT)
+
+#define ATTR1_FLIP_MASK 0x3000
+#define ATTR1_FLIP_SHIFT 12
+#define ATTR1_FLIP(n) ((n)<<ATTR1_FLIP_SHIFT)
+
+#define ATTR1_SIZE_MASK 0xC000
+#define ATTR1_SIZE_SHIFT 14
+#define ATTR1_SIZE(n) ((n)<<ATTR1_SIZE_SHIFT)
+
+
+#define ATTR1_BUILDR(x, size, hflip, vflip) \
+( ((x)&511) | (((hflip)&1)<<12) | (((vflip)&1)<<13) | (((size)&3)<<14) )
+
+#define ATTR1_BUILDA(x, size, affid) \
+( ((x)&511) | (((affid)&31)<<9) | (((size)&3)<<14) )
+
+
+// --- OAM attribute 2 -------------------------------------------------
+
+#define ATTR2_ID_MASK 0x03FF
+#define ATTR2_ID_SHIFT 0
+#define ATTR2_ID(n) ((n)<<ATTR2_ID_SHIFT)
+
+#define ATTR2_PRIO_MASK 0x0C00
+#define ATTR2_PRIO_SHIFT 10
+#define ATTR2_PRIO(n) ((n)<<ATTR2_PRIO_SHIFT)
+
+#define ATTR2_PALBANK_MASK 0xF000
+#define ATTR2_PALBANK_SHIFT 12
+#define ATTR2_PALBANK(n) ((n)<<ATTR2_PALBANK_SHIFT)
+
+
+#define ATTR2_BUILD(id, pbank, prio) \
+( ((id)&0x3FF) | (((pbank)&15)<<12) | (((prio)&3)<<10) )
+
+
+#endif // __MEMDEF__
diff --git a/include/memmap.h b/include/memmap.h
new file mode 100644
index 0000000..a473310
--- /dev/null
+++ b/include/memmap.h
@@ -0,0 +1,97 @@
+//
+// GBA Memory map
+//
+//! \file tonc_memmap.h
+//! \author J Vijn
+//! \date 20060508 - 20060508
+//
+// === NOTES ===
+// * This is a _small_ set of typedefs, #defines and inlines that can
+// be found in tonclib, and might not represent the
+// final forms.
+
+#ifndef __MEMMAP__
+#define __MEMMAP__
+
+
+// === MEMORY SECTIONS ================================================
+
+// basic sections
+#define MEM_IO 0x04000000
+#define MEM_PAL 0x05000000 // no 8bit write !!
+#define MEM_VRAM 0x06000000 // no 8bit write !!
+#define MEM_OAM 0x07000000 // no 8bit write !!
+
+// basic sizes
+#define PAL_SIZE 0x00400
+#define VRAM_SIZE 0x18000
+#define OAM_SIZE 0x00400
+
+// sub sizes
+#define PAL_BG_SIZE 0x00200
+#define PAL_OBJ_SIZE 0x00200
+#define VRAM_BG_SIZE 0x10000
+#define VRAM_OBJ_SIZE 0x08000
+#define M3_SIZE 0x12C00
+#define M4_SIZE 0x09600
+#define M5_SIZE 0x0A000
+#define VRAM_PAGE_SIZE 0x0A000
+
+// sub sections
+#define REG_BASE MEM_IO
+
+#define MEM_PAL_OBJ (MEM_PAL + PAL_BG_SIZE)
+#define MEM_VRAM_BACK (MEM_VRAM+ VRAM_PAGE_SIZE)
+#define MEM_VRAM_OBJ (MEM_VRAM+ VRAM_BG_SIZE)
+
+
+// === STRUCTURED MEMORY MAP ==========================================
+// Heavily typedefed, watch your pointers
+// Should simplify memory accesses
+
+
+// --- PAL ---
+// pal_bg_mem[y] = COLOR (color y)
+#define pal_bg_mem ((COLOR*)MEM_PAL)
+#define pal_obj_mem ((COLOR*)MEM_PAL_OBJ)
+
+// pal_bg_bank[y] = COLOR[] (bank y)
+// pal_bg_bank[y][x] = COLOR (bank y, color x : color y*16+x)
+#define pal_bg_bank ((PALBANK*)MEM_PAL)
+#define pal_obj_bank ((PALBANK*)MEM_PAL_OBJ)
+
+
+// --- VRAM ---
+// tile_mem[y] = TILE[] (char block y)
+// tile_mem[y][x] = TILE (char block y, tile x)
+#define tile_mem ( (CHARBLOCK*)MEM_VRAM)
+#define tile8_mem ((CHARBLOCK8*)MEM_VRAM)
+
+#define tile_mem_obj ( (CHARBLOCK*)MEM_VRAM_OBJ)
+#define tile8_mem_obj ((CHARBLOCK8*)MEM_VRAM_OBJ)
+
+// vid_mem[a] = COLOR
+#define vid_mem ((COLOR*)MEM_VRAM)
+
+
+// --- OAM ---
+// oatr_mem[a] = OBJ_ATTR (oam entry a)
+#define oam_mem ((OBJ_ATTR*)MEM_OAM)
+#define obj_mem ((OBJ_ATTR*)MEM_OAM)
+#define obj_aff_mem ((OBJ_AFFINE*)MEM_OAM)
+
+
+// === REGISTER LIST ==================================================
+
+
+// === VIDEO REGISTERS ===
+#define REG_DISPCNT *(vu32*)(REG_BASE+0x0000) // display control
+#define REG_DISPSTAT *(vu16*)(REG_BASE+0x0004) // display interupt status
+#define REG_VCOUNT *(vu16*)(REG_BASE+0x0006) // vertical count
+
+// === KEYPAD ===
+#define REG_KEYINPUT *(vu16*)(REG_BASE+0x0130) // Key status
+#define REG_KEYCNT *(vu16*)(REG_BASE+0x0132)
+
+
+#endif // __MEMMAP__
diff --git a/include/toolbox.h b/include/toolbox.h
new file mode 100644
index 0000000..064f0a3
--- /dev/null
+++ b/include/toolbox.h
@@ -0,0 +1,154 @@
+//
+// toolbox.h:
+//
+// Tools header for obj_demo
+//
+// (20060211-20060924, cearn)
+//
+// === NOTES ===
+// * This is a _small_ set of typedefs, #defines and inlines that can
+// be found in tonclib, and might not represent the
+// final forms.
+
+
+#ifndef TOOLBOX_H
+#define TOOLBOX_H
+
+#include "types.h" // (tonc_types.h)
+#include "memmap.h" // (tonc_memmap.h)
+#include "memdef.h" // (tonc_memdef.h)
+#include "input.h" // (tonc_input.h)
+
+// === (tonc_core.h) ==================================================
+
+// tribool: 1 if {plus} on, -1 if {minus} on, 0 if {plus}=={minus}
+INLINE int bit_tribool(u32 x, int plus, int minus);
+
+
+extern COLOR *vid_page;
+extern u16 __key_curr, __key_prev;
+
+
+// === (tonc_video.h) =================================================
+
+// --- sizes ---
+#define SCREEN_WIDTH 240
+#define SCREEN_HEIGHT 160
+
+#define M3_WIDTH SCREEN_WIDTH
+#define M3_HEIGHT SCREEN_HEIGHT
+#define M4_WIDTH SCREEN_WIDTH
+#define M4_HEIGHT SCREEN_HEIGHT
+#define M5_WIDTH 160
+#define M5_HEIGHT 128
+
+// --- colors ---
+
+#define CLR_BLACK 0x0000
+#define CLR_RED 0x001F
+#define CLR_LIME 0x03E0
+#define CLR_YELLOW 0x03FF
+#define CLR_BLUE 0x7C00
+#define CLR_MAG 0x7C1F
+#define CLR_CYAN 0x7FE0
+#define CLR_WHITE 0x7FFF
+
+INLINE COLOR RGB15(u32 red, u32 green, u32 blue);
+
+INLINE void vid_vsync();
+u16 *vid_flip();
+
+
+// --- Objects ---
+
+void oam_init(OBJ_ATTR *obj, u32 count);
+void oam_copy(OBJ_ATTR *dst, const OBJ_ATTR *src, u32 count);
+
+INLINE OBJ_ATTR *obj_set_attr(OBJ_ATTR *obj, u16 a0, u16 a1, u16 a2);
+INLINE void obj_set_pos(OBJ_ATTR *obj, int x, int y);
+INLINE void obj_hide(OBJ_ATTR *oatr);
+INLINE void obj_unhide(OBJ_ATTR *obj, u16 mode);
+void obj_copy(OBJ_ATTR *dst, const OBJ_ATTR *src, u32 count);
+
+
+// === INLINES ========================================================
+
+// --- (tonc_core.h) --------------------------------------------------
+
+// --- Simple bit macros ---
+#define BIT(n) ( 1<<(n) )
+#define BIT_SHIFT(a, n) ( (a)<<(n) )
+#define BIT_SET(word, flag) ( word |= (flag) )
+#define BIT_CLEAR(word, flag) ( word &= ~(flag) )
+#define BIT_FLIP(word, flag) ( word ^= (flag) )
+#define BIT_EQ(word, flag) ( ((word)&(flag)) == (flag) )
+
+// some EVIL bit-field operations, >:)
+// _x needs shifting
+#define BFN_PREP(x, name) ( ((x)<<name##_SHIFT) & name##_MASK )
+#define BFN_GET(y, name) ( ((y) & name##_MASK)>>name##_SHIFT )
+#define BFN_SET(y, x, name) (y = ((y)&~name##_MASK) | BFN_PREP(x,name) )
+
+// x already shifted
+#define BFN_PREP2(x, name) ( (x) & name##_MASK )
+#define BFN_GET2(y, name) ( (y) & name##_MASK )
+#define BFN_SET2(y, x, name) (y = ((y)&~name##_MASK) | BFN_PREP2(x,name) )
+
+//! Gives a tribool (-1, 0, or +1) depending on the state of some bits.
+/*! Looks at the \a plus and \a minus bits of \a flags, and subtracts
+* their status to give a +1, -1 or 0 result. Useful for direction flags.
+* \param plus Bit number for positive result
+* \param minus Bit number for negative result
+* \return <b>+1</b> if \a plus bit is set but \a minus bit isn't<br>
+* <b>-1</b> if \a minus bit is set and \a plus bit isn't</br>
+* <b>0</b> if neither or both are set.
+*/
+INLINE int bit_tribool(u32 flags, int plus, int minus)
+{ return ((flags>>plus)&1) - ((flags>>minus)&1); }
+
+
+// --- (tonc_video.h) -------------------------------------------------
+
+//! Wait for next VBlank
+INLINE void vid_vsync()
+{
+ while(REG_VCOUNT >= 160); // wait till VDraw
+ while(REG_VCOUNT < 160); // wait till VBlank
+}
+
+//! Create a 15bit BGR color.
+INLINE COLOR RGB15(u32 red, u32 green, u32 blue)
+{ return red | (green<<5) | (blue<<10); }
+
+
+// --- Objects ---
+
+
+//! Set the attributes of an object.
+INLINE OBJ_ATTR *obj_set_attr(OBJ_ATTR *obj, u16 a0, u16 a1, u16 a2)
+{
+ obj->attr0= a0; obj->attr1= a1; obj->attr2= a2;
+ return obj;
+}
+
+//! Set the position of \a obj
+INLINE void obj_set_pos(OBJ_ATTR *obj, int x, int y)
+{
+ BFN_SET(obj->attr0, y, ATTR0_Y);
+ BFN_SET(obj->attr1, x, ATTR1_X);
+}
+
+//! Hide an object.
+INLINE void obj_hide(OBJ_ATTR *obj)
+{ BFN_SET2(obj->attr0, ATTR0_HIDE, ATTR0_MODE); }
+
+//! Unhide an object.
+/*! \param obj Object to unhide.
+* \param mode Object mode to unhide to. Necessary because this affects
+* the affine-ness of the object.
+*/
+INLINE void obj_unhide(OBJ_ATTR *obj, u16 mode)
+{ BFN_SET2(obj->attr0, mode, ATTR0_MODE); }
+
+
+#endif // TOOLBOX_H
diff --git a/include/types.h b/include/types.h
new file mode 100644
index 0000000..5ad8121
--- /dev/null
+++ b/include/types.h
@@ -0,0 +1,120 @@
+//
+// Basic structs and typedefs
+//
+//! \file tonc_types.h
+//! \author J Vijn
+//! \date 20060508 - 20060508
+//
+// === NOTES ===
+// * This is a _small_ set of typedefs, #defines and inlines that can
+// be found in tonclib, and might not represent the
+// final forms.
+
+
+#ifndef __TYPES__
+#define __TYPES__
+
+
+// === GCC ATTRIBUTES =================================================
+
+// alignment boundary
+#define ALIGN(_n) __attribute__((aligned(_n)))
+#define ALIGN4 __attribute__((aligned(4)))
+
+// pack aggregate members
+#define PACKED __attribute__((packed))
+
+
+// === TYPES: =========================================================
+
+// --- primary typedefs -----------------------------------------------
+typedef unsigned char u8, byte;
+typedef unsigned short u16, hword;
+typedef unsigned int u32, word;
+typedef unsigned long long u64;
+
+typedef signed char s8;
+typedef signed short s16;
+typedef signed int s32;
+typedef signed long long s64;
+
+// and volatiles for registers 'n stuff
+typedef volatile u8 vu8;
+typedef volatile u16 vu16;
+typedef volatile u32 vu32;
+typedef volatile u64 vu64;
+
+typedef volatile s8 vs8;
+typedef volatile s16 vs16;
+typedef volatile s32 vs32;
+typedef volatile s64 vs64;
+
+// and consts too for parameters *sigh*
+typedef const u8 cu8;
+typedef const u16 cu16;
+typedef const u32 cu32;
+typedef const u64 cu64;
+
+typedef const s8 cs8;
+typedef const s16 cs16;
+typedef const s32 cs32;
+typedef const s64 cs64;
+
+typedef struct { u32 data[8]; } BLOCK;
+
+// --- secondary typedefs ---------------------------------------------
+
+typedef u16 COLOR;
+
+// NOTE, u32[]!
+typedef struct { u32 data[8]; } TILE, TILE4;
+typedef struct { u32 data[16]; } TILE8;
+
+
+// --- memory map structs --------------------------------------------
+
+// --- PAL types ---
+typedef COLOR PALBANK[16];
+
+// --- VRAM types ---
+
+typedef COLOR M3LINE[240];
+typedef u8 M4LINE[240]; // NOTE u8, not u16!!
+typedef COLOR M5LINE[160];
+
+typedef TILE CHARBLOCK[512];
+typedef TILE8 CHARBLOCK8[256];
+
+// --- OAM structs ---
+// NOTE: OATR and OAFF are interlaced; when using affine objs,
+// struct/DMA/mem copies will give bad results
+typedef struct OBJ_ATTR
+{
+ u16 attr0;
+ u16 attr1;
+ u16 attr2;
+ s16 fill;
+} ALIGN4 OBJ_ATTR;
+
+typedef struct OBJ_AFFINE
+{
+ u16 fill0[3]; s16 pa;
+ u16 fill1[3]; s16 pb;
+ u16 fill2[3]; s16 pc;
+ u16 fill3[3]; s16 pd;
+} ALIGN4 OBJ_AFFINE;
+
+
+// === DEFINES ========================================================
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+// `inline' inlines the function when -O > 0 when called,
+// but also creates a body for the function itself
+// `static' removes the body as well
+#define INLINE static inline
+
+
+#endif // __TYPES__
diff --git a/source/main.c b/source/main.c
new file mode 100644
index 0000000..a36688d
--- /dev/null
+++ b/source/main.c
@@ -0,0 +1,46 @@
+#include <string.h>
+#include "../include/input.h"
+#include "../include/toolbox.h"
+#include "../include/memmap.h"
+#include "../include/types.h"
+#include "../include/memdef.h"
+#include "../sprites/player.h"
+
+OBJ_ATTR obj_buffer[128];
+OBJ_AFFINE *obj_aff_buffer= (OBJ_AFFINE*)obj_buffer; // Object affine-buffer
+
+void obj_test() {
+ int x= 96, y= 32;
+ u32 tid= 0, pb= 0;
+ OBJ_ATTR *player = &obj_buffer[0];
+
+ obj_set_attr(player,
+ ATTR0_SQUARE,
+ ATTR1_SIZE_16,
+ ATTR2_PALBANK(pb) | tid
+ );
+
+ obj_set_pos(player, x, y);
+
+ while(1) {
+ vid_vsync();
+ key_poll();
+
+ oam_copy(oam_mem, obj_buffer, 1);
+ }
+}
+
+int main() {
+ memcpy(&tile_mem[4][0], playerTiles, playerTilesLen);
+ memcpy(pal_obj_mem, playerPal, playerPalLen);
+
+ oam_init(obj_buffer, 128);
+
+ REG_DISPCNT= DCNT_OBJ | DCNT_OBJ_1D;
+
+ obj_test();
+
+ while(1);
+
+ return 0;
+}
diff --git a/sprites/player.c b/sprites/player.c
new file mode 100644
index 0000000..1dafa3a
--- /dev/null
+++ b/sprites/player.c
@@ -0,0 +1,64 @@
+//======================================================================
+//
+// player, 16x16@4,
+// + palette 256 entries, not compressed
+// + 4 tiles not compressed
+// Total size: 512 + 128 = 640
+//
+// Time-stamp: 2020-08-07, 16:34:01
+// Exported by Cearn's Usenti v1.7.6
+// (comments, kudos, flames to "daytshen@hotmail.com")
+//
+//======================================================================
+
+const unsigned short playerPal[256]=
+{
+ 0x0000,0x031F,0x7C00,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+};
+
+const unsigned short playerTiles[64]=
+{
+ 0x0005,0x0000,0x1110,0x1111,0x1110,0x1111,0x1110,0x1111,
+ 0x1110,0x1222,0x1110,0x1222,0x1110,0x1222,0x1110,0x1111,
+ 0x0000,0x0000,0x1111,0x0111,0x1111,0x0111,0x1111,0x0111,
+ 0x2221,0x0111,0x2221,0x0111,0x2221,0x0111,0x1111,0x0111,
+ 0x1110,0x1111,0x1110,0x1111,0x1110,0x2222,0x1110,0x2221,
+ 0x1110,0x1111,0x1110,0x1111,0x1110,0x1111,0x0000,0x0000,
+ 0x1111,0x0111,0x1111,0x0111,0x2222,0x0111,0x1222,0x0111,
+ 0x1111,0x0111,0x1111,0x0111,0x1111,0x0111,0x0000,0x0000,
+};
+
diff --git a/sprites/player.h b/sprites/player.h
new file mode 100644
index 0000000..65f840a
--- /dev/null
+++ b/sprites/player.h
@@ -0,0 +1,24 @@
+//======================================================================
+//
+// player, 16x16@4,
+// + palette 256 entries, not compressed
+// + 4 tiles not compressed
+// Total size: 512 + 128 = 640
+//
+// Time-stamp: 2020-08-07, 16:34:01
+// Exported by Cearn's Usenti v1.7.6
+// (comments, kudos, flames to "daytshen@hotmail.com")
+//
+//======================================================================
+
+#ifndef __PLAYER__
+#define __PLAYER__
+
+#define playerPalLen 512
+extern const unsigned short playerPal[256];
+
+#define playerTilesLen 128
+extern const unsigned short playerTiles[64];
+
+#endif // __PLAYER__
+
diff --git a/sprites/toolbox.c b/sprites/toolbox.c
new file mode 100644
index 0000000..e58687c
--- /dev/null
+++ b/sprites/toolbox.c
@@ -0,0 +1,65 @@
+//
+// toolbox.c
+//
+// Tools source for obj_demo
+//
+// (20060922-20060924, cearn)
+//
+// === NOTES ===
+// * This is a _small_ set of typedefs, #defines and inlines that can
+// be found in tonclib, and might not represent the
+// final forms.
+
+#include "../include/toolbox.h"
+
+// === (tonc_core.c) ==================================================
+
+u16 __key_curr= 0, __key_prev= 0;
+
+// === (tonc_oam.c) ===================================================
+
+void oam_init(OBJ_ATTR *obj, u32 count)
+{
+ u32 nn= count;
+ u32 *dst= (u32*)obj;
+
+ // Hide each object
+ while(nn--)
+ {
+ *dst++= ATTR0_HIDE;
+ *dst++= 0;
+ }
+ // init oam
+ oam_copy(oam_mem, obj, count);
+}
+
+void oam_copy(OBJ_ATTR *dst, const OBJ_ATTR *src, u32 count)
+{
+
+// NOTE: while struct-copying is the Right Thing to do here,
+// there's a strange bug in DKP that sometimes makes it not work
+// If you see problems, just use the word-copy version.
+#if 1
+ while(count--)
+ *dst++ = *src++;
+#else
+ u32 *dstw= (u32*)dst, *srcw= (u32*)src;
+ while(count--)
+ {
+ *dstw++ = *srcw++;
+ *dstw++ = *srcw++;
+ }
+#endif
+
+}
+
+void obj_copy(OBJ_ATTR *dst, const OBJ_ATTR *src, u32 count)
+{
+ int ii;
+ for(ii=0; ii<count; ii++)
+ {
+ dst[ii].attr0= src[ii].attr0;
+ dst[ii].attr1= src[ii].attr1;
+ dst[ii].attr2= src[ii].attr2;
+ }
+}