#define LCDCF_BGON 0b00000001
#define LCDCF_ON 0b10000000
#define LCDCF_OBJON 0b00000010
+#define LCDCF_TILE_BANK 0b00010000
#define LCDF_WINDOWON 0b00100000
#define LCDF_OBJ_SIZE 0b00000100
#define LCDF_WINBANKSELECT 0b01000000
#define BGP 0b11100100
+#define BG_CYCLE_FRAMES 7
+
; vblank handler
vblank:
; dma previous frame's oam
call scroll_write
+ ; cycle bg tiles for animations
+ ld a, [frame_count]
+ and a, BG_CYCLE_FRAMES
+ jr z, @skip_cycle REL
+
+ ld a, [RLCD]
+ xor a, LCDCF_TILE_BANK
+ ld [RLCD], a
+@skip_cycle:
+
ld a, 1
ld [frame_ready], a
ret