The olcPixelGameEngine for Retro Platforms Part I


I’m very found of the Atari 8-bit machines and the Atari ST. When I saw the PixelGameEngine (PGE for the rest of this text) i thought why not port it? I started to look at the Atari ST. Using my own 520 STM as a the target machine.

I soon realised that a regular port wouldn’t cut it. My first attempt was to remove a lot of stuff just to get it to compile. The first PGE binary needed a 4 MB machine. Not even close for my 512kB target machine. In the test program all graphics routines is written from scratch and that is because of the bit plane situation, more on that below.

Before we dig deeper let’s look at the hardware.

The Atari ST

The Atari ST is made to be cheap it has almost no custom chips. For the original machines you can look at it as a 68000 processor connected to a 32k frame buffer.

  • Motorola 68000 processor running at 8 MHz
  • 520kB to a maximum of 4MB of RAM
  • TOS operating system
  • A YM2149 sound chip
  • MK68901 MFP
  • Built in midi
Atari TOS

Graphics capabilities

The ST always (almost) has 32kb of screen memory. In the following graphics modes:

  • 320 x 200 pixels, 16 colors
  • 640 x 200 pixels, 4 colors
  • 640 x 400 pixels, monochrome

For graphics and games the first mode is the most useful.

The screen memory is organised in bitplanes which are interleaved. It looks like this i word (16bits) of bit 0, one word of bit 1, one word of bit 2 and finally one word of bit 3. Then we start over. This makes it harder to set individual pixels. It’s also harder to copy graphics that is not a multiple of 16 pixels. To get around this you pre shift your graphics to save time.To complicate things more you can only set the screen adress on even 256 bytes. This is because the LSB of the screen adress is missing in hardware. This makes scrolling a lot harder. You basically have to copy all your graphics data. This eats up all your processor time for one frame at least.

The Atari 8-bit

The Atari 8-bit machines is the opposite to the Atari ST. It has a lot of different graphics modes. The Hardware:

  • MOS 6502 processor running at 1.77 MHz (PAL)
  • ANTIC and GITA custom graphics chips
  • POKEY custom chip for sound, keyboard, paddles and serial communication
  • Maximum of 128 kB of RAM (newer mods with more memory exists)

As for graphics capabilities you have up to 17 different graphics modes to choose from. But it does not end there. You also have something called the display list which means you can mix and match your graphics modes as you see fit. This is a very powerful feature. There is also hardware scrolling support and the possibility to add interrupts in the display list. This means that you can have interrupts happening on a specific line for example to change the palette or scrolling.

Test programs

We end the first part by looking at my test programs I’ll also link the code att the end of this post.

Atari 8-bit

A smal test in 40×23 pixels

Uses ANTIC modes 2,7 and 8. Then writes random numbers to the screen as fast as possible.

Atari ST

Atari ST version here called the SimpleGameEngine.

Program is written in C++ and uses gcc 8.3 for cross compilation.

The Atari ST version is here called the simpleGameEngine. I’ve decided to change the names to PGE68000 and PGE6502 to be consistent.

The code

Atari ST version:

Atari 8-bit version:

Final note on the code the GitHub version may differ slightly from the running code in the video.

Final words

My tests have shown that it is possible to make the PGE for both the Atari ST and Atari 8-bit. It should also be possible to port to the C64 and Amiga.

In the next part

In the next part we will take a closer look on the Atari ST version of the PGE68000.

Rate this post!

Average rating 4.6 / 5. Vote count: 37

No votes so far! Be the first to rate this post.

Leave a Reply