|Spare Time Labs 2.0|
PIC CDC ACM
Fun with HC08
Java Goes Native
Gas Fired Furnace
Down Memory Lane
A lot of old people have asked for a CHIP-8 emulator that would run in a Java enabled phone so that they could play all those wonderfull games that they used to play when them was kids.
Just kidding! but indeed it is now possible, read on.
It all started two weeks ago when I got a new Nokia 6230 mobile phone (IMHO the best phone from Nokia ever). On Thursday it dawned on me that you could load Java programs, called MIDlest, into this phone. I'm very fond of Java and always looking for oportunities to learn more, so I'm always looking for projects that are interesting enough to do, yet small enough to complete, and I started to think what I could do. Would have to be something more challenging than "Hello World". And suddenly it hit me, CHIP8 emulator! This would be something that I could show to some old barfs and we could get a laugh out of it, something that could be completed in a few hours, it would teach me about MIDlet programming and let me reminis over some childhood carefree days when we old barfs were plaing with our TELMACs.
So off I go, downloaded the trial version of JBuilder X from Borland website (30 day free trial sets a nice time limit to any project!) and the series 40 SDK from Nokia Forum website. Topped it up with the 'Introduction to the game API'. In an hour I had everything installed and had compiled the example Sheepdog game. Installed the Nokia PC Suite that comes with phone and, hey presto, with Application Installer downloaded the jar/jad file into the phone.
(If you want to start from scratch there are a few quircks on the way, as the Nokia documentation does not quite match JBuilder X. The secrect is to first create a new project, then go to the Project Properties, select the J2ME Micro Editon as your JDK and then with the New... command you can go to the Micro/MIDLet template.)
Anyway, I stripped down the Sheepdog to bare minimum, located CHIP-8 spec from the net, downloaded the CHIP-8 game TANK and started to work on the emulator. By Saturday morning (some six hours to the project) the emulator showed the first signs of life, and I spent a few hours on Sunday morning weeding out the bugs. The first part of this week (some three hours) was spent debugging the emulator, only to find out that actually the TANK game has a bug in it (the up/down keys are reversed and the target only moves sideways)! IIRC (it was more that 20 years ago) there was a bug in the original TANK game listings, so this file was probably typed in from those listing and never tested! Shows you how popular the CHIP-8 games are these days, doesn'it!
It is Saturday morning again and I'm writing this web page to complete and share this litle project. Hope somebody gets at least a laugh out of it. I have no plans to further develop this, I'm releasing it all here under the GNU GPL lisence so feel free to waste your time on further development!
You can download the jar/jad file for your phone from here .
The emulator source code is here for online browsing:
or you can download the whole project including the games in zip file from here . The emulator is Copyrighted by me and released under GNU GPL, the copyright issue of the games is a bit diffuse, but since the games are widely and freely available in the net (besided having been distributed originally free of charge) and no-one seems to object I've included them in my collection. If somebody convinces me to be a copyright holder of any of the games and objects to this I will remove them from the project.
Some of the games (like the 'Alien') are SuperCHIP-8 games, and though they run they are not usable in this emulator. Actually most of the games are useless, only the 'Invaders' and the 'Kaleid'(oscope) seem to be usable. Some of the games are useless because they are SCHIP-8, some have bugs in them and some use keys that are not available on the emulator because the phones have only nine keys available for games and whereas the original COSMAC had hex-keypad. But hey, you can fix this all: the source code for the emulator is here, the tools and docs available from Nokia,Sun and Borland, and there is even an assembler and disassembler along with some source code available in the net. So, like they used to say in the Creative Computing, if your creative insanity is looking for an outlet...
Interestingly the speed of the emulation is not a problem, although I paid absolutely no attention to the speed, I just coded in the most straight forward way. Even the drawing of sprites is done pixel by pixel without any smart blitstuff. The speed on my 6230 seems to match my recollection of the speed of my Telmac. And consider that this is an emulator emulating a CHIP-8 interpreter running on top of Java virtual machine! And during development all this was run in an emulated phone on my PC!!!
Have a laugh, regs Kusti
I've provided no links to off site things as they are likely to brake soon, instead I recoomend that you Google for with key words like "Series 40 SDK","Chip8 instruction set", "Cosmac", "JBuilder X download","Introduction to game API" etc.P.P.S.
I could not resist creating a Chip8 emulator applet, you can try the applet here . Wasted a good three hours on it.