Palette rotation
Jump to navigation
Jump to search
Palette rotation is a non-NeoGeo-specific video effect produced by rotating (shifting in a loop) a range of color entries inside a palette.
Like the auto animation feature, this effect was frequently used for cyclic animations (waterfalls, neon signs...) without having to use multiple tiles, saving up graphics memory and VRAM access 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
The easiest way is to simply cycle through a table of pre-baked palettes. It can also be done procedurally, for example:
; Untested ! Doesn't care about transparent index.
; Executes in about 720 cycles
lea COLOR_LIST,a0 ; Pointer to list of 32 colors
lea PALETTE,a1 ; Pointer to destination palette in palette RAM
lea 64(a0),a2 ; End of list (32 words)
clr.l d0
move.b ROT_INDEX,d0 ; Offset variable
andi.b #31,d0 ; Warp on 32
add.w d0,d0 ; Colors are words
adda.l d0,a0
move.b #16,d7 ; Number of entries in a palette
-:
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