Raster Tricks
Exploiting the electron beam
Raster tricks push hardware beyond specifications by precisely timed manipulation during screen display, achieving impossible-seeming effects.
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.
Why the beam is the clock
Every trick here rests on one fact: the video chip builds the picture a line at a time, in a fixed order, and the CPU can change the chip’s registers while it works. Whatever the chip has already drawn keeps its old settings; whatever it draws next uses the new ones. One screen, two configurations.
That makes the electron beam a clock the program can synchronise to — and it means these effects are measured in CPU cycles, not milliseconds. A C64 PAL line is 63 cycles, and a write landing one cycle late lands on the wrong side of a pixel. The technique is not “write to this register”; it is “write to this register now”.
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 Screen Positioning — VSP for the horizontal position combined with a line crunch for the vertical, so the whole screen can be placed anywhere. Not a mid-line technique in its own right, but a composition of two.
- 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 at all
These are not undocumented registers — the registers are all in the manual. What is undocumented is what happens when you write to them at a moment the designers did not anticipate, because the chip is a state machine that was only ever specified for the states it was expected to be in.
Border opening is the clearest case. The VIC-II decides to draw border by comparing the current line against a limit; change the limit after it has made that comparison for the frame and it never finds the edge it was looking for, so it carries on drawing playfield into the surround. Nothing is being tricked — the chip is doing exactly what it was built to do, having been asked a question its designers assumed nobody would ask.
📘 The FLI bug is what it costs. Forcing a badline where the chip does not
expect one leaves the colour information set to $FF for the leftmost 12 multicolour
pixels, which the VIC-II renders as bright grey.
That grey-ish left-hand stripe on FLI pictures is not a bug in the demo; it is the
hardware telling you where it was interrupted. Artists designed around it, and
later variants reduced it.
⚠ Several of these depend on chip revision — 6567R56A against 6567R8 against 6569, 6581 against 8580. Code that is cycle-exact on one machine can be a line out on another, which is why the scene tested on hardware rather than in emulators.
See also
- Raster splits — working C64 code for the basic technique everything here builds on, in the Pattern Library.
- Raster effects — the general idea, before it is pushed.
- Stable raster — getting cycle-exact in the first place, which every trick here assumes.
- VIC-II and Copper — the chips being argued with.
- Demo Scene — who worked most of this out.