mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-06-07 21:29:31 +00:00
Proof of concept for palette fader
This commit is contained in:
parent
b8a35d4d26
commit
9ea2a14a2b
2
loader.s
2
loader.s
|
@ -286,6 +286,8 @@ mainContinue2:
|
||||||
lda #returnToProDOS
|
lda #returnToProDOS
|
||||||
sta PRODOSRETURN
|
sta PRODOSRETURN
|
||||||
|
|
||||||
|
jsr paletteFade
|
||||||
|
|
||||||
jml MAINENTRY
|
jml MAINENTRY
|
||||||
|
|
||||||
returnToProDOS:
|
returnToProDOS:
|
||||||
|
|
163
loaderGraphics.s
163
loaderGraphics.s
|
@ -109,6 +109,124 @@ setPaletteLoop_SMC:
|
||||||
RESTORE_XY
|
RESTORE_XY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; setPaletteColor
|
||||||
|
; Set a single color in a palette
|
||||||
|
; PARAML0 = 0:Color index
|
||||||
|
; PARAML1 = 0:R:G:B
|
||||||
|
; A = Palette index
|
||||||
|
;
|
||||||
|
setPaletteColor:
|
||||||
|
phx
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
sta SCRATCHL
|
||||||
|
lda PARAML0
|
||||||
|
asl
|
||||||
|
clc
|
||||||
|
adc SCRATCHL
|
||||||
|
tax
|
||||||
|
lda PARAML1
|
||||||
|
sta $e19e00,x
|
||||||
|
plx
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; getPaletteColor
|
||||||
|
; Reads a single color from a palette
|
||||||
|
; X = Color index
|
||||||
|
; A = Palette index
|
||||||
|
; A => Color value 0:R:G:B
|
||||||
|
;
|
||||||
|
getPaletteColor:
|
||||||
|
phx
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
sta SCRATCHL
|
||||||
|
txa
|
||||||
|
asl
|
||||||
|
clc
|
||||||
|
adc SCRATCHL
|
||||||
|
tax
|
||||||
|
lda $e19e00,x
|
||||||
|
plx
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; paletteFade
|
||||||
|
;
|
||||||
|
; PARAML2 = targetPalette
|
||||||
|
;
|
||||||
|
paletteFade:
|
||||||
|
ldy #$f
|
||||||
|
|
||||||
|
paletteFadeTimeLoop:
|
||||||
|
ldx #$f
|
||||||
|
|
||||||
|
paletteFadeColorLoop:
|
||||||
|
lda #0
|
||||||
|
jsr getPaletteColor
|
||||||
|
cmp #0
|
||||||
|
beq paletteFadeColorLoopSkipColor
|
||||||
|
|
||||||
|
pha ; Fade red channel
|
||||||
|
and #$0F00
|
||||||
|
beq paletteFadeColorLoopSkipR
|
||||||
|
pla
|
||||||
|
sec
|
||||||
|
sbc #$0100
|
||||||
|
bra paletteFadeColorLoopG
|
||||||
|
|
||||||
|
paletteFadeColorLoopSkipR:
|
||||||
|
pla
|
||||||
|
|
||||||
|
paletteFadeColorLoopG:
|
||||||
|
pha ; Fade green channel
|
||||||
|
and #$00F0
|
||||||
|
beq paletteFadeColorLoopSkipG
|
||||||
|
pla
|
||||||
|
sec
|
||||||
|
sbc #$0010
|
||||||
|
bra paletteFadeColorLoopB
|
||||||
|
|
||||||
|
paletteFadeColorLoopSkipG:
|
||||||
|
pla
|
||||||
|
|
||||||
|
paletteFadeColorLoopB:
|
||||||
|
pha ; Fade blue channel
|
||||||
|
and #$000F
|
||||||
|
beq paletteFadeColorLoopSkipB
|
||||||
|
pla
|
||||||
|
dec
|
||||||
|
bra paletteFadeColorLoopStore
|
||||||
|
|
||||||
|
paletteFadeColorLoopSkipB:
|
||||||
|
pla
|
||||||
|
|
||||||
|
paletteFadeColorLoopStore:
|
||||||
|
stx PARAML0
|
||||||
|
sta PARAML1
|
||||||
|
lda #0
|
||||||
|
jsr setPaletteColor
|
||||||
|
|
||||||
|
paletteFadeColorLoopSkipColor:
|
||||||
|
dex
|
||||||
|
bpl paletteFadeColorLoop
|
||||||
|
jsr delayMedium
|
||||||
|
dey
|
||||||
|
bpl paletteFadeTimeLoop
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; Vertical blank checkers
|
; Vertical blank checkers
|
||||||
;
|
;
|
||||||
|
@ -162,3 +280,48 @@ waitVBLToStart:
|
||||||
|
|
||||||
BITS16
|
BITS16
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; delayShort
|
||||||
|
; Sleeps for a teeny bit
|
||||||
|
;
|
||||||
|
delayShort:
|
||||||
|
SAVE_AXY
|
||||||
|
|
||||||
|
ldy #$01 ; Loop a bit
|
||||||
|
delayShortOuter:
|
||||||
|
ldx #$ff
|
||||||
|
delayShortInner:
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
dex
|
||||||
|
bne delayShortInner
|
||||||
|
dey
|
||||||
|
bne delayShortOuter
|
||||||
|
|
||||||
|
RESTORE_AXY
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; delayMedium
|
||||||
|
; Sleeps for medium time (about 0.25 sec, but not calculated as such)
|
||||||
|
;
|
||||||
|
delayMedium:
|
||||||
|
SAVE_AX
|
||||||
|
|
||||||
|
ldx #$50
|
||||||
|
delayMediumInner:
|
||||||
|
jsr delayShort
|
||||||
|
dex
|
||||||
|
bne delayMediumInner
|
||||||
|
|
||||||
|
RESTORE_AX
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
BORDER = $FF
|
BORDER = $FF
|
||||||
|
BORDERL = $0F
|
||||||
|
BORDERR = $F0
|
||||||
FILL = $22
|
FILL = $22
|
||||||
EMPTY = $ee
|
EMPTY = $ee
|
||||||
|
|
||||||
|
@ -46,7 +48,7 @@ renderLoadingBar:
|
||||||
ldx currentLoadingBar+CBR_VRAM
|
ldx currentLoadingBar+CBR_VRAM
|
||||||
|
|
||||||
BITS8A
|
BITS8A
|
||||||
lda #BORDER ; Left border
|
lda #BORDERL ; Left border
|
||||||
sta VRAMBANK,x
|
sta VRAMBANK,x
|
||||||
sta VRAMBANK+160,x
|
sta VRAMBANK+160,x
|
||||||
sta VRAMBANK+160*2,x
|
sta VRAMBANK+160*2,x
|
||||||
|
@ -96,7 +98,7 @@ renderLoadingBarFill:
|
||||||
cpy currentLoadingBar+CBR_FINAL
|
cpy currentLoadingBar+CBR_FINAL
|
||||||
bne renderLoadingBarLoop
|
bne renderLoadingBarLoop
|
||||||
|
|
||||||
lda #BORDER ; Right border
|
lda #BORDERR ; Right border
|
||||||
sta VRAMBANK,x
|
sta VRAMBANK,x
|
||||||
sta VRAMBANK+160,x
|
sta VRAMBANK+160,x
|
||||||
sta VRAMBANK+160*2,x
|
sta VRAMBANK+160*2,x
|
||||||
|
|
Loading…
Reference in New Issue
Block a user