A long time ago I owned a C64 and made lots of programs for it. And then the Amiga was released, but was far too expensive at first. Until Commodore released the A500; I bought one of those and had lots of happy moments coding for it…
Now the Amiga used a 68000 CPU, a 16/32bit beast compared to the 8bit 6510 CPU in a C64. I can still remember purchasing a 68000 book and the excitement of discovering not only a multiply instruction, but also a divide! And like most coders at the time, used those to produce a 3D starfield…
So I learned all about bit-planes and Blitters and Copper lists, and a host of other new things the Amiga had. I got into 3D graphics, and had a 3D engine running before I started working at Core Design.
My first Amiga game for Core was a 3D helicopter flight-sim called Thunderhawk. That was followed by Jaguar XJ-220, a sprite based racing game. Now, not a lot of people know that Jaguar started out as a polygon-based game, but I wasn’t happy with it; instead, a sprite-based game was pitched, and the rest is now history.
When the Mega-CD came along, I switched from the Amiga to Mega-CD, never to return…
…until now. Now I have the freedom to do whatever I want, to work on whatever I want, so I think I might give the Amiga another go.
Going Back To the Amiga.
Okay, so I’ve been thinking about doing this for a while, and I think I might just create a few Amiga games.
It sure felt a bit daunting at first; after all, it’s been a long time since I touched an Amiga, and I’m really rusty! First thing needed was a 68000 assembler, but that wasn’t a problem; my build system has a 68000 assembler built in, one I coded to investigate creating some Megadrive games.
How To Run Some Code
But the Amiga is disk based, so I needed a way to get some code running on it. The Amiga uses an ADF file, which is simply an image of a disk. The Amiga used double-sided 80 track 3.5″ disks, each track having 11x512K sectors. That gives a total capacity of 880K. My current emulator of choice is WinUAE, and that seems pretty good. Using disk images is easy, so no problem there.
Only problem is getting code into an ADF file to run on the emulator. I did look up the Amiga EXE file format, with a view to updating my build system to generate those. Amiga EXE files are relocatable, so writing that format involves constructing a specially formatted file. Not ideal, but workable.
Still had the problem of getting the EXE into an ADF file. Well, there are tools available for updating ADF files, but it all seemed tedious to be honest. Besides, I love to go straight to the hardware, and remembered back in the day my Amiga games did just that.
Boot-Blocks For The Win!
The trick (if it can be called that) is to use the boot-block. The Amiga boot-block occupies the first 1K of a disk, and if formatted correctly, contains code that can auto-boot the disk. Booting a game this way gives you full control over the machine, much to my liking.
So I’ve updated my build system to assemble a boot-block file, check sum it, and generate an ADF file that can be run on the emulator. Didn’t forget that to generate the checksum, had to consider that the 68000 is big-endian, whereas an Intel based CPU is little-endian.
For example, on the 68000, the 4 byte longword $11223344 is stored like this:
11 22 33 44
But an Intel CPU stores it this way:
44 33 22 11
So right now, I just have the ability to assemble a boot-block and create an ADF file:
Next step is to code a disk loading system. That shouldn’t be too hard as I’ve already done it once, although a long time ago; I’ve gathered up all the information I need to create this.
I Did It Once…
One thing I have done is take Thunderhawk and run that on the emulator, breaking into the debug monitor so I could examine memory and disassemble the code. I can reverse engineer quite a lot, which will help me. The Thunderhawk code has disk loading code, keyboard reader, mouse reader, as well as some other bits and pieces, so I can take what I need; after all, I did write the code in the first place!
So that’s it for part 1. Hopefully next time I’ll have a disk loader working.