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: https://github.com/dataochljud/simpleGameEngine

Atari 8-bit version: https://pastebin.com/zCUkZeWe

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.

PGE Driver – upcoming olc::PixelGameEngine game

PGE Driver is an arcade style racing / death-match game where the aim is to win – by any means necessary! With nitro boost and heavy machine guns at your disposal, along side pre-race upgrades such as engine power, tyres, and armour – the choice really is yours… Win by being the fastest, or the deadliest, it’s your call.


What started as merely a theme to accompany an exercise in code discipline, ended up blowing out to a fully featured game which so far has spawned 3 olcPGEX extensions for sprite handling, camera tracking, and sprite animation. Not to mention a fully customisable menu system with panel transitions and overlays.

The cars in this game are fun to drive and easy to do burnouts in, which shows off the PGEv2.xx’s ability to render many 10’s of thousands of decals on the screen at any given time and still maintain a satisfactory frame rate. By the end of a race there might be 40,000 or so skid decals on the track! This was not possible until PGE v2.0 so well done Javidx9, you’ve made the PGE a viable game engine for those of us who like the simplicity, but still need some power under the hood 😉



A playable demo is not available as of time of writing, however you can check out a short demo clip of a couple of levels and vehicles to see how the game is progressing so far…

If you are interested in the extensions of mine that were used to create this game you can check them out in the contributions folder in the github here:

https://github.com/OneLoneCoder/olcPixelGameEngine/tree/master/Contributions

Author: Justin Richards

How to attribute/credit/cite the olc::PixelGameEngine

Hello! Firstly a big thank you, the fact that you are reading this means you actually care about doing the right thing, and want to acknowledge the software you have used from other developers.

The olc::PixelGameEngine is open source and is released under the OLC-3 licence. This means you can use it freely, even for commercial projects. However, the licence requires that appropriate attribution is required.

Releasing Software in Executable Binary Form

Your olc::PixelGameEngine application needs to display to the user the following message:

Copyright 2018 – 2020 OneLoneCoder.com

Most people prefer to do this by either:

  • Keeping the application in window mode, and not changing the text displayed in the window’s title bar. By default, olc::PixelGameEngine applications are out-of-the-box compliant.
  • A splash screen along the lines of “Made using olc::PixelGameEngine” and including the above notice.
  • Full attribution in a “Credits” or “Licences” menu available without special requirements of the user (such as completing the game for example)

Releasing Software in Source Code Form

If your project is distributed via source code, and you use either part, or all of the olc::PixelGameEngine, the full text of the OLC-3 licence needs to be included in the source code distribution. By default, an unchanged olcPixelGameEngine.h file will satisfy the licence requirements. If you maintain an external catalogue of licences, you should include OLC-3 in that too.

Releasing Derivative Works

Since the olc::PixelGameEngine is open source, you are allowed to modify it. This could be in the form of adding additional features, wrapping it into an alternative framework, cloning the features, or using parts of the code. In this instance, the full OLC-3 licence text needs to be included, and if your derivative work is in binary form, it must display to the user the above copyright notice.

Citation in Academic Works

If you use olc::PixelGameEngine for school, research, academic pursuit, you can reference/cite it properly in the following way:

olc::PixelGameEngine, v2.05, OneLoneCoder.com, 2020

The version number and year are of course flexible and should be changed as required.

Referencing in Digital Media

If you write blogs, make videos, create content and want to reference the olc::PixelGameEngine,, or indeed the OneLoneCoder website or javidx9 youtube channel, then the correct links are:

https://github.com/OneLoneCoder/olcPixelGameEngine

https://OneLoneCoder.com

https://youtube.com/javidx9

Finally, again a big thank you for taking this seriously. Software development is a hard and time consuming task, in the hope that it makes someone else’s software easier and quicker to produce. It is important that the hard work of others is given the credit it deserves – javidx9.

olc::PixelGameEngine 2.0 is here!

After quite a few late nights, it’s finally here! PGE 2.0 is a significant upgrade on its predecessor, and is 100% backward compatible. This major revision brings in hardware accelerated sprites in the form of the olc::Decal, multiple rendering layers, and has been completely re-organised to make it easy to port to other platforms.

The features added were in response to the fantastic feedback from this community. You guys wanted to use it as a genuine game engine? Now you can.

Download from the Github Repo and try for yourself!