The Spectrum fans amongst you may be aware that there is now a
Spectrum emulator, called ZX Gamer by Roger Boesch, available for the iPhone. There's one important thing about this emulator, and that is that it sucks. It doesn't just suck a little bit. In fact, it manages to suck so much that it actually runs slower than a real Spectrum (3.5 MHz) on my 3GS (600 MHz). Everyone else who's had the misfortune to download this app agrees, as it's currently got 13 ratings on the App Store, each of which gives it just one star.
Now, there's basically no way you can manage to write an emulator which runs that slowly, unless you write it in a completely inappropriate language. One completely inappropriate language to write a Spectrum emulator in would be JavaScript. However, Matt Westcott is a bit of a nutter (in an entirely good way) and in fact has done
just that, calling it JSSpeccy.
Now this starts to get interesting... the three games distributed with ZX Gamer (Batty, Cyclone and Exolon) are three of the example games Matt put up for the JSSpeccy demo. Also, Mr Boesch contacted Matt to ask him some details about JSSpeccy's Z80 core implementation. What's now particularly interesting is that ZXGamer runs at
exactly the same speed as JSSpeccy (which happily runs on the iPhone), taking just over 30 seconds to flip from the controls screen to the high score table on Batty. This could all be coincidence, and Mr Boesch has publicly stated that
ZXGamer is not based on JSSpeccy. So that's alright then.
However, I'm well known to be a sucker for punishment, so I paid for and downloaded this sucky software, and after backing up my iPhone had a little snoop around the backup directory. I quickly found a couple of files...
$ cat 6573fa774785883cf41752388d5fa9d4b7d1a482.mdinfo
[ binary junk ]AppDomain-com.rogerboesch.zxgame[ more binary junk ]
For the uninitiated, that says that the file 6573... contains data relating to the application name "zxgame.rogerboesch.com". The .mdinfo file contains the metadata, while the actual file data is in...
$ head 6573fa774785883cf41752388d5fa9d4b7d1a482.mddata
function sign_extend(v) {
return v < 128 ? v : v-256;
}
function z80_do_opcodes()
{
while(tstates < event_next_event ) {
var opcode;
function sign_extend(v) {
return v < 128 ? v : v-256;
}
function z80_do_opcodes()
{
while(tstates < event_next_event ) {
var opcode;
Wow! Mr Boesch has managed to completely independently come up with his own Z80 core implementation which looks
exactly like JSSpeccy's. What are the chances of that happening?
Disclaimer: JSSpeccy is basically a translation of
Fuse's Z80 core (which was written by me) into JavaScript. What this does mean is the JSSpeccy is GPL code, and therefore so it would appear is ZXGamer. Where should we go from here?