heckmeck!

Nerd content and
cringe since 1999

Alexander Grupe
Losso/ATW

September 2025

Blog

2025-08

Some aftermath of the Amiga preferences extractor: While writing the parsing code, I thought I had either lost my mind or the official file format specification was wrong. One of these possibilities is way more probable than the other, and it wasn’t helping that the output images looked a bit trippy:

When they were supposed to look like this:

But, as many programmers know, it is a good sign to feel like you’re going mad. You will stubbornly try to prove that reality is wrong and you are right, and in the end you’ll learn something either way…

In my case I thought I had found a bug in an official Amiga header file that has been around for forty years. Crazy, right? My own code comments would agree:

// weird: something is off by 1 byte there:
// - devs/system-configuration from Workbench-v2.04.adf
// - expected system colors: aaa 000 fff 68b
// - extracted colors:       d0a aa00 00f ff06 <-- upper bits used?!
// - sprite colors look ok
//
// possible explanation (intuition/preferences.h):
//
//    UWORD color17;      /* Colors for pointer sprite    */
//    UWORD color18;      /*   "     "     "      "       */
//    UWORD color19;      /*   "     "     "      "       */
//    UWORD PointerTicks; /* Sensitivity of the pointer   */
//    UWORD color0;       /* Standard 4 Workbench-Screen colors */
//    UWORD color1;
//    UWORD color2;
//    UWORD color3;
//
// PointerTicks is a byte, not a word!?
// no, wait, there's an *extra* byte after! (still: ?)
//
// with a dummy readByte() inserted:
// - extracted colors aaa 000 fff 68b, sprite colors e44 000 eec
// - looks about right

Assuming an extra byte between PointerTicks and color0 solved the problem! I thought I had really found a bug in the ancient reference code and was getting all excited. Then I noticed something in the hex dump:

0800 0005 0000 0000 0000 c350 0000 0000
0009 27c0 0000 0001 0000 4e20 0000 0000
c000 4000 7000 b000 3c00 4c00 3f00 4300
1fc0 20c0 1fc0 2000 0f00 1100 0d80 1280
04c0 0940 0460 08a0 0020 0040 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 ff00 0e44 0000 0eec 0001 0d0a  green = color17/18/19
aa00 000f ff06 8b00 0000 8100 2c00 0000  red   = color0/1/2/3
...

If you’ve ever worked with text files, you might spot what’s suspicious about the first red color value: The value is 0d0a when it’s supposed to be 0aaa. Is it a coincidence that 0d0a is also the byte encoding of an MS-DOS/Windows linebreak?

Well, it is not. Someone is clearly converting LF linebreaks to CR LF, replacing all 0a bytes with 0d 0a (and treating the binary data as text). But who? At first I assumed my code must be at fault, or the way I invoked “unadf”, a tool from ADFlib to extract files from Amiga disk images. But after some poking it was clear that unadf itself performed the erroneous linebreak translations.

Note: This only affected the Windows build. Under Windows, you need to pass a special flag to open, apparently, otherwise all your bytes will be mangled by default. Now that’s helpful, and totally not insane! :)

So, sadly there was no exciting bug discovery in Commodore’s old code, and sadly, I was not tripping. :) But the bug was still a nice find – it must have been around for years!

Big shoutout to the ADFlib maintainers for fixing the issue in record time, and thanks for all your work!

On the Amiga, you were able to, nah!, you were invited to customize everything on your desktop: the colors, the mouse pointer, the keyboard repeat rate, the screen position.

Amiga preferences editors

While this could get out of hand from time to time, it provided a great way to customize your disks. You only needed to include a 232-byte system file to boot with your colors and mouse cursor. (As long as you were booting into AmigaDOS, and not using a custom trackloader.) This way, you could:

  • design a fancy, futuristic, or goofy mouse cursor,
  • use your logo as the pointer,
  • set all colors to black and use a fully-transparent mouse cursor to hide the fact that you’re using DOS at all.

One day I wondered: Wouldn’t it be fun to automatically gather all the preferences files ever released and collect them into a gallery of system settings?

This weekend I finally got around to write a system-preferences extractor using ADFlib and the docs, and designed a template for the preview images:

Hmm, come to think of it: The enlarged mouse pointer seems kinda redundant the longer I’m staring at it…

Anyway, since I’ve already coded everything, I’m only one full TOSEC download away from building a more-or-less comprehensive gallery. Oh, and a round of pouët scraping, probably…

previous next close