Yesterday’s Full Frontal javascript conference turned out to be the ideal setting to compare notes with Ben Firshman of JSNES fame on the finer points of implementing emulators in Javascript – so this new release of JSSpeccy is the natural consequence of that. I’ve put in an optimisation which might possibly be a speed boost on Chrome (only writing bytes to ImageData when absolutely absolutely necessary), and the much-needed ability to load your own snapshot files, using the little-known getAsBinary method on file upload objects. (Unfortunately Firefox 3.5 is the only browser which supports it right now, but it looks like it may be in the process of getting the official W3C blessing right now.) And since I was on a roll, on the train back I implemented tape loading traps and the ability to load .TAP files (again, only on Firefox 3.5). Wahey!
Archive for the ‘Javascript’ Category
JSSpeccy v20091121
Saturday, November 21st, 2009JSSpeccy v20090929 (Don’t-Mess-With-Geeks Edition)
Tuesday, September 29th, 2009I wasn’t really planning on developing JSSpeccy further, because I didn’t consider it a serious project with a future. However, it turns out that someone else did. Enough to rip it off wholesale and pass it off as their own work on the iPhone app store for £1.29 a pop, no less. Yes, thanks to the detective work of Phil Kendall we now know that ZXGamer, the much heralded Spectrum emulator for the iPhone, was nothing more than JSSpeccy with a fancy title screen tacked on. (Which of course is a blatant violation of the GPL, and being pure Javascript, would explain why it ran at less than the speed of a real Spectrum on a 600 MHz device, and why it was overwhelmingly rated at one out of five stars. Epic fail.) It’s been pulled from the app store now – so while ZXGamer is gradually disappearing from the internet, it’s time to redress the balance a bit.
A new version of JSSpeccy is out. It doesn’t run at full speed on an iPhone either (although it positively speeds along on recent versions of Safari on real computers), but it does boast the following changes:
- GPL v3 licenced, with prominent notices to make it clear that playing silly buggers like the above will not be tolerated (even if they do include source…)
- A bit of speed optimisation (about 15% faster maybe)
- A pimped-up user interface with shiny icons
- And most relevantly, entirely controllable via iPhone / iPod Touch touchscreen. In principle. (If you’re expecting an immersive gaming experience, you’ll be disappointed.)
So there you go – probably the best Spectrum emulator for the iPhone ever. And it’s free.
JSSpeccy: A ZX Spectrum emulator in Javascript
Sunday, October 19th, 2008I’m really typecasting myself here. If there were an international “Person most likely to write a Spectrum emulator in Javascript” award, I’d have taken it for the last five years running. So here it is – probably the most stereotypical project I’ll ever come up with.
- Readme file
- Run JSSpeccy online (includes 10 classic games!)
- Download JSSpeccy (644Kb)
- JSSpeccy Subversion repository
Writing this wasn’t actually such a big deal – the Z80 core was ported from the one in Fuse, with the Perl-and-C-preprocessor-munging trickery still intact, and Javascript is syntactically close enough to C that that wasn’t a mammoth task. (I got 90% of it done on the train journey back from International Vodka Party alongside recording silly songs about tube stations.) The one fiddly bit was working around the places where the Fuse code used low-level C constructs to its advantage: using unions to chop and change between individual registers and 16-bit register pairs, and relying on limited-size C data types (often in pretty subtle ways) to truncate 8-bit and 16-bit values at the right time, whereas Javascript only has integers. (Actually, the really time-consuming bit was debugging it all… luckily, Fuse has a rather excellent test suite too.)
The rest is just creative abuse of the <canvas> element, as usual… it’ll take advantage of the putImageData interface to do the pixel pushing if available (on my machine Firefox has it, Safari doesn’t) and fall back on drawing 1×1 pixel rectangles otherwise. This time I’ve thrown in Google’s ExplorerCanvas as a nod to those poor unfortunates still stuck with Internet Explorer. Incidentally, I’d be curious to know how it rates on Google Chrome (I don’t have an XP/Vista box to test on) – if the hype is true (and it implements the putImageData interface like all good up-to-date browsers should) then I’d expect it to comfortably reach 100% Spectrum speed on modest hardware.
Antisocial
Thursday, October 9th, 2008
This is it then… my big comeback to the Javascript demo scene after a two year absence, and also the moment when my demo coding muse returned from a long holiday, I guess. Ladies and gentlemen, I give you… Antisocial, a biting satire on social networking phenomena.
Visit the Antisocial microsite…
With my characteristic lack of organisation, I found myself with two weeks to go to the Sundown party, having promised a demo release, and with nothing specific in the pipeline. So, I decided to take a chance and run with an idea that had been sitting on top of my “demos to write when I have more free time than I do right now” pile for the best part of a year. I had it all planned out in my head, right down to the soundtrack: a mysterious track from an unlabelled CD I picked up at a ZX Spectrum Orchestra gig in 2005 (which turned out to be Round, from their Clive Live^3 EP). A quick bit of permission-getting later, and I was at the point of no return.
I knew it would be an ambitious job, and a bit of a leap artistically and technically from my usual stuff. I pencilled in a rough project plan in my diary. I drew up storyboards. I read up on the maths that was too nasty to contemplate on previous projects. And shockingly enough, I actually enjoyed all of the above.
Comet Chaos
Monday, July 7th, 2008Thanks to Oleg for reminding me at OpenTech that I still hadn’t written this up yet…
This started out as an experiment in Comet techniques (which allow you to actively push data out from web servers without the client having to initiate the request) which quickly ballooned in ambitiousness – I didn’t set out to write Just Another Chat Application after all. The end result is a realtime multiplayer Javascript conversion of the Spectrum wargame Chaos… or a reasonable chunk of it, at least.
If you’re interested in the workings behind it, check out this video from my Oxford Geek Nights presentation to hear about how Comet is like a small child on a car journey, find out how close web developers can get to world domination, and watch a live demonstration going pear-shaped.
ZXpaintyONE
Friday, July 6th, 2007
So I wanted to enter the ZX81 Graphic Competition 2007. But I didn’t particularly want to type out block graphics character by character into a Basic program on an emulated ZX81 keyboard. So I wrote a ZX81 art package. In Javascript.
It does make sense – Javascript is one of the few languages you can write graphical applications in that’s truly cross-platform – as in ‘doesn’t require Windows users to install a massive runtime and a bundle of libraries’. Well, in this case we do require them to install Firefox, but come on, who’s going to object to that?
It’s dead easy to use (painting in three shades of grey is hardly rocket science after all) and it exports directly to ZX81 .P format courtesy of a neat Basic snippet from Russell Marks. So if you’re feeling artistic, give it a go – you don’t even need to download it. (But if you do, you get the additional perk of being able to supply an overlay image to trace around.)
Update (2008-07-12): Now features a handy clickable palette, as requested by Yerzmyey – so that people with less than three buttons on their mouse can use it. You’d think that a Mac user like me would have thought of that, really…
Canvastastic beta_1 released
Monday, September 11th, 2006The loose ends are now tied up and Canvastastic is ready for a not-chronically-rushed release. It’s now placed under a proper licence (the LGPL) and, more importantly, it has actual API documentation!
Download: Canvastastic beta_1 (20K, .tar.gz)
If you’re anything like me, you’ll probably be turning your nose up at having to download the thing just to see what the fuss is about, so I’m happy to oblige with some online demos…
- Boxes (demonstrates lighting and camera movement)
- Robot (demonstrates transforms and animation)
- and finally, the library source itself, for those wanting a spot of light bedtime reading.
Canvastastic
Monday, September 4th, 2006At this weekend’s BarCamp London, I announced a new Javascript library which takes the 3D engine from my Gallions Reach demo and promises to place it in the hands of industrious web developers, hackers and masher-uppers everywhere. The presentation seemed to go down well, so it’s only right that I should get this first release out, as promised. Strictly raw materials right now (and still no real documentation), so be prepared to fill in the gaps…
- Canvastastic beta 0
- Tales From The Third Dimension – slides from the talk (PDF, 220K)
- Additional (pre-<canvas>) examples were taken from my 2004 demo Mooncheese
You shouldn’t have to wait too long for proper documentation, especially in view of the valiant effort Simon has already made. That Willison is a crafty one, as anyone who witnessed him pretending not to be a werewolf will testify. I borrowed his laptop for my talk, and within half an hour of getting it back he’d trawled through the code I’d left on it and more or less written up the complete API documentation – and promptly set about drawing diagrams to explain 3D coordinate transformations. Zero-day w4r3z, anyone?
(technorati fodder: barcamp, barcamplondon, barcamplondon06)
Gallions Reach
Tuesday, August 8th, 2006It’s been a good while since my last serious demoscene production, and it could have been even longer if I’d gone ahead with my plan to sit out this year’s Assembly competitions and take a break for once. But then along came Opera to sponsor the browser demo compo and assign it an “Open Web Standards” (read: anything but Flash) angle. How could a Javascript afficionado like me resist? And so, after a long coding slog, I give you: Gallions Reach.

- Gallions Reach on Pouet
- Info file (inc. system requirements)
- Download Gallions Reach (ZIP, 3.0 Mb)