;; suppose you wanted to change the 3rd sprite palette, and the 2nd background palette
;; You load up the color you want into the accumulator, then store it into spritePalFade/bckPal PLUS the index of the palette color you want to change (0-15)
;; +0-3 = 1st palette
;; +4-7 = 2nd palette
;; +8-11 = 3rd palette
;; +12-15 = 4th palette
LDA #$0F ; black
STA spritePalFade+8 ; 3rd sprite palette, 1st color
LDA #$00 ; dark grey
STA spritePalFade+9 ; 3rd sprite palette, 2nd color
LDA #$10 ; light grey
STA spritePalFade+10 ; 3rd sprite palette, 3rd color
LDA #$20 ; white
STA spritePalFade+11 ; 3rd sprite palette, 4th color
;; Now we do the same for the background palette
LDA #$0F ; black
STA bckPal+4 ; 2nd background palette, 1st color
LDA #$00 ; dark grey
STA bckPal+5 ; 2nd background palette, 2nd color
LDA #$10 ; light grey
STA bckPal+6 ; 2nd background palette, 3rd color
LDA #$20 ; white
STA bckPal+7 ; 2nd background palette, 4th color
;; IMPORTANT!!!
;; Once you've done all the palette changes you want, you're going to load a non-zero number into the variable updatePalettes
;; This will tell the palette update script that runs during vblank to make the appropriate PPU writes
;; If you forget to load a non-zero number into updatePalettes, your palette changes will fail to update, and you will be sad :(
LDA #$01
STA updatePalettes
RTS