VBlank increments counter in memory

And changes palette based on that
This commit is contained in:
greg 2016-12-16 00:43:24 -08:00
parent 5b00976269
commit 771628a1ab

View File

@ -4,6 +4,7 @@
.EQU PalNum $0000
.EQU VBlankCount $0010
.BANK 0 SLOT 0
.org 0
@ -13,17 +14,11 @@ VBlank:
Set_A_8_XY_16
stz $2115
ldx #$0400 ;setup VRAM
ldx #$0400
stx $2116 ; VRAM address
lda PalNum
sta $2119
lda VBlankCount
ina
sta VBlankCount
lda $4210 ; clear NMI flag
rti
.ENDS
@ -72,8 +67,8 @@ Start:
stz PalNum
Load_Palette_Color $00, $00
Load_Palette_Color $00, $00
Load_Palette_Color $00, $00
Load_Palette_Color $00, $0f
Load_Palette_Color $00, $ff
Load_Palette_Color $ff, $0a
Set_Screen_Brightness %00001111
@ -105,26 +100,31 @@ Start:
mainloop:
wai
wai
wai
wai
wai
wai
wai
wai
wai
wai
wai
wai
lda PalNum
clc
adc #$04
and #$1c
sta PalNum
lda VBlankCount
beq SetBack
sbc #$80
beq SetDifferent
jmp mainloop
SetBack:
Reset_Palette_Offset
Load_Palette_Color $00, $00
Load_Palette_Color $00, $0f
Load_Palette_Color $00, $ff
Load_Palette_Color $ff, $0a
jmp mainloop
SetDifferent:
Reset_Palette_Offset
Load_Palette_Color $0f, $f0
Load_Palette_Color $00, $0f
Load_Palette_Color $0a, $00
Load_Palette_Color $00, $00
jmp mainloop
.ENDS