Initial Commit

This commit is contained in:
Brian Buller 2020-07-11 08:41:14 -05:00
parent 55c0f7f3cd
commit 1478a597cf
176 changed files with 11933 additions and 0 deletions

16
background/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = background.gb
OBJS = background.o
all: $(BIN)
$.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

13
background/background.c Normal file
View File

@ -0,0 +1,13 @@
#include <gb/gb.h>
#include "bg_data.c"
#include "bg_data.map"
void main() {
set_bkg_data(0, 131, tiledata);
VBK_REG = 1;
VBK_REG = 0;
set_bkg_tiles(0, 0, 20, 18, tilemap);
SHOW_BKG;
DISPLAY_ON;
}

BIN
background/background.gb Normal file

Binary file not shown.

2642
background/background.lst Normal file

File diff suppressed because it is too large Load Diff

132
background/bg_data.c Normal file
View File

@ -0,0 +1,132 @@
unsigned const char tiledata[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xDF,0xDF,0xC1,0xC1,0xC0,0xC0,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x3F,0x0F,0x0F,0x01,0x01,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x1F,0x1F,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xF8,0xF8,
0xFE,0xFE,0xFC,0xFC,0xF8,0xF8,0xF0,0xF0,0xC0,0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,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFE,0xFE,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0xC0,0xC0,0x80,0x80,
0xFF,0xFF,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x0C,0x0C,0x18,0x18,
0x01,0x01,0x03,0x03,0x07,0x07,0x07,0x07,0x0F,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x1F,
0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x02,0x02,0x06,0x06,0x0C,0x0C,0x08,0x08,0x18,0x18,0x30,0x30,0x20,0x20,0x20,0x20,
0x0C,0x0C,0x18,0x18,0x10,0x10,0x20,0x20,0x60,0x60,0x40,0x40,0xC0,0xC0,0x80,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x02,0x02,0x04,0x04,
0x30,0x30,0x20,0x20,0x60,0x60,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x06,0x06,
0x40,0x40,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x02,0x02,0x06,0x06,0x08,0x08,0x18,0x18,0x30,0x30,0x60,0x60,0x40,0x40,
0x08,0x08,0x18,0x18,0x30,0x30,0x60,0x60,0x40,0x40,0xC0,0xC0,0x80,0x80,0x00,0x00,
0x00,0x00,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x07,0x07,0x07,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0x04,0x04,0x08,0x08,0x08,0x08,0x10,0x10,0x30,0x30,0x20,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x03,0x03,0x02,0x02,0x06,0x06,0x04,0x04,0x08,0x08,0x18,0x18,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x02,0x02,0x02,0x06,0x06,0x04,0x04,0x0C,0x0C,0x18,0x18,0x10,0x10,0x20,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x20,0x20,0x18,0x18,
0x07,0x07,0x07,0x07,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,
0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0xC0,0xC0,0x80,0x80,0x80,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x02,0x02,
0x60,0x60,0x40,0x40,0x40,0x40,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x0C,0x0C,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x60,0x60,0x18,0x18,0x04,0x04,0x03,0x03,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
0x02,0x02,0x06,0x06,0x0C,0x0C,0x08,0x08,0x18,0x18,0x30,0x30,0x20,0x20,0x40,0x40,
0x02,0x02,0x06,0x06,0x0C,0x0C,0x08,0x08,0x18,0x18,0x10,0x10,0x10,0x10,0x20,0x20,
0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x60,0x60,0x30,0x30,0x18,0x18,0x0E,0x0E,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x60,0x60,
0x1F,0x1F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x04,0x04,
0x40,0x40,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x1C,0x1C,0x06,0x06,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xC0,0xC0,0x70,0x70,0x1C,0x1C,0x07,0x07,0x01,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x60,0x60,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,
0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0x40,0x40,
0x0C,0x0C,0x08,0x08,0x10,0x10,0x10,0x10,0x30,0x30,0x60,0x60,0x40,0x40,0x40,0x40,
0x00,0x00,0x01,0x01,0x01,0x01,0x03,0x03,0x02,0x02,0x04,0x04,0x04,0x04,0x08,0x08,
0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x10,
0x00,0x00,0x00,0x00,0x0E,0x0E,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x30,0x30,0x08,0x08,
0x1F,0x1F,0x1F,0x1F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x02,0x02,
0x10,0x10,0x20,0x20,0x60,0x60,0x40,0x40,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
0x0E,0x0E,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x80,0x60,0x60,0x38,0x38,0x0C,0x0C,0x07,0x07,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0xE0,0x30,0x30,
0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x03,
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xE0,0xE0,0xE0,0xE0,
0x02,0x02,0x04,0x04,0x08,0x08,0x18,0x18,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x40,
0x18,0x18,0x06,0x06,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x20,0x20,0x1C,0x1C,0x06,0x06,0x03,0x03,
0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x78,0x78,0x07,0x07,
0xC0,0xC0,0x60,0x60,0x30,0x30,0x08,0x08,0x0E,0x0E,0x03,0x03,0x01,0x01,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0xC0,0xC0,0x40,0x40,0x60,0x60,0x30,0x30,0x0C,0x0C,0x02,0x02,0x03,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0xE0,
0x18,0x18,0x0E,0x0E,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0xE0,0x38,0x38,0x0E,0x0E,0x03,0x03,0x00,0x00,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,0x0F,0x0F,0x0F,0x0F,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,
0x02,0x02,0x04,0x04,0x08,0x08,0x18,0x18,0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,
0x38,0x38,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x38,0x38,0x06,0x06,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
0x07,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x01,0x01,0x00,0x00,
0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x0F,0x0F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x1F,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0xF0,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xFE,0xFE,
0xFF,0xFF,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,
0xFF,0xFF,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFC,0xFC,0xFD,0xFD,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x1F,0x1F,0x7F,0x7F,0xFF,0xFF,
0x00,0x00,0x03,0x03,0x0F,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x80,0x80,0xF8,0xF8,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xFC,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x0F,0x0F,0x0F,0x0F,0x07,0x07,0x07,0x07,0x03,0x03,0x01,0x01,0xE1,0xE1,0xF8,0xF8};

16
beep/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = beep.gb
OBJS = main.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

BIN
beep/beep.gb Normal file

Binary file not shown.

29
beep/main.c Normal file
View File

@ -0,0 +1,29 @@
#include <gb/gb.h>
#include <gb/drawing.h>
void main() {
NR50_REG = 0xFF;
NR51_REG = 0xFF;
NR52_REG = 0x80;
gotogxy(1, 1);
gprintf("====== Beep ======");
gotogxy(2, 3);
gprintf("Press any button");
while(1) {
UBYTE joypad_state = joypad();
if(joypad_state) {
NR10_REG = 0x38U;
NR11_REG = 0x70U;
NR12_REG = 0xE0U;
NR13_REG = 0x0AU;
NR14_REG = 0xC6U;
NR51_REG |= 0x11;
delay(200);
}
}
}

235
beep/main.lst Normal file
View File

@ -0,0 +1,235 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 09:50:25 2020
4
5 ;--------------------------------------------------------
6 .module lcc2312250
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _main
12 ;--------------------------------------------------------
13 ; special function registers
14 ;--------------------------------------------------------
15 ;--------------------------------------------------------
16 ; special function bits
17 ;--------------------------------------------------------
18 ;--------------------------------------------------------
19 ; internal ram data
20 ;--------------------------------------------------------
21 .area _DATA
22 ;--------------------------------------------------------
23 ; overlayable items in internal ram
24 ;--------------------------------------------------------
25 .area _OVERLAY
26 ;--------------------------------------------------------
27 ; indirectly addressable internal ram data
28 ;--------------------------------------------------------
29 .area _ISEG
30 ;--------------------------------------------------------
31 ; bit data
32 ;--------------------------------------------------------
33 .area _BSEG
34 ;--------------------------------------------------------
35 ; external ram data
36 ;--------------------------------------------------------
37 .area _XSEG
38 ;--------------------------------------------------------
39 ; global & static initialisations
40 ;--------------------------------------------------------
41 .area _GSINIT
42 .area _GSFINAL
43 .area _GSINIT
44 ;--------------------------------------------------------
45 ; Home
46 ;--------------------------------------------------------
47 .area _HOME
48 .area _CODE
49 ;--------------------------------------------------------
50 ; code
51 ;--------------------------------------------------------
52 .area _CODE
53 ; main.c 4
54 ; genLabel
55 ; genFunction
56 ; ---------------------------------
57 ; Function main
58 ; ---------------------------------
0000 59 ___main_start:
0000 60 _main:
0000 E8 FD 61 lda sp,-3(sp)
62 ; main.c 5
63 ; genAssign
0002 01 24 FF 64 ld bc,#0xFF24
65 ; genAssign (pointer)
0005 3E FF 66 ld a,#0xFF
0007 02 67 ld (bc),a
68 ; main.c 6
69 ; genAssign
0008 01 25 FF 70 ld bc,#0xFF25
71 ; genAssign (pointer)
000B 3E FF 72 ld a,#0xFF
000D 02 73 ld (bc),a
74 ; main.c 7
75 ; genAssign
000E 01 26 FF 76 ld bc,#0xFF26
77 ; genAssign (pointer)
0011 3E 80 78 ld a,#0x80
0013 02 79 ld (bc),a
80 ; main.c 9
81 ; genIpush
82 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0014 21 01 01 83 ld hl,#0x0101
0017 E5 84 push hl
85 ; genCall
0018 CD 00 00 86 call _gotogxy
001B E8 02 87 lda sp,2(sp)
88 ; main.c 10
89 ; genIpush
90 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
001D 21 84 00 91 ld hl,#__str_0
0020 E5 92 push hl
93 ; genCall
0021 CD 00 00 94 call _gprintf
0024 E8 02 95 lda sp,2(sp)
96 ; main.c 12
97 ; genIpush
98 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0026 21 02 03 99 ld hl,#0x0302
0029 E5 100 push hl
101 ; genCall
002A CD 00 00 102 call _gotogxy
002D E8 02 103 lda sp,2(sp)
104 ; main.c 13
105 ; genIpush
106 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
002F 21 97 00 107 ld hl,#__str_1
0032 E5 108 push hl
109 ; genCall
0033 CD 00 00 110 call _gprintf
0036 E8 02 111 lda sp,2(sp)
112 ; main.c 15
113 ; genLabel
0038 114 00104$:
115 ; main.c 16
116 ; genCall
117 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0038 CD 00 00 118 call _joypad
003B 4B 119 ld c,e
120 ; genAssign
003C 79 121 ld a,c
122 ; main.c 17
123 ; genIfx
003D B7 124 or a,a
003E CA 38 00 125 jp z,00104$
126 ; main.c 18
127 ; genAssign
0041 01 10 FF 128 ld bc,#0xFF10
129 ; genAssign (pointer)
0044 3E 38 130 ld a,#0x38
0046 02 131 ld (bc),a
132 ; main.c 19
133 ; genAssign
0047 01 11 FF 134 ld bc,#0xFF11
135 ; genAssign (pointer)
004A 3E 70 136 ld a,#0x70
004C 02 137 ld (bc),a
138 ; main.c 20
139 ; genAssign
004D 01 12 FF 140 ld bc,#0xFF12
141 ; genAssign (pointer)
0050 3E E0 142 ld a,#0xE0
0052 02 143 ld (bc),a
144 ; main.c 21
145 ; genAssign
0053 01 13 FF 146 ld bc,#0xFF13
147 ; genAssign (pointer)
0056 3E 0A 148 ld a,#0x0A
0058 02 149 ld (bc),a
150 ; main.c 22
151 ; genAssign
0059 01 14 FF 152 ld bc,#0xFF14
153 ; genAssign (pointer)
005C 3E C6 154 ld a,#0xC6
005E 02 155 ld (bc),a
156 ; main.c 24
157 ; genAssign
005F 01 25 FF 158 ld bc,#0xFF25
159 ; genAssign
160 ; AOP_STK for _main_sloc0_1_0
0062 F8 01 161 lda hl,1(sp)
0064 36 25 162 ld (hl),#0x25
0066 23 163 inc hl
0067 36 FF 164 ld (hl),#0xFF
165 ; genPointerGet
166 ; AOP_STK for _main_sloc0_1_0
167 ; AOP_STK for _main_sloc1_1_0
0069 2B 168 dec hl
006A 5E 169 ld e,(hl)
006B 23 170 inc hl
006C 56 171 ld d,(hl)
006D 1A 172 ld a,(de)
006E 2B 173 dec hl
006F 2B 174 dec hl
175 ; genOr
176 ; AOP_STK for _main_sloc1_1_0
0070 77 177 ld (hl),a
0071 7F 178 ld a,a
0072 F6 11 179 or a,#0x11
180 ; genAssign (pointer)
0074 02 181 ld (bc),a
182 ; main.c 26
183 ; genIpush
184 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0075 21 C8 00 185 ld hl,#0x00C8
0078 E5 186 push hl
187 ; genCall
0079 CD 00 00 188 call _delay
007C E8 02 189 lda sp,2(sp)
190 ; genGoto
007E C3 38 00 191 jp 00104$
192 ; genLabel
0081 193 00106$:
194 ; genEndFunction
0081 E8 03 195 lda sp,3(sp)
0083 C9 196 ret
0084 197 ___main_end:
0084 198 __str_0:
0084 3D 3D 3D 3D 3D 3D 199 .ascii "====== Beep ======"
20 42 65 65 70 20
3D 3D 3D 3D 3D 3D
0096 00 200 .db 0x00
0097 201 __str_1:
0097 50 72 65 73 73 20 202 .ascii "Press any button"
61 6E 79 20 62 75
74 74 6F 6E
00A7 00 203 .db 0x00
204 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
0 ___main_end 0084 R
0 ___main_start 0000 R
0 __str_0 0084 R
0 __str_1 0097 R
_delay **** GX
_gotogxy **** GX
_gprintf **** GX
_joypad **** GX
0 _main 0000 GR
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size A8 flags 0
1 _DATA size 0 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 0 flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

16
big_sprite/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = big_sprite.gb
OBJS = big_sprite.o
all: $(BIN)
$.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

11
big_sprite/big_sprite.c Normal file
View File

@ -0,0 +1,11 @@
#include <gb/gb.h>
#include "sprite.c"
void main() {
SPRITES_8x16;
set_sprite_data(0, 4, sprite);
set_sprite_tile(0, 0);
move_sprite(0, 75, 75);
set_sprite_tile(1, 2);
move_sprite(1, 75 + 8, 75);
SHOW_SPRITES;
}

BIN
big_sprite/big_sprite.gb Normal file

Binary file not shown.

220
big_sprite/big_sprite.lst Normal file
View File

@ -0,0 +1,220 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 08:00:47 2020
4
5 ;--------------------------------------------------------
6 .module lcc2194330
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _main
12 .globl _sprite
13 ;--------------------------------------------------------
14 ; special function registers
15 ;--------------------------------------------------------
16 ;--------------------------------------------------------
17 ; special function bits
18 ;--------------------------------------------------------
19 ;--------------------------------------------------------
20 ; internal ram data
21 ;--------------------------------------------------------
22 .area _DATA
0000 23 _sprite::
0000 24 .ds 64
25 ;--------------------------------------------------------
26 ; overlayable items in internal ram
27 ;--------------------------------------------------------
28 .area _OVERLAY
29 ;--------------------------------------------------------
30 ; indirectly addressable internal ram data
31 ;--------------------------------------------------------
32 .area _ISEG
33 ;--------------------------------------------------------
34 ; bit data
35 ;--------------------------------------------------------
36 .area _BSEG
37 ;--------------------------------------------------------
38 ; external ram data
39 ;--------------------------------------------------------
40 .area _XSEG
41 ;--------------------------------------------------------
42 ; global & static initialisations
43 ;--------------------------------------------------------
44 .area _GSINIT
45 .area _GSFINAL
46 .area _GSINIT
47 ; big_sprite.c 1
48 ; big_sprite.c 12
49 ; genArrayInit
50 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0000 21 00 00 51 ld hl,#_sprite
0003 CD 00 00 52 call __initrleblock
0006 0C 53 .db 12
0007 FF FF 80 80 80 80 54 .db 0xFF, 0xFF, 0x80, 0x80, 0x80, 0x80, 0x81, 0x81
81 81
000F 83 83 87 87 55 .db 0x83, 0x83, 0x87, 0x87
0013 F4 81 56 .db -12,0x81
0015 0C 57 .db 12
0016 83 83 87 87 80 80 58 .db 0x83, 0x83, 0x87, 0x87, 0x80, 0x80, 0xFF, 0xFF
FF FF
001E FF FF 01 01 59 .db 0xFF, 0xFF, 0x01, 0x01
0022 EC C1 60 .db -20,0xC1
0024 08 61 .db 8
0025 E1 E1 F1 F1 01 01 62 .db 0xE1, 0xE1, 0xF1, 0xF1, 0x01, 0x01, 0xFF, 0xFF
FF FF
002D 00 63 .db 0
64 ;--------------------------------------------------------
65 ; Home
66 ;--------------------------------------------------------
67 .area _HOME
68 .area _CODE
69 ;--------------------------------------------------------
70 ; code
71 ;--------------------------------------------------------
72 .area _CODE
73 ; big_sprite.c 3
74 ; genLabel
75 ; genFunction
76 ; ---------------------------------
77 ; Function main
78 ; ---------------------------------
0000 79 ___main_start:
0000 80 _main:
0000 E8 FD 81 lda sp,-3(sp)
82 ; big_sprite.c 4
83 ; genAssign
0002 01 40 FF 84 ld bc,#0xFF40
85 ; genAssign
86 ; AOP_STK for _main_sloc0_1_0
0005 F8 01 87 lda hl,1(sp)
0007 36 40 88 ld (hl),#0x40
0009 23 89 inc hl
000A 36 FF 90 ld (hl),#0xFF
91 ; genPointerGet
92 ; AOP_STK for _main_sloc0_1_0
93 ; AOP_STK for _main_sloc1_1_0
000C 2B 94 dec hl
000D 5E 95 ld e,(hl)
000E 23 96 inc hl
000F 56 97 ld d,(hl)
0010 1A 98 ld a,(de)
0011 2B 99 dec hl
0012 2B 100 dec hl
101 ; genOr
102 ; AOP_STK for _main_sloc1_1_0
0013 77 103 ld (hl),a
0014 7F 104 ld a,a
0015 F6 04 105 or a,#0x04
106 ; genAssign (pointer)
0017 02 107 ld (bc),a
108 ; big_sprite.c 5
109 ; genIpush
110 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0018 21 00 00 111 ld hl,#_sprite
001B E5 112 push hl
113 ; genIpush
001C 21 00 04 114 ld hl,#0x0400
001F E5 115 push hl
116 ; genCall
0020 CD 00 00 117 call _set_sprite_data
0023 E8 04 118 lda sp,4(sp)
119 ; big_sprite.c 6
120 ; genIpush
121 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0025 21 00 00 122 ld hl,#0x0000
0028 E5 123 push hl
124 ; genCall
0029 CD 00 00 125 call _set_sprite_tile
002C E8 02 126 lda sp,2(sp)
127 ; big_sprite.c 7
128 ; genIpush
129 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
002E 21 4B 4B 130 ld hl,#0x4B4B
0031 E5 131 push hl
132 ; genIpush
0032 3E 00 133 ld a,#0x00
0034 F5 134 push af
0035 33 135 inc sp
136 ; genCall
0036 CD 00 00 137 call _move_sprite
0039 E8 03 138 lda sp,3(sp)
139 ; big_sprite.c 8
140 ; genIpush
141 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
003B 21 01 02 142 ld hl,#0x0201
003E E5 143 push hl
144 ; genCall
003F CD 00 00 145 call _set_sprite_tile
0042 E8 02 146 lda sp,2(sp)
147 ; big_sprite.c 9
148 ; genIpush
149 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0044 21 53 4B 150 ld hl,#0x4B53
0047 E5 151 push hl
152 ; genIpush
0048 3E 01 153 ld a,#0x01
004A F5 154 push af
004B 33 155 inc sp
156 ; genCall
004C CD 00 00 157 call _move_sprite
004F E8 03 158 lda sp,3(sp)
159 ; big_sprite.c 10
160 ; genAssign
0051 01 40 FF 161 ld bc,#0xFF40
162 ; genAssign
163 ; AOP_STK for _main_sloc0_1_0
0054 F8 01 164 lda hl,1(sp)
0056 36 40 165 ld (hl),#0x40
0058 23 166 inc hl
0059 36 FF 167 ld (hl),#0xFF
168 ; genPointerGet
169 ; AOP_STK for _main_sloc0_1_0
170 ; AOP_STK for _main_sloc1_1_0
005B 2B 171 dec hl
005C 5E 172 ld e,(hl)
005D 23 173 inc hl
005E 56 174 ld d,(hl)
005F 1A 175 ld a,(de)
0060 2B 176 dec hl
0061 2B 177 dec hl
178 ; genOr
179 ; AOP_STK for _main_sloc1_1_0
0062 77 180 ld (hl),a
0063 7F 181 ld a,a
0064 F6 02 182 or a,#0x02
183 ; genAssign (pointer)
0066 02 184 ld (bc),a
185 ; genLabel
0067 186 00101$:
187 ; genEndFunction
0067 E8 03 188 lda sp,3(sp)
0069 C9 189 ret
006A 190 ___main_end:
191 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
0 ___main_end 006A R
0 ___main_start 0000 R
__initrleblock **** GX
0 _main 0000 GR
_move_sprite **** GX
_set_sprite_data **** GX
_set_sprite_tile **** GX
1 _sprite 0000 GR
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size 6A flags 0
1 _DATA size 40 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 2E flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

11
big_sprite/sprite.c Normal file
View File

@ -0,0 +1,11 @@
unsigned char sprite[] =
{
0xFF,0xFF,0x80,0x80,0x80,0x80,0x81,0x81,
0x83,0x83,0x87,0x87,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x83,0x83,0x87,0x87,0x80,0x80,0xFF,0xFF,
0xFF,0xFF,0x01,0x01,0xC1,0xC1,0xC1,0xC1,
0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,
0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,
0xE1,0xE1,0xF1,0xF1,0x01,0x01,0xFF,0xFF
};

View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = big_sprite_animation.gb
OBJS = big_sprite_animation.o
all: $(BIN)
$.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,21 @@
#include <gb/gb.h>
#include "cards.c"
void main() {
SPRITES_8x16;
set_sprite_data(0, 8, cards);
set_sprite_tile(0, 0);
move_sprite(0, 75, 75);
set_sprite_tile(1, 2);
move_sprite(1, 75 + 8, 75);
SHOW_SPRITES;
while(1) {
set_sprite_tile(0, 3);
set_sprite_tile(1, 5);
delay(500);
set_sprite_tile(0, 0);
set_sprite_tile(1, 2);
delay(500);
}
}

Binary file not shown.

View File

@ -0,0 +1,290 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 08:05:34 2020
4
5 ;--------------------------------------------------------
6 .module lcc2202740
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _main
12 .globl _cards
13 ;--------------------------------------------------------
14 ; special function registers
15 ;--------------------------------------------------------
16 ;--------------------------------------------------------
17 ; special function bits
18 ;--------------------------------------------------------
19 ;--------------------------------------------------------
20 ; internal ram data
21 ;--------------------------------------------------------
22 .area _DATA
0000 23 _cards::
0000 24 .ds 128
25 ;--------------------------------------------------------
26 ; overlayable items in internal ram
27 ;--------------------------------------------------------
28 .area _OVERLAY
29 ;--------------------------------------------------------
30 ; indirectly addressable internal ram data
31 ;--------------------------------------------------------
32 .area _ISEG
33 ;--------------------------------------------------------
34 ; bit data
35 ;--------------------------------------------------------
36 .area _BSEG
37 ;--------------------------------------------------------
38 ; external ram data
39 ;--------------------------------------------------------
40 .area _XSEG
41 ;--------------------------------------------------------
42 ; global & static initialisations
43 ;--------------------------------------------------------
44 .area _GSINIT
45 .area _GSFINAL
46 .area _GSINIT
47 ; big_sprite_animation.c 1
48 ; big_sprite_animation.c 22
49 ; genArrayInit
50 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0000 21 00 00 51 ld hl,#_cards
0003 CD 00 00 52 call __initrleblock
0006 0C 53 .db 12
0007 FF FF 80 80 80 80 54 .db 0xFF, 0xFF, 0x80, 0x80, 0x80, 0x80, 0x81, 0x81
81 81
000F 83 83 87 87 55 .db 0x83, 0x83, 0x87, 0x87
0013 F4 81 56 .db -12,0x81
0015 0C 57 .db 12
0016 83 83 87 87 80 80 58 .db 0x83, 0x83, 0x87, 0x87, 0x80, 0x80, 0xFF, 0xFF
FF FF
001E FF FF 01 01 59 .db 0xFF, 0xFF, 0x01, 0x01
0022 EC C1 60 .db -20,0xC1
0024 14 61 .db 20
0025 E1 E1 F1 F1 01 01 62 .db 0xE1, 0xE1, 0xF1, 0xF1, 0x01, 0x01, 0xFF, 0xFF
FF FF
002D FF FF 80 80 83 83 63 .db 0xFF, 0xFF, 0x80, 0x80, 0x83, 0x83, 0x87, 0x87
87 87
0035 8E 8E 8C 8C 64 .db 0x8E, 0x8E, 0x8C, 0x8C
0039 F8 80 65 .db -8,0x80
003B 16 66 .db 22
003C 81 81 83 83 87 87 67 .db 0x81, 0x81, 0x83, 0x83, 0x87, 0x87, 0x8F, 0x8F
8F 8F
0044 80 80 FF FF FF FF 68 .db 0x80, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x01
01 01
004C C1 C1 E1 E1 71 71 69 .db 0xC1, 0xC1, 0xE1, 0xE1, 0x71, 0x71
0052 FA 31 70 .db -6,0x31
0054 10 71 .db 16
0055 71 71 E1 E1 C1 C1 72 .db 0x71, 0x71, 0xE1, 0xE1, 0xC1, 0xC1, 0x81, 0x81
81 81
005D F1 F1 F1 F1 01 01 73 .db 0xF1, 0xF1, 0xF1, 0xF1, 0x01, 0x01, 0xFF, 0xFF
FF FF
0065 00 74 .db 0
75 ;--------------------------------------------------------
76 ; Home
77 ;--------------------------------------------------------
78 .area _HOME
79 .area _CODE
80 ;--------------------------------------------------------
81 ; code
82 ;--------------------------------------------------------
83 .area _CODE
84 ; big_sprite_animation.c 4
85 ; genLabel
86 ; genFunction
87 ; ---------------------------------
88 ; Function main
89 ; ---------------------------------
0000 90 ___main_start:
0000 91 _main:
0000 E8 FD 92 lda sp,-3(sp)
93 ; big_sprite_animation.c 5
94 ; genAssign
0002 01 40 FF 95 ld bc,#0xFF40
96 ; genAssign
97 ; AOP_STK for _main_sloc0_1_0
0005 F8 01 98 lda hl,1(sp)
0007 36 40 99 ld (hl),#0x40
0009 23 100 inc hl
000A 36 FF 101 ld (hl),#0xFF
102 ; genPointerGet
103 ; AOP_STK for _main_sloc0_1_0
104 ; AOP_STK for _main_sloc1_1_0
000C 2B 105 dec hl
000D 5E 106 ld e,(hl)
000E 23 107 inc hl
000F 56 108 ld d,(hl)
0010 1A 109 ld a,(de)
0011 2B 110 dec hl
0012 2B 111 dec hl
112 ; genOr
113 ; AOP_STK for _main_sloc1_1_0
0013 77 114 ld (hl),a
0014 7F 115 ld a,a
0015 F6 04 116 or a,#0x04
117 ; genAssign (pointer)
0017 02 118 ld (bc),a
119 ; big_sprite_animation.c 6
120 ; genIpush
121 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0018 21 00 00 122 ld hl,#_cards
001B E5 123 push hl
124 ; genIpush
001C 21 00 08 125 ld hl,#0x0800
001F E5 126 push hl
127 ; genCall
0020 CD 00 00 128 call _set_sprite_data
0023 E8 04 129 lda sp,4(sp)
130 ; big_sprite_animation.c 7
131 ; genIpush
132 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0025 21 00 00 133 ld hl,#0x0000
0028 E5 134 push hl
135 ; genCall
0029 CD 00 00 136 call _set_sprite_tile
002C E8 02 137 lda sp,2(sp)
138 ; big_sprite_animation.c 8
139 ; genIpush
140 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
002E 21 4B 4B 141 ld hl,#0x4B4B
0031 E5 142 push hl
143 ; genIpush
0032 3E 00 144 ld a,#0x00
0034 F5 145 push af
0035 33 146 inc sp
147 ; genCall
0036 CD 00 00 148 call _move_sprite
0039 E8 03 149 lda sp,3(sp)
150 ; big_sprite_animation.c 9
151 ; genIpush
152 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
003B 21 01 02 153 ld hl,#0x0201
003E E5 154 push hl
155 ; genCall
003F CD 00 00 156 call _set_sprite_tile
0042 E8 02 157 lda sp,2(sp)
158 ; big_sprite_animation.c 10
159 ; genIpush
160 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0044 21 53 4B 161 ld hl,#0x4B53
0047 E5 162 push hl
163 ; genIpush
0048 3E 01 164 ld a,#0x01
004A F5 165 push af
004B 33 166 inc sp
167 ; genCall
004C CD 00 00 168 call _move_sprite
004F E8 03 169 lda sp,3(sp)
170 ; big_sprite_animation.c 11
171 ; genAssign
0051 01 40 FF 172 ld bc,#0xFF40
173 ; genAssign
174 ; AOP_STK for _main_sloc0_1_0
0054 F8 01 175 lda hl,1(sp)
0056 36 40 176 ld (hl),#0x40
0058 23 177 inc hl
0059 36 FF 178 ld (hl),#0xFF
179 ; genPointerGet
180 ; AOP_STK for _main_sloc0_1_0
181 ; AOP_STK for _main_sloc1_1_0
005B 2B 182 dec hl
005C 5E 183 ld e,(hl)
005D 23 184 inc hl
005E 56 185 ld d,(hl)
005F 1A 186 ld a,(de)
0060 2B 187 dec hl
0061 2B 188 dec hl
189 ; genOr
190 ; AOP_STK for _main_sloc1_1_0
0062 77 191 ld (hl),a
0063 7F 192 ld a,a
0064 F6 02 193 or a,#0x02
194 ; genAssign (pointer)
0066 02 195 ld (bc),a
196 ; big_sprite_animation.c 13
197 ; genLabel
0067 198 00102$:
199 ; big_sprite_animation.c 14
200 ; genIpush
201 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0067 21 00 03 202 ld hl,#0x0300
006A E5 203 push hl
204 ; genCall
006B CD 00 00 205 call _set_sprite_tile
006E E8 02 206 lda sp,2(sp)
207 ; big_sprite_animation.c 15
208 ; genIpush
209 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0070 21 01 05 210 ld hl,#0x0501
0073 E5 211 push hl
212 ; genCall
0074 CD 00 00 213 call _set_sprite_tile
0077 E8 02 214 lda sp,2(sp)
215 ; big_sprite_animation.c 16
216 ; genIpush
217 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0079 21 F4 01 218 ld hl,#0x01F4
007C E5 219 push hl
220 ; genCall
007D CD 00 00 221 call _delay
0080 E8 02 222 lda sp,2(sp)
223 ; big_sprite_animation.c 17
224 ; genIpush
225 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0082 21 00 00 226 ld hl,#0x0000
0085 E5 227 push hl
228 ; genCall
0086 CD 00 00 229 call _set_sprite_tile
0089 E8 02 230 lda sp,2(sp)
231 ; big_sprite_animation.c 18
232 ; genIpush
233 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
008B 21 01 02 234 ld hl,#0x0201
008E E5 235 push hl
236 ; genCall
008F CD 00 00 237 call _set_sprite_tile
0092 E8 02 238 lda sp,2(sp)
239 ; big_sprite_animation.c 19
240 ; genIpush
241 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0094 21 F4 01 242 ld hl,#0x01F4
0097 E5 243 push hl
244 ; genCall
0098 CD 00 00 245 call _delay
009B E8 02 246 lda sp,2(sp)
247 ; genGoto
009D C3 67 00 248 jp 00102$
249 ; genLabel
00A0 250 00104$:
251 ; genEndFunction
00A0 E8 03 252 lda sp,3(sp)
00A2 C9 253 ret
00A3 254 ___main_end:
255 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
0 ___main_end 00A3 R
0 ___main_start 0000 R
__initrleblock **** GX
1 _cards 0000 GR
_delay **** GX
0 _main 0000 GR
_move_sprite **** GX
_set_sprite_data **** GX
_set_sprite_tile **** GX
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size A3 flags 0
1 _DATA size 80 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 66 flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

View File

@ -0,0 +1,19 @@
unsigned char cards[] =
{
0xFF,0xFF,0x80,0x80,0x80,0x80,0x81,0x81,
0x83,0x83,0x87,0x87,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x83,0x83,0x87,0x87,0x80,0x80,0xFF,0xFF,
0xFF,0xFF,0x01,0x01,0xC1,0xC1,0xC1,0xC1,
0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,
0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,
0xE1,0xE1,0xF1,0xF1,0x01,0x01,0xFF,0xFF,
0xFF,0xFF,0x80,0x80,0x83,0x83,0x87,0x87,
0x8E,0x8E,0x8C,0x8C,0x80,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x81,0x81,0x83,0x83,
0x87,0x87,0x8F,0x8F,0x80,0x80,0xFF,0xFF,
0xFF,0xFF,0x01,0x01,0xC1,0xC1,0xE1,0xE1,
0x71,0x71,0x31,0x31,0x31,0x31,0x31,0x31,
0x71,0x71,0xE1,0xE1,0xC1,0xC1,0x81,0x81,
0xF1,0xF1,0xF1,0xF1,0x01,0x01,0xFF,0xFF
};

16
blank/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = blank.gb
OBJS = blank.o
all: $(BIN)
$.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

2
blank/blank.c Normal file
View File

@ -0,0 +1,2 @@
void main() {
}

BIN
blank/blank.gb Normal file

Binary file not shown.

90
blank/blank.lst Normal file
View File

@ -0,0 +1,90 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 07:28:28 2020
4
5 ;--------------------------------------------------------
6 .module lcc2137180
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _main
12 ;--------------------------------------------------------
13 ; special function registers
14 ;--------------------------------------------------------
15 ;--------------------------------------------------------
16 ; special function bits
17 ;--------------------------------------------------------
18 ;--------------------------------------------------------
19 ; internal ram data
20 ;--------------------------------------------------------
21 .area _DATA
22 ;--------------------------------------------------------
23 ; overlayable items in internal ram
24 ;--------------------------------------------------------
25 .area _OVERLAY
26 ;--------------------------------------------------------
27 ; indirectly addressable internal ram data
28 ;--------------------------------------------------------
29 .area _ISEG
30 ;--------------------------------------------------------
31 ; bit data
32 ;--------------------------------------------------------
33 .area _BSEG
34 ;--------------------------------------------------------
35 ; external ram data
36 ;--------------------------------------------------------
37 .area _XSEG
38 ;--------------------------------------------------------
39 ; global & static initialisations
40 ;--------------------------------------------------------
41 .area _GSINIT
42 .area _GSFINAL
43 .area _GSINIT
44 ;--------------------------------------------------------
45 ; Home
46 ;--------------------------------------------------------
47 .area _HOME
48 .area _CODE
49 ;--------------------------------------------------------
50 ; code
51 ;--------------------------------------------------------
52 .area _CODE
53 ; blank.c 1
54 ; genLabel
55 ; genFunction
56 ; ---------------------------------
57 ; Function main
58 ; ---------------------------------
0000 59 ___main_start:
0000 60 _main:
61
62 ; blank.c 2
63 ; genLabel
0000 64 00101$:
65 ; genEndFunction
66
0000 C9 67 ret
0001 68 ___main_end:
69 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
0 ___main_end 0001 R
0 ___main_start 0000 R
0 _main 0000 GR
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size 1 flags 0
1 _DATA size 0 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 0 flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

16
hello_world/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = hello_world.gb
OBJS = hello_world.o
all: $(BIN)
$.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,7 @@
#include <gb/gb.h>
#include <stdio.h>
void main() {
printf("Hello World!");
printf("\n\nPress Start");
}

BIN
hello_world/hello_world.gb Normal file

Binary file not shown.

118
hello_world/hello_world.lst Normal file
View File

@ -0,0 +1,118 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 07:41:10 2020
4
5 ;--------------------------------------------------------
6 .module lcc2164950
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _main
12 ;--------------------------------------------------------
13 ; special function registers
14 ;--------------------------------------------------------
15 ;--------------------------------------------------------
16 ; special function bits
17 ;--------------------------------------------------------
18 ;--------------------------------------------------------
19 ; internal ram data
20 ;--------------------------------------------------------
21 .area _DATA
22 ;--------------------------------------------------------
23 ; overlayable items in internal ram
24 ;--------------------------------------------------------
25 .area _OVERLAY
26 ;--------------------------------------------------------
27 ; indirectly addressable internal ram data
28 ;--------------------------------------------------------
29 .area _ISEG
30 ;--------------------------------------------------------
31 ; bit data
32 ;--------------------------------------------------------
33 .area _BSEG
34 ;--------------------------------------------------------
35 ; external ram data
36 ;--------------------------------------------------------
37 .area _XSEG
38 ;--------------------------------------------------------
39 ; global & static initialisations
40 ;--------------------------------------------------------
41 .area _GSINIT
42 .area _GSFINAL
43 .area _GSINIT
44 ;--------------------------------------------------------
45 ; Home
46 ;--------------------------------------------------------
47 .area _HOME
48 .area _CODE
49 ;--------------------------------------------------------
50 ; code
51 ;--------------------------------------------------------
52 .area _CODE
53 ; hello_world.c 4
54 ; genLabel
55 ; genFunction
56 ; ---------------------------------
57 ; Function main
58 ; ---------------------------------
0000 59 ___main_start:
0000 60 _main:
61
62 ; hello_world.c 5
63 ; genIpush
64 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0000 21 13 00 65 ld hl,#__str_0
0003 E5 66 push hl
67 ; genCall
0004 CD 00 00 68 call _printf
0007 E8 02 69 lda sp,2(sp)
70 ; hello_world.c 6
71 ; genIpush
72 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0009 21 20 00 73 ld hl,#__str_1
000C E5 74 push hl
75 ; genCall
000D CD 00 00 76 call _printf
0010 E8 02 77 lda sp,2(sp)
78 ; genLabel
0012 79 00101$:
80 ; genEndFunction
81
0012 C9 82 ret
0013 83 ___main_end:
0013 84 __str_0:
0013 48 65 6C 6C 6F 20 85 .ascii "Hello World!"
57 6F 72 6C 64 21
001F 00 86 .db 0x00
0020 87 __str_1:
0020 0A 88 .db 0x0A
0021 0A 89 .db 0x0A
0022 50 72 65 73 73 20 90 .ascii "Press Start"
53 74 61 72 74
002D 00 91 .db 0x00
92 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
0 ___main_end 0013 R
0 ___main_start 0000 R
0 __str_0 0013 R
0 __str_1 0020 R
0 _main 0000 GR
_printf **** GX
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size 2E flags 0
1 _DATA size 0 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 0 flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

16
input_state/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = input_state.gb
OBJS = input_state.o
all: $(BIN)
$.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

39
input_state/input_state.c Normal file
View File

@ -0,0 +1,39 @@
#include <stdio.h>
#include <gb/gb.h>
void printAndWait(char* text) {
printf(text);
delay(100);
}
void main() {
while(1) {
switch(joypad()) {
case J_LEFT:
printAndWait("Left!\n");
break;
case J_RIGHT:
printAndWait("Right!\n");
break;
case J_UP:
printAndWait("Up!\n");
break;
case J_DOWN:
printAndWait("Down!\n");
break;
case J_START:
printAndWait("Start!\n");
break;
case J_SELECT:
printAndWait("Select!\n");
break;
case J_A:
printAndWait("A!\n");
break;
case J_B:
printAndWait("B!\n");
break;
}
}
}

BIN
input_state/input_state.gb Normal file

Binary file not shown.

334
input_state/input_state.lst Normal file
View File

@ -0,0 +1,334 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 08:36:18 2020
4
5 ;--------------------------------------------------------
6 .module lcc2232240
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _main
12 .globl _printAndWait
13 ;--------------------------------------------------------
14 ; special function registers
15 ;--------------------------------------------------------
16 ;--------------------------------------------------------
17 ; special function bits
18 ;--------------------------------------------------------
19 ;--------------------------------------------------------
20 ; internal ram data
21 ;--------------------------------------------------------
22 .area _DATA
23 ;--------------------------------------------------------
24 ; overlayable items in internal ram
25 ;--------------------------------------------------------
26 .area _OVERLAY
27 ;--------------------------------------------------------
28 ; indirectly addressable internal ram data
29 ;--------------------------------------------------------
30 .area _ISEG
31 ;--------------------------------------------------------
32 ; bit data
33 ;--------------------------------------------------------
34 .area _BSEG
35 ;--------------------------------------------------------
36 ; external ram data
37 ;--------------------------------------------------------
38 .area _XSEG
39 ;--------------------------------------------------------
40 ; global & static initialisations
41 ;--------------------------------------------------------
42 .area _GSINIT
43 .area _GSFINAL
44 .area _GSINIT
45 ;--------------------------------------------------------
46 ; Home
47 ;--------------------------------------------------------
48 .area _HOME
49 .area _CODE
50 ;--------------------------------------------------------
51 ; code
52 ;--------------------------------------------------------
53 .area _CODE
54 ; input_state.c 4
55 ; genLabel
56 ; genFunction
57 ; ---------------------------------
58 ; Function printAndWait
59 ; ---------------------------------
0000 60 ___printAndWait_start:
0000 61 _printAndWait:
62
63 ; input_state.c 5
64 ; genIpush
65 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
66 ; AOP_STK for
0000 F8 02 67 lda hl,2(sp)
0002 2A 68 ld a,(hl+)
0003 66 69 ld h,(hl)
0004 6F 70 ld l,a
0005 E5 71 push hl
72 ; genCall
0006 CD 00 00 73 call _printf
0009 E8 02 74 lda sp,2(sp)
75 ; input_state.c 6
76 ; genIpush
77 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
000B 21 64 00 78 ld hl,#0x0064
000E E5 79 push hl
80 ; genCall
000F CD 00 00 81 call _delay
0012 E8 02 82 lda sp,2(sp)
83 ; genLabel
0014 84 00101$:
85 ; genEndFunction
86
0014 C9 87 ret
0015 88 ___printAndWait_end:
89 ; input_state.c 9
90 ; genLabel
91 ; genFunction
92 ; ---------------------------------
93 ; Function main
94 ; ---------------------------------
0015 95 ___main_start:
0015 96 _main:
97
98 ; input_state.c 10
99 ; genLabel
0015 100 00111$:
101 ; input_state.c 11
102 ; genCall
103 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0015 CD 00 00 104 call _joypad
0018 4B 105 ld c,e
106 ; genCmpEq
107 ; genCmpEq: left 1, right 1, result 0
0019 79 108 ld a,c
001A FE 01 109 cp a,#0x01
001C CA 58 00 110 jp z,00102$
001F 111 00124$:
112 ; genCmpEq
113 ; genCmpEq: left 1, right 1, result 0
001F 79 114 ld a,c
0020 FE 02 115 cp a,#0x02
0022 CA 4C 00 116 jp z,00101$
0025 117 00125$:
118 ; genCmpEq
119 ; genCmpEq: left 1, right 1, result 0
0025 79 120 ld a,c
0026 FE 04 121 cp a,#0x04
0028 CA 64 00 122 jp z,00103$
002B 123 00126$:
124 ; genCmpEq
125 ; genCmpEq: left 1, right 1, result 0
002B 79 126 ld a,c
002C FE 08 127 cp a,#0x08
002E CA 70 00 128 jp z,00104$
0031 129 00127$:
130 ; genCmpEq
131 ; genCmpEq: left 1, right 1, result 0
0031 79 132 ld a,c
0032 FE 10 133 cp a,#0x10
0034 CA 94 00 134 jp z,00107$
0037 135 00128$:
136 ; genCmpEq
137 ; genCmpEq: left 1, right 1, result 0
0037 79 138 ld a,c
0038 FE 20 139 cp a,#0x20
003A CA A0 00 140 jp z,00108$
003D 141 00129$:
142 ; genCmpEq
143 ; genCmpEq: left 1, right 1, result 0
003D 79 144 ld a,c
003E FE 40 145 cp a,#0x40
0040 CA 88 00 146 jp z,00106$
0043 147 00130$:
148 ; genCmpEq
149 ; genCmpEq: left 1, right 1, result 0
0043 79 150 ld a,c
0044 FE 80 151 cp a,#0x80
0046 CA 7C 00 152 jp z,00105$
0049 153 00131$:
154 ; genGoto
0049 C3 15 00 155 jp 00111$
156 ; input_state.c 13
157 ; genLabel
004C 158 00101$:
159 ; genIpush
160 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
004C 21 AD 00 161 ld hl,#__str_0
004F E5 162 push hl
163 ; genCall
0050 CD 00 00 164 call _printAndWait
0053 E8 02 165 lda sp,2(sp)
166 ; input_state.c 14
167 ; genGoto
0055 C3 15 00 168 jp 00111$
169 ; input_state.c 16
170 ; genLabel
0058 171 00102$:
172 ; genIpush
173 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0058 21 B4 00 174 ld hl,#__str_1
005B E5 175 push hl
176 ; genCall
005C CD 00 00 177 call _printAndWait
005F E8 02 178 lda sp,2(sp)
179 ; input_state.c 17
180 ; genGoto
0061 C3 15 00 181 jp 00111$
182 ; input_state.c 19
183 ; genLabel
0064 184 00103$:
185 ; genIpush
186 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0064 21 BC 00 187 ld hl,#__str_2
0067 E5 188 push hl
189 ; genCall
0068 CD 00 00 190 call _printAndWait
006B E8 02 191 lda sp,2(sp)
192 ; input_state.c 20
193 ; genGoto
006D C3 15 00 194 jp 00111$
195 ; input_state.c 22
196 ; genLabel
0070 197 00104$:
198 ; genIpush
199 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0070 21 C1 00 200 ld hl,#__str_3
0073 E5 201 push hl
202 ; genCall
0074 CD 00 00 203 call _printAndWait
0077 E8 02 204 lda sp,2(sp)
205 ; input_state.c 23
206 ; genGoto
0079 C3 15 00 207 jp 00111$
208 ; input_state.c 25
209 ; genLabel
007C 210 00105$:
211 ; genIpush
212 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
007C 21 C8 00 213 ld hl,#__str_4
007F E5 214 push hl
215 ; genCall
0080 CD 00 00 216 call _printAndWait
0083 E8 02 217 lda sp,2(sp)
218 ; input_state.c 26
219 ; genGoto
0085 C3 15 00 220 jp 00111$
221 ; input_state.c 28
222 ; genLabel
0088 223 00106$:
224 ; genIpush
225 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0088 21 D0 00 226 ld hl,#__str_5
008B E5 227 push hl
228 ; genCall
008C CD 00 00 229 call _printAndWait
008F E8 02 230 lda sp,2(sp)
231 ; input_state.c 29
232 ; genGoto
0091 C3 15 00 233 jp 00111$
234 ; input_state.c 31
235 ; genLabel
0094 236 00107$:
237 ; genIpush
238 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0094 21 D9 00 239 ld hl,#__str_6
0097 E5 240 push hl
241 ; genCall
0098 CD 00 00 242 call _printAndWait
009B E8 02 243 lda sp,2(sp)
244 ; input_state.c 32
245 ; genGoto
009D C3 15 00 246 jp 00111$
247 ; input_state.c 34
248 ; genLabel
00A0 249 00108$:
250 ; genIpush
251 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
00A0 21 DD 00 252 ld hl,#__str_7
00A3 E5 253 push hl
254 ; genCall
00A4 CD 00 00 255 call _printAndWait
00A7 E8 02 256 lda sp,2(sp)
257 ; input_state.c 36
258 ; genGoto
00A9 C3 15 00 259 jp 00111$
260 ; genLabel
00AC 261 00113$:
262 ; genEndFunction
263
00AC C9 264 ret
00AD 265 ___main_end:
00AD 266 __str_0:
00AD 4C 65 66 74 21 267 .ascii "Left!"
00B2 0A 268 .db 0x0A
00B3 00 269 .db 0x00
00B4 270 __str_1:
00B4 52 69 67 68 74 21 271 .ascii "Right!"
00BA 0A 272 .db 0x0A
00BB 00 273 .db 0x00
00BC 274 __str_2:
00BC 55 70 21 275 .ascii "Up!"
00BF 0A 276 .db 0x0A
00C0 00 277 .db 0x00
00C1 278 __str_3:
00C1 44 6F 77 6E 21 279 .ascii "Down!"
00C6 0A 280 .db 0x0A
00C7 00 281 .db 0x00
00C8 282 __str_4:
00C8 53 74 61 72 74 21 283 .ascii "Start!"
00CE 0A 284 .db 0x0A
00CF 00 285 .db 0x00
00D0 286 __str_5:
00D0 53 65 6C 65 63 74 287 .ascii "Select!"
21
00D7 0A 288 .db 0x0A
00D8 00 289 .db 0x00
00D9 290 __str_6:
00D9 41 21 291 .ascii "A!"
00DB 0A 292 .db 0x0A
00DC 00 293 .db 0x00
00DD 294 __str_7:
00DD 42 21 295 .ascii "B!"
00DF 0A 296 .db 0x0A
00E0 00 297 .db 0x00
298 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
0 ___main_end 00AD R
0 ___main_start 0015 R
0 ___printAndWait_end 0015 R
0 ___printAndWait_start 0000 R
0 __str_0 00AD R
0 __str_1 00B4 R
0 __str_2 00BC R
0 __str_3 00C1 R
0 __str_4 00C8 R
0 __str_5 00D0 R
0 __str_6 00D9 R
0 __str_7 00DD R
_delay **** GX
_joypad **** GX
0 _main 0015 GR
0 _printAndWait 0000 GR
_printf **** GX
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size E1 flags 0
1 _DATA size 0 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 0 flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

16
input_wait/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = input_wait.gb
OBJS = input_wait.o
all: $(BIN)
$.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

15
input_wait/input_wait.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
#include <gb/gb.h>
void main() {
while(1) {
printf("Press Start\n\n");
waitpad(J_START);
printf("Please hold down A!\n\n");
waitpad(J_A);
printf("Holding down A!\n\n");
waitpadup();
printf("Tired already?\n\n\n");
}
}

BIN
input_wait/input_wait.gb Normal file

Binary file not shown.

184
input_wait/input_wait.lst Normal file
View File

@ -0,0 +1,184 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 08:38:44 2020
4
5 ;--------------------------------------------------------
6 .module lcc2236500
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _main
12 ;--------------------------------------------------------
13 ; special function registers
14 ;--------------------------------------------------------
15 ;--------------------------------------------------------
16 ; special function bits
17 ;--------------------------------------------------------
18 ;--------------------------------------------------------
19 ; internal ram data
20 ;--------------------------------------------------------
21 .area _DATA
22 ;--------------------------------------------------------
23 ; overlayable items in internal ram
24 ;--------------------------------------------------------
25 .area _OVERLAY
26 ;--------------------------------------------------------
27 ; indirectly addressable internal ram data
28 ;--------------------------------------------------------
29 .area _ISEG
30 ;--------------------------------------------------------
31 ; bit data
32 ;--------------------------------------------------------
33 .area _BSEG
34 ;--------------------------------------------------------
35 ; external ram data
36 ;--------------------------------------------------------
37 .area _XSEG
38 ;--------------------------------------------------------
39 ; global & static initialisations
40 ;--------------------------------------------------------
41 .area _GSINIT
42 .area _GSFINAL
43 .area _GSINIT
44 ;--------------------------------------------------------
45 ; Home
46 ;--------------------------------------------------------
47 .area _HOME
48 .area _CODE
49 ;--------------------------------------------------------
50 ; code
51 ;--------------------------------------------------------
52 .area _CODE
53 ; input_wait.c 4
54 ; genLabel
55 ; genFunction
56 ; ---------------------------------
57 ; Function main
58 ; ---------------------------------
0000 59 ___main_start:
0000 60 _main:
61
62 ; input_wait.c 5
63 ; genLabel
0000 64 00102$:
65 ; input_wait.c 6
66 ; genIpush
67 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0000 21 3D 00 68 ld hl,#__str_0
0003 E5 69 push hl
70 ; genCall
0004 CD 00 00 71 call _printf
0007 E8 02 72 lda sp,2(sp)
73 ; input_wait.c 7
74 ; genIpush
75 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0009 3E 80 76 ld a,#0x80
000B F5 77 push af
000C 33 78 inc sp
79 ; genCall
000D CD 00 00 80 call _waitpad
0010 E8 01 81 lda sp,1(sp)
82 ; input_wait.c 9
83 ; genIpush
84 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0012 21 4B 00 85 ld hl,#__str_1
0015 E5 86 push hl
87 ; genCall
0016 CD 00 00 88 call _printf
0019 E8 02 89 lda sp,2(sp)
90 ; input_wait.c 10
91 ; genIpush
92 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
001B 3E 10 93 ld a,#0x10
001D F5 94 push af
001E 33 95 inc sp
96 ; genCall
001F CD 00 00 97 call _waitpad
0022 E8 01 98 lda sp,1(sp)
99 ; input_wait.c 11
100 ; genIpush
101 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0024 21 61 00 102 ld hl,#__str_2
0027 E5 103 push hl
104 ; genCall
0028 CD 00 00 105 call _printf
002B E8 02 106 lda sp,2(sp)
107 ; input_wait.c 12
108 ; genCall
109 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
002D CD 00 00 110 call _waitpadup
111 ; input_wait.c 13
112 ; genIpush
113 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0030 21 73 00 114 ld hl,#__str_3
0033 E5 115 push hl
116 ; genCall
0034 CD 00 00 117 call _printf
0037 E8 02 118 lda sp,2(sp)
119 ; genGoto
0039 C3 00 00 120 jp 00102$
121 ; genLabel
003C 122 00104$:
123 ; genEndFunction
124
003C C9 125 ret
003D 126 ___main_end:
003D 127 __str_0:
003D 50 72 65 73 73 20 128 .ascii "Press Start"
53 74 61 72 74
0048 0A 129 .db 0x0A
0049 0A 130 .db 0x0A
004A 00 131 .db 0x00
004B 132 __str_1:
004B 50 6C 65 61 73 65 133 .ascii "Please hold down A!"
20 68 6F 6C 64 20
64 6F 77 6E 20 41
21
005E 0A 134 .db 0x0A
005F 0A 135 .db 0x0A
0060 00 136 .db 0x00
0061 137 __str_2:
0061 48 6F 6C 64 69 6E 138 .ascii "Holding down A!"
67 20 64 6F 77 6E
20 41 21
0070 0A 139 .db 0x0A
0071 0A 140 .db 0x0A
0072 00 141 .db 0x00
0073 142 __str_3:
0073 54 69 72 65 64 20 143 .ascii "Tired already?"
61 6C 72 65 61 64
79 3F
0081 0A 144 .db 0x0A
0082 0A 145 .db 0x0A
0083 0A 146 .db 0x0A
0084 00 147 .db 0x00
148 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
0 ___main_end 003D R
0 ___main_start 0000 R
0 __str_0 003D R
0 __str_1 004B R
0 __str_2 0061 R
0 __str_3 0073 R
0 _main 0000 GR
_printf **** GX
_waitpad **** GX
_waitpadup **** GX
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size 85 flags 0
1 _DATA size 0 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 0 flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

16
move_sprite/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = move_sprite.gb
OBJS = move_sprite.o
all: $(BIN)
$.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

36
move_sprite/move_sprite.c Normal file
View File

@ -0,0 +1,36 @@
#include <gb/gb.h>
#include "ufo.c"
void main() {
int x = 55;
int y = 75;
SPRITES_8x8;
set_sprite_data(0, 0, ufo);
set_sprite_tile(0, 0);
move_sprite(0, x, y);
SHOW_SPRITES;
while(1) {
if(joypad() & J_RIGHT) {
x++;
move_sprite(0, x, y);
delay(10);
}
if(joypad() & J_LEFT) {
x--;
move_sprite(0, x, y);
delay(10);
}
if(joypad() & J_UP) {
y--;
move_sprite(0, x, y);
delay(10);
}
if(joypad() & J_DOWN) {
y++;
move_sprite(0, x, y);
delay(10);
}
}
}

BIN
move_sprite/move_sprite.gb Normal file

Binary file not shown.

443
move_sprite/move_sprite.lst Normal file
View File

@ -0,0 +1,443 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 08:42:08 2020
4
5 ;--------------------------------------------------------
6 .module lcc2241580
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _main
12 .globl _ufo
13 ;--------------------------------------------------------
14 ; special function registers
15 ;--------------------------------------------------------
16 ;--------------------------------------------------------
17 ; special function bits
18 ;--------------------------------------------------------
19 ;--------------------------------------------------------
20 ; internal ram data
21 ;--------------------------------------------------------
22 .area _DATA
0000 23 _ufo::
0000 24 .ds 16
25 ;--------------------------------------------------------
26 ; overlayable items in internal ram
27 ;--------------------------------------------------------
28 .area _OVERLAY
29 ;--------------------------------------------------------
30 ; indirectly addressable internal ram data
31 ;--------------------------------------------------------
32 .area _ISEG
33 ;--------------------------------------------------------
34 ; bit data
35 ;--------------------------------------------------------
36 .area _BSEG
37 ;--------------------------------------------------------
38 ; external ram data
39 ;--------------------------------------------------------
40 .area _XSEG
41 ;--------------------------------------------------------
42 ; global & static initialisations
43 ;--------------------------------------------------------
44 .area _GSINIT
45 .area _GSFINAL
46 .area _GSINIT
47 ; move_sprite.c 1
48 ; move_sprite.c 37
49 ; genArrayInit
50 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0000 21 00 00 51 ld hl,#_ufo
0003 CD 00 00 52 call __initrleblock
0006 10 53 .db 16
0007 5A 3C E3 42 7C 99 54 .db 0x5A, 0x3C, 0xE3, 0x42, 0x7C, 0x99, 0xEB, 0xA5
EB A5
000F FB A5 66 99 E7 42 55 .db 0xFB, 0xA5, 0x66, 0x99, 0xE7, 0x42, 0x5A, 0x3C
5A 3C
0017 00 56 .db 0
57 ;--------------------------------------------------------
58 ; Home
59 ;--------------------------------------------------------
60 .area _HOME
61 .area _CODE
62 ;--------------------------------------------------------
63 ; code
64 ;--------------------------------------------------------
65 .area _CODE
66 ; move_sprite.c 4
67 ; genLabel
68 ; genFunction
69 ; ---------------------------------
70 ; Function main
71 ; ---------------------------------
0000 72 ___main_start:
0000 73 _main:
0000 E8 F9 74 lda sp,-7(sp)
75 ; move_sprite.c 5
76 ; genAssign
77 ; AOP_STK for _main_x_1_1
0002 F8 05 78 lda hl,5(sp)
0004 36 37 79 ld (hl),#0x37
0006 23 80 inc hl
0007 36 00 81 ld (hl),#0x00
82 ; move_sprite.c 6
83 ; genAssign
84 ; AOP_STK for _main_y_1_1
0009 F8 03 85 lda hl,3(sp)
000B 36 4B 86 ld (hl),#0x4B
000D 23 87 inc hl
000E 36 00 88 ld (hl),#0x00
89 ; move_sprite.c 8
90 ; genAssign
0010 01 40 FF 91 ld bc,#0xFF40
92 ; genAssign
93 ; AOP_STK for _main_sloc0_1_0
0013 F8 01 94 lda hl,1(sp)
0015 36 40 95 ld (hl),#0x40
0017 23 96 inc hl
0018 36 FF 97 ld (hl),#0xFF
98 ; genPointerGet
99 ; AOP_STK for _main_sloc0_1_0
100 ; AOP_STK for _main_sloc1_1_0
001A 2B 101 dec hl
001B 5E 102 ld e,(hl)
001C 23 103 inc hl
001D 56 104 ld d,(hl)
001E 1A 105 ld a,(de)
001F 2B 106 dec hl
0020 2B 107 dec hl
108 ; genAnd
109 ; AOP_STK for _main_sloc1_1_0
0021 77 110 ld (hl),a
0022 7F 111 ld a,a
0023 E6 FB 112 and a,#0xFB
113 ; genAssign (pointer)
0025 02 114 ld (bc),a
115 ; move_sprite.c 9
116 ; genIpush
117 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0026 21 00 00 118 ld hl,#_ufo
0029 E5 119 push hl
120 ; genIpush
002A 21 00 00 121 ld hl,#0x0000
002D E5 122 push hl
123 ; genCall
002E CD 00 00 124 call _set_sprite_data
0031 E8 04 125 lda sp,4(sp)
126 ; move_sprite.c 10
127 ; genIpush
128 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0033 21 00 00 129 ld hl,#0x0000
0036 E5 130 push hl
131 ; genCall
0037 CD 00 00 132 call _set_sprite_tile
003A E8 02 133 lda sp,2(sp)
134 ; move_sprite.c 11
135 ; genIpush
136 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
003C 21 37 4B 137 ld hl,#0x4B37
003F E5 138 push hl
139 ; genIpush
0040 3E 00 140 ld a,#0x00
0042 F5 141 push af
0043 33 142 inc sp
143 ; genCall
0044 CD 00 00 144 call _move_sprite
0047 E8 03 145 lda sp,3(sp)
146 ; move_sprite.c 12
147 ; genAssign
0049 01 40 FF 148 ld bc,#0xFF40
149 ; genAssign
150 ; AOP_STK for _main_sloc0_1_0
004C F8 01 151 lda hl,1(sp)
004E 36 40 152 ld (hl),#0x40
0050 23 153 inc hl
0051 36 FF 154 ld (hl),#0xFF
155 ; genPointerGet
156 ; AOP_STK for _main_sloc0_1_0
157 ; AOP_STK for _main_sloc1_1_0
0053 2B 158 dec hl
0054 5E 159 ld e,(hl)
0055 23 160 inc hl
0056 56 161 ld d,(hl)
0057 1A 162 ld a,(de)
0058 2B 163 dec hl
0059 2B 164 dec hl
165 ; genOr
166 ; AOP_STK for _main_sloc1_1_0
005A 77 167 ld (hl),a
005B 7F 168 ld a,a
005C F6 02 169 or a,#0x02
170 ; genAssign (pointer)
005E 02 171 ld (bc),a
172 ; move_sprite.c 14
173 ; genLabel
005F 174 00110$:
175 ; move_sprite.c 15
176 ; genCall
177 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
005F CD 00 00 178 call _joypad
0062 4B 179 ld c,e
180 ; genAnd
0063 79 181 ld a,c
0064 E6 01 182 and a,#0x01
0066 20 03 183 jr nz,00119$
0068 C3 90 00 184 jp 00102$
006B 185 00119$:
186 ; move_sprite.c 16
187 ; genPlus
188 ; AOP_STK for _main_x_1_1
189 ; genPlusIncr
006B F8 05 190 lda hl,5(sp)
006D 34 191 inc (hl)
006E 20 02 192 jr nz,00120$
0070 23 193 inc hl
0071 34 194 inc (hl)
0072 195 00120$:
196 ; move_sprite.c 17
197 ; genCast
198 ; AOP_STK for _main_y_1_1
0072 F8 03 199 lda hl,3(sp)
0074 4E 200 ld c,(hl)
201 ; genCast
202 ; AOP_STK for _main_x_1_1
0075 23 203 inc hl
0076 23 204 inc hl
0077 46 205 ld b,(hl)
206 ; genIpush
207 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0078 79 208 ld a,c
0079 F5 209 push af
007A 33 210 inc sp
211 ; genIpush
007B 78 212 ld a,b
007C F5 213 push af
007D 33 214 inc sp
215 ; genIpush
007E 3E 00 216 ld a,#0x00
0080 F5 217 push af
0081 33 218 inc sp
219 ; genCall
0082 CD 00 00 220 call _move_sprite
0085 E8 03 221 lda sp,3(sp)
222 ; move_sprite.c 18
223 ; genIpush
224 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0087 21 0A 00 225 ld hl,#0x000A
008A E5 226 push hl
227 ; genCall
008B CD 00 00 228 call _delay
008E E8 02 229 lda sp,2(sp)
230 ; genLabel
0090 231 00102$:
232 ; move_sprite.c 20
233 ; genCall
234 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0090 CD 00 00 235 call _joypad
0093 4B 236 ld c,e
237 ; genAnd
0094 79 238 ld a,c
0095 E6 02 239 and a,#0x02
0097 20 03 240 jr nz,00121$
0099 C3 C4 00 241 jp 00104$
009C 242 00121$:
243 ; move_sprite.c 21
244 ; genMinus
245 ; AOP_STK for _main_x_1_1
009C F8 05 246 lda hl,5(sp)
009E 5E 247 ld e,(hl)
009F 23 248 inc hl
00A0 56 249 ld d,(hl)
00A1 1B 250 dec de
00A2 2B 251 dec hl
00A3 73 252 ld (hl),e
00A4 23 253 inc hl
00A5 72 254 ld (hl),d
255 ; move_sprite.c 22
256 ; genCast
257 ; AOP_STK for _main_y_1_1
00A6 F8 03 258 lda hl,3(sp)
00A8 4E 259 ld c,(hl)
260 ; genCast
261 ; AOP_STK for _main_x_1_1
00A9 23 262 inc hl
00AA 23 263 inc hl
00AB 46 264 ld b,(hl)
265 ; genIpush
266 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
00AC 79 267 ld a,c
00AD F5 268 push af
00AE 33 269 inc sp
270 ; genIpush
00AF 78 271 ld a,b
00B0 F5 272 push af
00B1 33 273 inc sp
274 ; genIpush
00B2 3E 00 275 ld a,#0x00
00B4 F5 276 push af
00B5 33 277 inc sp
278 ; genCall
00B6 CD 00 00 279 call _move_sprite
00B9 E8 03 280 lda sp,3(sp)
281 ; move_sprite.c 23
282 ; genIpush
283 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
00BB 21 0A 00 284 ld hl,#0x000A
00BE E5 285 push hl
286 ; genCall
00BF CD 00 00 287 call _delay
00C2 E8 02 288 lda sp,2(sp)
289 ; genLabel
00C4 290 00104$:
291 ; move_sprite.c 25
292 ; genCall
293 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
00C4 CD 00 00 294 call _joypad
00C7 4B 295 ld c,e
296 ; genAnd
00C8 79 297 ld a,c
00C9 E6 04 298 and a,#0x04
00CB 20 03 299 jr nz,00122$
00CD C3 F7 00 300 jp 00106$
00D0 301 00122$:
302 ; move_sprite.c 26
303 ; genMinus
304 ; AOP_STK for _main_y_1_1
00D0 F8 03 305 lda hl,3(sp)
00D2 5E 306 ld e,(hl)
00D3 23 307 inc hl
00D4 56 308 ld d,(hl)
00D5 1B 309 dec de
00D6 2B 310 dec hl
00D7 73 311 ld (hl),e
00D8 23 312 inc hl
00D9 72 313 ld (hl),d
314 ; move_sprite.c 27
315 ; genCast
316 ; AOP_STK for _main_y_1_1
00DA 2B 317 dec hl
00DB 4E 318 ld c,(hl)
319 ; genCast
320 ; AOP_STK for _main_x_1_1
00DC 23 321 inc hl
00DD 23 322 inc hl
00DE 46 323 ld b,(hl)
324 ; genIpush
325 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
00DF 79 326 ld a,c
00E0 F5 327 push af
00E1 33 328 inc sp
329 ; genIpush
00E2 78 330 ld a,b
00E3 F5 331 push af
00E4 33 332 inc sp
333 ; genIpush
00E5 3E 00 334 ld a,#0x00
00E7 F5 335 push af
00E8 33 336 inc sp
337 ; genCall
00E9 CD 00 00 338 call _move_sprite
00EC E8 03 339 lda sp,3(sp)
340 ; move_sprite.c 28
341 ; genIpush
342 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
00EE 21 0A 00 343 ld hl,#0x000A
00F1 E5 344 push hl
345 ; genCall
00F2 CD 00 00 346 call _delay
00F5 E8 02 347 lda sp,2(sp)
348 ; genLabel
00F7 349 00106$:
350 ; move_sprite.c 30
351 ; genCall
352 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
00F7 CD 00 00 353 call _joypad
00FA 4B 354 ld c,e
355 ; genAnd
00FB 79 356 ld a,c
00FC E6 08 357 and a,#0x08
00FE 20 03 358 jr nz,00123$
0100 C3 5F 00 359 jp 00110$
0103 360 00123$:
361 ; move_sprite.c 31
362 ; genPlus
363 ; AOP_STK for _main_y_1_1
364 ; genPlusIncr
0103 F8 03 365 lda hl,3(sp)
0105 34 366 inc (hl)
0106 20 02 367 jr nz,00124$
0108 23 368 inc hl
0109 34 369 inc (hl)
010A 370 00124$:
371 ; move_sprite.c 32
372 ; genCast
373 ; AOP_STK for _main_y_1_1
010A F8 03 374 lda hl,3(sp)
010C 4E 375 ld c,(hl)
376 ; genCast
377 ; AOP_STK for _main_x_1_1
010D 23 378 inc hl
010E 23 379 inc hl
010F 46 380 ld b,(hl)
381 ; genIpush
382 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0110 79 383 ld a,c
0111 F5 384 push af
0112 33 385 inc sp
386 ; genIpush
0113 78 387 ld a,b
0114 F5 388 push af
0115 33 389 inc sp
390 ; genIpush
0116 3E 00 391 ld a,#0x00
0118 F5 392 push af
0119 33 393 inc sp
394 ; genCall
011A CD 00 00 395 call _move_sprite
011D E8 03 396 lda sp,3(sp)
397 ; move_sprite.c 33
398 ; genIpush
399 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
011F 21 0A 00 400 ld hl,#0x000A
0122 E5 401 push hl
402 ; genCall
0123 CD 00 00 403 call _delay
0126 E8 02 404 lda sp,2(sp)
405 ; genGoto
0128 C3 5F 00 406 jp 00110$
407 ; genLabel
012B 408 00112$:
409 ; genEndFunction
012B E8 07 410 lda sp,7(sp)
012D C9 411 ret
012E 412 ___main_end:
413 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
0 ___main_end 012E R
0 ___main_start 0000 R
__initrleblock **** GX
_delay **** GX
_joypad **** GX
0 _main 0000 GR
_move_sprite **** GX
_set_sprite_data **** GX
_set_sprite_tile **** GX
1 _ufo 0000 GR
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size 12E flags 0
1 _DATA size 10 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 18 flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

5
move_sprite/ufo.c Normal file
View File

@ -0,0 +1,5 @@
unsigned char ufo[] =
{
0x5A,0x3C,0xE3,0x42,0x7C,0x99,0xEB,0xA5,
0xFB,0xA5,0x66,0x99,0xE7,0x42,0x5A,0x3C
};

16
small_sprite/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = small_sprite.gb
OBJS = small_sprite.o sprite.o
all: $(BIN)
$.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,10 @@
#include <gb/gb.h>
#include "sprite.c"
void main() {
SPRITES_8x8;
set_sprite_data(0, 8, sprite);
set_sprite_tile(0, 0);
move_sprite(0, 50, 50);
SHOW_SPRITES;
}

Binary file not shown.

View File

@ -0,0 +1,192 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 07:53:24 2020
4
5 ;--------------------------------------------------------
6 .module lcc2182930
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _main
12 .globl _sprite
13 ;--------------------------------------------------------
14 ; special function registers
15 ;--------------------------------------------------------
16 ;--------------------------------------------------------
17 ; special function bits
18 ;--------------------------------------------------------
19 ;--------------------------------------------------------
20 ; internal ram data
21 ;--------------------------------------------------------
22 .area _DATA
0000 23 _sprite::
0000 24 .ds 16
25 ;--------------------------------------------------------
26 ; overlayable items in internal ram
27 ;--------------------------------------------------------
28 .area _OVERLAY
29 ;--------------------------------------------------------
30 ; indirectly addressable internal ram data
31 ;--------------------------------------------------------
32 .area _ISEG
33 ;--------------------------------------------------------
34 ; bit data
35 ;--------------------------------------------------------
36 .area _BSEG
37 ;--------------------------------------------------------
38 ; external ram data
39 ;--------------------------------------------------------
40 .area _XSEG
41 ;--------------------------------------------------------
42 ; global & static initialisations
43 ;--------------------------------------------------------
44 .area _GSINIT
45 .area _GSFINAL
46 .area _GSINIT
47 ; small_sprite.c 1
48 ; small_sprite.c 11
49 ; genArrayInit
50 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0000 21 00 00 51 ld hl,#_sprite
0003 CD 00 00 52 call __initrleblock
0006 10 53 .db 16
0007 7E 00 99 00 81 00 54 .db 0x7E, 0x00, 0x99, 0x00, 0x81, 0x00, 0xA5, 0x00
A5 00
000F 81 00 DB 00 C3 00 55 .db 0x81, 0x00, 0xDB, 0x00, 0xC3, 0x00, 0x3C, 0x00
3C 00
0017 00 56 .db 0
57 ;--------------------------------------------------------
58 ; Home
59 ;--------------------------------------------------------
60 .area _HOME
61 .area _CODE
62 ;--------------------------------------------------------
63 ; code
64 ;--------------------------------------------------------
65 .area _CODE
66 ; small_sprite.c 4
67 ; genLabel
68 ; genFunction
69 ; ---------------------------------
70 ; Function main
71 ; ---------------------------------
0000 72 ___main_start:
0000 73 _main:
0000 E8 FD 74 lda sp,-3(sp)
75 ; small_sprite.c 5
76 ; genAssign
0002 01 40 FF 77 ld bc,#0xFF40
78 ; genAssign
79 ; AOP_STK for _main_sloc0_1_0
0005 F8 01 80 lda hl,1(sp)
0007 36 40 81 ld (hl),#0x40
0009 23 82 inc hl
000A 36 FF 83 ld (hl),#0xFF
84 ; genPointerGet
85 ; AOP_STK for _main_sloc0_1_0
86 ; AOP_STK for _main_sloc1_1_0
000C 2B 87 dec hl
000D 5E 88 ld e,(hl)
000E 23 89 inc hl
000F 56 90 ld d,(hl)
0010 1A 91 ld a,(de)
0011 2B 92 dec hl
0012 2B 93 dec hl
94 ; genAnd
95 ; AOP_STK for _main_sloc1_1_0
0013 77 96 ld (hl),a
0014 7F 97 ld a,a
0015 E6 FB 98 and a,#0xFB
99 ; genAssign (pointer)
0017 02 100 ld (bc),a
101 ; small_sprite.c 6
102 ; genIpush
103 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0018 21 00 00 104 ld hl,#_sprite
001B E5 105 push hl
106 ; genIpush
001C 21 00 08 107 ld hl,#0x0800
001F E5 108 push hl
109 ; genCall
0020 CD 00 00 110 call _set_sprite_data
0023 E8 04 111 lda sp,4(sp)
112 ; small_sprite.c 7
113 ; genIpush
114 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0025 21 00 00 115 ld hl,#0x0000
0028 E5 116 push hl
117 ; genCall
0029 CD 00 00 118 call _set_sprite_tile
002C E8 02 119 lda sp,2(sp)
120 ; small_sprite.c 8
121 ; genIpush
122 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
002E 21 32 32 123 ld hl,#0x3232
0031 E5 124 push hl
125 ; genIpush
0032 3E 00 126 ld a,#0x00
0034 F5 127 push af
0035 33 128 inc sp
129 ; genCall
0036 CD 00 00 130 call _move_sprite
0039 E8 03 131 lda sp,3(sp)
132 ; small_sprite.c 9
133 ; genAssign
003B 01 40 FF 134 ld bc,#0xFF40
135 ; genAssign
136 ; AOP_STK for _main_sloc0_1_0
003E F8 01 137 lda hl,1(sp)
0040 36 40 138 ld (hl),#0x40
0042 23 139 inc hl
0043 36 FF 140 ld (hl),#0xFF
141 ; genPointerGet
142 ; AOP_STK for _main_sloc0_1_0
143 ; AOP_STK for _main_sloc1_1_0
0045 2B 144 dec hl
0046 5E 145 ld e,(hl)
0047 23 146 inc hl
0048 56 147 ld d,(hl)
0049 1A 148 ld a,(de)
004A 2B 149 dec hl
004B 2B 150 dec hl
151 ; genOr
152 ; AOP_STK for _main_sloc1_1_0
004C 77 153 ld (hl),a
004D 7F 154 ld a,a
004E F6 02 155 or a,#0x02
156 ; genAssign (pointer)
0050 02 157 ld (bc),a
158 ; genLabel
0051 159 00101$:
160 ; genEndFunction
0051 E8 03 161 lda sp,3(sp)
0053 C9 162 ret
0054 163 ___main_end:
164 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
0 ___main_end 0054 R
0 ___main_start 0000 R
__initrleblock **** GX
0 _main 0000 GR
_move_sprite **** GX
_set_sprite_data **** GX
_set_sprite_tile **** GX
1 _sprite 0000 GR
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size 54 flags 0
1 _DATA size 10 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 18 flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

1
small_sprite/sprite.c Normal file
View File

@ -0,0 +1 @@
unsigned char sprite[] = { 0x7E, 0x00, 0x99, 0x00, 0x81, 0x00, 0xA5, 0x00, 0x81, 0x00, 0xDB, 0x00, 0xC3, 0x00, 0x3C, 0x00 };

87
small_sprite/sprite.lst Normal file
View File

@ -0,0 +1,87 @@
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.3.1 Wed Jul 8 07:53:24 2020
4
5 ;--------------------------------------------------------
6 .module lcc2182970
7
8 ;--------------------------------------------------------
9 ; Public variables in this module
10 ;--------------------------------------------------------
11 .globl _sprite
12 ;--------------------------------------------------------
13 ; special function registers
14 ;--------------------------------------------------------
15 ;--------------------------------------------------------
16 ; special function bits
17 ;--------------------------------------------------------
18 ;--------------------------------------------------------
19 ; internal ram data
20 ;--------------------------------------------------------
21 .area _DATA
0000 22 _sprite::
0000 23 .ds 16
24 ;--------------------------------------------------------
25 ; overlayable items in internal ram
26 ;--------------------------------------------------------
27 .area _OVERLAY
28 ;--------------------------------------------------------
29 ; indirectly addressable internal ram data
30 ;--------------------------------------------------------
31 .area _ISEG
32 ;--------------------------------------------------------
33 ; bit data
34 ;--------------------------------------------------------
35 .area _BSEG
36 ;--------------------------------------------------------
37 ; external ram data
38 ;--------------------------------------------------------
39 .area _XSEG
40 ;--------------------------------------------------------
41 ; global & static initialisations
42 ;--------------------------------------------------------
43 .area _GSINIT
44 .area _GSFINAL
45 .area _GSINIT
46 ; sprite.c 1
47 ; sprite.c 2
48 ; genArrayInit
49 ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
0000 21 00 00 50 ld hl,#_sprite
0003 CD 00 00 51 call __initrleblock
0006 10 52 .db 16
0007 7E 00 99 00 81 00 53 .db 0x7E, 0x00, 0x99, 0x00, 0x81, 0x00, 0xA5, 0x00
A5 00
000F 81 00 DB 00 C3 00 54 .db 0x81, 0x00, 0xDB, 0x00, 0xC3, 0x00, 0x3C, 0x00
3C 00
0017 00 55 .db 0
56 ;--------------------------------------------------------
57 ; Home
58 ;--------------------------------------------------------
59 .area _HOME
60 .area _CODE
61 ;--------------------------------------------------------
62 ; code
63 ;--------------------------------------------------------
64 .area _CODE
65 .area _CODE
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 1.
Symbol Table
__initrleblock **** GX
1 _sprite 0000 GR
ASxxxx Assembler V01.75 (GameBoy Z80-like CPU), page 2.
Area Table
0 _CODE size 0 flags 0
1 _DATA size 10 flags 0
2 _OVERLAY size 0 flags 0
3 _ISEG size 0 flags 0
4 _BSEG size 0 flags 0
5 _XSEG size 0 flags 0
6 _GSINIT size 18 flags 0
7 _GSFINAL size 0 flags 0
8 _HOME size 0 flags 0

BIN
small_sprite/sprite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

16
window/Makefile Normal file
View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = window.gb
OBJS = main.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

153
window/bg.c Normal file
View File

@ -0,0 +1,153 @@
const unsigned char bg_tiledata[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFC,0xFF,0xFE,0xFF,0xFC,0xFF,0xFE,0xFF,0xFC,0xFF,0xFE,0xFF,0xFC,0xFF,0xFE,0xFF,
0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,
0x3E,0xFF,0x3E,0xFF,0x3E,0xFF,0x3E,0xFF,0x3E,0xFF,0x3F,0xFF,0x1F,0xFF,0x3F,0xFF,
0x3F,0xFF,0x7F,0xFF,0x7F,0xFF,0xFD,0xFF,0xFA,0xFF,0xF9,0xFF,0xD4,0xFF,0xAA,0xFF,
0x00,0xFF,0x80,0xFF,0x00,0xFF,0x80,0xFF,0x80,0xFF,0x20,0xFF,0x40,0xFF,0x20,0xFF,
0x00,0xFF,0x00,0xFF,0x02,0xFF,0x00,0xFF,0x23,0xFF,0x01,0xFF,0x20,0xFF,0x15,0xFF,
0x80,0xFF,0x00,0xFF,0x81,0xFF,0x81,0xFF,0x04,0xFF,0x84,0xFF,0x88,0xFF,0x40,0xFF,
0x9E,0xFF,0x82,0xFF,0x3B,0xFE,0x12,0xFF,0x00,0xFF,0x04,0xFB,0x00,0xFF,0x40,0xFF,
0xFC,0x03,0xED,0x12,0xBC,0x43,0xEE,0x11,0x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0x17,0xEF,0x17,0xEF,0x2B,0xD7,0x8B,0xF7,
0x0F,0xFF,0x07,0xFF,0x0F,0xFF,0x07,0xFF,0x0F,0xFF,0x0F,0xFF,0x5F,0xFF,0x0F,0xF7,
0xAB,0xD7,0xCB,0xF7,0xDB,0xE7,0x4B,0xF7,0xCD,0xF3,0xC5,0xFB,0xC9,0x77,0xED,0xF3,
0x1F,0xFE,0x0F,0xFF,0x1B,0xFF,0x0F,0xFF,0x1F,0xFF,0x1F,0xFF,0x3F,0xFF,0x1F,0xEF,
0xE5,0xFB,0xF5,0xFB,0xF5,0xFB,0xF5,0xFB,0xE4,0xFB,0xF2,0xFD,0xF2,0xFD,0xF0,0xFF,
0x3F,0xFF,0x1F,0xFF,0x1F,0xFF,0x1F,0xFF,0x5F,0xFF,0x3F,0xFF,0x3F,0xFF,0x1F,0xFF,
0xF2,0xFD,0xF8,0xFF,0xF8,0xFF,0xFA,0xFD,0xF8,0xFF,0xF8,0xFF,0xF9,0xFE,0xFC,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0x7F,0xFF,0x7F,0xFF};

21
window/border.c Normal file
View File

@ -0,0 +1,21 @@
const unsigned char border[] =
{
0x00,0x00,0x1F,0x1F,0x20,0x20,0x4F,0x4F,
0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,
0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,
0x4F,0x4F,0x20,0x20,0x1F,0x1F,0x00,0x00,
0x00,0x00,0xF8,0xF8,0x04,0x04,0xF2,0xF2,
0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,
0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,
0xF2,0xF2,0x04,0x04,0xF8,0xF8,0x00,0x00,
0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,
0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,
0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,
0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,
0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

16
window/main.c Normal file
View File

@ -0,0 +1,16 @@
#include <gb/gb.h>
#include "bg.c"
#include "bg.map"
#include "border.c"
#include "window.c"
void main() {
set_bkg_data(0, 152, bg_tiledata);
set_bkg_tiles(0, 0, 20, 18, bg_tilemap);
SHOW_BKG;
set_win_data(152, 9, border);
set_win_tiles(0, 0, 20, 4, window);
move_win(7, 112);
SHOW_WIN;
}

3232
window/main.lst Normal file

File diff suppressed because it is too large Load Diff

15
window/window.c Normal file
View File

@ -0,0 +1,15 @@
#define windowWidth 20
#define windowHeight 4
#define windowBank 0
const unsigned char window[] =
{
0x98,0x9C,0x9C,0x9C,0x9C,0x9C,0x9C,0x9C,0x9C,0x9C,
0x9C,0x9C,0x9C,0x9C,0x9C,0x9C,0x9C,0x9C,0x9C,0x9A,
0x9E,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0x9F,
0x9E,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0x9F,
0x99,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,
0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9B
};

BIN
window/window.gb Normal file

Binary file not shown.

View File

@ -0,0 +1,39 @@
# GBDK Playground
It has 16 kB of RAM, man.
## Samples
| [Blank](blank) | [Hello World](hello_world) | [Small Sprite](small_sprite) |
|:-------------------------:|:-------------------------------:|:--------------------------------:|
| ![](blank/screenshot.png) | ![](hello_world/screenshot.png) | ![](small_sprite/screenshot.png) |
| Minimum required code | Print `Hello World!` | Render small 8x8 sprite |
| [Big Sprite](big_sprite) | [Big Sprite Animation](big_sprite_animation) | [Input State](input_state) |
|:------------------------------:|:--------------------------------------------:|:-------------------------------:|
| ![](big_sprite/screenshot.png) | ![](big_sprite_animation/screenshot.gif) | ![](input_state/screenshot.png) |
| Render big 16x16 sprite | Animate big 16x16 sprite | Read joypad state |
| [Input Wait](input_wait) | [Move Sprite](move_sprite) | [Background](background) |
|:------------------------------:|:-------------------------------:|:-------------------------------:|
| ![](input_wait/screenshot.png) | ![](move_sprite/screenshot.gif) | ![](background/screenshot.png) |
| Wait for button input | Move a sprite using joypad | Render a full-screen background |
| [Window](window) | [Beep](beep) | [Simple SHMUP](simple_shmup) |
|:--------------------------:|:------------------------:|:--------------------------------:|
| ![](window/screenshot.png) | ![](beep/screenshot.png) | ![](simple_shmup/screenshot.png) |
| Renders a window | Make a sound | Very simple SHMUP |
| [Huge Sprite](huge_sprite) | [Drawing](drawing) | [Detect GB Type](detect_gb) |
|:-------------------------------:|:-------------------------------:|:----------------------------------:|
| ![](huge_sprite/screenshot.png) | ![](drawing/screenshot.png) | ![](detect_gb/screenshot.png) |
| Renders a huge 40x64 sprite | Built-in drawing functions | Detect which GB is being used |
| [Save RAM](save_ram) | [Font](font) | [Link](link) |
|:-------------------------------:|:-------------------------------:|:----------------------------------:|
| ![](save_ram/screenshot.png) | ![](font/screenshot.png) | ![](link/screenshot.png) |
| Save/load variables | Load a new font | Send/Receive data using link cable |
| [Color](color) | More coming soon... |
|:-------------------------------:|:----------------------------------:|
| ![](color/screenshot.png) | ![](docs/res/more_coming_soon.png) |
| Use palettes for Game Boy Color | Contributions are welcome! |

View File

@ -0,0 +1,17 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = background.gb
OBJS = background.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf *.o *.lst

View File

@ -0,0 +1,94 @@
# Background
<div style="text-align: center"><img src="screenshot.png" alt="" /></div>
Renders a full-screen background image.
## Source
```c
#include <gb/gb.h>
#include "bg_data.c"
#include "bg_data.map"
void main() {
```
First load the tile patterns in the Background Tile Pattern table. This
means that we load all the 8x8 images that make up our picture (131 of them
to be exact).
```c
set_bkg_data(0, 131, tiledata);
VBK_REG = 1;
VBK_REG = 0;
```
Then we set the tile pattern in the background tile table. The variable
`tilemap` contains an array of tile numbers that reference to the the tiles
we loaded previously using `set_bkg_data`.
Our image is `20` tiles wide and `18` tiles high, thus having a total of 360
tiles. How is that possible when we only loaded `131` tiles?
Well, that is because some in the image are identical. So instead the tile
is only saved once in the `tiledata` variable and reused multiple times in
the `tilemap` variable.
```c
set_bkg_tiles(0, 0, 20, 18, tilemap);
```
In order for the background to actually show up we call `SHOW_BKG`.
```c
SHOW_BKG;
DISPLAY_ON;
}
```

View File

@ -0,0 +1,37 @@
// # Background
// <div style="text-align: center"><img src="screenshot.png" alt="" /></div>
//
// Renders a full-screen background image.
//
// ## Source
#include <gb/gb.h>
#include "bg_data.c"
#include "bg_data.map"
void main() {
// First load the tile patterns in the Background Tile Pattern table. This
// means that we load all the 8x8 images that make up our picture (131 of them
// to be exact).
set_bkg_data(0, 131, tiledata);
VBK_REG = 1;
VBK_REG = 0;
// Then we set the tile pattern in the background tile table. The variable
// `tilemap` contains an array of tile numbers that reference to the the tiles
// we loaded previously using `set_bkg_data`.
//
// Our image is `20` tiles wide and `18` tiles high, thus having a total of 360
// tiles. How is that possible when we only loaded `131` tiles?
//
// Well, that is because some in the image are identical. So instead the tile
// is only saved once in the `tiledata` variable and reused multiple times in
// the `tilemap` variable.
set_bkg_tiles(0, 0, 20, 18, tilemap);
// In order for the background to actually show up we call `SHOW_BKG`.
SHOW_BKG;
DISPLAY_ON;
}

View File

@ -0,0 +1,142 @@
/*
Advanced PCX to GameBoy converter v2.15
Tiles data
Original PCX File : "BG_DATA.PCX"
Number of Tiles : 131
TileMap Size : 20x18
*/
unsigned const char tiledata[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xDF,0xDF,0xC1,0xC1,0xC0,0xC0,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x3F,0x0F,0x0F,0x01,0x01,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x1F,0x1F,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xF8,0xF8,
0xFE,0xFE,0xFC,0xFC,0xF8,0xF8,0xF0,0xF0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x03,0x03,0x07,0x07,0x07,0x07,0x0F,0x0F,
0xE0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,
0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0x0F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x0F,0x0F,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x0F,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0xF8,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0xE0,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xFC,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
0xE0,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
0x0F,0x0F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xF8,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFE,0xFE,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0xC0,0xC0,0x80,0x80,
0xFF,0xFF,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x0C,0x0C,0x18,0x18,
0x01,0x01,0x03,0x03,0x07,0x07,0x07,0x07,0x0F,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x1F,
0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x02,0x02,0x06,0x06,0x0C,0x0C,0x08,0x08,0x18,0x18,0x30,0x30,0x20,0x20,0x20,0x20,
0x0C,0x0C,0x18,0x18,0x10,0x10,0x20,0x20,0x60,0x60,0x40,0x40,0xC0,0xC0,0x80,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x02,0x02,0x04,0x04,
0x30,0x30,0x20,0x20,0x60,0x60,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x06,0x06,
0x40,0x40,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x02,0x02,0x06,0x06,0x08,0x08,0x18,0x18,0x30,0x30,0x60,0x60,0x40,0x40,
0x08,0x08,0x18,0x18,0x30,0x30,0x60,0x60,0x40,0x40,0xC0,0xC0,0x80,0x80,0x00,0x00,
0x00,0x00,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x07,0x07,0x07,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0x04,0x04,0x08,0x08,0x08,0x08,0x10,0x10,0x30,0x30,0x20,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x03,0x03,0x02,0x02,0x06,0x06,0x04,0x04,0x08,0x08,0x18,0x18,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x02,0x02,0x02,0x06,0x06,0x04,0x04,0x0C,0x0C,0x18,0x18,0x10,0x10,0x20,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x20,0x20,0x18,0x18,
0x07,0x07,0x07,0x07,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,
0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0xC0,0xC0,0x80,0x80,0x80,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x02,0x02,
0x60,0x60,0x40,0x40,0x40,0x40,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x0C,0x0C,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x60,0x60,0x18,0x18,0x04,0x04,0x03,0x03,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
0x02,0x02,0x06,0x06,0x0C,0x0C,0x08,0x08,0x18,0x18,0x30,0x30,0x20,0x20,0x40,0x40,
0x02,0x02,0x06,0x06,0x0C,0x0C,0x08,0x08,0x18,0x18,0x10,0x10,0x10,0x10,0x20,0x20,
0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x60,0x60,0x30,0x30,0x18,0x18,0x0E,0x0E,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x60,0x60,
0x1F,0x1F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x04,0x04,
0x40,0x40,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x1C,0x1C,0x06,0x06,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xC0,0xC0,0x70,0x70,0x1C,0x1C,0x07,0x07,0x01,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x60,0x60,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,
0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0x40,0x40,
0x0C,0x0C,0x08,0x08,0x10,0x10,0x10,0x10,0x30,0x30,0x60,0x60,0x40,0x40,0x40,0x40,
0x00,0x00,0x01,0x01,0x01,0x01,0x03,0x03,0x02,0x02,0x04,0x04,0x04,0x04,0x08,0x08,
0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x10,
0x00,0x00,0x00,0x00,0x0E,0x0E,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x30,0x30,0x08,0x08,
0x1F,0x1F,0x1F,0x1F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x02,0x02,
0x10,0x10,0x20,0x20,0x60,0x60,0x40,0x40,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
0x0E,0x0E,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x80,0x60,0x60,0x38,0x38,0x0C,0x0C,0x07,0x07,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0xE0,0x30,0x30,
0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x03,
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xE0,0xE0,0xE0,0xE0,
0x02,0x02,0x04,0x04,0x08,0x08,0x18,0x18,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x40,
0x18,0x18,0x06,0x06,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x20,0x20,0x1C,0x1C,0x06,0x06,0x03,0x03,
0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x78,0x78,0x07,0x07,
0xC0,0xC0,0x60,0x60,0x30,0x30,0x08,0x08,0x0E,0x0E,0x03,0x03,0x01,0x01,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0xC0,0xC0,0x40,0x40,0x60,0x60,0x30,0x30,0x0C,0x0C,0x02,0x02,0x03,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0xE0,
0x18,0x18,0x0E,0x0E,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0xE0,0x38,0x38,0x0E,0x0E,0x03,0x03,0x00,0x00,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,0x0F,0x0F,0x0F,0x0F,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,
0x02,0x02,0x04,0x04,0x08,0x08,0x18,0x18,0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,
0x38,0x38,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x38,0x38,0x06,0x06,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
0x07,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x01,0x01,0x00,0x00,
0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x0F,0x0F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x1F,0x1F,0xFF,0xFF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,0x80,0xF8,0xF8,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xFC,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x0F,0x0F,0x0F,0x0F,0x07,0x07,0x07,0x07,0x03,0x03,0x01,0x01,0xE1,0xE1,0xF8,0xF8};

Binary file not shown.

View File

@ -0,0 +1,2 @@
docco -t ../docs/res/readme_c.jst -o ./ background.c
mv background.html README.md

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,17 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = beep.gb
OBJS = beep.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,6 @@
# Beep
![](screenshot.png)
Demonstrates how to play a simple SFX sound.

View File

@ -0,0 +1,31 @@
#include <gb/gb.h>
#include <gb/drawing.h>
void main() {
NR50_REG = 0xFF;
NR51_REG = 0xFF;
NR52_REG = 0x80;
gotogxy(1, 1);
gprintf("====== Beep ======");
gotogxy(2, 3);
gprintf("Press any button");
while(1) {
UBYTE joypad_state = joypad();
if(joypad_state) {
NR10_REG = 0x38U;
NR11_REG = 0x70U;
NR12_REG = 0xE0U;
NR13_REG = 0x0AU;
NR14_REG = 0xC6U;
NR51_REG |= 0x11;
delay(200);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,17 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = big_sprite.gb
OBJS = big_sprite.o sprite.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,178 @@
# Big Sprite
<div style="text-align: center"><img src="screenshot.png" alt="" /></div>
Renders a big sprite of 16x16. Since the Game Boy hardware does not directly
support sprites that large
## Source
Start by including `gb/gb.h` this file defines most important functions you
are going to need when develop Game Boy games.
```c
#include <gb/gb.h>
```
The `sprite.c` file defines the sprite data in the form of an unsigned char
array. Most of the time you want to generate this file using tools such as
GBTD.
```c
#include "sprite.c"
void main() {
```
Set the sprite size to 8x16 pixels, two tiles one above the other. Internally
sets bit 2 of the LCDC register to 1.
```c
SPRITES_8x16;
```
Loads the tile patterns stored in `sprite` into the Sprite Tile Pattern
table.
* first parameter `0` determines at which position we should start loading.
* second parameter `4` determines how many tiles we want to loading
* third parameter `sprite` sets the variable to load from
This means that we are loading 4 tiles starting at 0 from the variable
sprite.
```c
set_sprite_data(0, 4, sprite);
```
Tell sprite `0` to display sprite `0`. Since we are loading 8x16 tiles this
will make sprite 0 show tile `0` and tile `1`.
```c
set_sprite_tile(0, 0);
```
Finally move a sprite to a position that we can see.
```c
move_sprite(0, 75, 75);
```
We want to display a 16x16 sprite. Unfortunately the Game Boy hardware does
not directly support a sprite that large. So in order to have a sprite of
that size we are simply displaying two 8x16 tiles next to each other!
Since we've already loaded our entire sprite in line 16 we can now simply
tell sprite `1` to display our second sprite. Again, since we are displaying
8x16 tiles this statement will display tile `2` and tile `3`.
```c
set_sprite_tile(1, 2);
```
In order to form the illusion of a bigger sprite we display the second tile
directly next to the other simply by offsetting the position 8 pixels to the
right.
```c
move_sprite(1, 75 + 8, 75);
```
As always, in order for the sprites to display we need to call
`SHOW_SPRITES` once.
```c
SHOW_SPRITES;
}
```

View File

@ -0,0 +1,51 @@
// # Big Sprite
// <div style="text-align: center"><img src="screenshot.png" alt="" /></div>
//
// Renders a big sprite of 16x16. Since the Game Boy hardware does not directly
// support sprites that large
//
// ## Source
// Start by including `gb/gb.h` this file defines most important functions you
// are going to need when develop Game Boy games.
#include <gb/gb.h>
// The `sprite.c` file defines the sprite data in the form of an unsigned char
// array. Most of the time you want to generate this file using tools such as
// GBTD.
#include "sprite.c"
void main() {
// Set the sprite size to 8x16 pixels, two tiles one above the other. Internally
// sets bit 2 of the LCDC register to 1.
SPRITES_8x16;
// Loads the tile patterns stored in `sprite` into the Sprite Tile Pattern
// table.
//
// * first parameter `0` determines at which position we should start loading.
// * second parameter `4` determines how many tiles we want to loading
// * third parameter `sprite` sets the variable to load from
//
// This means that we are loading 4 tiles starting at 0 from the variable
// sprite.
set_sprite_data(0, 4, sprite);
// Tell sprite `0` to display sprite `0`. Since we are loading 8x16 tiles this
// will make sprite 0 show tile `0` and tile `1`.
set_sprite_tile(0, 0);
// Finally move a sprite to a position that we can see.
move_sprite(0, 75, 75);
// We want to display a 16x16 sprite. Unfortunately the Game Boy hardware does
// not directly support a sprite that large. So in order to have a sprite of
// that size we are simply displaying two 8x16 tiles next to each other!
//
// Since we've already loaded our entire sprite in line 16 we can now simply
// tell sprite `1` to display our second sprite. Again, since we are displaying
// 8x16 tiles this statement will display tile `2` and tile `3`.
set_sprite_tile(1, 2);
// In order to form the illusion of a bigger sprite we display the second tile
// directly next to the other simply by offsetting the position 8 pixels to the
// right.
move_sprite(1, 75 + 8, 75);
// As always, in order for the sprites to display we need to call
// `SHOW_SPRITES` once.
SHOW_SPRITES;
}

View File

@ -0,0 +1,2 @@
docco -t ../docs/res/readme_c.jst -o ./ big_sprite.c
mv big_sprite.html README.md

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,38 @@
/*
SPRITE.C
Tile Source File.
Info:
Form : All tiles as one unit.
Format : Gameboy 4 color.
Compression : None.
Counter : None.
Tile size : 16 x 16
Tiles : 0 to 0
Palette colors : None.
SGB Palette : None.
CGB Palette : None.
Convert to metatiles : No.
This file was generated by GBTD v2.2
*/
/* Start of tile array. */
unsigned char sprite[] =
{
0xFF,0xFF,0x80,0x80,0x80,0x80,0x81,0x81,
0x83,0x83,0x87,0x87,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x83,0x83,0x87,0x87,0x80,0x80,0xFF,0xFF,
0xFF,0xFF,0x01,0x01,0xC1,0xC1,0xC1,0xC1,
0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,
0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,
0xE1,0xE1,0xF1,0xF1,0x01,0x01,0xFF,0xFF
};
/* End of SPRITE.C */

View File

@ -0,0 +1,31 @@
/*
SPRITE.H
Include File.
Info:
Form : All tiles as one unit.
Format : Gameboy 4 color.
Compression : None.
Counter : None.
Tile size : 16 x 16
Tiles : 0 to 0
Palette colors : None.
SGB Palette : None.
CGB Palette : None.
Convert to metatiles : No.
This file was generated by GBTD v2.2
*/
/* Bank of tiles. */
#define spriteBank 0
/* Start of tile array. */
extern unsigned char sprite[];
/* End of SPRITE.H */

View File

@ -0,0 +1,17 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = big_sprite_animation.gb
OBJS = big_sprite_animation.o cards.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,6 @@
# Big Sprite Animation
![](screenshot.gif)
Renders a big 16x16 animated sprite of 2 frames using a delay of 500.

View File

@ -0,0 +1,21 @@
#include <gb/gb.h>
#include "cards.c"
void main() {
SPRITES_8x16;
set_sprite_data(0, 8, cards);
set_sprite_tile(0, 0);
move_sprite(0, 75, 75);
set_sprite_tile(1, 2);
move_sprite(1, 75 + 8, 75);
SHOW_SPRITES;
while(1) {
set_sprite_tile(0, 4);
set_sprite_tile(1, 6);
delay(500);
set_sprite_tile(0, 0);
set_sprite_tile(1, 2);
delay(500);
}
}

View File

@ -0,0 +1,46 @@
/*
CARDS.C
Tile Source File.
Info:
Form : All tiles as one unit.
Format : Gameboy 4 color.
Compression : None.
Counter : None.
Tile size : 16 x 16
Tiles : 0 to 1
Palette colors : None.
SGB Palette : None.
CGB Palette : None.
Convert to metatiles : No.
This file was generated by GBTD v2.2
*/
/* Start of tile array. */
unsigned char cards[] =
{
0xFF,0xFF,0x80,0x80,0x80,0x80,0x81,0x81,
0x83,0x83,0x87,0x87,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x83,0x83,0x87,0x87,0x80,0x80,0xFF,0xFF,
0xFF,0xFF,0x01,0x01,0xC1,0xC1,0xC1,0xC1,
0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,
0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,
0xE1,0xE1,0xF1,0xF1,0x01,0x01,0xFF,0xFF,
0xFF,0xFF,0x80,0x80,0x83,0x83,0x87,0x87,
0x8E,0x8E,0x8C,0x8C,0x80,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x81,0x81,0x83,0x83,
0x87,0x87,0x8F,0x8F,0x80,0x80,0xFF,0xFF,
0xFF,0xFF,0x01,0x01,0xC1,0xC1,0xE1,0xE1,
0x71,0x71,0x31,0x31,0x31,0x31,0x31,0x31,
0x71,0x71,0xE1,0xE1,0xC1,0xC1,0x81,0x81,
0xF1,0xF1,0xF1,0xF1,0x01,0x01,0xFF,0xFF
};
/* End of CARDS.C */

View File

@ -0,0 +1,31 @@
/*
CARDS.H
Include File.
Info:
Form : All tiles as one unit.
Format : Gameboy 4 color.
Compression : None.
Counter : None.
Tile size : 16 x 16
Tiles : 0 to 1
Palette colors : None.
SGB Palette : None.
CGB Palette : None.
Convert to metatiles : No.
This file was generated by GBTD v2.2
*/
/* Bank of tiles. */
#define cardsBank 0
/* Start of tile array. */
extern unsigned char cards[];
/* End of CARDS.H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,17 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = blank.gb
OBJS = blank.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,35 @@
# Blank
<div style="text-align: center"><img src="screenshot.png" alt="" /></div>
This example contains the minimal amount of code needed to create a working
Game Boy game. Though not a very exciting one.
## Source
All a GBDK game needs to compile and run (any C-program, in fact) is a main
function. This is the entry point into your program.
```c
void main() {
}
```

View File

@ -0,0 +1,13 @@
// # Blank
// <div style="text-align: center"><img src="screenshot.png" alt="" /></div>
//
// This example contains the minimal amount of code needed to create a working
// Game Boy game. Though not a very exciting one.
//
// ## Source
// All a GBDK game needs to compile and run (any C-program, in fact) is a main
// function. This is the entry point into your program.
void main() {
}

View File

@ -0,0 +1,2 @@
docco -t ../docs/res/readme_c.jst -o ./ blank.c
mv blank.html README.md

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,17 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-yp0x143=0x80
BIN = color.gbc
OBJS = color.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,6 @@
# Color
![](screenshot.png)
Demonstrates how to use palettes and create a Game Boy Color ROM.

View File

@ -0,0 +1,142 @@
/*
Advanced PCX to GameBoy converter v2.15
Tiles data
Original PCX File : "BG_DATA.PCX"
Number of Tiles : 131
TileMap Size : 20x18
*/
unsigned const char tiledata[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xDF,0xDF,0xC1,0xC1,0xC0,0xC0,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x3F,0x0F,0x0F,0x01,0x01,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,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0x00,
0xE0,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
0x0F,0x0F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xF8,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFE,0xFE,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0xC0,0xC0,0x80,0x80,
0xFF,0xFF,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x0C,0x0C,0x18,0x18,
0x01,0x01,0x03,0x03,0x07,0x07,0x07,0x07,0x0F,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x1F,
0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x02,0x02,0x06,0x06,0x0C,0x0C,0x08,0x08,0x18,0x18,0x30,0x30,0x20,0x20,0x20,0x20,
0x0C,0x0C,0x18,0x18,0x10,0x10,0x20,0x20,0x60,0x60,0x40,0x40,0xC0,0xC0,0x80,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x02,0x02,0x04,0x04,
0x30,0x30,0x20,0x20,0x60,0x60,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x06,0x06,
0x40,0x40,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x02,0x02,0x06,0x06,0x08,0x08,0x18,0x18,0x30,0x30,0x60,0x60,0x40,0x40,
0x08,0x08,0x18,0x18,0x30,0x30,0x60,0x60,0x40,0x40,0xC0,0xC0,0x80,0x80,0x00,0x00,
0x00,0x00,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x07,0x07,0x07,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0x04,0x04,0x08,0x08,0x08,0x08,0x10,0x10,0x30,0x30,0x20,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x03,0x03,0x02,0x02,0x06,0x06,0x04,0x04,0x08,0x08,0x18,0x18,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x02,0x02,0x02,0x06,0x06,0x04,0x04,0x0C,0x0C,0x18,0x18,0x10,0x10,0x20,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x20,0x20,0x18,0x18,
0x07,0x07,0x07,0x07,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,
0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0xC0,0xC0,0x80,0x80,0x80,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x02,0x02,
0x60,0x60,0x40,0x40,0x40,0x40,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x0C,0x0C,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x60,0x60,0x18,0x18,0x04,0x04,0x03,0x03,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
0x02,0x02,0x06,0x06,0x0C,0x0C,0x08,0x08,0x18,0x18,0x30,0x30,0x20,0x20,0x40,0x40,
0x02,0x02,0x06,0x06,0x0C,0x0C,0x08,0x08,0x18,0x18,0x10,0x10,0x10,0x10,0x20,0x20,
0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x60,0x60,0x30,0x30,0x18,0x18,0x0E,0x0E,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x60,0x60,
0x1F,0x1F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x04,0x04,
0x40,0x40,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x1C,0x1C,0x06,0x06,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xC0,0xC0,0x70,0x70,0x1C,0x1C,0x07,0x07,0x01,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x60,0x60,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,
0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0x40,0x40,
0x0C,0x0C,0x08,0x08,0x10,0x10,0x10,0x10,0x30,0x30,0x60,0x60,0x40,0x40,0x40,0x40,
0x00,0x00,0x01,0x01,0x01,0x01,0x03,0x03,0x02,0x02,0x04,0x04,0x04,0x04,0x08,0x08,
0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x10,
0x00,0x00,0x00,0x00,0x0E,0x0E,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x30,0x30,0x08,0x08,
0x1F,0x1F,0x1F,0x1F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x02,0x02,
0x10,0x10,0x20,0x20,0x60,0x60,0x40,0x40,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
0x0E,0x0E,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x80,0x60,0x60,0x38,0x38,0x0C,0x0C,0x07,0x07,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0xE0,0x30,0x30,
0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x03,
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xE0,0xE0,0xE0,0xE0,
0x02,0x02,0x04,0x04,0x08,0x08,0x18,0x18,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x40,
0x18,0x18,0x06,0x06,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x20,0x20,0x1C,0x1C,0x06,0x06,0x03,0x03,
0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x78,0x78,0x07,0x07,
0xC0,0xC0,0x60,0x60,0x30,0x30,0x08,0x08,0x0E,0x0E,0x03,0x03,0x01,0x01,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0xC0,0xC0,0x40,0x40,0x60,0x60,0x30,0x30,0x0C,0x0C,0x02,0x02,0x03,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0xE0,
0x18,0x18,0x0E,0x0E,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0xE0,0x38,0x38,0x0E,0x0E,0x03,0x03,0x00,0x00,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,0x0F,0x0F,0x0F,0x0F,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,
0x02,0x02,0x04,0x04,0x08,0x08,0x18,0x18,0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,
0x38,0x38,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x38,0x38,0x06,0x06,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
0x07,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x01,0x01,0x00,0x00,
0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x0F,0x0F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x1F,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0xF0,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xFE,0xFE,
0xFF,0xFF,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,
0xFF,0xFF,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFC,0xFC,0xFD,0xFD,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x1F,0x1F,0x7F,0x7F,0xFF,0xFF,
0x00,0x00,0x03,0x03,0x0F,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x80,0x80,0xF8,0xF8,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xFC,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x0F,0x0F,0x0F,0x0F,0x07,0x07,0x07,0x07,0x03,0x03,0x01,0x01,0xE1,0xE1,0xF8,0xF8};

View File

@ -0,0 +1,39 @@
#include <gb/gb.h>
#include <gb/cgb.h> // Include cgb functions
// Background taken from 'background' example
#include "bg_data.c"
#include "bg_data.map"
// Sprite taken from 'small_sprite' example
const unsigned char sprite[] =
{
0x7E,0x7E,0x99,0x99,0x81,0x81,0xA5,0xA5,
0x81,0x81,0xDB,0xDB,0xC3,0xC3,0x3C,0x3C
};
// These palettes replace the default palette with the appropriate colors. See cgb.h for more defined colors.
UWORD bkgPalette[] = {
RGB_PURPLE, RGB_BLACK, RGB_ORANGE, RGB_BROWN
};
UWORD sprPalette[] = {
RGB_GREEN, RGB_BLUE, RGB_RED, RGB_YELLOW
};
void main(void){
set_bkg_palette(0, 1, bkgPalette); // UBYTE first_palette, UBYTE nb_palettes, UWORD *rgb_data
set_bkg_data(0, 131, tiledata);
set_bkg_tiles(0, 0, 20, 18, tilemap);
SHOW_BKG;
set_sprite_palette(0, 1, sprPalette); // UBYTE first_palette, UBYTE nb_palettes, UWORD *rgb_data
set_sprite_data(0, 1, sprite);
set_sprite_tile(0, 0);
move_sprite(0, 50, 50);
SHOW_SPRITES;
DISPLAY_ON;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = detect_gb.gb
OBJS = detect_gb.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,5 @@
# Detect GB
![](screenshot.png)
Detect which GB is being used/emulated.

View File

@ -0,0 +1,21 @@
#include <gb/gb.h>
#include <stdio.h>
extern UBYTE _cpu;
void main() {
switch (_cpu) {
case 0x01:
printf("DMG or SGB");
break;
case 0xFF:
printf("POCKET or SGB2");
break;
case 0x11:
printf("COLOR");
break;
default:
printf("OTHER");
break;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,15 @@
<% for (var i = 0, l = sections.length; i<l; i++) { %>
<% var section = sections[i]; %>
<%= section.docsText %>
<% if (!(/^\s*$/).test(section.codeText)) { %>
```c
<%= section.codeText %>
```
<% } %>
<% } %>

View File

@ -0,0 +1,16 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = drawing.gb
OBJS = drawing.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@ -0,0 +1,5 @@
# Drawing
![](screenshot.png)
Demonstrates built-in GBDK drawing functions. Operate the D-Pad to use the plot function to draw on the screen. Press the A Button to change plot point colors (Black, White, Dark Gray, Light Gray). Press the B button to clear the screen.

View File

@ -0,0 +1,41 @@
#include <gb/gb.h>
#include <gb/drawing.h>
UINT8 x = 1, y = 1, i = 3, j, f;
void main() {
color(BLACK, WHITE, SOLID); // forecolor, backcolor, mode [Colors: WHITE (0), LTGREY (1), DKGREY(2), BLACK (3)]
circle(100, 60, 30, M_FILL); // x, y, radius, style (M_FILL or M_NOFILL)
line(40, 40, 50, 50); // x1, y1, x2, y2
box(120, 125, 125, 135, M_NOFILL); // x1, y1, x2, y2, style (M_FILL or M_NOFILL)
plot_point(3, 4); // Plot a single pixel on the screen
gotogxy(18, 15); // Places you at these coordinates
gprintf("Hi"); // When using the drawing library you must use gprintf instead of printf
while (1) {
if (joypad() == J_UP && y != 0)
y--;
if (joypad() == J_DOWN && y != 143)
y++;
if (joypad() == J_LEFT && x != 0)
x--;
if (joypad() == J_RIGHT && x != 159)
x++;
if (joypad() == J_A) { // Change colors
waitpadup();
i++;
if (i > 3)
i = 0;
}
if (joypad() == J_B) { // Function to 'clear' the screen
for (j = 0; j < 20; j++) { // GB screen is 20 columns wide and 18 columns tall
for (f = 0; f < 18; f++) {
gotogxy(j, f);
wrtchr(' '); // Use wrtchr to place a character when using the drawing library
}
}
}
plot(x, y, i, SOLID); // Draws a pixel on the screen (x, y, color, mode)
delay(10);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Some files were not shown because too many files have changed in this diff Show More