JSR handlePaletteCycleTimer
LDA gameTimerTicks
CLC
ADC #$01 ;; change this to how fast you want the timer to run.
STA gameTimerTicks
LDA gameTimerLo
ADC #$00
STA gameTimerLo
LDA gameTimerHi
ADC #$00
STA gameTimerHi
JMP ++
handlePaletteCycleTimer:
;WE DONT USE SPECIAL SCREENS ANYMORE
;; Pal cycling on "Medium"-speed screens :
LDA screenSpeed
CMP #$01
BEQ doPaletteCycleTimer
;; another example, Pal cycling on screen type 255 screens :
;LDA screenType
;CMP #255
;BEQ doPaletteCycleTimer
JMP endPaletteCycleTimer
doPaletteCycleTimer:
;; from here, DO the palette cycle:
LDA palettesCycleTimer
BNE dontUpdatePaletteCycleTimer
LDA #$A0 ;; HERE !!! the SPEED of the cycling
STA palettesCycleTimer
LDA cycleDir
BNE pickPaletteToCycle
LDA cycleDir
BEQ pickPaletteToCycle2
decreaseCycle:
DEC cycleStage
dontUpdatePaletteCycleTimer:
DEC palettesCycleTimer
endPaletteCycleTimer:
RTS
pickPaletteToCycle:
LDA #$02 ;; HERE !!! the "Sub 3" palette
ASL
ASL ;; these multiply your literal or variable with 4 so we can get the right offset for each palette in increments of 4.
TAX
LDY bckPal+1,x ;; pocket colour 1 in reg y
LDA bckPal+2,x
STA bckPal+1,x ;; move colour 2 to 1
LDA bckPal+3,x
STA bckPal+2,x ;; move colour 3 to 2
TYA
STA bckPal+3,x ;; move pocket
to 3
LDA #$01
STA updateScreenData ;; loading anything but zero into this value tells NESmaker it needs to update palettes.
LDA cycleStage
BNE decreaseCycle
LDA #$01
STA cycleStage
LDA cycleDir
EOR #$01
STA cycleDir
RTS
pickPaletteToCycle2:
LDA #$02 ;; HERE !!! the "Sub 3" palette
ASL
ASL ;; these multiply your literal or variable with 4 so we can get the right offset for each palette in increments of 4.
TAX
LDY bckPal+2,x ;; pocket colour 1 in reg y
LDA bckPal+1,x
STA bckPal+2,x ;; move colour 2 to 1
LDA bckPal+3,x
STA bckPal+1,x ;; move colour 3 to 2
TYA
STA bckPal+3,x ;; move pocket
to 3
LDA #$01
STA updateScreenData ;; loading anything but zero into this value tells NESmaker it needs to update palettes.
LDA cycleStage
BNE decreaseCycle
LDA #$01
STA cycleStage
LDA cycleDir
EOR #$01
STA cycleDir
RTS
++