I'm trying to figure out how to cycle between pallets by pressing select. I am able to swap the pallets, but not how I want it to. I declared "dcolors" a variable in the "user variables" tab and set it to 6. My idea was to set it to 6 and every time you pressed select it would subtract 1 from the variable and when the variable reaches 1 it goes back up to 6. I made some progress, the colors do swap, but I just cant seem to figure it out how to make it work properly. It only cycles through them 2 times, and it doesn't seem to go to the green pallet at all. The only reason it is green is because that is the starting pallet I chose in the program.
Here is my code so far:
I have a basic understanding of coding C++ from my Arduino projects, so I know what I want to do, but I just don't know how to tell it to do it. ASM seems so much more complicated than I originally thought
Here is my code so far:
Code:
LDA dcolors
DEC dcolors
LDA dcolors
CMP #$01
BEQ +
ADC dcolors
ADC dcolors
ADC dcolors
ADC dcolors
ADC dcolors
++
LDA dcolors
CMP #$04
BEQ +
LDA #$0F ; black
STA spritePalFade+0 ; 1st sprite palette, 1st color
LDA #$16 ; Light Red
STA spritePalFade+1 ; 1st sprite palette, 2nd color
LDA #$38 ; Tan
STA spritePalFade+2 ; 1st sprite palette, 3rd color
LDA #$06 ; Dark Red
STA spritePalFade+3 ; 1st sprite palette, 4th color
LDA #$01
STA updatePalettes
RTS
+
LDA dcolors
CMP #$06
BEQ +
LDA #$0F ; black
STA spritePalFade+0 ; 1st sprite palette, 1st color
LDA #$14 ; Light Purple
STA spritePalFade+1 ; 1st sprite palette, 2nd color
LDA #$38 ; Tan
STA spritePalFade+2 ; 1st sprite palette, 3rd color
LDA #$04 ; Dark Purple
STA spritePalFade+3 ; 1st sprite palette, 4th color
LDA #$01
STA updatePalettes
RTS
+
LDA dcolors
CMP #$02
BEQ +
LDA #$0F ; black
STA spritePalFade+0 ; 1st sprite palette, 1st color
LDA #$2A ; Light Green
STA spritePalFade+1 ; 1st sprite palette, 2nd color
LDA #$38 ; Tan
STA spritePalFade+2 ; 1st sprite palette, 3rd color
LDA #$1A ; Dark Green
STA spritePalFade+3 ; 1st sprite palette, 4th color
LDA #$01
STA updatePalettes
RTS
+
I have a basic understanding of coding C++ from my Arduino projects, so I know what I want to do, but I just don't know how to tell it to do it. ASM seems so much more complicated than I originally thought