mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-02-20 21:29:00 +00:00
Added palette cross-fading
This commit is contained in:
parent
9ea2a14a2b
commit
4b183a0d99
@ -17,6 +17,7 @@
|
|||||||
701E708B2A660CEB0030C35D /* progressBar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = progressBar.s; sourceTree = "<group>"; };
|
701E708B2A660CEB0030C35D /* progressBar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = progressBar.s; sourceTree = "<group>"; };
|
||||||
701E708E2A67844B0030C35D /* loaderGraphics.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loaderGraphics.s; sourceTree = "<group>"; };
|
701E708E2A67844B0030C35D /* loaderGraphics.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loaderGraphics.s; sourceTree = "<group>"; };
|
||||||
701E708F2A69CE520030C35D /* loadingBar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loadingBar.s; sourceTree = "<group>"; };
|
701E708F2A69CE520030C35D /* loadingBar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loadingBar.s; sourceTree = "<group>"; };
|
||||||
|
701E70902A6A23800030C35D /* sharedGraphics.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = sharedGraphics.s; sourceTree = "<group>"; };
|
||||||
705456862A43E03B00A2B866 /* GeneratePixelCircle.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GeneratePixelCircle.py; sourceTree = "<group>"; };
|
705456862A43E03B00A2B866 /* GeneratePixelCircle.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GeneratePixelCircle.py; sourceTree = "<group>"; };
|
||||||
705456882A4D336200A2B866 /* animation.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = animation.s; sourceTree = "<group>"; };
|
705456882A4D336200A2B866 /* animation.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = animation.s; sourceTree = "<group>"; };
|
||||||
7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMTable.py; sourceTree = "<group>"; };
|
7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMTable.py; sourceTree = "<group>"; };
|
||||||
@ -62,8 +63,9 @@
|
|||||||
706DF1641F2D39F700AA6680 /* loader.s */,
|
706DF1641F2D39F700AA6680 /* loader.s */,
|
||||||
701E708E2A67844B0030C35D /* loaderGraphics.s */,
|
701E708E2A67844B0030C35D /* loaderGraphics.s */,
|
||||||
701E708F2A69CE520030C35D /* loadingBar.s */,
|
701E708F2A69CE520030C35D /* loadingBar.s */,
|
||||||
70E9D8611F2BD95400555C19 /* gscats.s */,
|
701E70902A6A23800030C35D /* sharedGraphics.s */,
|
||||||
70E9D8601F2BD95400555C19 /* graphics.s */,
|
70E9D8601F2BD95400555C19 /* graphics.s */,
|
||||||
|
70E9D8611F2BD95400555C19 /* gscats.s */,
|
||||||
70E9D8621F2BD95400555C19 /* macros.s */,
|
70E9D8621F2BD95400555C19 /* macros.s */,
|
||||||
7099E3841F41022100182A82 /* gameobject.s */,
|
7099E3841F41022100182A82 /* gameobject.s */,
|
||||||
70F011D123B989B800C8873F /* random.s */,
|
70F011D123B989B800C8873F /* random.s */,
|
||||||
|
@ -12,13 +12,7 @@ beginGameplay:
|
|||||||
; Initialize random numbers
|
; Initialize random numbers
|
||||||
lda #1
|
lda #1
|
||||||
jsr seedRandom
|
jsr seedRandom
|
||||||
|
|
||||||
; Set up palette for terrain and players
|
|
||||||
lda #basePalette
|
|
||||||
sta PARAML0
|
|
||||||
lda #0
|
|
||||||
jsr setPalette
|
|
||||||
|
|
||||||
; Set up sprite rendering
|
; Set up sprite rendering
|
||||||
BITS8
|
BITS8
|
||||||
lda #3
|
lda #3
|
||||||
@ -57,6 +51,11 @@ beginGameplay:
|
|||||||
jsr compileTerrain
|
jsr compileTerrain
|
||||||
jsr clipTerrain
|
jsr clipTerrain
|
||||||
|
|
||||||
|
; Set up palette for terrain and players
|
||||||
|
lda #basePalette
|
||||||
|
sta PARAML2
|
||||||
|
jsr paletteFade
|
||||||
|
|
||||||
gameplayLoop:
|
gameplayLoop:
|
||||||
lda projectileActive
|
lda projectileActive
|
||||||
bpl gameplayLoopKeyboardSkip
|
bpl gameplayLoopKeyboardSkip
|
||||||
@ -397,7 +396,7 @@ fire:
|
|||||||
|
|
||||||
|
|
||||||
basePalette:
|
basePalette:
|
||||||
.word $0aef,$0080,$0080,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0f00,$0bbb,$ddd,$007b,$0a5b,$0000,$0fff
|
.word $06af,$0072,$0072,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0d00,$0bbb,$ddd,$007b,$0a5b,$0000,$0fff
|
||||||
|
|
||||||
|
|
||||||
quitRequested:
|
quitRequested:
|
||||||
|
82
graphics.s
82
graphics.s
@ -151,68 +151,6 @@ disableFillMode:
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; setPaletteColor
|
|
||||||
; Set a single color in a palette
|
|
||||||
; PARAML0 = 0:Color index
|
|
||||||
; PARAML1 = 0:R:G:B
|
|
||||||
; A = Palette index
|
|
||||||
;
|
|
||||||
; Trashes X
|
|
||||||
|
|
||||||
setPaletteColor:
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
sta SCRATCHL
|
|
||||||
lda PARAML0
|
|
||||||
asl
|
|
||||||
clc
|
|
||||||
adc SCRATCHL
|
|
||||||
tax
|
|
||||||
lda PARAML1
|
|
||||||
sta $e19e00,x
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; setPalette
|
|
||||||
; Set all colors in a palette from memory
|
|
||||||
; PARAML0 = Pointer to 32 color bytes
|
|
||||||
; A = Palette index
|
|
||||||
;
|
|
||||||
setPalette:
|
|
||||||
SAVE_XY
|
|
||||||
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
BITS8A
|
|
||||||
sta setPaletteLoop_SMC+1
|
|
||||||
BITS16
|
|
||||||
ldx #0
|
|
||||||
ldy #0
|
|
||||||
|
|
||||||
setPaletteLoop:
|
|
||||||
lda (PARAML0),y
|
|
||||||
setPaletteLoop_SMC:
|
|
||||||
sta $e19e00,x ; Self-modifying code!
|
|
||||||
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
inx
|
|
||||||
inx
|
|
||||||
cpx #32
|
|
||||||
bne setPaletteLoop
|
|
||||||
|
|
||||||
RESTORE_XY
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; drawNumber
|
; drawNumber
|
||||||
;
|
;
|
||||||
@ -254,25 +192,10 @@ drawSpriteBankSafe:
|
|||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; BORDER_COLOR
|
; Alternate vertical blank checkers
|
||||||
;
|
|
||||||
; Trashes A
|
|
||||||
;
|
|
||||||
.macro BORDER_COLOR color
|
|
||||||
SAVE_AXY
|
|
||||||
BITS8
|
|
||||||
lda BORDERCOLOR
|
|
||||||
and #$f0
|
|
||||||
ora color
|
|
||||||
sta BORDERCOLOR
|
|
||||||
BITS16
|
|
||||||
RESTORE_AXY
|
|
||||||
.endmacro
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; Vertical blank checkers
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
.if 0
|
||||||
; The Brutal Deluxe version, taken from LemminGS
|
; The Brutal Deluxe version, taken from LemminGS
|
||||||
;
|
;
|
||||||
nextVBL:
|
nextVBL:
|
||||||
@ -322,5 +245,6 @@ waitVBLToStart:
|
|||||||
|
|
||||||
BITS16
|
BITS16
|
||||||
rts
|
rts
|
||||||
|
.endif
|
||||||
|
|
||||||
.include "spritebank.s"
|
.include "spritebank.s"
|
||||||
|
3
gscats.s
3
gscats.s
@ -20,7 +20,7 @@ mainBank2:
|
|||||||
BITS8
|
BITS8
|
||||||
lda #$f0
|
lda #$f0
|
||||||
sta TEXTCOLOR
|
sta TEXTCOLOR
|
||||||
BITS16
|
BITS16
|
||||||
|
|
||||||
jmp beginGameplay
|
jmp beginGameplay
|
||||||
|
|
||||||
@ -31,6 +31,7 @@ quitGame:
|
|||||||
|
|
||||||
|
|
||||||
.include "random.s"
|
.include "random.s"
|
||||||
|
.include "sharedGraphics.s"
|
||||||
.include "graphics.s"
|
.include "graphics.s"
|
||||||
.include "sound.s"
|
.include "sound.s"
|
||||||
.include "animation.s"
|
.include "animation.s"
|
||||||
|
43
loader.s
43
loader.s
@ -18,22 +18,6 @@ MAINENTRY = $020000
|
|||||||
|
|
||||||
.org $800
|
.org $800
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; BORDER_COLOR
|
|
||||||
;
|
|
||||||
; Trashes A
|
|
||||||
;
|
|
||||||
.macro BORDER_COLOR color
|
|
||||||
SAVE_AXY
|
|
||||||
BITS8
|
|
||||||
lda BORDERCOLOR
|
|
||||||
and #$f0
|
|
||||||
ora color
|
|
||||||
sta BORDERCOLOR
|
|
||||||
BITS16
|
|
||||||
RESTORE_AXY
|
|
||||||
.endmacro
|
|
||||||
|
|
||||||
LOADSTEP = 3
|
LOADSTEP = 3
|
||||||
|
|
||||||
.macro addProgress amount
|
.macro addProgress amount
|
||||||
@ -45,8 +29,6 @@ LOADSTEP = 3
|
|||||||
main:
|
main:
|
||||||
BITS16
|
BITS16
|
||||||
NATIVE
|
NATIVE
|
||||||
SHRVIDEO
|
|
||||||
SHADOWMEMORY
|
|
||||||
|
|
||||||
; Cache system colors
|
; Cache system colors
|
||||||
BITS8
|
BITS8
|
||||||
@ -286,6 +268,8 @@ mainContinue2:
|
|||||||
lda #returnToProDOS
|
lda #returnToProDOS
|
||||||
sta PRODOSRETURN
|
sta PRODOSRETURN
|
||||||
|
|
||||||
|
lda #skyPalette
|
||||||
|
sta PARAML2
|
||||||
jsr paletteFade
|
jsr paletteFade
|
||||||
|
|
||||||
jml MAINENTRY
|
jml MAINENTRY
|
||||||
@ -410,27 +394,6 @@ soundPath:
|
|||||||
fontPath:
|
fontPath:
|
||||||
pstring "/GSAPP/FONTBANK"
|
pstring "/GSAPP/FONTBANK"
|
||||||
|
|
||||||
|
.include "sharedGraphics.s"
|
||||||
loaderPalette:
|
|
||||||
.word $0aef,$06af,$0800,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0f00,$0bbb,$ddd,$007b,$0a5b,$0000,$0fff
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; showLoadingScreen
|
|
||||||
;
|
|
||||||
;
|
|
||||||
showLoadingScreen:
|
|
||||||
lda #loaderPalette
|
|
||||||
sta PARAML0
|
|
||||||
lda #0
|
|
||||||
jsr setPalette
|
|
||||||
; jsr initSCBs
|
|
||||||
BORDER_COLOR #$7
|
|
||||||
lda #$1111
|
|
||||||
jsr slowColorFill
|
|
||||||
jsr renderLoadingBar
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.include "loaderGraphics.s"
|
.include "loaderGraphics.s"
|
||||||
.include "loadingBar.s"
|
.include "loadingBar.s"
|
||||||
|
318
loaderGraphics.s
318
loaderGraphics.s
@ -1,3 +1,27 @@
|
|||||||
|
loaderPalette:
|
||||||
|
.word $0aef,$06af,$0800,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0f00,$0bbb,$0ddd,$007b,$0a5b,$0000,$0fff
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; showLoadingScreen
|
||||||
|
;
|
||||||
|
;
|
||||||
|
showLoadingScreen:
|
||||||
|
lda #$0000
|
||||||
|
jsr slowColorFill
|
||||||
|
SHRVIDEO
|
||||||
|
SHADOWMEMORY
|
||||||
|
lda #loaderPalette
|
||||||
|
sta PARAML0
|
||||||
|
lda #0
|
||||||
|
jsr setPalette
|
||||||
|
BORDER_COLOR #$7
|
||||||
|
lda #$1111
|
||||||
|
jsr slowColorFill
|
||||||
|
jsr renderLoadingBar
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; slowColorFill
|
; slowColorFill
|
||||||
; Fills the screen with a color (or two). Slow because it has to run from
|
; Fills the screen with a color (or two). Slow because it has to run from
|
||||||
@ -31,297 +55,3 @@ slowColorFillLoop:
|
|||||||
|
|
||||||
slowColorFillLoopDone:
|
slowColorFillLoopDone:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; initSCBs
|
|
||||||
; Initialize all scanline control bytes
|
|
||||||
;
|
|
||||||
; Trashes A,X
|
|
||||||
|
|
||||||
initSCBs:
|
|
||||||
lda #0
|
|
||||||
ldx #$0100 ;set all $100 scbs to A
|
|
||||||
|
|
||||||
initSCBsLoop:
|
|
||||||
dex
|
|
||||||
dex
|
|
||||||
sta $e19d00,x
|
|
||||||
bne initSCBsLoop
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; setScanlinePalette
|
|
||||||
; Set the palette for a given scan line
|
|
||||||
;
|
|
||||||
; PARAML0 = Palette index
|
|
||||||
; X = Start scan line
|
|
||||||
; Y = Count
|
|
||||||
|
|
||||||
setScanlinePalette:
|
|
||||||
pha
|
|
||||||
|
|
||||||
setScanlinePaletteLoop:
|
|
||||||
lda $e19d00,x
|
|
||||||
ora PARAML0
|
|
||||||
sta $e19d00,x
|
|
||||||
inx
|
|
||||||
dey
|
|
||||||
bne setScanlinePaletteLoop
|
|
||||||
|
|
||||||
pla
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; setPalette
|
|
||||||
; Set all colors in a palette from memory
|
|
||||||
; PARAML0 = Pointer to 32 color bytes
|
|
||||||
; A = Palette index
|
|
||||||
;
|
|
||||||
setPalette:
|
|
||||||
SAVE_XY
|
|
||||||
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
BITS8A
|
|
||||||
sta setPaletteLoop_SMC+1
|
|
||||||
BITS16
|
|
||||||
ldx #0
|
|
||||||
ldy #0
|
|
||||||
|
|
||||||
setPaletteLoop:
|
|
||||||
lda (PARAML0),y
|
|
||||||
setPaletteLoop_SMC:
|
|
||||||
sta $e19e00,x ; Self-modifying code!
|
|
||||||
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
inx
|
|
||||||
inx
|
|
||||||
cpx #32
|
|
||||||
bne setPaletteLoop
|
|
||||||
|
|
||||||
RESTORE_XY
|
|
||||||
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
|
|
||||||
;
|
|
||||||
|
|
||||||
; The Brutal Deluxe version, taken from LemminGS
|
|
||||||
;
|
|
||||||
nextVBL:
|
|
||||||
lda #75
|
|
||||||
pha
|
|
||||||
nextVBL0:
|
|
||||||
lda $e0c02e
|
|
||||||
and #$7f
|
|
||||||
cmp 1,s
|
|
||||||
blt nextVBL0
|
|
||||||
cmp #100
|
|
||||||
bge nextVBL0
|
|
||||||
pla
|
|
||||||
waitVBL:
|
|
||||||
lda $e0c018
|
|
||||||
bpl waitVBL
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
; The Apple version, taken from GS Tech Note 039
|
|
||||||
;
|
|
||||||
syncVBL:
|
|
||||||
;sei
|
|
||||||
BITS8
|
|
||||||
syncVBL0:
|
|
||||||
ldaA $C02f
|
|
||||||
asl ; VA is now in the Carry flag
|
|
||||||
ldaA $C02e
|
|
||||||
rol ; Roll Carry into bit 0
|
|
||||||
cmp #200 ; A now contains line number
|
|
||||||
blt syncVBL0
|
|
||||||
BITS16
|
|
||||||
;cli
|
|
||||||
rts
|
|
||||||
|
|
||||||
; The old style //e version
|
|
||||||
;
|
|
||||||
vblSync:
|
|
||||||
BITS8
|
|
||||||
|
|
||||||
waitVBLToFinish:
|
|
||||||
lda $E0C019
|
|
||||||
bmi waitVBLToFinish
|
|
||||||
waitVBLToStart:
|
|
||||||
lda $E0C019
|
|
||||||
bpl waitVBLToStart
|
|
||||||
|
|
||||||
BITS16
|
|
||||||
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,8 +6,8 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
BORDER = $FF
|
BORDER = $FF
|
||||||
BORDERL = $0F
|
BORDERL = $1F
|
||||||
BORDERR = $F0
|
BORDERR = $F1
|
||||||
FILL = $22
|
FILL = $22
|
||||||
EMPTY = $ee
|
EMPTY = $ee
|
||||||
|
|
||||||
|
278
sharedGraphics.s
Normal file
278
sharedGraphics.s
Normal file
@ -0,0 +1,278 @@
|
|||||||
|
skyPalette:
|
||||||
|
.word $06af,$06af,$06af,$06af,$06af,$06af,$06af,$06af,$06af,$06af,$06af,$06af,$06af,$06af,$06af,$06af
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; BORDER_COLOR
|
||||||
|
;
|
||||||
|
; Trashes A
|
||||||
|
;
|
||||||
|
.macro BORDER_COLOR color
|
||||||
|
SAVE_AXY
|
||||||
|
BITS8
|
||||||
|
lda BORDERCOLOR
|
||||||
|
and #$f0
|
||||||
|
ora color
|
||||||
|
sta BORDERCOLOR
|
||||||
|
BITS16
|
||||||
|
RESTORE_AXY
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; setPalette
|
||||||
|
; Set all colors in a palette from memory
|
||||||
|
; PARAML0 = Pointer to 32 color bytes
|
||||||
|
; A = Palette index
|
||||||
|
;
|
||||||
|
setPalette:
|
||||||
|
SAVE_XY
|
||||||
|
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
BITS8A
|
||||||
|
sta setPaletteLoop_SMC+1
|
||||||
|
BITS16
|
||||||
|
ldx #0
|
||||||
|
ldy #0
|
||||||
|
|
||||||
|
setPaletteLoop:
|
||||||
|
lda (PARAML0),y
|
||||||
|
setPaletteLoop_SMC:
|
||||||
|
sta $e19e00,x ; Self-modifying code!
|
||||||
|
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
inx
|
||||||
|
inx
|
||||||
|
cpx #32
|
||||||
|
bne setPaletteLoop
|
||||||
|
|
||||||
|
RESTORE_XY
|
||||||
|
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
|
||||||
|
; Y = Color index
|
||||||
|
; A = Palette index
|
||||||
|
; A => Color value 0:R:G:B
|
||||||
|
;
|
||||||
|
getPaletteColor:
|
||||||
|
SAVE_XY
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
sta SCRATCHL
|
||||||
|
tya
|
||||||
|
asl
|
||||||
|
clc
|
||||||
|
adc SCRATCHL
|
||||||
|
tax
|
||||||
|
lda $e19e00,x
|
||||||
|
RESTORE_XY
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; paletteFade
|
||||||
|
;
|
||||||
|
; PARAML2 = targetPalette
|
||||||
|
;
|
||||||
|
paletteFade:
|
||||||
|
ldx #$f
|
||||||
|
|
||||||
|
paletteFadeTimeLoop:
|
||||||
|
ldy #$f
|
||||||
|
|
||||||
|
paletteFadeColorLoop:
|
||||||
|
lda #0
|
||||||
|
jsr getPaletteColor
|
||||||
|
sta SCRATCHL2
|
||||||
|
|
||||||
|
phy ; Find target red
|
||||||
|
tya
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
lda (PARAML2),y
|
||||||
|
cmp SCRATCHL2
|
||||||
|
beq paletteFadeColorLoopSkipColor ; Entire color already matches
|
||||||
|
and #$0F00
|
||||||
|
sta SCRATCHL
|
||||||
|
ply
|
||||||
|
|
||||||
|
lda SCRATCHL2 ; Fade red channel
|
||||||
|
and #$0F00
|
||||||
|
cmp SCRATCHL
|
||||||
|
beq paletteFadeColorLoopG
|
||||||
|
bcs paletteFadeColorLoopDecR
|
||||||
|
lda SCRATCHL2
|
||||||
|
clc
|
||||||
|
adc #$0100
|
||||||
|
sta SCRATCHL2
|
||||||
|
bra paletteFadeColorLoopG
|
||||||
|
|
||||||
|
paletteFadeColorLoopDecR:
|
||||||
|
lda SCRATCHL2
|
||||||
|
sec
|
||||||
|
sbc #$0100
|
||||||
|
sta SCRATCHL2
|
||||||
|
|
||||||
|
paletteFadeColorLoopG:
|
||||||
|
phy ; Find target green
|
||||||
|
tya
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
lda (PARAML2),y
|
||||||
|
and #$00F0
|
||||||
|
sta SCRATCHL
|
||||||
|
ply
|
||||||
|
|
||||||
|
lda SCRATCHL2 ; Fade green channel
|
||||||
|
and #$00F0
|
||||||
|
cmp SCRATCHL
|
||||||
|
beq paletteFadeColorLoopB
|
||||||
|
bcs paletteFadeColorLoopDecG
|
||||||
|
lda SCRATCHL2
|
||||||
|
clc
|
||||||
|
adc #$0010
|
||||||
|
sta SCRATCHL2
|
||||||
|
bra paletteFadeColorLoopB
|
||||||
|
|
||||||
|
paletteFadeColorLoopDecG:
|
||||||
|
lda SCRATCHL2
|
||||||
|
sec
|
||||||
|
sbc #$0010
|
||||||
|
sta SCRATCHL2
|
||||||
|
|
||||||
|
paletteFadeColorLoopB:
|
||||||
|
phy ; Find target blue
|
||||||
|
tya
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
lda (PARAML2),y
|
||||||
|
and #$000F
|
||||||
|
sta SCRATCHL
|
||||||
|
ply
|
||||||
|
|
||||||
|
lda SCRATCHL2 ; Fade blue channel
|
||||||
|
and #$000F
|
||||||
|
cmp SCRATCHL
|
||||||
|
beq paletteFadeColorLoopStore
|
||||||
|
bcs paletteFadeColorLoopDecB
|
||||||
|
inc SCRATCHL2
|
||||||
|
bra paletteFadeColorLoopStore
|
||||||
|
|
||||||
|
paletteFadeColorLoopDecB:
|
||||||
|
dec SCRATCHL2
|
||||||
|
|
||||||
|
paletteFadeColorLoopStore:
|
||||||
|
sty PARAML0
|
||||||
|
lda SCRATCHL2
|
||||||
|
sta PARAML1
|
||||||
|
lda #0
|
||||||
|
jsr setPaletteColor
|
||||||
|
bra paletteFadeColorLoopDone
|
||||||
|
|
||||||
|
paletteFadeColorLoopSkipColor:
|
||||||
|
ply
|
||||||
|
|
||||||
|
paletteFadeColorLoopDone:
|
||||||
|
dey
|
||||||
|
bpl paletteFadeColorLoopNext
|
||||||
|
jsr delayFade
|
||||||
|
jsr delayFade
|
||||||
|
jsr delayFade
|
||||||
|
jsr delayFade
|
||||||
|
jsr delayFade
|
||||||
|
dex
|
||||||
|
bpl paletteFadeTimeLoopNext
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
paletteFadeColorLoopNext:
|
||||||
|
jmp paletteFadeColorLoop
|
||||||
|
paletteFadeTimeLoopNext:
|
||||||
|
jmp paletteFadeTimeLoop
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Vertical blank checkers
|
||||||
|
;
|
||||||
|
|
||||||
|
; The Brutal Deluxe version, taken from LemminGS
|
||||||
|
;
|
||||||
|
nextVBL:
|
||||||
|
lda #75
|
||||||
|
pha
|
||||||
|
nextVBL0:
|
||||||
|
lda $e0c02e
|
||||||
|
and #$7f
|
||||||
|
cmp 1,s
|
||||||
|
blt nextVBL0
|
||||||
|
cmp #100
|
||||||
|
bge nextVBL0
|
||||||
|
pla
|
||||||
|
waitVBL:
|
||||||
|
lda $e0c018
|
||||||
|
bpl waitVBL
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; delayFade
|
||||||
|
; Sleeps for a teeny bit
|
||||||
|
;
|
||||||
|
delayFade:
|
||||||
|
SAVE_AXY
|
||||||
|
|
||||||
|
ldy #$01 ; Loop a bit
|
||||||
|
delayFadeOuter:
|
||||||
|
ldx #$ff
|
||||||
|
delayFadeInner:
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
dex
|
||||||
|
bne delayFadeInner
|
||||||
|
dey
|
||||||
|
bne delayFadeOuter
|
||||||
|
|
||||||
|
RESTORE_AXY
|
||||||
|
rts
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user