Here comes the second release of the day (and yes, it feels extremely weird “saying” that ), this time called MD201701 and for the Atari 8-bit; raster-flavoured code and the character set are mine, with the music this time being a conversion of an old Adlib tracker song produced by Adam “Sack” Hay.
The bars are a combination of colour splits to set the base hue and sixteen possible lines of bitmap data for the luminance, so any entry in the full 256 colour GTIA palette is available on each scanline – the majority of raster bar demos only use the 128 colour CTIA colours – although I’m only using 240 in total because two sixteen shade sets of brown are so close that one might as well be skipped. There are only two bars plotted for each frame, but an “infinite rasters” routine which cycles through six buffers and rotates the palette on each pass makes things look busier than they are in reality.
Oh, the scrolling messages both have eight colour splits per scanline which was a nightmare to get timed correctly and required quite a bit of hoop jumping in the process! This release was part of the New Years Disc 2017 and organised through the Atari 8-bit section of the Atari Age forums, grab the entire package because it’s worth it!
This post has come a little later than expected, but a few people have asked about it so lets have a quick prod around behind the scenes of MD201509. There are two parts so, unsurprisingly, we’ll start with the intro.
This part is more complex than it initially appears, using cycle-accurate splits for the colour for each letter in the logo; the diagonal tilt comes from a split on each scanline that writes to the horizontal scroll register but it’s not possible to change colours midway across a badline… but that line is where the top bevel of the little bias relief tiles sit so the colour changes wouldn’t be visible anyway! Instead the routine pushes out new colour values six times per scanline for six of the eight lines (since the lower bevel doesn’t need a split either) and sets the colour to grey for the other two.
The same basic technique is used for the colour splits under the scroller and swinging text line, with the routine loading two registers with colour values at the start of each scanline and alternating between writing them across the screen. The badline here just happens to be where both colour gradients are white, so a single change is needed at the start of that line rather than multiple writes during it. Both split routines are unrolled code and built as subroutines so they can be called twice per frame.
In the main part, thirty seven of the colour splits aren’t actually colour splits! The first column is done traditionally by changing the background colour once per scanline with a sprite masking the two character columns to the left of it, but the rest are FLI with a memory- and processor-intensive, unrolled routine rewriting all of the colour data for them once per frame; this routine was what the entire demo was built around so everything else is pushed into the gaps it leaves and there are even a couple of changes for the masking sprites during the bitmap embedded within that chunk of code. A simple bitmap dissolve changes the FLI area back and forth between $55 and $aa (the colour data has a blue gradient value in one nybble and its equivalent from the brown gradient in the other), executing on runtime wherever the interrupts aren’t hogging the processor.
There are a few more colour splits under the scroller which are only slightly different to the ones in the intro and the badline is avoided completely so they’re just seven pixels high. There’s also a hardware sprite at the left side of the scroller because the entire screen is in forty column mode and there would be a character wide gap there without it.
Finally we get to the bitmap filling the majority of the screen. There’s been some talk on MD201509‘s CSDb entry about how it was done that make it seem complicated, but the black parts of the image are just set bits in the bitmap whilst all of the coloured areas are unset. Move some sprites around with the priority set so they’re behind the picture and they’ll only appear over the coloured parts; there are a few more sprites underlaid to add colour where it wasn’t possible to use attributes due to clash, but those are the higher-numbered sprites so the moving ones have priority. The only remaining feature is another routine on runtime that goes through the circles in “random” order, fading them to white and back down to one of the darker colours in the palette, this uses a subroutine for each circle and a jump table to select which is currently being called.
So there we go, the basics of how MD201509 works… if anyone wants to ask questions just fire away and I’ll do my best to answer. If there’s enough interest I might be brave enough to open a Github repository to publicly display my spaghetti-like source code!
After quite a bit of soul searching and chatting to people on IRC, this blog and in person at Play Margate about the idea, the first monthly demo has been completed and released, with the download available from the Cosine website and CSDb. The name is MD201509 (or Monthly Demo – September 2015 to it’s parents) with the “serial number” approach being settled on because coming up with a one-file demo and a decent name at least once a month would have proved too taxing for my already caffeine-addled brain. The main part looks like this…
…and there’s a last minute bonus intro before it as well which even the other members of Cosine hadn’t seen before release because it was started on Monday when I was procrastinating about finishing the main part!
So now I’m sort of committed (or possibly should be committed) to the whole monthly demo concept and we’ll have to wait and see how much of a self-inflicted pain in the backside it becomes! Although I’m not particularly good at planning ahead there are already a couple of ideas milling around for future instalments so fingers crossed…