This is an attempt to make an Atari 2600 emulator in Java. I actually started this a long time ago, but after getting the CPU fully implemented I didn't have time to finish it. A few weeks ago an I did an FPGA VGA project and it reminded me about Jatari.. plus I got a couple emails asking me about.. so I decided to start development up again. The CPU is fully implemented, but most of the hardware is not. I'm not sure if I'll bother to finish it, but we'll see. I was thinking lately of making this work on Android but it appears there is already an Atari 2600 emulator for it.
What It Does
Right now Jatari consists of a number of Java class files: TIA (graphics and sound.. I believe this chip is also nicknamed Stella), Television (emulates the raster beam of a TV), PIA (the RIOT IO, timer chip, and RAM), ROM (where cartridge memory sits), m65xx (decodes instructions from a 6502/6507/6510 cpu), MemoryBus (routes to object/chip where memory read/writes should go), and Jatari (simply the "main" class that starts it all up). I normally stay away from heavily object oriented programming like this, but I decided to give this a try here. Originally I was trying to keep everything realtime with the TV and video drawing pieces asyncronous and everything in a few and bigger class files, but I changed my mind and decided to just try and get it working like this first. To make Jatari run as an applet or in J2ME should be as simple as adjusting the Television class to use an applet/midlet canvas instead of a Frame and making the ROM read from an HTTP socket to grab the game file. The Jatari class would have to be modified too to extend Applet or Midlet.
In its current state, Jatari will render the test.bin file included in the download correctly. Now I have to make sure the PIA works, add sprites, collision dectection, and connect the keyboard with the Joystick interface.
I found some really nice example programs on http://khryssun.free.fr/programming.html. I've been using these to test and make sure Jatari is working properly. Right now I can perfectly render the heart picture with Jatari. I'm currently getting about 700-800 frames per second on a 2.6 GHz E7300 Core2 DUO.
Java To C++
I've also been thinking of doing the Atari emulator for Playstation 2 or maybe iPod-Touch/iPhone, so I wrote a Perl script that would convert this Java code to C++. Everything should convert pretty much straight over except for the Monitor.java class which will have to be written specifically for the computer/device this is being ported to. I already converted the m65xx code to C by hand a long time ago, but I figured this would be better so if I find a bug ever in the Java code, I don't have to rewrite the fix by hand into the C/C++ code.
January 9, 2011: Not sure why I decided to do this today, but I updated the Television.java class to use a MemoryImageSource in Java instead of drawLine() for drawing the pixels. The speed increased from 130 FPS to about 700 to 800 FPS on the heart picture on a 2.6GHz E7300 Core2 Duo. Only getting around 90 FPS on an Atom N270 netbook :).
Copyright 1997-2021 - Michael Kohn