SHARE
TWEET

Untitled

a guest Aug 30th, 2018 26 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;-------------------------------------------
  2. Pal_AddSub_Val = $0D
  3. Pal_WaitFrames = $0E ;Store vblank frames
  4. Pal_DirType    = $0F ;add/sub 10-30 to colors
  5.  
  6. ;restore palette from black to original
  7. Restore_Palette
  8.     lda #$30
  9.     ldx #$F0
  10.     bne .Store_Direction
  11.  
  12. ;fade palette to black
  13. Fadeout_Palette
  14.     lda #$10
  15.     tax
  16. .Store_Direction
  17.     stx Pal_AddSub_Val
  18.  
  19. ;main palette fade processing here
  20. .Proc_PalFade
  21.     sta Pal_DirType
  22.     ldy #$04    ;update once per 4 frames
  23.     sty Pal_WaitFrames
  24.     ldy #$1F    ;full sprite/bg pals
  25. .loop_UpdatePal
  26.     lda $620,y  ;get old/prev pal state
  27.     sec
  28.     sbc Pal_DirType
  29.     bpl .Store_PalCol
  30.     lda #$0F    ;black color
  31. .Store_PalCol
  32.     sta $600,y  ;store current pal state
  33.     dey
  34.     bpl .loop_UpdatePal
  35.     sty ColorTrig
  36. .loop_PalDelay
  37.     jsr WaitVblank
  38.     dec Pal_WaitFrames
  39.     bne .loop_PalDelay
  40.  
  41. ;next pal fade cycle
  42.     lda Pal_DirType
  43.     clc
  44.     adc Pal_AddSub_Val
  45.     bmi .PalFade_RTS
  46.     cmp #$50
  47.     bne .Proc_PalFade
  48. .PalFade_RTS
  49.     rts         ;exit routine
  50. ;-------------------------------------------
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top