A long-overdue maintenance update to JSSpeccy to apply a bugfix independently found by Antonio Villena and Andrew without-a-surname: IM 2 interrupt handlers were broken because I had an 0xfff where there should have been an 0xffff. Thanks both!
Read on for the complete notes/transcript of the talk (in hopefully more coherent form than the talk itself – next time I promise to spend less time on the flashy demo and more time figuring out exactly what I’m going to say…)
- Fake Plastic Cubes – online version
- Fake Plastic Cubes – download (10Kb)
- Fake Plastic Cubes on Pouet
Still, even if the execution this time didn’t work out, I think it’s been a worthwhile exercise in bringing pieces together. Jacob Seidelin’s PNG compression hack (where JS code is stored in a PNG image to take advantage of the compression, then unpacked on a canvas using getImageData) has created a bit of a buzz in the JS development world, but this is the first time it’s been used in an actual demoscene production (which is surprising, given how the demoscene is the spiritual home of size-coding hacks). Ben Firshman’s JSNES has been dynamically generating audio for some time now, ardently chasing the moving target that is Mozilla’s Audio Data API (with a trusty Flash snippet as a fallback), and Mathieu ‘p01′ Henri was experimenting with softsynths long before then. Not even my own code is safe from this cherry-picking exercise of doom – the 3D routines are a mishmash of Gallions Reach / Canvastastic (for the lighting model) and Antisocial (for the full scene / movable camera handling). Finally, node.js makes a cameo appearance, because having an actual web server on hand makes development go a lot smoother.
Put them all together and you have the ingredients for a delicious 64K Intro cake. This time it came out a bit half-baked, but I’m passing on the recipe in the hope that someone else can make it work:
Update 2010-06-08: Oops. In the process of testing how Safari 5 shapes up, I discovered a rather silly oversight: the audio buffering routine was set up to never use more than 10% of CPU. Now that I’ve fixed it, it turns out that Chrome and Safari (at least) have no trouble at all playing Jugi’s Dope theme in its 28-channel glory. (However, taking the brakes off the buffering does mean that we can’t reliably pause the audio any more. A small price to pay, I think you’ll agree.)
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.
- Readme file
- Run JSSpeccy online (includes 10 classic games!)
- Download JSSpeccy (644Kb)
- JSSpeccy Subversion repository
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.
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.
Thanks to Oleg for reminding me at OpenTech that I still hadn’t written this up yet…
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.
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…