This month’s new entry into the Monthly Demo pantheon is MD201603, which was released earlier today. Programming and the character set were by me, but rather than finding an unused tune from a Cosine member, this time there is a brutal cover of the Protracker module Lost In Time from SAE’s collection Amazing Tunes 2 by new member aNdy who also did the logo and sprite graphics. He’s the person who comments occasionally on this ‘ere blog and essentially stops me from completely losing the plot.
The emphasis is once more placed on the scroller, which is a DYPP routine; that differs from MD201602‘s DYCP code by having just the one scroller but moving each pixel column independently rather than just each character column. The movement is also significantly more complicated here because, although going for the simpler single curve approach would’ve made this quite a bit less resource hungry, the double cosine movement just looked so nice!
I’ll get around to the regular “how it works” quite soon and the source code is already up at Github for those brave advemturers who want to go exploring completely unaided! Oh and don’t worry, I haven’t forgotten the simple DYCP example that some nice people asked me to write as well and that’ll hopefully get done at the weekend if all goes to “plan”!
The majority of this post will be on MD201602‘s DYCP scrollers since the logo movement relies on what is a technique which requires very little processing time; there are multiple copies of the bitmap in memory generated when the code starts, with each stored at a different character offset horizontally so the routine swinging the logos can take a value from the curve, strip the lower seven bits off for the hardware scroll register and use what’s left to select which version of the logo to use. No data is moved in realtime so this takes a couple of scanlines at most, have a look at lines 379 to 398 of the source code since that sets up the top logo, writing directly to the registers.
The DYCP scrollers themselves are… well, just traditional DYCPs really and I’ve tried to optimise things as much as possible without losing that “spirit” too, which is why the routine isn’t going to set a record! The character set is five pixels high and, similarly to the logos, converted on start up by a routine called font_xvert so the top pixel row of each character is in a contiguous table, then the second row and so on; this format allows any of the characters to be accessed quickly, with the renderer for the first scroll drawn looking like this:
The Y register is, appropriately enough, being used to designate the height that the character will be written into dycp_workspace (a standard character set arranged in columns of six characters on screen) whilst X is selecting which character to draw – the first line of every character is stored at dycp_xfont, the second line kept one 256 byte page on from that original position and the third, fourth and fifth are each a page further into memory than the one before them. The BEQ in the source fragment above means that if the content of the scrolling message in dycp_buffer_1 at that point is zero, the character is empty and the rendering can be skipped entirely. (And with that in mind, it probably isn’t difficult to understand why the greetings scroller is spaced out!)
Finally, there’s the colour bar in the middle of the screen using the same kind of vertical splitting that MD201509 employs and, to make the scrollers look like they’re passing behind it, the screen RAM on that central line of the five being used by the DYCPs is constantly being manipulated; if the character in the second scroller is using the first half of the cosine curve then the value written to that column on the central line of the screen is taken from line_cache (which is a copy of what’s initially generated at that point on the screen) but if the position is 128 to 255 then the routine writes a zero there instead which is always a blank character. Filling the first eight bytes of dycp_workspace which starts at $5000 with $FF from the VICE monitor or using an Action Replay cartridge once the code is executing will make that blank space visible and shows how this works more clearly, the solid blocks move across the screen and it looks like this:
So… that’s the basics at least and the source code is available to prod around too, but if anyone has a question please get in touch through the “usual channels”. I might also be persuaded to post source code for a more generic DYCP routine if enough people want it?
So no new posts since the last one bemoaning the lack of them; perhaps I need to write something each time there’s a new release, something this perhaps?
There’s a new Cosine release just appeared online, which was written as an intro for Twitch.tv channel Gamerz Xtreme; channel owner Adam – who used to go by the handle Psycho Stick – basically wanted an oldschool crack intro style affair, so naturally I went for raster bars, sprite movements, a three colour logo swinging back and forth and cosine curves pretty much everywhere!
There isn’t a Github repository this time – since it was written for someone else it didn’t feel appropriate and the “plan” was never to release everything that way – but the source code comes with a text file that configures many of the on-screen elements such as the raster bars, sprites and logo, allowing their movement and colour to be tweaked; it’s not a perfect solution (I seriously toyed with writing a dedicated, Windows-based editor at one point) but does the job well enough and allows the intro to be changed over time without input from mas as the programmer.
And who doesn’t love a good raster split… or two hundred? The music is by Matt “4-Mat” Simmonds from the old Commodore Zone release Comets Trilogy which was used because, as a remix of Rob Hubbard’s classic Crazy Comets, seemed to fit nicely with the overall style.
In other news Sean Connolly has been beavering away with Ableton Live 9 recently so, along with the loop he did for Macro Clone Cafe, he’s produced a rather lovely new version of his track “A Sporting Chance” (the C64 version appears in Blok Copy) which can be heard in the little thingy above this paragraph or over at Soundcloud.