Atari 8-bit games on Tiny FPGA BX Games Console


#1

I have been looking into what it would take to run Atari 2600 games on our Tiny FPGA BX Games Console.

Most of the work is in the TIA (Television Interface Adapter) which uses a small number of registers to generate a TV picture on the fly. It supports the playfield (background), 2 sprites (players), a ball and 2 missiles using a palette of 16 colours and 8 luminosity levels, using less than 64 bytes of registers.

The screen is 160 x 192 which we could map onto 320 x 192 on our display. We would need to allow a small amount of code to be executed between every horizontal line.

There are VHDL implementations of the TIA, but I haven’t seen a Verilog one. We would need a custom implementation of it anyway to fit in with our display and with PicoSoC.

There is a good description of the TIA and programming the Atari 2600 in the Stella Programming Guide.

As the Atari 2600 uses very little RAM and not much ROM, we could fit it in my RAM version of PicoSoC.

I have been looking at the Source code of Adventure, to see how the games were programmed.

I was thinking that we could reimplement some games in C, but using the same register API that the original uses. The audio output and button input doesn’t look very hard to do.

Once we have a working TIA, it also looks quite feasible to replace picorv32 with a 6502 CPU and run the original games.

I also quite like the idea of running the Deepmind AI software that learns to play a selection of these games, in real time using our console. Again, that looks as if it might be feasible to me. The Deepmind software is on Github. We could send the keystrokes over the uart and perhaps send the screen back over the uart or the usb connection. Or we might be able to send back the register set and use the PC emulator to reconstruct the screen.


#2

Here is a start of the Adventure Game. I started with a software implementation with direct driving of the LCD from the RAM version of PicoSoC.

The drawing of a new room is slow. I will look at the hardware implementation of TIA when I have the first level working in software.


#3

I have been pondering building a 6502 version of the SoC for a little while now too… It should free up (quite) a few more resources, but at the cost of being a bit more difficult to program… I’m happy coding in 6502 ASM, but I was brought up on a C64, and I’m weird :slight_smile:

That TIA chip is something else. :slight_smile: have you seen the “ultimate atari 2600 talk”? It’s well worth a watch… The people who wrote games for those things were absolute wizards … :mage:


#4

I don’t think I have programmed in 6502 assembler, but I have used Z80 and 68000 assembler. I downloaded the DASM assembler and assembled Adventure in it, and then ran it in the Stella emulator. That all looks straightforward and gives an effective development environment for Atari 2600 games.

So are you going to produce a C64 clone for the console? We don’t have enough RAM for a full version of that, but presumably you could produce something close, with a subset of VIC-II features? Or perhaps that is close to what you have in your latest version of video hardware (which I am still waiting eagerly to see).


#5

I now have a playable first level of the Atari 2600 Adventure Game on the FPGC.

To run it do:

git clone https://github.com/lawrie/atari_tia_soc
cd atari_tia_soc/games/adventure
make

It looks pretty much identical to the original as it uses the same graphics. It has a few screen glitches and there is no sound. Also the dragons don’t so much bite you as push you onto a wall like a sumo wrestler. So the gameplay needs some work on it and level 1 of Adventure is rather boring. The magnet does not work. The Easter Egg room is there, but I have removed the wall so you can wander in and take a look around.

The X and Y keys act as Start and level select. The A button drops items.

It uses the BRAM SoC, so no there is use of flash memory and just a hardware.bin, no firmware.bin.

The LCD is driven directly from C code, not in the VGA style of tinyfpga-game-soc, but there is some TIA-like hardware acceleration that makes displaying rooms instantaneous.

I am reaching the 14k limit of the BRAM SoC so getting the other levels in this version may be challenging.

Level 2 of Adventure is more interesting to play, and level 3 is the same as two, but with random object placement.

The source code for other Atari 2600 games is available, e.g. for Pitfall, so making those work with the original graphics shouldn’t be hard.