Atari ST Programming: STOS and Turbo C

Screen Shot 2022-03-31 at 1.37.38 PM.png

Previously I got my MiSTer set up afresh, and I mentioned part of the motivation was to get back into retro programming.

One of the systems closest to my heart is the Atari ST, because that was our entry into the 16-bit computing era.

At the time the Amiga was out of budget for many of us in our home town, so as well as being the cost-concious option, it was also the best bet for access to games to swap.

It didn't take me long to yearn to get back into programming. On the Spectrum, I didn't get very far. There was something about that system that didn't gel quite as well for me. Really, instead of the Spectrum 128+2 I should have gone for the C64. Having both now, I do kind of regret the choice, though again I had way more friends with Speccies than anything else by a huge margin.

Introducing the Atari ST

EEEF96A2-37E7-485E-9DCD-4E9E2F876FEA_1_102_a.jpeg

The Atari ST was the first reasonably priced, fully 16-bit microcomputer, and the first computer with a colour graphical interface. It hit the UK market in 1985.

There were 16-bit computers before it, such as the Sinclair QL, but those machines were more 8/16-bit hybrids. The ST, unlike its contemporaries (Macintosh, Apple //GS, Amiga, Archimedes, IBM PC), was lower priced at launch and fully 16-bit.

Like the Mac and Amiga, it comprised a 8mhz Motorola 68000 and could be expanded up to 4MB of RAM, though as-standard our STFM had 512kb.

If you had a monitor, it could output a high mono resolution of 640×400, or monitor/TV medium 640×200 (4 colors) or low resolution 300×200 in 16 colors from a palette of 512.

One of the little-known facts about the ST that made it a cut above the regular home computers of the time is the OS is not just a pretty face, but Digital Research actually based their code on CP/M-68K. This meant, outside of Microsoft DOS and Unix, the ST had what could be considered a top-tier, industrial strength hierarchical operating system with a mature API and hard disk support.

What TOS did lack, however, was pre-emptive multitasking found on the Amiga and later MiNT, and not otherwise readily available to home users until Windows 95.

Due to the price/performance, it was popular in things like Desktop Publishing, a brand new market at the time, along with Computer Aided Design, Word Processing, and even found a strong fanbase in professional music studios due to the included MIDI features.

Atari ST Architecture

While the ST didn't have all the custom chips of the Amiga, it was still a big deal in its day. Due to the similarities with the Apple Mac, when the ST came on the market it was nicknamed the Jackintosh after the new Atari head honcho, Jack Tramiel.

035365D7-B9BA-4286-BBFD-5CD772AB0D45.jpeg

The Atari ST operating system, or TOS (The Operating System or Tramiel Operating System) lives in Read-Only memory (ROM) and consists of:

  • BIOS (Basic Input/Output System) the lowest level bootstrap layer.
  • XBIOS (Extended BIOS).
  • GEMDOS the command line/application operating system interface.
  • GEM (Graphic Environment Manager) graphical user interface, developed by Digital Research.

GEM provides APIs and tools for:

  • VDI (Virtual Device Interface) which manages graphical objects.
  • AES (Application Environment Services) which manages windows and events.

Programming the Atari ST

Unfortunately, unlike the Vic 20 and the BBC Micro, the BASIC options on the ST were a bit lacking.

That is, until STOS arrived on the scene.

This was exactly what I was needing, because it was a language developed especially for games/multimedia (though multimedia wasn't really a thing yet).

A3FC144E-507E-49A4-9B23-F477EE94D383.jpeg

As well as the original STOS software, I bought the compiler and even a sound sampler. I made small games and even tried to replicate the "demo scene" with bouncing sprites and scrolling messages, well as much as I could.

ADA26867-2047-4356-8BCB-3519A66756DE_1_105_c.jpeg

Still, this didn't feel like "real coding" - at the time I didn't realize a lot of commercial software, especially in the education market but even real games was developed using the exact same tools I was learning. I yearned to do something more "grown up".

Around the time I left high school and started working for the local health service, I enrolled on a college night course about COBOL programming and knew at that point I would have to save up for a PC.

My friend had moved up to coding in 68000 assembly and I just couldn't do very much with it - I still find 68000 on the ST and Amiga much more difficult than the 6502/6510/z80 due to how the bitmap displays work.

As luck would have it, the next year I did another community college course where we used Borland Turbo C, an IDE/Compiler also available on Atari ST (though seems available officially mainly in Germany, and developed outside of Borland then brought into the fold? My copy was ... unofficial ... but it did have English help files ... a crack perhaps?).

What is great about C, especially "enhanced" environments such as Turbo C, is it abstracts a lot of the crap that got in my way due to lack of brain.

8DC9BCC9-A6BF-4613-A0D6-6368181B01B4_1_102_a.jpeg

Atari ST Emulation

There are two main emulators for the ST range, Hatari and for windows users, STEem (not related to the pre-Hive blockchain).

For mac folks you can download the DMG or use brew or macports sudo brew install hatari and on Ubuntu use apt sudo apt-get install hatari.

Hatari came with an open source version of TOS, otherwise you will need to download a copy of the ROM from the internets. As I have physical ST machines sat here I feel fully justified using online ROM images.

Once you have Hatari, the first thing you will want to do (other than set the TOS rom as previously mentioned) is create a folder to act as your hard disk and then select it (F12 to get the settings screen):

Screen Shot 2022-03-31 at 6.22.18 PM.png

I like to set the screen resolution to at least medium.

If you have a MiSTer then look no further than the hard disk image provided by Pezz. As well as games and demos, it also includes STOS and Turbo C!

STOS Setup

Screen Shot 2022-03-31 at 6.26.01 PM.png

Grab STOS and the compiler here. Uncompress it to the folder you selected as your ST hard drive earlier and then find the BASIC*.TOS and run it.

Screen Shot 2022-03-31 at 6.25.49 PM.png

Turbo/Pure C

Turbo C is in the VHD linked earlier, but you can also get the software independently with some sleuthing.

Screen Shot 2022-03-31 at 5.10.00 PM.png

You used to be able to get this IDE from various sites and now the links seem broken when looking for the Borland version, but I found Pure C here and here and it seems functionally identical to the Turbo C I was expecting.

If you download rather than use the disk image, ensure you have the paths set correctly or else your code won't compile.

Screen Shot 2022-03-31 at 5.12.27 PM.png

Next Up

As this has already gone long I will leave us there and pick up in a part 2.

Next time I will show how to code and compile so you can run your new programs on emulated or real hardware ...



0
0
0.000
0 comments