How our CD5 part works

So… erm yes, I said over at the Plus/4 World forums that I’d write a “how it works” for the Cosine contribution to Crackers’ Demo 5 and here it is girls and boys, only six months late! Generally speaking there are two actual effects in play, the forty by five byte luminance scroller running through the middle of the bitmapped logo and a sixteen by ten pixel DYCP which works in the regular 39 by 6 character workspace but splits it into two blocks which are four characters high at the top and bottom of the screen.

The DYCP isn’t doing anything majorly different to the other single character routines I’d released around the same time – the loops are all unrolled and there’s specially formatted character data for speed which was originally drawn with ProMotion (I’m actually using an older version) before being converted using my cheap and cheerless bitmap to raw data converter – except that it has two distinct versions of the clear and draw code; one starts from the left hand half of the first character and proceeds to draw across to the right whilst the other begins from the right hand half; the code then flips back and forth whenever the hardware scroll finishes a cycle. During what I’ll refer to as the “design phase” for want of a better term, I settled on wanting the four character high areas so the redraw has to happen during the logo and there was only enough time to render ten pixel high characters.

And since I mentioned the logo, it was originally drawn using C64-specific tool Project One (again, I’m using an older version… one of these days I’ll update all my tools) with the colours used representing luminances; that data was then converted for the Plus/4 with a small assembly language routine on the C64 (all it actually did was translate the C64 colour data and dump it into memory so I could save the results out with a virtual Action Replay cartridge) and all of the colour data was manually created as an included source file. Here’s the logo’s “before” picture when it was still on the C64:

Finally there’s the large luminance scroller; the TED keeps luminance and colour data separately for bitmap-based displays like the logo so one eight by eight pixel attribute cell has two bytes of information, one containing two nybbles of colour (values from $0 to $f for sixteen possible colours) and the other holding two nybbles of luminance data (this time values from $0 to $7 for eight possible brightnesses). The “trick” here is that the luminance has been limited to a maximum of $5 for every cell in the picture where the scroller can pass over it, so when that is added to the scroller’s buffer which is either $0 or $2 for each nybble there’s a noticeable hike in brightness. To keep things simple there’s a second copy of that luminance data used for reference.

And, apart from mentioning that the music was created by aNdy using Knaecketraecker, pretty much covers everything I think. The source code is available online for those brave enough to go prodding around it and I’ll have a go at answering questions if any arise.