bpharoah

What you got there sour grapes?

Atari, Retro

Writing An Atari Game

Atari 2600

Atari 2600

Escape from Oof World – Adventures in programming the Atari 2600

New! You can now play Escape from Oof World in the browser, click below:

Play Escape From Oof World!

I suspect you have two questions here. What the heck is Oof World? And what is an Atari 2600?

Let me address the second question first. This, my friends, is the Atari 2600:

Retro-tastic

Yes, the grand-daddy of all home computer consoles, running cartridges that could hold a whopping 4k of memory.

The games looked like this:

Pole Position

Awesome right? This is what I grew up with. And I loved it. For some reason recently, I’ve been pining for my past and I think I love the old Ataris even more than ever. Wait. How the heck did they make that game?

Anyway, so having noticed a resurgence in retro-gaming, and a relatively new basic programming language for the Atari 2600, I decided to try my hand at writing a game for it!

Which leads to the second question. What is Escape from Oof World? Well that’s the name of the game I’ve been writing. Inspired by my 5-year-old’s love for a range of cuddly toys that he decided to call Oofs! Here’s my favourite Oof:

Oof!

He’s my favourite for 2 reasons;
1 he looks funny, 2 my son calls him “Lord Dark Oof” – love it!

So, let’s write some code!

Tools required:

  • A computer!
  • batari Basic
  • Visual bB
  • Stella (Atari 2600 emulator)
  • Infinite patience (I failed on this one, but hey, I got there in the end)

Look here for batari Basic and Visual bB:
http://www.randomterrain.com/atari-2600-memories-batari-basic-vbb.html#install_vbb

All the nitty gritty on programming and commands for batari Basic is here:
http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html

Stella is here: https://stella-emu.github.io/downloads.html

Read the instructions and follow the setup exactly, and you’ll be up and running in minutes.

The BASICS

Ha! Basics.

Ahem. Anyway. So the Atari 2600 has the following available to it:

Playfield – the background graphics. A whole 32 pixels wide and 11 pixels deep…
Player0 – 1st sprite
Player1  – 2nd sprite
Missile0 – 1st player missile
Missile1 – 2nd player missile
Ball – ball!

Not a lot to work with is it? Fear not, there are lots of tricks to get more out of it. batari Basic, has a few extra kernels up its sleeve to make things easier too. For instance, the DPC+ kernel will allow extra “virtual” sprites – although a bit of flicker will be introduced. Plus higher resolution playfields.

BoRing! Show me some code

Okay! I’m going to assume now that you’ve installed everything you need and have created a new empty project.

So, first of all, lets draw a sprite. Sprites can be up to 8 pixels wide (although you can stretch them) and any number of pixels high.

Lets use this handy tool to draw something:
https://alienbill.com/2600/playerpalnext.html

Let’s make an Oof!

Oof!

So, above, I have expertly drawn 2 frames of animation. On the PlayerPal editor, there’s an option to generate code – select this and click on generate batariBasic code.

Paste the result into your project:

rem CODE INSPIRED BY Atarius Maximus at http://www.atariage.com/forums/index.php?showtopic=109288
set kernel_options player1colors playercolors pfcolors
player0x = 50
player0y = 50
main
f=f+1
rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME…
if f = 10 then player0:
%00111100
%01111110
%11110111
%11111111
%11101011
%11111111
%01111110
%00111100
end
if f = 10 then player0color:
$0E;
$0E;
$0E;
$0E;
$0E;
$0E;
$0E;
$0E;
end
if f = 20 then player0:
%00111100
%01111110
%11101111
%11111111
%11010111
%11111111
%01111110
%00111100
end
if f = 20 then player0color:
$0E;
$0E;
$0E;
$0E;
$0E;
$0E;
$0E;
$0E;
end

if f=20 then f=0

if joy0right then REFP0 = 0
if joy0left then REFP0 = 8

drawscreen

if joy0right then player0x = player0x + 1
if joy0left then player0x = player0x – 1
if joy0up then player0y = player0y – 1
if joy0down then player0y = player0y + 1

goto main

Now, click the save icon and then the run icon:

Your first bit of Atari 2600 code ! Use the arrow keys to move the Oof around 🙂

Oof animation

There you have it. Your first piece of Atari 2600 basic code!

Now, I’ve thought about going deeper into detail on all the different commands and kernels etc., but why reinvent the wheel? The links in this blog should be enough to get you started, but I am more than willing to answer any questions you may have: news@psvrblog.com

In the meantime, here’s a little sample of Escape From Oof World, complete with title screen!

Leave a Reply

Theme by Anders Norén