Skip to content

FPP

Flexible Pixel Position

A Commodore 64 trick that lets a program choose which line of graphics the VIC-II shows on every raster line, so a picture can be turned upside down, repeated or stretched. It is built from the same badline tricks as FLD and linecrunch, and the scene's list of firsts gives it to the demo Random, released in June 1989.

FPP, flexible pixel position, gives a Commodore 64 program a free choice of which line of graphics appears on each raster line of the screen. The Codebase64 wiki defines it as “the ability put every single pixel-line of graphics vertically on the screen independently of any other pixel-line”. Line 40 of a logo can appear above line 10, line 10 can appear three times in a row, and the whole logo can be drawn upside down, all without redrawing anything in memory. Squashing, stretching and mirroring a picture become a matter of filling in a table of values, one for each raster line.

What it adds

The C64’s other vertical tricks all move graphics while keeping their order. FLD holds back the start of a character row, opening a gap of any number of raster lines and pushing everything below it down. Linecrunch squeezes rows into a single raster line and pulls everything below it up. The Codebase64 wiki also describes FPD, flexible pixel distance, which combines the two so that each individual pixel line can be spaced out from the one above it. FPP goes further. In the wiki’s words, “Where as with FPD the lines always keep the same order, with FPP you can turn your graphics upside down, display it tripple times, stretch it or whatever.” Its overview of these tricks adds that “With FPP, you can simulate all the other ones.”

How it works

The VIC-II normally shows each character row for eight raster lines, counting through the rows of each character with its row counter, RC. FPP stops the chip from moving on by itself, so that the same line of graphics is fetched over and over, and then changes where that line comes from, once per raster line, by writing $D018. That register chooses the screen memory and the character set (or bitmap) the chip reads from. The wiki’s overview, “Introduction to Vertical Tweaks”, describes several ways to hold the chip still, and its example routines use two of them:

  • Repeating the last line. A linecrunch on every raster line keeps the chip permanently on the eighth line of a character row. Christian Bauer’s 1996 description of the chip explains why: “If you now do this in every raster line, the RC will always stay at 7 and there will be no c-accesses”, meaning that no new character codes are fetched. In text mode the same characters are therefore drawn on every line, and changing $D018 between lines picks a different character set, and with it a different eighth line. The wiki’s example notes the limit, “only 8 lines per video-bank”, since $D018 can choose between eight 2K character sets within the 16K the chip can see. In return the loop has enough spare time on each line to open the side borders as well.
  • Repeating the first line. A tighter loop, related to FLI timing, forces a badline on every raster line. The chip fetches new character codes each time, from the screen $D018 points at, but the timing leaves it showing the first line of graphics again. The wiki’s example of this method gives “up to 128 lines per video-bank”, at the cost of “a rather short timing loop with no possibilities to open the sideborders or hardly even have sprites over it”. Its write to $D011 has to come every 20 cycles.

The method has to suit the picture. The wiki’s overview warns that “You can not have a pure FLI picture and do FPP with it, you have to compromise”, and suggests that an effect which only needs to space lines out may be better done as FPD, “where you have more color opportunities and possibility of opening the borders”. The same idea works for sprites: the wiki’s sprite FPP routine changes a sprite’s data pointer on every raster line.

Who did it first

The Codebase64 wiki’s list of demo firsts gives FPP to Random, a one-file demo released by the groups Bones, Triangle 3532 and Upfront on 26 June 1989. CSDb credits the code to Zoro of Upfront and the music to Johannes Bjerregaard of Maniacs of Noise, and records that it was released at the 2000 A.D. Party. A CSDb comment points out that the demo’s own text gives July, although the party was held in June. The list’s compilers warn that “it is not always straightforward to determine who did what and when”, and no other public source found for this entry names an earlier FPP.

Sources

See also

Checked. Verified against primary sources and signed off by a person.