# 8-bit computer tools
I have started writing some tools in preparation for working with
platforms I haven't really used before. The first is a linker script
for Atari 8-bit computers. The Atari computers have an interesting
binary load format. On Commodore systems, a PRG file is simply
contiguous memory image, starting with a load address header. Once
the file is loaded, nothing special happens. To distribute a RUNable
machine code program, you make a memory image containing a small
BASIC program followed by the machine code which is loaded into
BASIC memory. The BASIC program is just a SYS call, which calls a
the machine code following it. Messy and ad hoc, but it gets the job
done.
Atari 8-bit computers on the other hand have an executable file
format made specifically for machine code programs. This format
consists of any number of segments of binary code or data, each with
a header specifying start address and end address. These segments
are loaded sequentially and can correspond to any memory range.
There are two special vectors in memory used during loading. One
that when written to will execute at the address you wrote to it.
This allows a program to execute code before all segments have
loaded. The other, if it has written to during loading, will be the
the start address of execution once the whole program has loaded.
These are referred to as init and run segments, respectively.
This way I you could for example load some small program in an early
segment to display a picture or start a music playback interrupt
while other, larger segments are loading. Or you could load some
precalculation routines, execute them and then load the main program
over it. Very flexible, yet simple. To do the same thing on
Commodore, you'd have to invoke the disk routines explicitly from
your program to load separate files.
The minimum executable consists of two segments: a 2 byte run
address segment (excluding its header) and your code segment. The
overhead for each segment is four bytes. Additionally, the
executable starts with the 2 "magic" bytes ff ff. The total overhead
to run a simple program is thus 2+4+4+2, ten bytes. This compares
favorably with Commodore BASIC stubbed programs, which need 2 bytes
for a load address and some > 10 bytes for a line of BASIC tokens.
Now that that's out of the way, I can focus more on the interesting
video and sound hardware on the Atari 8-bit computers. It's good to
have things like this out of the way for the rainy day when I
eventually will want to dig deeper.
The next tool I'm working on is a sprite/tile sheet converter for
the TurboGrafx-16 console. Also planned is an Atari display list
assembler. I will write more on that later!