diff --git a/.gitignore b/.gitignore index c6127b3..59515ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +.DS_Store +**/obj +**/gbdk + # Prerequisites *.d diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..b1f27e8 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7feb1e3 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,19 @@ +{ + "files.associations": { + "*.md": "markdown", + "stdio.h": "c", + "gb.h": "c", + "font.h": "c", + "smiley.h": "c", + "character.h": "c", + "metasprites.h": "c", + "blankscreen.h": "c", + "underwater_map.h": "c", + "collision.h": "c", + "common.h": "c", + "actor.h": "c", + "stdlib.h": "c", + "string.h": "c", + "gfxdefines.h": "c" + } +} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..650ac70 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +GBDK_HOME = gbdk + +CC = $(GBDK_HOME)/bin/lcc -mz80:sms -Wm-yoA -Wl-j + +BINS = BiffBolton.sms + +all: $(BINS) + +ASRC = $(wildcard *.s) +CSRC = $(wildcard *.c) + +OBJS = $(CSRC:%.c=%.o) $(ASRC:%.s=%.o) + +compile.bat: Makefile + @echo "REM Automatically generated from Makefile" > compile.bat + @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat + +# Compile and link single file in one pass + +%.o: %.c + $(CC) -c -o $@ $< + +%.o: %.s + $(CC) -c -o $@ $< + +$(BINS): $(OBJS) + $(CC) -Wm-yS -o $@ $^ + rm -f *.map *.noi *.ihx *.lst + +clean: + rm -f *.o *.lst *.map *.sms *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + diff --git a/compile.bat b/compile.bat new file mode 100644 index 0000000..eb096ff --- /dev/null +++ b/compile.bat @@ -0,0 +1,6 @@ +REM Automatically generated from Makefile +gbdk\bin\lcc -mz80:sms -Wm-yoA -Wl-j -c -o obj\main.o src\main.c +gbdk\bin\lcc -mz80:sms -Wm-yoA -Wl-j -c -o obj\Utils.o src\Utils.c +gbdk\bin\lcc -mz80:sms -Wm-yoA -Wl-j -c -o obj\gfxTiles.o res\gfxTiles.c +gbdk\bin\lcc -mz80:sms -Wm-yoA -Wl-j -Wm-yS -o obj\BiffBolton.sms obj\main.o obj\Utils.o obj\gfxTiles.o +rm -f *.map *.noi *.ihx *.lst diff --git a/res/gfxDefines.h b/res/gfxDefines.h new file mode 100644 index 0000000..7f7803e --- /dev/null +++ b/res/gfxDefines.h @@ -0,0 +1,16 @@ +#ifndef GFXDEFINES_H_INCLUDED +#define GFXDEFINES_H_INCLUDED + +#include "../src/Utils.h" + +#define GFX_TS_TILES 0 +#define GFX_TC_TILES 112 + +#define UDG_FISH_F1 2 +#define UDG_FISH_F2 UDG_FISH_F1 + 4 +#define UDG_SUE_F1 96 + +extern const u8 const myTiles[]; +extern const u8 const myTilePalette[]; + +#endif // GFXDEFINES_H_INCLUDED diff --git a/res/gfxTiles.c b/res/gfxTiles.c new file mode 100644 index 0000000..a9e132b --- /dev/null +++ b/res/gfxTiles.c @@ -0,0 +1,123 @@ +#include "gfxDefines.h" + +const u8 const myTilePalette[]= +{ +0x34,0x00,0x3F,0x01,0x02,0x03,0x0B,0x0F, +0x2A,0x2B,0x06,0x15,0x19,0x04,0x3D,0x20 +}; + +const u8 const myTiles[]= +{ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x88,0x88,0x66,0x11,0x88,0x88,0x66,0x11,0xEE,0xEE,0x00,0x11,0x00,0x00,0x00,0xFF,0x44,0x44,0x33,0x88,0x44,0x44,0x33,0x88,0x77,0x77,0x00,0x88,0x00,0x00,0x00,0xFF, +0x00,0x6C,0x00,0x00,0x28,0xD6,0x00,0x00,0x29,0xD6,0x00,0x00,0x28,0xD7,0x01,0x01,0x00,0xFF,0x01,0x01,0x00,0x7F,0x13,0x13,0x70,0x0F,0x0F,0x0F,0xF8,0x07,0x07,0x77, +0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x98,0x00,0x70,0x00,0x6C,0x80,0x98,0x80,0x14,0xE0,0xE8,0xE0,0x0C,0xF0,0xF0,0xF0,0x0B,0xF0,0xF0,0xF0,0x05,0x80,0xFA,0x80, +0xFC,0x03,0x03,0x7B,0xFE,0x01,0x01,0x4D,0x7F,0x00,0x00,0x3E,0x3E,0x00,0x01,0x1D,0x1C,0x00,0x03,0x03,0x0C,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x77,0x00,0x8A,0x70,0xC5,0x00,0x3A,0xC8,0x07,0x00,0xF8,0xF8,0x04,0x00,0xF8,0xF8,0x08,0x00,0xF0,0xF0,0x1C,0x00,0xE0,0xE8,0xF8,0x00,0x00,0x10,0x10,0x00,0x00,0x00, +0x00,0x04,0x68,0x68,0x00,0x02,0xFC,0xFC,0x01,0x00,0xFE,0xFE,0x28,0xD7,0x01,0x01,0x28,0xD7,0x01,0x01,0x00,0x7F,0x13,0x13,0x70,0x0F,0x0F,0x0F,0xF8,0x07,0x07,0x77, +0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x98,0x00,0x70,0x00,0x6C,0x80,0x98,0x80,0x14,0xE0,0xE8,0xE0,0x0C,0x90,0xF0,0x90,0x68,0x00,0x90,0x60,0x67,0x08,0x98,0x68, +0xB4,0x7B,0x03,0x03,0xFE,0x79,0x01,0x05,0x7F,0x3C,0x00,0x02,0x56,0x38,0x01,0x05,0x3C,0x00,0x03,0x1B,0x18,0x00,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x47,0x1A,0xB8,0x58,0x05,0x00,0xFA,0xF8,0x07,0x02,0xF8,0xF8,0x07,0x00,0xF8,0xF8,0x08,0x00,0xF0,0xF0,0x1C,0x00,0xE0,0xE8,0xF8,0x00,0x00,0x10,0x10,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x0A,0x04,0x00,0x04,0x09,0x06,0x04,0x02,0x04,0x03,0x00,0x03,0x08,0x07,0x00,0x05,0x2A,0x05,0x00,0x00,0x7A,0x25,0x20,0x20,0x7D,0x3A,0x38,0x3B, +0x20,0x00,0x00,0x00,0x50,0x20,0x00,0x20,0x90,0x60,0x20,0x40,0x20,0xC0,0x00,0xC0,0x10,0xE0,0x00,0xA0,0x54,0xA0,0x00,0x00,0x5E,0xA4,0x04,0x04,0xBE,0x5C,0x1C,0xDC, +0x7D,0x3A,0x38,0x38,0xFE,0x7D,0x7C,0x7D,0xFD,0x72,0x70,0x72,0xF2,0x50,0x50,0x50,0xD0,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xBF,0x5D,0x1C,0x1D,0x7F,0xBE,0x3E,0xBE,0xBF,0x4E,0x0E,0x4E,0x4F,0x0A,0x0A,0x0A,0x0B,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x7A,0x24,0x20,0x24,0x79,0x36,0x34,0x32,0x7C,0x33,0x30,0x31,0xFA,0x75,0x70,0x70,0xFA,0x75,0x70,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x5E,0x24,0x04,0x24,0x9E,0x6C,0x2C,0x4C,0x3E,0xCC,0x0C,0x8C,0x5F,0xAE,0x0E,0x0E,0x5F,0xAE,0x0E,0x0E, +0xF9,0x56,0x50,0x57,0xDD,0x0A,0x08,0x08,0x9C,0x0B,0x08,0x0B,0x0E,0x05,0x04,0x05,0x05,0x02,0x00,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x9F,0x6A,0x0A,0xEA,0xBB,0x50,0x10,0x10,0x39,0xD0,0x10,0xD0,0x70,0xA0,0x20,0xA0,0xA0,0x40,0x00,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x01,0x00,0x03,0x00,0x02,0x01,0x03,0x00,0x02,0x01,0x07,0x00,0x04,0x03,0x07,0x00,0x04,0x03,0xFD,0x02,0xF8,0x05,0xFA,0x05,0x80,0x78,0x7A,0x05,0x40,0x38, +0x80,0x00,0x80,0x00,0x40,0x80,0x40,0x00,0x40,0x80,0x40,0x00,0xA0,0x40,0x20,0x80,0xE0,0x00,0x20,0xC0,0xBF,0x40,0x1F,0xA0,0x5F,0xA0,0x01,0x1E,0x5E,0xA0,0x02,0x1C, +0x3A,0x05,0x20,0x18,0x1F,0x00,0x10,0x0F,0x1F,0x00,0x10,0x0B,0x3F,0x00,0x20,0x1C,0x3F,0x00,0x21,0x1E,0x7E,0x00,0x42,0x3C,0x7C,0x00,0x4C,0x30,0x70,0x00,0x70,0x00, +0x5C,0xA0,0x04,0x18,0xF8,0x00,0x08,0xF0,0xF8,0x00,0x08,0xD0,0xFC,0x00,0x04,0x38,0xFC,0x00,0x84,0x78,0x7E,0x00,0x42,0x3C,0x3E,0x00,0x32,0x0C,0x0E,0x00,0x0E,0x00, +0x01,0x00,0x01,0x00,0x03,0x00,0x02,0x01,0x03,0x00,0x02,0x01,0x07,0x00,0x04,0x03,0x07,0x00,0x04,0x03,0x0F,0x00,0x08,0x07,0x0E,0x01,0x08,0x06,0x0F,0x00,0x08,0x07, +0x80,0x00,0x80,0x00,0x40,0x80,0x40,0x00,0x40,0x80,0x40,0x00,0xA0,0x40,0x20,0x80,0xE0,0x00,0x20,0xC0,0xF0,0x00,0x10,0xE0,0x70,0x80,0x10,0x60,0xF0,0x00,0x10,0xE0, +0x07,0x00,0x04,0x03,0x07,0x00,0x04,0x03,0x07,0x00,0x04,0x03,0x07,0x00,0x04,0x03,0x03,0x00,0x02,0x01,0x03,0x00,0x02,0x01,0x03,0x00,0x02,0x01,0x01,0x00,0x01,0x00, +0xE0,0x00,0x20,0xC0,0xE0,0x00,0x20,0xC0,0xE0,0x00,0x20,0xC0,0xE0,0x00,0x20,0xC0,0xC0,0x00,0x40,0x80,0xC0,0x00,0x40,0x80,0xC0,0x00,0x40,0x80,0x80,0x00,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x3E,0x1C,0x1C,0x00,0x73,0x3E,0x3A,0x00,0x6B,0x3E,0x3E,0x00,0x77,0x3E,0x3E,0x00,0x3E,0x1C,0x1C,0x00,0x1C,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x24,0x18,0x18,0x00,0x3C,0x18,0x18,0x00,0x24,0x18,0x00,0x00,0x3C,0x18,0x18,0x00,0x24,0x18,0x18,0x00,0x18,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x4C,0x4C,0x4C,0x00,0xC6,0xC6,0xC6,0x00,0xC6,0xC6,0xC6,0x00,0x64,0x64,0x64,0x00,0x38,0x38,0x38,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x00,0x38,0x38,0x38,0x00,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00,0x7E,0x7E,0x7E,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x00,0xC6,0xC6,0xC6,0x00,0x0E,0x0E,0x0E,0x00,0x7C,0x7C,0x7C,0x00,0xE0,0xE0,0xE0,0x00,0xFE,0xFE,0xFE,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x7E,0x7E,0x00,0x0C,0x0C,0x0C,0x00,0x38,0x38,0x38,0x00,0x06,0x06,0x06,0x00,0xC6,0xC6,0xC6,0x00,0x7C,0x7C,0x7C,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x00,0x3C,0x3C,0x3C,0x00,0x6C,0x6C,0x6C,0x00,0xCC,0xCC,0xCC,0x00,0xFE,0xFE,0xFE,0x00,0x0C,0x0C,0x0C,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0x00,0x80,0x80,0x80,0x00,0xFC,0xFC,0xFC,0x00,0x06,0x06,0x06,0x00,0xC6,0xC6,0xC6,0x00,0x7C,0x7C,0x7C,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x00,0xC0,0xC0,0xC0,0x00,0xFC,0xFC,0xFC,0x00,0xC6,0xC6,0xC6,0x00,0xC6,0xC6,0xC6,0x00,0x7C,0x7C,0x7C,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFE,0x00,0xC6,0xC6,0xC6,0x00,0x0C,0x0C,0x0C,0x00,0x18,0x18,0x18,0x00,0x30,0x30,0x30,0x00,0x30,0x30,0x30,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x00,0xC6,0xC6,0xC6,0x00,0x7C,0x7C,0x7C,0x00,0xC6,0xC6,0xC6,0x00,0xC6,0xC6,0xC6,0x00,0x7C,0x7C,0x7C,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x00,0xC6,0xC6,0xC6,0x00,0xC6,0xC6,0xC6,0x00,0x7E,0x7E,0x7E,0x00,0x06,0x06,0x06,0x00,0x7C,0x7C,0x7C,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00, +0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x00,0x18,0x18,0x18,0x00,0x3C,0x3C,0x3C,0x00,0x7C,0x7C,0x7C,0x00,0x3C,0x3C,0x3C,0x00,0x18,0x18,0x18,0x00,0x08,0x08,0x08,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x66,0x66,0x00,0x00,0xFF,0xFD,0x02,0x00,0xFF,0xFE,0x01,0x00,0xFF,0xFF,0x00,0x00,0x7E,0x7E,0x00,0x00,0x3C,0x3C,0x00,0x00,0x18,0x18,0x00,0x00, +0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x44,0x44,0x44,0x00,0x08,0x08,0x08,0x00,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x00, +0x00,0x3C,0x00,0x00,0x00,0x42,0x00,0x00,0x00,0x99,0x00,0x00,0x00,0xA1,0x00,0x00,0x00,0xA1,0x00,0x00,0x00,0x99,0x00,0x00,0x00,0x42,0x00,0x00,0x00,0x3C,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x78,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x38,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x78,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x7C,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x4C,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x3C,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x38,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x38,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x7C,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x6C,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x4C,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x38,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x34,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x38,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x38,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x10,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x6C,0x00,0x00,0x00,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x7C,0x00,0x00, +0xFF,0x00,0x00,0x00,0x80,0x7F,0x00,0x7F,0xBF,0x7F,0x00,0x40,0x84,0x7F,0x1C,0x60,0xBF,0x7F,0x00,0x40,0x84,0x7F,0x1C,0x60,0xFF,0x00,0x00,0x00,0xE0,0x7F,0x00,0x1F, +0xFF,0x00,0x00,0x00,0x01,0xFE,0x00,0xFE,0xFD,0xFE,0x00,0x02,0x21,0xFE,0x38,0x06,0xFD,0xFE,0x00,0x02,0x21,0xFE,0x38,0x06,0xFF,0x00,0x00,0x00,0x01,0xFE,0x00,0xFE, +0x9F,0x79,0x20,0x40,0x86,0x7F,0x18,0x61,0xE1,0x7F,0x06,0x18,0xB8,0x5F,0x01,0x46,0xA6,0x5F,0x00,0x59,0xBF,0x41,0x00,0x40,0x80,0x7F,0x00,0x7F,0xFF,0x00,0x00,0x00, +0xFD,0xFE,0x00,0x02,0x95,0x6E,0x20,0x4A,0x95,0xEE,0x20,0x4A,0x75,0xEE,0x80,0x0A,0x1D,0xFA,0x60,0x82,0x85,0xFE,0x18,0x62,0x63,0xFE,0x00,0x9C,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00, +0x03,0x00,0x00,0x00,0x0F,0x03,0x03,0x00,0x1F,0x0F,0x0F,0x00,0x3F,0x1D,0x1D,0x02,0x3F,0x18,0x18,0x07,0x7D,0x32,0x30,0x0D,0xFA,0x65,0x60,0x18,0xFA,0x65,0x60,0x18, +0xC0,0x00,0x00,0x00,0xF0,0xC0,0xC0,0x00,0xF8,0xF0,0xF0,0x00,0xFC,0xB8,0xB8,0x40,0xFC,0x18,0x18,0xE0,0xBE,0x4C,0x0C,0xB0,0x5F,0xA6,0x06,0x18,0x5F,0xA6,0x06,0x18, +0xFF,0x70,0x70,0x0F,0xFF,0x3E,0x3C,0x01,0xF1,0x7F,0x72,0x00,0x73,0x2C,0x23,0x13,0x3F,0x00,0x1F,0x1F,0x7F,0x00,0x3F,0x3F,0x7F,0x00,0x00,0x06,0x1F,0x0E,0x00,0x00, +0xFF,0x0E,0x0E,0xF0,0xFE,0x4C,0x0C,0xB0,0xFF,0x9E,0x1E,0x60,0xCF,0x32,0xC6,0xCC,0xCE,0x30,0xC8,0xC8,0xF8,0x00,0x80,0xE0,0xF8,0x70,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0F,0x03,0x03,0x00,0x1F,0x0F,0x0F,0x00,0x3F,0x1D,0x1D,0x02,0x3F,0x18,0x18,0x07,0x7D,0x32,0x30,0x0D,0xFA,0x65,0x60,0x18,0xFA,0x65,0x60,0x18, +0xC0,0x00,0x00,0x00,0xF0,0xC0,0xC0,0x00,0xF8,0xF0,0xF0,0x00,0xFC,0xB8,0xB8,0x40,0xFC,0x18,0x18,0xE0,0xBE,0x4C,0x0C,0xB0,0x5F,0xA6,0x06,0x18,0x5F,0xA6,0x06,0x18, +0xFF,0x70,0x70,0x0F,0x7F,0x32,0x30,0x0D,0xFF,0x79,0x78,0x06,0xF3,0x4C,0x63,0x33,0x73,0x0C,0x13,0x13,0x1F,0x00,0x01,0x07,0x1F,0x0E,0x00,0x00,0x00,0x00,0x00,0x00, +0xFF,0x0E,0x0E,0xF0,0xFF,0x7C,0x3C,0x80,0x8F,0xFE,0x4E,0x00,0xCE,0x34,0xC4,0xC8,0xFC,0x00,0xF8,0xF8,0xFE,0x00,0xFC,0xFC,0xFE,0x00,0x00,0x60,0xF8,0x70,0x00,0x00, +0x07,0x07,0x00,0x40,0x08,0x0D,0x00,0x67,0x00,0x0B,0x00,0x3F,0x00,0x1B,0x00,0x1F,0x7F,0x7F,0x1F,0x00,0x7F,0x7F,0x00,0x00,0x7A,0x55,0x00,0x28,0x7B,0x44,0x00,0x39, +0xE0,0xE0,0x00,0x02,0x10,0xB0,0x00,0xE6,0x00,0xD0,0x00,0xFC,0x00,0xD8,0x00,0xF8,0xFE,0xFE,0xF8,0x00,0xFE,0xFE,0x00,0x00,0x5E,0xAA,0x00,0x14,0xDE,0x22,0x00,0x9C, +0x3F,0x00,0x00,0x0F,0x3F,0x00,0x00,0x07,0x7B,0x00,0x04,0x30,0x68,0x10,0x07,0x30,0x38,0x00,0x07,0x00,0x0F,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xFC,0x00,0x00,0xF0,0xF8,0x80,0x00,0x60,0xCC,0x00,0x30,0x00,0x1E,0x08,0xE0,0x04,0x0E,0x00,0xF0,0x04,0xFE,0x00,0x00,0x00,0xC8,0x00,0x00,0x30,0x78,0x00,0x00,0x00, +0x07,0x07,0x00,0x40,0x08,0x0D,0x00,0x67,0x00,0x0B,0x00,0x3F,0x00,0x1B,0x00,0x1F,0x7F,0x7F,0x1F,0x00,0x7F,0x7F,0x00,0x00,0x7A,0x55,0x00,0x28,0x7B,0x44,0x00,0x39, +0xE0,0xE0,0x00,0x02,0x10,0xB0,0x00,0xE6,0x00,0xD0,0x00,0xFC,0x00,0xD8,0x00,0xF8,0xFE,0xFE,0xF8,0x00,0xFE,0xFE,0x00,0x00,0x5E,0xAA,0x00,0x14,0xDE,0x22,0x00,0x9C, +0x3F,0x00,0x00,0x0F,0x1F,0x01,0x00,0x06,0x33,0x00,0x0C,0x00,0x78,0x10,0x07,0x20,0x70,0x00,0x0F,0x20,0x7F,0x00,0x00,0x00,0x13,0x00,0x00,0x0C,0x1E,0x00,0x00,0x00, +0xFC,0x00,0x00,0xF0,0xFC,0x00,0x00,0xE0,0xDE,0x00,0x20,0x0C,0x16,0x08,0xE0,0x0C,0x1C,0x00,0xE0,0x00,0xF0,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; diff --git a/src/Utils.c b/src/Utils.c new file mode 100644 index 0000000..1efa958 --- /dev/null +++ b/src/Utils.c @@ -0,0 +1,61 @@ +#include "Utils.h" + +u8 IN_JoyNow,IN_JoyOld; + +void ClrScreen(void) +{ + fill_bkg_rect(0,0,32,24,0); +} + +void SetTileData(u8 tileStartID,u8 tilecount,const u8* const pData) +{ + set_bkg_4bpp_data(tileStartID,tilecount,pData); +} + +void SetTilePalette(u8 palStartID,u8 colourCount,const u8* const pPalette) +{ + u8 n=0; + palStartID &=3; + for(n=0;n +#include + +typedef unsigned char u8; +typedef unsigned short u16; + +extern u8 IN_JoyNow,IN_JoyOld; + +extern void ClrScreen(void); +extern void SetTileData(u8 tileStartID,u8 tilecount,const u8* const pData); +extern void SetTilePalette(u8 palStartID,u8 colourCount,const u8* const pPalette); +extern void TilePut(u8 tx,u8 ty,u8 TileID); +extern void TilePut2X2(u8 tx,u8 ty,u8 TileStartID); + +extern bool IsBitSet(u8 var,u8 bit); +extern void IN_Update(); +extern bool IN_IsKeyDown(u8 keyID); + +#endif // UTILS_H_INCLUDED diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..6edd585 --- /dev/null +++ b/src/main.c @@ -0,0 +1,82 @@ +#include + +#include +#include +#include + +#include "Utils.h" +#include "../res/gfxDefines.h" + +#define UPDATE_DELAY 10u + +void init(void) +{ +} + +void main(void) +{ + + init(); + + u8 x, y, t; + u8 delay = UPDATE_DELAY; + SetTilePalette(0, 16, myTilePalette); + SetTileData(GFX_TS_TILES, GFX_TC_TILES, myTiles); + + ClrScreen(); + + DISPLAY_ON; + SHOW_BKG; + + TilePut(0, 0, 1); + TilePut2X2(5, 5, UDG_FISH_F1); + + TilePut2X2(7, 7, UDG_FISH_F2); + x = 10; + y = 0; + t = UDG_SUE_F1; + + // Main loop + while (1) + { + + IN_Update(); + TilePut2X2(x, y, t); + if (delay > 0) + { + --delay; + } + else + { + if (IN_IsKeyDown(J_RIGHT)) + { + ++x; + if (x > 31) + x = 0; + } + else if (IN_IsKeyDown(J_LEFT)) + { + --x; + if (x > 32) + x = 31; + } + + if (IN_IsKeyDown(J_DOWN)) + { + ++y; + if (y > 22) + y = 0; + } + else if (IN_IsKeyDown(J_UP)) + { + --y; + if (y > 22) + y = 22; + } + + delay = UPDATE_DELAY; + } + + vsync(); + } +} \ No newline at end of file