cf19_Apr1992

Many of you will be familiar with the name Warren ‘Waz’ Pilkington, the noble hacker who provided countless POKEs and listings for CF’s Gamebusters section and helped many a battle-scarred gamer scrape their way through hundreds of otherwise-impossible C64 games (check out our extensive interview with Waz here).

As well as a penchant for producing pristine POKEs, Waz was also a budding C64 musician and also served as an administrator of the High Voltage SID Collection (a mammoth archive of every piece of music ever produced for the C64 – Ed).

However, not every piece of music in the archive is perfectly preserved, and it’s up to talented and tenacious custodians such as Warren to try and restore some of the corrupted tunes to their former glory. Indeed, Warren contacted us recently with quite the story to tell – we’ll let him take it from here…

“Many CF readers will remember the extensive Indiana Jones and the Fate of Atlantis feature in CF19, complete with a gun-toting, Nazi-punching Indy on the cover. The game went on to score a respectable 84% in CF21 – although other magazines at the time didn’t rate the game as highly, James Leach was impressed by the game’s polish, atmosphere, and gargantuan levels.

Years later when the High Voltage SID Collection (HVSC) was created, the music was dutifully extracted from the game and added to the archives. At the time it did appear to be a clean version, but many SID fans had noted that the music appeared to have issues at around 1m30s, blurting out some odd-sounding background notes before falling completely out of sync when the tune restarted. Suitable checks were made and it was discovered that the main music code itself wasn’t bugged as such, but something somewhere wasn’t quite right. It had been documented in the bugged SIDs list for some time, and the problem seemed like it would be confined to the annals of history – until now.

As a SID fan and a fan of Martin Walker’s music – and spurred on by the admiration for the effort he put into the reworking of Hunter’s Moon as of late – I wanted to get to the bottom of the problem and work out what was happening, what could be done to finally get the tune working, and hopefully salvage a little piece of C64 music history along the way.

indy1
The C64 version of Indy was an epic, if challenging, romp through the isometric city of Atlantis.

The first task was to try and obtain an original source (rather than a ‘cracked’ version), and as it transpired, Gamebase64 had an original tape (.tap) image which contained both sides of the tape. Once the game loaded the title theme played, so I listened for a while and sure enough it produced exactly the same bug at exactly the right time; this seemed to indicate that if the original game was also bugged in this way, the original rip for HVSC had also replicated that bug, too. So, not a good start then.

The next thing to do was to use Jens Christian Huus’ excellent DeepSID web page and play the SID file back through there. Jens’ player has an added bonus of being able to mute any of the three SID channels, so I muted channel three (a bit lucky that I managed to get this right first time!) and spotted the issue right away: it sounded very much like channels one and two were actually playing correctly and looping at the same time, but as soon as voice three was brought back into the equation it didn’t sound remotely as it should. So, the focus was now clear: time to discover what channel three was up to.

At first I wanted to take a look into the assembly language code for the music player to determine what was happening where. With my Action Replay cartridge at the ready, I managed to trace my way through the code and deduce where the voice data for channel three was stored.

While the sequence data for channels one and two appeared to be consistent with Martin’s player (which I was able to deduce by referencing screenshots previously printed in CF and Martin’s recent interview), all was not well with channel three: although it seemed to get off to a perfectly good start, the data began to degrade, leading me to suspect that that it had been overwritten. Not good, really.

indy5
Well, there’s your problem. Looks like some muppet’s overwritten your data.  I couldn’t fix that for less than a monkey, squire (Are you sure about this? – Ed)

I deduced that during the mastering of the game (when the game code is ‘packaged up’ ready to be put on tape and disk – Ed), parts of the code which were in later sections of memory had been overwritten, and as such this meant that the music player was reading corrupted data which wouldn’t sound right. So the source of the bug was now found – but how to fix it?

I then had a brainwave: what if Martin used a cross-assembler to deploy his music player (he often referred to such tools in his diaries) and the same data was used elsewhere in another version? I decided that the best comparison would be the Amstrad CPC 464 version, so I downloaded WinAPE, located a disk image of the game, and loaded it in.

The good news was, the music in the Amstrad version was also by Martin Walker, and appeared to be exactly the same composition as the C64 piece. I listened through. It didn’t bug. It played the whole theme correctly!

Now, I’m not an expert on Z80 assembly language, but did wonder whether the machine code routine used for the music player would use the same music data for its sequences as the C64 version. I already knew part of the data was correct (up to the 1m30s mark or so), and so if I searched for that data in a machine code monitor, what would show up? Using some of the debug utilities in WinAPE, I did just that, and managed to find the correct music data for channel three!

indy7
With the help of WinAPE, Waz managed to locate the uncorrupted data for channel three hidden deep within the Amstrad version’s code.

So the next question was, what if I plugged in the music data from the Amstrad version directly into the C64’s memory using the Action Replay? After entering the data, I restarted the game and listened to it. All the way through. And it didn’t bug out, or fall out of sync. For the first time ever on the C64, the tune was playing correctly, and comparing it side by side with the Amstrad version, all the sequences sounded the same. One of the holy grails of bugged C64 tunes had finally been resolved!

My final task was to use SIDEdit to fix the issue in the archived .SID file, which will make a great addition to the next HVSC update (due around Christmas 2018). It’s also nice to give something back to Martin Walker after all these years of enjoying his work – the Armalyte loading theme is still one of my all-time favourites.

It’s always good to be able to give something back, albeit this time in a different way; I’ve always regarded my time as a Gamebusters contributor as a really good experience, and knowing that people were able to get a bit further through the tough games was a humbling thing for me. It was (and always will be) about helping people.” Warren Pilkington 

We were utterly blown away by Waz’s tenacity and dedication; so much so, we decided to see what Martin Walker had to say about this masterpiece of digital archelogy:

“What a stunning piece of detective work by Warren! I was totally unaware that my C64 music for Indiana Jones and the Fate of Atlantis was bugged, and even had I known I would have initially assumed (just like Warren) that this was a result of the music being hacked from a pirated version of the game. A huge well done to him for both tracking down the cause (of course, I’m relieved the bug was none of my doing), and restoring the C64 music to its intended glory. The saddest thing is that C64 owners presumably never heard the full version of my music in the game they bought, so it’s great to hear the restored SID file where all three of its channels stay perfectly in sync throughout.”

It doesn’t stop there. What happens next will amaze you.

“His exploration has also brought to light a bit of past skullduggery on the part of the software house: I was totally unaware that I had a music/fx credit on the Amstrad version of this game, have certainly never heard the Amstrad conversion of my C64 music, and of course never received a penny for it. Given that Warren discovered exactly the same music data was used, I can only assume that someone reverse-engineered my C64 music driver, converted in it some way to suit the Amstrad sound chip, and hoped for the best. In fact, I never wrote ANY music for the Amstrad, so I now wonder just how many times my name appeared on projects that I was not involved with at all!”

indy6
Despite receiving a credit within the game, Martin actually had nothing to do with the music for the Amstrad version and was nowhere near Cleethorpes on the day in question, your Honour.

So there you have it: some ingenious digital detective work courtesy of Warren Pilkington. The big question is, what other secrets lie hidden away inside our favourite C64 games?

Links:

A ZIP of the unbugged tune in question is here.

High Voltage SID Collection: https://www.hvsc.c64.org

Zaw Towers: https://www.zawtowers.org.uk

Yew Tree Magic (Martin Walker): http://www.yewtreemagic.co.uk/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s