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.

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:

Author: Justin Richards

Drawing many large sprites with the pixel game engine (AKA achieving parallax with the pge)

please note this article refers to the pixel game engine version 1, version 2 will have support for far more optimal large sprite rendering out of the box, however some of the information here might be interesting to others that follow. especially if wanting to do own manipulation of sprites.

Continue reading “Drawing many large sprites with the pixel game engine (AKA achieving parallax with the pge)”

Dev Log: Laravel Blogging Platform – Starting Out

Laravel is a great framework that makes web development quick, easy and elegant. I’ve been using it for approximately a year at work and absolutely love it! There are plenty of extremely well-made packages to help extend its functionality from better handling of form request data, to implementations of multi-factor authentication.

But I’ve yet to find a package that adds a blog facility to a website. I’m not a fan of pre-packaged blog/CMS platforms such as WordPress and Drupal, so always prefer to roll my own solution. So, why not use my new-found knowledge and appreciation of Laravel to give something back that I’m passionate about?

Continue reading “Dev Log: Laravel Blogging Platform – Starting Out”