Earlier this year, I had to figure out how I was going to load level data into
Magicore Anomala. A level
contains backgrounds, sprites, animations, dialogue scripts, and much more.
Ideally, I want to pack all of these things into a single file, so that I can
deal with the filesystem and file names as little as possible.
I did some cursory searching on tools or frameworks that make it easy to define
and build custom file formats, but the stuff I found was a little too complex
for my use case, and not flexible enough. So I created my own tool, and I
open-sourced it in case others find it useful too.
If there was, it would be spelled "Assemblify", which is now the name of your
So, the cool thing about Assembly is that whenever you perform an instruction,
the CPU runs a bunch of comparisons automatically! They are stored in "condition
flags", which you can use to branch (goto) or do other stuff if the right
conditions are met.
I came across a cute little trick while looking to optimize my physics routine
in Magicore Anomala.
In the routine, I need to check if each object is inbounds, and deactivate it if
it goes out of bounds. Pretty typical situation, and we'd probably see it
written as something like this:
Magicore Anomala is powered largely by the Amiga's blitter, allowing me to
quickly clear the screen and draw hundreds of objects every frame at a full
60fps. It runs in parallel with the CPU and excels at copying or manipulating
large blocks of data.
But the blitter goes above and beyond the functionality of simply hauling bits
around. You can shift, mask, and logically combine up to three independent
sources anywhere in shared memory.
Today I'll show you how Magicore uses the copper and blitter to convert and copy
a 24-bit RGB color palette into the Amiga's 12-bit color registers, every frame,
using zero CPU cycles.
One interesting challenge when coding the game engine for Magicore Anomala is
figuring out the ideal data structures for different scene objects.
Since we're on a 7MHz CPU and need to process hundreds of objects per frame,
every CPU cycle counts. Here are the requirements for the bullet objects: