From 1c5087c830f290f3e88996fc1594d94abc1e3f22 Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 19 Apr 2016 11:48:18 +0100 Subject: Fixs to GB 16-bit register load op and others --- src/example/Makefile | 4 +-- src/example/gb.asm | 76 +++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 57 insertions(+), 23 deletions(-) (limited to 'src/example') diff --git a/src/example/Makefile b/src/example/Makefile index 906bb44..f83d006 100644 --- a/src/example/Makefile +++ b/src/example/Makefile @@ -20,7 +20,7 @@ # Makefile for examples # -ALL = spectrum.tap c64.t64 zx81.p gb.rom vcs.bin +ALL = spectrum.tap c64.t64 zx81.p gb.gb vcs.bin CASM = ../casm all: $(ALL) $(CASM) @@ -39,7 +39,7 @@ c64.t64: c64.asm $(CASM) zx81.p: zx81.asm $(CASM) $(CASM) zx81.asm -gb.rom: gb.asm $(CASM) +gb.gb: gb.asm $(CASM) $(CASM) gb.asm vcs.bin: vcs.asm $(CASM) diff --git a/src/example/gb.asm b/src/example/gb.asm index ddefadb..10381e9 100644 --- a/src/example/gb.asm +++ b/src/example/gb.asm @@ -4,7 +4,7 @@ option output-file,gb.gb option output-format,gameboy - option gameboy-irq,vbl,vbl_code + ;option gameboy-irq,vbl,vbl_code VRAM equ $8000 SCRN equ $9800 @@ -20,13 +20,13 @@ READY equ $ff81 XPOS equ $ff82 VBLANK macro -; push af -;.wait -; ldh a,(CURLINE) -; cp 144 -; jr nz,wait -; -; pop af + push af +.wait + ldh a,(CURLINE) + cp 144 + jr nz,wait + + pop af endm @@ -60,7 +60,7 @@ VBLANK macro ; ld hl,VRAM ld de,sprite - ld a,16 + ld c,16 VBLANK @@ -68,16 +68,48 @@ VBLANK macro ld a,(de) ld (hl+),a inc de - dec a + dec c jr nz,copy ld a,1 ldh (READY),a -.idle ei - halt - nop + + VBLANK + + ; Set sprite numbers + ; + xor a + ld (OAM+2),a + ld (OAM+6),a + ld (OAM+10),a + + ; Set sprite flags + ; + ld a,$80 + ld (OAM+3),a + ld (OAM+7),a + ld (OAM+11),a + +.idle + VBLANK + + ldh a,(XPOS) + inc a + ldh (XPOS),a + + ld (OAM),a + ld (OAM+1),a + + add 20 + ld (OAM+4),a + ld (OAM+5),a + + add 33 + ld (OAM+8),a + ld (OAM+9),a + jr idle vbl_code: @@ -98,12 +130,14 @@ vbl_code: reti sprite: - defb $ff,00 - defb $ff,00 - defb $ff,00 - defb $ff,00 - defb $ff,00 - defb $ff,00 - defb $ff,00 - defb $ff,00 + defb $ff,$ff + defb $00,00 + defb $ff,$ff + defb $00,00 + defb $ff,$ff + defb $00,00 + defb $ff,$ff + defb $00,00 + defb $ff,$ff + defb $00,00 -- cgit v1.2.3