Given that this was to be a quick system I leant on my UNIX knowledge and decided to use the curses library for the screen management. Usefully in the early 90s Eric Smith (of MiNT fame) wrote a basic TOS version based upon the early BSD UNIX sources. I had a full build environment under MiNT too, so it was logical to use that. (This comprised GCC 2.5.8pl1 and mintlibs pl 46.)
To cut a long story short, this part of the project, including reading in an INI file and parsing a simplified CSV format file, was quite simple.
The frustrating parts were controlling the sound system. Thankfully I found reasonable documentation for the STe/TT Microwire interface to control the volume of the DMA audio. The difficult bit was controlling the speaker on the TT. After numerous attempts to get it to work I got no-where until I discovered:
- A 'feature' of the mintlibs <osbind.h> header combined with GCC meant that the value passed to Ongibit() and Offgibit() HAS to be unsigned short otherwise it doesn't work.
- The game I was using to test (Bubble Bobble) cleared the PSG Port A, meaning that bit 6 got cleared, turning the speaker back on! This meant that even after I'd got it working I didn't know that I had. I only discovered this when I tried a different game.
Anyway, by late yesterday I had a working program which would work on all Ataris as I'd made sure that I only controlled the DMA audio and other extras on the relevant machines. I even checked by running it under MiNT with memory protection turned on to make absolutely sure that there wasn't any erroneous memory access. All fine.
So, today at the asking of that nice Petari fellow I posted a binary... Well it crashed and burned on his STe... Oh dear!
He suggested that I try in an emulator, so I downloaded Hatari for my Mac, installed TOS 1.62 into it, recompiled the code giving the compiler the -m68000 options as I guessed that it was building 68030 binaries by default and copied the executable into the emulator's "hard disk"...
The result... it mostly worked. If run from the AUTO folder it ran and didn't crash anything on exit, most of the time. Run from the GEM desktop it would always crash with three bombs on exit and I have no idea why.
I haven't got my STe available at the moment (it's in the loft) so I can't try it on a real machine.
So I'm almost there.
If anyone would like to play I've attached a zip file containing the source and an executable. As mentioned about you'll need GCC, make, mintlibs and Eric Smith's curses library to build it.