Raster Tricks
Exploiting the electron beam
Raster tricks push hardware beyond specifications by precisely timed manipulation during screen display, achieving impossible-seeming effects.
Overview
Raster tricks are raster effects taken further—exploiting undocumented behaviours, cycle-exact timing, and hardware quirks to achieve effects the chip designers never intended. The demoscene pushed these techniques furthest, displaying more colours, more sprites, and more complex effects than any specification promised.
Fast facts
- Beyond spec: effects exceeding documented capabilities.
- Timing: cycle-perfect precision required.
- Discovery: often through experimentation.
- Demoscene: primary developers of techniques.
- Documentation: initially secret, now shared.
Advanced techniques
Beyond basic raster effects:
- FLI (C64): Flexible Line Interpretation — force a badline on every line by writing YSCROLL into
$D011to match the current raster line's low 3 bits. Combined with per-line$D018writes, this gives 8 colours per 8×8 cell instead of 2. - AGSP (C64): Any-Given-Scanline Position — generalised mid-line raster manipulation, foundation of many demoscene effects.
- NUFLI (C64): New Unrestricted FLI — refined FLI with reduced sprite-count constraints.
- VSP (C64): Variable Screen Position — mid-line
$D016XSCROLL manipulation that shifts the entire screen position. Originally a side-effect (the "VSP crash"), later weaponised for stable scrolling effects. - Border opening (C64): clearing bit 3 of
$D011(24-row mode) or$D016(38-column mode) at exactly the right cycle bypasses the border and renders sprites/playfield outside the normal display area. - Sprite stretching (C64): writing to
$D017(Y-expand) at a precise cycle causes the VIC-II to re-fetch sprite data, allowing arbitrary-height sprites — used for full-screen logos and demo effects. - Copper tricks (Amiga): per-scanline register manipulation — colour gradients, mode switches, sprite repositioning, palette cycling. The Copper's elegance makes most C64-style raster tricks one or two MOVE instructions apart.
Why they work
Exploiting hardware:
- Undocumented registers: behaviours not in manual.
- Timing windows: brief moments to change state.
- Race conditions: beat the hardware to changes.
- Side effects: using bugs as features.