#### AllDarnDavey

##### Active member

Split it into background and sprite fade versions.

Fade background palettes to black

Code:

```
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; do fading to black for background pals - code by dale_coop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDX #$00
doFadeCurrentBckPal:
LDA bckPal,x ;; loads joes pallete for background (0-3) (4-7) (8-11) (12-15) 4,8,and 12 is not needed since its the same bgcolor as 0
CMP #$10 ;; compares 10
BCC + ;; if less than 10 skip to p1, if not continue below
SEC ;; needs for subtraction
SBC #$10 ;; subtract #$10
STA bckPal,x ;; store it back into pallete
JMP goNextBckPal;; jump to the next pal2
+
LDA #$0F ;; set accumalator to 0F which is (black)
STA bckPal,x ;; store it into pallete
goNextBckPal:
INX
CPX #4
BEQ goNextBckPal
CPX #8
BEQ goNextBckPal
CPX #12
BEQ goNextBckPal
CPX #16
BCC doFadeCurrentBckPal
LDA #$01
STA updateScreenData
RTS
```

Fade Sprites to black

Code:

```
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; do fading to black for sprite pals - code by dale_coop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDX #$00
doFadeCurrentSpritePal:
LDA spritePalFade,x ;; loads joes pallete for background (0-3) (4-7) (8-11) (12-15) 4,8,and 12 is not needed since its the same color as 0
CMP #$10 ;; compares 10
BCC + ;; if less than 10 skip to p1, if not continue below
SEC ;; needs for subtraction
SBC #$10 ;; subtract #$10
STA spritePalFade,x ;; store it back into pallete
JMP goNextSpritePal;; jump to the next pal2
+
LDA #$0F ;; set accumalator to 0F which is (black)
STA spritePalFade,x ;; store it into pallete
goNextSpritePal:
INX
CPX #4
BEQ goNextSpritePal
CPX #8
BEQ goNextSpritePal
CPX #12
BEQ goNextSpritePal
CPX #16
BCC doFadeCurrentSpritePal
LDA #$01
STA updateScreenData
RTS
```