Originally written in French. Translated by AI — the meaning has been preserved, not the prose.
Main idea
On a VGA screen in mode 13h (320 × 200 pixels, 256 colors), each pixel is a byte that holds not a color but a color index. The video card's table, the palette, maps each of the 256 indices to a red-green-blue triplet. An image therefore breaks down into two independent layers: a function that gives an integer for every pixel, reduced modulo 256, and a palette that turns those integers into colors.
The two layers vary separately. Switching palettes changes the whole look of an image without modifying a single pixel; changing the formula changes the drawing without touching the colors. The modulo 256 reduction itself costs nothing in Turbo Pascal: assigning a value to a Byte variable keeps only its 8 low-order bits.
Why it matters
This indirection explains how a demo of a few dozen kilobytes can produce hundreds of different images: one formula and a few palettes are enough, and you combine them. It is also the precondition for animation by palette cycling.
Nuances and limits
The indirection exists only in indexed-color modes. On a direct-color screen, each pixel carries its own triplet and there is no longer a table to vary.
Open questions
- Do palettes borrowed from another program impose a shared aesthetic on images computed from very different formulas?