Atari 8-bit games on Tiny FPGA BX Games Console


Hi Dave,

If you get any time, could you look at how I might do the audio for the Atari 2600 TIA as described in

I have added some simple tone generation so I can get some beeps out of the games I am developing and porting, but I don’t really understand audio enough to properly emulate the rather simple TIA audio,

I have just done square wave tones of approximately the right frequency, but with no volume control.

I don’t really know how to do the audio volume, how to get a purer tone, and how to do the other waveforms which are described as:

D3 D2 D1 D0 Type of noise or
0 0 0 0 set to 1
0 0 0 1 4 bit poly
0 0 1 0 div 15 -> 4 bit poly
0 0 1 1 5 bit poly -> 4 bit poly
0 1 0 0 div 2 : pure tone
0 1 0 1 div 2 : pure tone
0 1 1 0 div 31 : pure tone
0 1 1 1 5 bit poly -> div 2
1 0 0 0 9 bit poly (white noise)
1 0 0 1 5 bit poly
1 0 1 0 div 31 : pure tone
1 0 1 1 set last 4 bits to 1
1 1 0 0 div 6 : pure tone
1 1 0 1 div 6 : pure tone
1 1 1 0 div 93 : pure tone
1 1 1 1 5 bit poly div 6

I have currently just implemented the ones that say pure tone.


I could probably work out how to do the volume control but as the volume on my earphones is very low anyway, and if I use a powered speaker, it has a volume control, I am not sure how useful that is.

The outputs that are not pure tones need some sort of waveform output, but I am not sure what waveform those descriptions like “set to 1”, “set last 4 bits”, “4-bit poly”, “div 15 -> 4 bit poly” etc. correspond to.

Presumably the tone output would be purer if I used a triangle wave rather than the square wave I am currently using.


This is another description of some of the possible sounds:

TIA code Name Description
1 Saw sounds similar to a saw waveform
3 Engine many 2600 games use this for an engine sound
4 Square a high pitched square waveform
6 Bass fat bass sound
7 Pitfall log sound in pitfall, low and buzzy
8 Noise white noise
12 Lead lower pitch square wave sound
15 Buzz atonal buzz, good for percussion


I’ve done a little bit of digging. That stella pdf you listed above unfortunately falls short of the kind of details required to implement things, but, there are some other kind people on the interwebs who’ve helped fill in a few more of the details:


… and then, because nothing’s ever as easy as it seems at first glance, there’s some additional information about non-linearities in the volume scaling here:

It looks like basically there are a few different shift registers, some frequency scalers, and a mechanism for combining the outputs together. It should be fairly straightforward to make something like that, but the devil is in the details. For example, I’m not sure what the polynomials are that the shift registers are using, and it’s hard to find documented details anywhere.

Ultimately it might be easiest to look at the schematics - for example available on pages like this:

… and figure out how things are working from there… ?? or maybe find another verilog implementation somewhere?

… I’m looking around as I’m typing this and found a VHDL implementation - this might be a good starting point as they seem to have got the shift registers figured out at least…



Thanks for all that. I will look into it more.

I had seen that VHDL implementation and mentioned it in the top post. But I have never looked at it much as I have never learnt VHDL and don’t find it that easy to read and understand. (But I haven’t really tried).

I did not need to look at the VHDL implementation for what I have done so far as the spec is good enough to implement from and the LCD rather than VGA makes our implementation a bit different.

But it looks like I do need to look at it for the audio.


I have this working fairly reliably now. It plays a mean game of Pong.

The CPU is running at 1Mhz rather than the 1.19Mhz of the original.

Writing a pixel to the screen takes 8 clock cycles, as it consists of 2 LCD pixels, each of which is a 16-bit color, and each 8-bit value takes 2 clock cycles.


Here is an Atari 2600 test program running on the FPGC.

It uses repeated NOPs to decide where to change the background colour on each horizontal line.

I had to change the number of repeats as on the Arlet Ottens CPU a NOP is one cycle not 2, but in my implementation a CPU cycle corresponds to 2 pixels, whereas on the Atari 2600, is corresponds to 3.

I currently only have the 128 colour palette approximately right.

Here is the source


A surprising amount of Pitfall and Adventure seems to be working. Nothing is quite right due to the horizontal timing being wrong, but most of the graphics is there. It might be possible to modify the kernal code to make the games work with this version.

Here is the first screen of Adventure with the portcullis jumped to one side and the key gone missing:

Different games will need different key mappings as some use the fire button on the joysticks, and some use the select, start and reset buttons that were on the Atari 2600 console. Others use two joysticks. There were also some console switches for things like difficulty and black-and-white mode.


A slight change to the routine that positions sprites, and Adventure is playing!