vblank_wait: vblank wait was not calling ret
#include "tiles.inc"
#include "video.s"
+#include "mem.s"
; fill bank
.fill 0, 0x7FFF - $
--- /dev/null
+; copies memory from one location to another
+; inputs:
+; de: source
+; hl: destination
+; bc: length
+memcpy:
+ @loop:
+ ld a, [de]
+ ld [hl+], a
+
+ inc de
+ dec bc
+ ld a, b
+ or a, c
+ jp nz, @loop
+
+ ret
ld a, [RLY]
cp a, 144
jp c, vblank_wait
+ ret
lcd_off:
; *never* turn off LCD without waiting
copy_tiles:
ld de, tileset0
- ld hl, VRAM9000
+ ld hl, VRAM
ld bc, tileset0_end - tileset0
-@loop:
-
- ld a, [de]
- ld [hl+], a
+ call memcpy
- inc de
- dec bc
- ld a, b
- or a, c
- jp nz, @loop
+ ld de, tileset1
+ ld hl, VRAM9000
+ ld bc, tileset1_end - tileset1
+ call memcpy
ret