Home

Awesome

jsbeeb tests

jsbeeb - Javascript BBC Micro emulator

A BBC Micro emulator in Javascript. Runs on Firefox, Chrome and Microsoft Edge. Emulates a 32K BBC B (with sideways RAM) and a 128K BBC Master. The BBC had a somewhat different-looking keyboard to a modern PC, and so it's useful to know some of the mappings:

To play right now, visit http://bbc.xania.org/. To load the default disc image (Elite in this case), press shift-F12 (which is shift-Break on the BBC).

Getting set up to run locally

jsbeeb needs to be built with webpack. If you're developing locally you'll need a recent node and then run npm install to install needed packages. node can be installed from https://nodejs.org/.

You can then run npm start to get a local webserver which will autoreload on changes in the code - visit http://localhost:8080/ and off you go.

jsbeeb uses node and webpack to afford me simple and standard web development tooling and third party library access without lots of painful copy/paste or wheel-reinventing, as well as the ability to better run tests, and "pack" up the site to make it smaller and faster to load when it's deployed to https://bbc.xania.org.

URL parameters

Patches

Patches can be applied by making a patch=P URL parameter. P is a sequence of semicolon separated patches of the form @XXXX,YYYY:ZZZZZ,... where the @XXXX specifies a PC address to breakpoint, the YYYY is the address to patch and the ZZZZ is the data to write at address YYYY. The @ part is optional, but is handy to ensure the code you want to patch has actually loaded. For example: patch=@31a6,0769:6e4c4d48465a which is a patch for the default Elite image. Once the PC has reached $31a6, the bytes at 0769 are replaced with 6e4c4d48465a.

Loading BASIC files from GitHub gists

Note that every update you make means you need to make a new raw link.

Things left to do

If you're looking to help:

Tests

For general correctness there are several tests in the tests directory, including:

For timing correctness we have:

Tests can be run automatically if you have node installed - just run make and it'll ensure the relevant libraries are installed, then it'll run the tests. Please note it can take a while to run the whole test suite.

Thanks

jsbeeb was heavily based on Sarah Walker's C B-Em emulator -- thanks to her for her hard work and for open sourcing her code. B-em is now being maintained by a group of enthusiasts - thanks to them too!

Huge thanks to Richard Talbot-Watkins for his advice and help along the way in fathoming out the instruction timings, interrupt fun, video code rewrite and for being such a good pal all these many years!

Thanks to Michael Borcherds for his help; improving the keyboard layouts and handling in Javascript, reporting issues, chasing down game bugs and much more.

Thanks to David Banks (hoglet) for his help in testing the gnarly BCD flag behaviour on real live BBCs.

Cheers to Ed Spittles for testing various interrupt timing code on a real BBC.

Thanks to Chris Jordan for his thorough testing, bug reports, ideas and help.

A lot of the early development used the amazing Visual 6502 as reference for intra-instruction timings. Amazing stuff.

Special shout out the users of the 6502 Forums

More information

I've written a lot of how the innards work on my blog in the emulation section.
I gave a presentation on how it all fits together at work, and posted the video up on YouTube. I presented again at GOTO Chicago 2016, and I'm hoping they post the video up.