Auto animation: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 7: | Line 7: | ||
An internal write-only 8bit counter is automatically decremented each frame. When it underflows, it is reloaded with the last value written to it, which comes from the 8 highest bits of {{Reg|REG_LSPCMODE}}. This sets the speed of the animation. | An internal write-only 8bit counter is automatically decremented each frame. When it underflows, it is reloaded with the last value written to it, which comes from the 8 highest bits of {{Reg|REG_LSPCMODE}}. This sets the speed of the animation. | ||
Each time that counter underflows, another internal 3bit counter is incremented. Those 3 bits can only be read in bits 2~0 of REG_LSPCMODE | Each time that counter underflows, another internal 3bit counter is incremented. Those 3 bits can only be read in bits 2~0 of REG_LSPCMODE. | ||
When auto-animation is disabled (bit 3 of REG_LSPCMODE set), the frame counter and animation counter continue to function. However, tiles are shown as if their animation mode select bits were reset (so the tile number specified is the tile shown). | When auto-animation is disabled (bit 3 of REG_LSPCMODE set), the frame counter and animation counter continue to function. However, tiles are shown as if their animation mode select bits were reset (so the tile number specified is the tile shown). | ||
Line 17: | Line 17: | ||
Depending on the animation period (4 or 8 frames), the tile number specified in [[Sprites|SCB1]] has the lower 2 or 3 bits replaced with those of the animation counter. | Depending on the animation period (4 or 8 frames), the tile number specified in [[Sprites|SCB1]] has the lower 2 or 3 bits replaced with those of the animation counter. | ||
Note that the bits are replaced, not added. Therefor, the consecutive tiles used for animation must be aligned on 4 or 8. | |||
[[Category:Video system]] | [[Category:Video system]] |
Revision as of 17:20, 24 December 2012
(Information from Charles MacDonald)
Auto-animation is a tile attribute for sprites and a special feature of the GPU used to animate loops without CPU usage.
An internal write-only 8bit counter is automatically decremented each frame. When it underflows, it is reloaded with the last value written to it, which comes from the 8 highest bits of REG_LSPCMODE. This sets the speed of the animation.
Each time that counter underflows, another internal 3bit counter is incremented. Those 3 bits can only be read in bits 2~0 of REG_LSPCMODE.
When auto-animation is disabled (bit 3 of REG_LSPCMODE set), the frame counter and animation counter continue to function. However, tiles are shown as if their animation mode select bits were reset (so the tile number specified is the tile shown).
These bits can be set in each tile's attribute word (odd bytes of SCB1):
Bit | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Def | Palette | Tile number MSBs | 3bit auto-anim | 2bit auto-anim | Vertical flip | Horizontal flip |
Bit 3 has priority.
Depending on the animation period (4 or 8 frames), the tile number specified in SCB1 has the lower 2 or 3 bits replaced with those of the animation counter.
Note that the bits are replaced, not added. Therefor, the consecutive tiles used for animation must be aligned on 4 or 8.