@ -1,3 +1,4 @@ | |||||
is.gb | is.gb | ||||
is.gb.sym | is.gb.sym | ||||
*.o | |||||
*.o | |||||
*.2bpp |
@ -1,10 +1,22 @@ | |||||
PNGFILES := $(shell find png -type f -name '*.png') | |||||
IMGFILES := $(PNGFILES:%.png=%.2bpp) | |||||
SFILES := $(shell find src -type f -name '*.s') | SFILES := $(shell find src -type f -name '*.s') | ||||
OFILES := $(SFILES:%.s=%.o) | OFILES := $(SFILES:%.s=%.o) | ||||
OUTPUT := is.gb | |||||
$(OUTPUT): $(OFILES) | |||||
.PHONY: clean | |||||
is.gb is.gb.sym: $(IMGFILES) $(OFILES) | |||||
rgblink -o $@ -n $@.sym $(OFILES) | rgblink -o $@ -n $@.sym $(OFILES) | ||||
rgbfix -v $@ | rgbfix -v $@ | ||||
$(OFILES): $(IMGFILES) | |||||
%.o: %.s | %.o: %.s | ||||
rgbasm -o $@ $< | |||||
rgbasm -o $@ $< | |||||
%.2bpp: %.png | |||||
rgbgfx -o $@ $< | |||||
clean: | |||||
rm -f is.gb is.gb.sym $(IMGFILES) $(OFILES) |
@ -0,0 +1,43 @@ | |||||
INCLUDE "hardware.inc" | |||||
Section "Player Data", WRAM0 | |||||
playerWorldX: dw | |||||
playerWorldY: dw | |||||
; Sprite data | |||||
playerScreenX: db | |||||
playerScreenY: db | |||||
playerTileIndex: db | |||||
playerFlags: db | |||||
Section "Player Code", ROM0 | |||||
spriteData: | |||||
INCBIN "png/player.2bpp" | |||||
PlayerInit:: | |||||
ld a, 8 | |||||
ld hl, playerScreenX | |||||
ld [hl], a | |||||
ld bc, _VRAM8800 | |||||
ld hl, spriteData | |||||
ld d, 16 | |||||
call memcpy | |||||
ld hl, playerScreenX | |||||
ld a, 8 | |||||
ld [hli], a | |||||
ld a, 144-8*3 | |||||
ld [hli], a | |||||
ld bc, _OAMRAM | |||||
ld hl, playerScreenX | |||||
ld d, 4 | |||||
call memcpy | |||||
ret | |||||
PlayerDraw:: | |||||
ret |
@ -0,0 +1,13 @@ | |||||
SECTION "Utilities", ROM0 | |||||
; Copies data between two regions | |||||
; @param d Size (in bytes) to copy. Must be >0 | |||||
; @param bc Pointer to the destination region | |||||
; @param hl Pointer to the source region | |||||
memcpy:: | |||||
ld a, [hli] | |||||
ld [bc], a | |||||
inc bc | |||||
dec d | |||||
jr nz, memcpy | |||||
ret |