While I still remember the details, I thought I’d go over my port of Blood Money to the C64. It had some really cool bits in it, and I had great fun doing it. Some parts make me cringe a little now, so it’d be interesting to revive it, and see if I can get it building again – or at the very least, go over the code again…
One thing that DID bug me, even back then, was the crappy starfield. It was just some characters stuck in the map, and it sucked.
So what were the main components?
Multi-Directional scrolling Sprite Multiplexor Scripting Sprite compression Turrets Character sprites Bullets / Weapons Collision Shop Front End
These are the major parts and we’ll take them one at a time. Before that, I want to briefly look over the code, and talk about the devkit – PDS. Programmers Development System. This was a lovely system, and one I’m sad I didn’t find while raiding the DMA Offices.
The PDS system consisted of a PC ISA card, and a C64 cartridge. The ISA card was common for all systems, while the target cartridge was custom for each platform.
As I can’t find a C64 image, here’s the Sam Coupé (Z80) one to show what it might look like.
EDIT: So with the RMC Cave opening up a “Dev Den“, Jason who is running that part, had a C64 one and it turns out there isn’t an interface, just a user port connector. This makes sense as the C64 already has everything it needs to read/write bytes in parallel.
This is the Z80 program, but the 6502 one was the same. It consisted of a built in text editor/assembler/debugger. The text editor could hold 8 files up to a maximum of 32k each, though you could include as many files as you like. It assembled before your finger left the key, and squired down in under a second. This was a massive speed boost from the 20 minutes I sometimes spent waiting on the C64 to disk assemble using a fast parallel disk interface.
The other good thing about PDS, is it remembers the start date, and the last time you touched it – which is very cool and handy. So I started this on 7th of August 1989…. though, this probably isn’t right. This was the month the office opened, and I was still working on Ballistix at this point. However, I did create a C64 framework, and then probably based the game off that. The date below 2/10/89 looks better, and the end date looks about right 25/4/90. Games back then took about 6 months, so this also fits.
So in the main code of all my C64 games, I setup equates (constants), and zero page and normal variables. On the 6502 there are 256 bytes of fast zero page, 2 are taken with I/O control, and the rest are available for use. Zero page instructions typically take 1 cycle less to operate, so are highly desirable for critical code optimisations.
These are some of the constants. At the top you can see the big ticket items – memory map etc. There’s a couple of interesting items here – Charmasks/Shipmasks, and down_load. The collision in Blood Money wasn’t character based, it was bitmap based. I actually read the background tiles, and then masked whatever frame of the ship was active onto these characters. This was pretty slow, but allowed proper collision to the background – something that was vital in later levels. I’ll discuss this mode later of course…
down_load – this was where the debugger/downloader code lived. Whenever the C64 hit a BRK instruction, I would detect this in the IRQ it generated, and jumped to the PDS debugger code.
This is how I allocated Zero Page variables. Prior to having good macros, I’d have to work these out manually, but now I was able to simple set a name and how many bytes I wanted, and the label would be set. I still use this method for variable allocation when need be – it’s really useful.
I use the same method for sprite variable allocation. Have to say… this is a lot of variables for each sprite – oh well….
And this is where I defined general variables, and player structure. There’s 2 of everything as Blood Money is a simultaneous 2 player game. This really effected the multiplexor – but more on that later….
Lastly for today, is the start up code, we take over everything and nuke stack and zero page, flick out ROMs etc and setup IRQs – the usual…
The IRQs in Blood Money are complicated, and heavily tied to the multiplexor, so I’ll talk about that next time…..
Also just to say…. as this was just my second game, and only a couple of months after the office opened, I’m amazed at the level of commenting in the source! 😂