Welcome to Dan Griffin's Javascript CPC Emulator

Here is an example of my work (the sort of thing I do for fun :)

The Amstrad CPC was a popular 8-bit machine from the 1980s based on the Z80 CPU architecure. I decided to have a go emulating it a couple of years ago, firstly to learn how an emulator works and secondly to capture some nostalga.

I had to learn how to emulate the Z80 CPU, the CPC custom chip (gate array), the Motorola CRTC 6845, the keyboard controller, memory architecture, i/o controller chip and an old school cathode ray tube

The whole thing was programmed test-first (I'm a big believer in TDD) using the Ruby programming language. This turned out to be horrendously slow. Fortunately, thanks to all the testing, I was able to refactor the code into a 'compiler' that was able to compile my CPC emulation into Ruby, Java or Javascript code. This meant, thanks to HTML5 and the canvas feature that it would run quite happlily in a modern web-browser.

So here is a classic game of 'Dizzy', using my emulator in a web-browser. Press the 'Spacebar' to start a game, and the use 'Space' to jump, 'Z' to go left, and 'X' to go right. Press 'Control', 'Shift' and 'Escape' together to reboot the machine into BASIC!

Here is the source code for your perusal. All code is licenced under the GPLv2.