Being an American, I was never exposed to the BBC machines. I tried running the emulator and entering a small program; alas, I can't figure out how to enter the "=" key, so I had to give up. I couldn't find "+" either.
I found the hardest part of writing my own microcomputer emulator in javascript was keyboard mapping. Each browser does things in a somewhat different way, and then there is the inherent tradeoff between emulating the original keyboard layout faithfully vs using a logical layout (where pressing "=" on the PC keyboard results in a "=" event in the emulator).
As for the CPU emulation speed, indeed chrome doesn't optimize switch statements greater than 128 entries. I got around this by coding it as "if (opcode < 0x80) switch (opcode) { first 128 cases } else switch (opcode) { other 128 cases }
I had tried using a 256-way opcode dispatch table, which was great for chrome, but it hurt firefox performance (which is blazing with the 256-way switch). Having two 128-way switches was pretty good for both browsers.
I found the hardest part of writing my own microcomputer emulator in javascript was keyboard mapping. Each browser does things in a somewhat different way, and then there is the inherent tradeoff between emulating the original keyboard layout faithfully vs using a logical layout (where pressing "=" on the PC keyboard results in a "=" event in the emulator).
As for the CPU emulation speed, indeed chrome doesn't optimize switch statements greater than 128 entries. I got around this by coding it as "if (opcode < 0x80) switch (opcode) { first 128 cases } else switch (opcode) { other 128 cases }
I had tried using a 256-way opcode dispatch table, which was great for chrome, but it hurt firefox performance (which is blazing with the 256-way switch). Having two 128-way switches was pretty good for both browsers.