Adventures in Amiga land part 1

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.

6 thoughts on “Adventures in Amiga land part 1

  1. This is great, but I do wonder why you didn’t just download a blank .adf file, mount it – and copy your files onto it?

    WinUAE even creates a blank disk file for you:
    https://eab.abime.net/showthread.php?t=62232

    Or if you prefer, just down an image:
    http://aminet.net/package/disk/misc/Empty_ADF_files (contains multiple disk imagines).

    But interesting stuff. As a fella programmer (applications, not games) who had the A2000 back in the day – I’d be interested knowing what programming language you’re using? AMOS? Basic? 68000 Assembler?

    Looking forward to the next part.

    Like

    1. Well, a blank ADF is just an 880K file, so it’s easy to make one. Just needs the first 1K to be in boot-block format (just needs a checksum) to make it a bootable disk. I don’t need to worry about file systems as I’ll code my own, so I can lay out the data on the disk anyway I like.

      As for languages, I’m using 68000 assembly language, because that’s what I do for fun. My day job is programming C++, currently coding AI for Elite Dangerous.

      Like

  2. Sensacional Sara!
    Is very nice to meet you!
    I played Jaguar XJ-220 very much!
    I remember when I’m a boy and see the Amiga first time running Blood Money.
    The game intro simply killed me, and I start to run to get my machine!
    At the time the computer that I had is brasilian unathorized clone of TRS Color and the other was a MSX. Amiga was far away ahead!
    Thanks for your efforts, and let me know about other texts and new game releases.

    Like

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