Open Source BBC Micro In JavaScript
Thursday, 15 May 2014

The BBC Micro was a revolutionary computer that had a worldwide impact. Now you can try it out in JavaScript in your browser.

What can be done with JavaScript today is impressive, but is emulating a 32K BBC Micro an indication of how powerful JavaScript is or is it an indication of how feeble home computers were?

The BBC Micro is a special computer because it introduced a generation in the UK to programming and it led to the creation of the ARM processor that is almost universal in mobile devices. It was also the inspiration for the amazingly successful Raspberry Pi - which has a model A and B just like the BBC Micro to show its roots. 




Matt Godbolt has just created an open source emulation of a 32K BBC Micro model B, jsbeeb, using nothing but standard JavaScript and what is really noteworthy is that he has started to describe how it all works.  

So far we only have an account of how the CPU was emulated. There are a number of 6502 emulators including some in JavaScript. If you think that emulating a CPU is a big problem - it is, but you have to keep in mind that processors like the 6502 have only a single byte op code. This results in a total of 256 possible op codes and in practice most of these aren't used. So what you need is a big select to dispatch each op code to a routine that processes it. In practice, for efficiency reasons, it is better to use a dispatch table of 256 references to funcitons that implement each of the operations. 

The 6502 may be a simple CPU, but getting it right so that it can be used to run real software is still a big problem. There are bugs in the hardware that are often made use of by anti-copy and security code and these have to be emulated if you want commercial code to run unmodified.

Then there is the small matter of timing. The code running in the emulator might well check to see how long an instruction took as judged by the way other peripherals change state. Matt Goodbolt's article describes how attention to timing was all-important for most software protection - read the article for the fine detail.

Of course, a machine is a lot more than just its CPU and we are promised more about the screen and peripheral emulation in a future part. 




You can try the emulation out at jsbeeb and once you have it running you can use all the BBC Micro commands and you need to know that F0 is F10, the Break Key is F12 and the "star" key is on the 2 key or the @ key. There is a disk image supplied with one of the most famous games on the BBC Micro - Elite. To run it enter *Elite3 and follow the instructions. 

Of course you could always download the code from GitHub and install it on your own server. 


AWS Lambda Adopts Java 21

AWS Lambda functions can now use all the new and useful language features as well as performance improvements introduced in Java 21 as part of the Amazon Corretto JDK implementation.

Hydra Turns PostgreSQL Into A Column Store

Hydra is an open-source extension that adds columnar tables to Postgres for efficient analytical reporting. Version 1.0 is generally available.

More News





or email your comment to:



Last Updated ( Sunday, 04 December 2016 )