Yes dear reader we’re going to take some time for another meander through a piece of user-developed software for the C64 to pontificate a little on what is happening behind the scenes. And since the author’s little missive regarding the previous instalment moaned about the use of ripped music we will this time cast our gaze over an earlier production where the programmer was also the musician.
A Commodore 64 demo released in 1986
Code and music by Rob Hubbard
This one-filer was developed and released by Rob Hubbard onto the online service Compunet in 1986 and primarily features a piece of music meant for the Durell game Chain Reaction (your correspondent originally received a copy of the demo under that filename) which apparently made it into the memory when said game is loaded but, for some undocumented reason, wasn’t actually played during play.
Moving on to the demo itself and there are two effects in play here, a sprite-based message which “dances” around the screen and a character-based effect that moves behind it. The sprites are just the eight standard C64 hardware sprites without the expansion or multicolour mode enabled and the motion apparently uses a pre-recorded sequence of movements for the first sprite which are then followed by the others after a delay; this is either achieved by having a delay before each starts using the same movement data or more likely relying on a couple of ring buffers which are populated by the lead sprite.
That moving effect going on behind the sprites relies on redefining characters, literally only writing a couple of bytes per frame into the character data each frame, one to draw and the other to clear the pattern; your correspondent assumes a 256 byte space is reserved in the character set with the code doing something along the lines of LDY position / DEY / STY position / LDA #value / STA memory,Y to draw the effect in. A column of characters from that reserved space are repeated across the screen and the horizontal motion is provided simply by changing the C64’s hardware smooth scroll register – no actual scrolling needs to take place because the pattern repeats horizontally.
As with Planet Invasion this probably wasn’t a particularly difficult piece of code to write with the lead sprite’s movement being the most complicated thing visually, but is at least a reasonably memorable final product in part for a sterling cover of Jean Michel Jarre’s Zoolook and the greetings meandering their way around the screen. From C64CD‘s perspective we also have to pause and note that, as mentioned previously, programmer Rob Hubbard learnt to program on the c64 around the same time and with the same resources available as the author.
 Imagine you have a couple of 256 byte spaces put aside in the computer’s memory (256 because then the index registers can be used to read from and write to those spaces on their own) and whenever your sprite moves, you stash it’s co-ordinates; for the first update the co-ordinates are stored at position 0, for the next 1 and so on and when position 255 is filled the counter pointing into the buffer “wraps” back to zero. Then we need a second counter that is set to start at 240 when the first is zeroed and counts in time with it as well, but this one is used to read from the buffers which means it’s picking up data that was written there sixteen updates previously.