Palette rotation: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Example code (please test !)) |
||
Line 1: | Line 1: | ||
Palette rotation is a video effect made by shifting | Palette rotation is a non-NeoGeo-specific video effect made by shifting a range of color entries inside a [[palettes|palette]]. | ||
This effect was frequently used | This effect was frequently used along [[auto animation]] for cyclic, scrolling animations (waterfalls...) without having to use multiple tiles, saving up graphics memory and VDC time. | ||
<gallery> | <gallery> | ||
Line 11: | Line 11: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
; Untested ! Doesn't care about transparent index. | |||
; Executes in about 720 cycles | |||
lea COLOR_LIST,a0 ; Pointer to list of 32 colors | |||
lea 64(a0),a2 ; End of list (32 words) | |||
lea PALETTE,a1 ; Pointer to start of palette in palette RAM | |||
clr.l d0 | |||
move.b ROT_INDEX,d0 ; Offset variable | |||
move.b #16,d7 ; Number of entries in palette | |||
andi.b #31,d0 ; Warp on 32 | |||
add.w d0,d0 ; Colors are words | |||
movea.l 0(a0,d0),a0 | |||
-: | |||
move.w (a0)+,(a1)+ ; Copy | |||
subq.b #1,d7 | |||
beq + ; Are we done ? | |||
cmp.l a0,a2 | |||
bne - ; Warp ? | |||
lea COLOR_LIST,a0 ; Warp ! | |||
bra - | |||
+: | |||
addq.b #1,ROT_INDEX ; Animate | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Video system]] | [[Category:Video system]] | ||
[[Category:Code]] | [[Category:Code]] |
Revision as of 14:59, 15 August 2016
Palette rotation is a non-NeoGeo-specific video effect made by shifting a range of color entries inside a palette.
This effect was frequently used along auto animation for cyclic, scrolling animations (waterfalls...) without having to use multiple tiles, saving up graphics memory and VDC time.
-
League Bowling's title screen uses palette rotation as a mean to provoke eye cancer.
-
Fatal Fury 2 uses palette rotations to animate water efficiently.
Example code
; Untested ! Doesn't care about transparent index.
; Executes in about 720 cycles
lea COLOR_LIST,a0 ; Pointer to list of 32 colors
lea 64(a0),a2 ; End of list (32 words)
lea PALETTE,a1 ; Pointer to start of palette in palette RAM
clr.l d0
move.b ROT_INDEX,d0 ; Offset variable
move.b #16,d7 ; Number of entries in palette
andi.b #31,d0 ; Warp on 32
add.w d0,d0 ; Colors are words
movea.l 0(a0,d0),a0
-:
move.w (a0)+,(a1)+ ; Copy
subq.b #1,d7
beq + ; Are we done ?
cmp.l a0,a2
bne - ; Warp ?
lea COLOR_LIST,a0 ; Warp !
bra -
+:
addq.b #1,ROT_INDEX ; Animate