Workprint – November 2017

I’ve decided to try a few little changes around here; for a start I want to stick to a schedule (goodness, I used the S word and it almost looked like I meant it too!) so from now onwards all workprint posts will appear on the first Friday of a month like this one is doing. That probably doesn’t sound like a major shift to most people but, as certain editors will no doubt attest, I’m a teensy bit rubbish with deadlines and even worse without! At some point over the “festive season” there’s going to be a few other changes too, but those are still in what I’m rather euphamistically referring to as “the planning stages”.

As far as programming goes, the scrolling shoot ’em up Rubidius in progress for the Hex Files rewrite is coming along slowly but surely with the most recent feature added is the subroutine that preps the engine for the start of a level; previously it was hardwired to just one map and block of attack wave data but now it deals with multiple levels correctly… although that wasn’t the case for several hours! When the new routines went in last Sunday they worked fine with the first level but would start doing bizarre things that should have been impossible during the second, including glitching entire tile rows. Remember kids, always keep a track of your “set in stone” subroutines because sometimes…

In this case the background scroller spreads the load out over eight frames and a couple of missed RTS commands (which I suspect were left out when the colour scrolling was added to previously empty “slots”) meant that, along with the update that was meant to happen on a specific frame, one of the other routines would be called out of sequence as well. I have no idea why the problem only manifested on the second level map though…

Koalatro (C64)

I’ve been almost worryingly quiet for a few months – according to others rather than myself I hasten to add, I worry about me all the time – due to a mixture of illness and… well, more illness really. Normal services will hopefully be resumed once the “festive season” is out of the way and I cheer up a bit! In the meantime, I’ve been working on entries for the Intro Creation Competition at the C64 Scene Database where the primary rule is that the releases must use a single block of 16K at all times. I’ve already put out one called Clonetro on the C64CD label and today has seen the launch of the second, this time from Cosine and sporting some music from aNdy.

Koalatro is a somewhat masochistic exercise in cramming a multicolour bitmap, music, scroller (with unrolled colour splitting code that takes over five hundred bytes on it’s own) and some text into just 15K. Using a Koalapainter format picture in an intro that small whilst executing doesn’t sound too complicated, but the 10,001 bytes of data would normally eat through two thirds of the space before any code or music is included! So, whilst all the data that a Koala picture would normally require is still present, 1,000 nybbles of $D800 colour data have been rather unceremoniously packed into 500 bytes. The double speed music (the player is called twice per frame) was supplied by aNdy who originally created it for a CSDb competition a few years ago, fortunately it was pretty short because the intro needed it to be.

The scroller started out as a reasonably straight copy of one in Contribution by Super Swap Sweden – the sprite colours are split on each scanline rather than the background colour, so it only just has enough time to load two values, write to all eight and keep the side borders open if the entire loop is unrolled and all of the LDAs are absolute! As is now usually the case, I’ve pushed the source code to Github for people to prod around, but it’s not exactly the cleanest thing I’ve ever written!

How MD201511 works

Since MD201511 was thrashed out in a hurry this’ll be a relatively short post, but here we go for the sake of completeness and so I can “show off” just a little… not about the Zybex-style starfield of course, that’s old hat and I’m probably the only C64 coder who hasn’t written one previously! It uses a block of thirty two characters in the font, taking 256 bytes of memory so STA $4C00,X can write anywhere within that block, subtracting eight from X moves one character to the left and it wraps around at the lefthand edge. Those characters are tiled across and down the screen with a “random” start position for each line to give some variety and a colour fade is similarly applied. Those logos over the top are nothing special either of course, although each three by three sprite copyright symbol only takes eight sprites because a little work went into designing them with the central sprite empty!

The primary effect is bang in the middle of the screen where, for a mere seven scanlines, the code is vertically splitting the horizontal scroll register to have seven independently moving areas; it doesn’t do the full eight scanlines to avoid the badline like MD201509‘s colour splits don’t. I did try just having the ROL scroller but the “join” between areas looked rough so the static text areas went in to make things look slightly neater. I’ve also been hinting in a less-than-subtle way that something “odd” is going on but, so far at least, nobody has said that they’ve noticed so here’s how MD201511 looks if the border colour is changed…

…and there’s only a “notch” at the left where the borders come in to mask the scrolling rather than on both sides. Since the code is writing to $D016 across the line it can switch from 38 column mode at the start to 40 by the end, meaning that seven scanline area is actually using 39 columns and everything else on screen leaves the lefthand column free so that it all lines up!