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