back to article Chap rebuilds BBC Micro in JavaScript

Matt Godbolt, a developer whose day job sees him work at a securities trading outfit, has used his personal time to rebuild the Acorn BBC Micro in JavaScript. JSBeeb, running here and downloadable from Github is the product of about two months' work. The emulator reproduces a 32K BBC Micro and when loaded into your browser …

COMMENTS

This topic is closed for new posts.
  1. Anonymous Coward
    Pint

    And, in true BBC fashion....

    ... There's no adverts!

  2. Longrod_von_Hugendong
    Thumb Up

    Good on him...

    Well done, up there with rubrics cube solvers etc. Proving JS can do some things :D

    1. DropBear

      Re: Good on him...

      Yes, well, it nicely demonstrates that not even javascript can slow down a multi-core CPU running at a few GHz so much as to no be able to pretend it's a single-core CPU clocked at a few MHz...

      1. Stevie

        Re: not even javascript can slow down

        it can if it uses the extra time to mine bitcoins in the margins.

    2. vagabondo
      Boffin

      Re: Good on him...

      " rubrics cube solvers"

      I think those would be better tackled by Deep Thought (HGTTG) than the humble Beeb Micro.

      1. Cliff

        Re: Good on him...

        Genius! I love this kind of completely redundant problem solving, it gives our species the edge over dolphins (computing lightweights)

        1. Chemist

          Re: Good on him...

          " it gives our species the edge over dolphins"

          Whilst I agree with you the dolphins are better engravers ( of the grey glass bowls)

        2. ashdav
          Coat

          Re: Good on him...

          Hmm. I always thought the mice were in control. But there you go

          (Ref H2G2)

  3. Woodgie
    Go

    Loading disks on a Mac

    Listen up, this is IMPORTANT people. What you need to do is disable Mission Control's use of f12 to bring up the Dashboard. SO pop on over to System Preferences>Mission Control and from the popup menu next to 'Show Dashboard' choose the -

    Then, to load the disk you've selected in the emulator press - by default- [shift]-[fn]-[f12] OR if you've selected 'Use all F1, F2, etc. keys as standard function keys' in System Preferences>Keyboard, you can leave out the [fn] key press.

    Enjoy!

  4. groovyf

    Ah, this has taken me back over 30 years to being hunched over the keyboard playing the rather remarkable Defender clone. Top stuff.

    1. James Hughes 1

      Planetoid IIRC.

      I think originally it was indeed called defender but they had to change the name.

      306k was my record. Came with a free broken space bar. Still have the Beeb in the loft...

      1. Sir Runcible Spoon
        Linux

        If Chuckie Egg is available, the missus won't be seeing me this weekend, and GTA V can get fucked :)

        1. SVV

          You mean you've never seen this?

          http://www.bagshot-row.org/chuckie-egg/

          Have a nice weekend, apiologies to your missus

          1. Anonymous Coward
            Anonymous Coward

            Re: You mean you've never seen this?

            Looks like Mrs Spoon will just have to spend quality time with his credit card down the shops.

            Alternatively, I could show her my etchings if she'd care to come over. Better still, she should bring his credit card with her for a threesome.

            Posting anonymously as I don't want the knight to recognise me.

            1. Sir Runcible Spoon
              Paris Hilton

              Re: You mean you've never seen this?

              To be honest you'd be doing me a favour, as long as I get her back eventually (and in one piece!).

              I had the leisure of an evening on my own a few months back, and even though my good lady wasn't there, I could still hear her saying "Come off there then" :D

              Mind you, it might take me more than a weekend to regain my skills to the level I did at school when I got to the last level with both Big Bird and the little birds. I got to that level with 99 lives left (i.e. at the end of the third time through) when the teacher kicked me out.

              Does anyone know what happens after that level? If it just goes back to little birds and starts all over again don't tell me, I don't think I could bear the disappointment after 27 years of suspense!

              1. Anonymous Coward
                Anonymous Coward

                Re: You mean you've never seen this?

                Thank you for posting a photo of the fair maiden. My conscience has just kicked in, reminded me of a notice I saw next to an exhibit in a museum - "Like another man's wife, look, but don't touch".

                Shops open in an hour. I'm off to dust off the Atari ST and see how far I can get on Joust. Good luck.

  5. Anonymous Coward
    Anonymous Coward

    Arghhh

    There goes my work day... I feel like I am 12 again

    1. Anonymous Coward
      Anonymous Coward

      Re: Arghhh

      Makes you feel like a 12 year old and a BBC reference in there, hmmmmmmm

  6. Paul Webb
    Happy

    At last

    A BBC Micro I can afford.

    1. Sorry that handle is already taken. Silver badge

      Re: At last

      At last! Now I can dig out those BASIC books that were published for kiddies and had simple games in them in multiple versions (though never IBM PC). The Micro was slightly before my time, and I never saw one in Australia anyway, so the books never got any use.

      1. Steven Roper

        Re: At last

        "The Micro was slightly before my time, and I never saw one in Australia anyway"

        They were here for a while. We had BBC Micros at my high school in Adelaide in 1983/84, although I don't know how much longer they were there after that since I finished school in '84. Those were the days - IT security meant nothing more than there was a lock on the classroom door, and the old *PASSLOOK was the epitome of hacking. Oh the fun we had breaking into the girls' accounts and leaving little love letters and promises to alter their Computer Studies grades up if they'd just accompany us to the school disco!

  7. James Boag

    Buy that man a Beer

    Ah the good old days, Never had a disk drive but then back in the day a dual tape deck was standard in most "Hi-Fi"'s

    1. Grikath

      Re: Buy that man a Beer

      and play him some music... ;)

      http://www.youtube.com/watch?v=F1mmHn-FD48

  8. Anonymous Coward
    Thumb Up

    Repton!

    I feel an evening of nostalgic gaming coming on.

  9. Anonymous Coward
    Anonymous Coward

    Clever - but why not use one of the very good emulators already out there...

    e.g. Beebem

    1. Jason Bloomberg Silver badge
      Thumb Up

      Re: why not use one of the very good emulators already out there

      I guess it falls into the traditional human endeavour of simply 'because he wants to'. Instead of wondering if something could be done he may have decided to try it and see - and that's what's driven personal and humanity's progress over the years.

      Perhaps he saw it as an enjoyable challenge or learning experience or maybe even to dispel notions that it could not be done, that javascript could not be used or would be too slow.

      There are plenty of worse and more pointless ways to spend one's time.

    2. bonkers

      thanks for that - I wasn't aware of Beebem, sounds simpler for what I want.

      Have you all seen the Java simulation of the 6502 core? - it really is "right down to the metal" - you can see the instructions being decoded on the metal lines.

      http://www.visual6502.org/JSSim/

  10. Sarev

    RISC OS Pico

    If you like JSBeeb, then you're bound to like RISC OS Pico - so you can boot your Raspberry Pi directly into BBC BASIC.

  11. Andrew Richards

    "... zippy performance, something the original BBC Micro was not entirely famous for."

    A 8-bit computer with a 2 MHz CPU from 30 years ago wouldn't really compare to a Cray from the same time but slow, really? Elite, Revs, Aviator, Firetrack (etc.) were fast enough for the time and anything written by Gary Partis was usually too fast to be playable (Psycastria is quite enjoyable under emulation - when slowed down!)

    Slap in a 16k ROM and there was real-time spell checking available years (a decade?) before this appeared in Word.

    1. Steven Jones

      Indeed, I've no idea what era the author first became aware of computers, but the BBC micro was faster than virtually all the direct competitors at the time. Indeed, BBC Basic (which was advanced for the time) was famously much faster than the competition.

      The 6502 was clocked at 2Mhz whilst some of the competitors ran at 1Mhz. Whilst the Z80 based competition was often clocked at 4MHz, this was a somewhat misleading comparison as the Z80 as the latter used more "clock ticks" for most operations (like memory access). The Z80 could be faster in some circumstances as it had more registers to play with, but the 6502 had some tricks of its own in referring to low memory. Generally I found that my 2Mhz BBC micro outran the 4MHz Nascom II I built.

      Anyway, this was long ago, but the BBC was considered pretty fast for its time.

      1. Wilseus

        Anyway, this was long ago, but the BBC was considered pretty fast for its time.

        Yes, that's the part of the article I thought was odd as well. In its day, the original Beeb was generally regarded as one of the fastest home computers out there.

        1. Simon Harris

          Re: Anyway, this was long ago, but the BBC was considered pretty fast for its time.

          Not only fast, but one of the few where you didn't run out of integers when you got to 32767.

      2. NeilPost Silver badge

        and the 3rd Generation BBC Micro the ARM powered BBC A3000 version of the Archimedes was pretty nippy too.

        http://chrisacorns.computinghistory.org.uk/Computers/A3000.html

    2. Jim 59

      Zippy?

      "... zippy performance, something the original BBC Micro was not entirely famous for".

      Agree with Andrew Richards. Having fast BASIC is exactly what the BBC Micro was famous for, as the reviewers in "Personal Computer World", "Your Computer" etc. never seemed to tire of writing. It was the fastest of the 8 bits until Locomotive Basic, written by the same software company, came along in the form of the Amstrad CPC464.

  12. Steve Todd

    Emulation? Pah!

    Real programmers reconstruct the machine in FPGA logic to get cycle accurate results

    http://www.mike-stirling.com/retro-fpga/bbc-micro-on-an-fpga/

    1. Anonymous Coward
      Headmaster

      Re: Emulation? Pah!

      If you read the article again a bit more carefully, you'll see that he is in fact performing cycle-accurate emulation in software. This is pretty much the bog-standard for 8-bit emulators and has been for decades; it's the only way to get the games that use hardware trickery (like timed sprite / colour / screen mode switches) to run properly. Its pretty impressive to pull it off in JS though.

      1. Steve Todd

        Re: Emulation? Pah!

        No, the article talks about maintaining synchronisation between the emulated CPU and peripheral chips. Few software emulators are truly cycle accurate, where a 2MHz clock changes state 4 million times per second, one change precisely every 250nS. They are serial processes whereas the original hardware ran everything in parallel (the processor was working at EXACTLY the same time as the video chip, VIA IO/Timer chips etc).

        1. Anonymous Coward
          Anonymous Coward

          Re: Emulation? Pah!

          Yes, but if the software is written such that it processes everything that can happen within that cycle across all the peripherals before it advances the emulated clock then what difference does it make whether or not the tasks are accomplished in parallel? All it means is that the processing may not occur in exact real-time, and may be subject to real-world speed-ups and slow-downs, but within the framework of the emulation everything still happens on all the right clock cycles.

          1. Steve Todd

            Re: Emulation? Pah!

            If it can do that, and maintain a consistent 500nS timing per cycle then yes, the software is truly cycle accurate. The point is that very few software emulators do that. They pretty much all cheat in one way or another, shortcuts are taken, time to complete a loop is inconsistent etc. With the FPGA based solution you can put a scope on it and match to within nanoseconds what the original hardware was doing.

            The other thing with FPGA emulation is you can then speed it up or slow it down in a precise and controlled fashion. There was a recent example of someone who got a Z80 core to run at 128MHz using an 8MB SDRAM (rigged up as 4K pages) and some on-chip caching.

  13. Peter Gathercole Silver badge

    "zippy performance, something the original BBC Micro was not famous for"

    I beg your pardon!

    In it's time, the BBC micro was pretty much at the top of the PC World Basic benchmarks for a couple of years.

    In the following years, the original IBM PC, which was a (admittedly crippled) 16 bit system running at twice the clock speed, did not manage to better the Beeb (I have the figures in front of me, but I can't be bothered to type them in). And a comparison with the C64, Apple ][, Spectrum et. al. had the Beeb running rings around them.

    I admit that benchmarking the Basic did not give a true indication of speed, but even if you look at the graphics speed and capability, the Beeb was the fastest and most capable home micro of it's time. The major drawback was it's relative lack of memory. I was even able to write a full Dec VT52 emulator in Basic that was as fast as the commercial terminals of the time.

    Sure it's slow in comparison to machines that came later than it, but that is completely expected. You would not expect a favourable comparison between a Model T and a Mondeo.

    1. Robin

      Re: "zippy performance, something the original BBC Micro was not famous for"

      "You would not expect a favourable comparison between a Model T and a Mondeo."

      Or between a Mondeo and other modern cars.

      1. Captain Scarlet Silver badge
        Mushroom

        Re: "zippy performance, something the original BBC Micro was not famous for"

        Don't make me slap a link up which shows even the Top Gear presenters like the Mondie!

    2. Steve Todd

      Re: "zippy performance, something the original BBC Micro was not famous for"

      Yes, the 2MHz 6502 that powered it was a little quicker than a 4MHz Z80, plus the memory was interleaved between CPU and video so there was no slow-down required to access video RAM. It was a fast PC for its day, but technology has moved on a long way from that point.

      Rule of thumb for emulation: your host system must be at least 10 times faster than the device being emulated. Being faster than a 6502 at 20MHz isn't a big push.

    3. Jim 59

      Re: "zippy performance, something the original BBC Micro was not famous for"

      Broadly agree with Peter Gathercole, however...

      ...if you look at the graphics speed and capability, the Beeb was the fastest and most capable home micro of it's time.

      True, but "it's time" only lasted about 3 years really. It launched in December 1981, but was overtaken as early as Spring 1984. Rather than making version 2, Acorn was complacent, relying on the BBC's advertising power and reputation to sell Model Bs at the increasingly absurd price of £400, which was not cool. Still, big credit to the model A/B for being so powerful so early.

      1. Steve Todd

        Re: "zippy performance, something the original BBC Micro was not famous for"

        To be fair the BBC had a lot of extra hardware in there that the spec said that it had to have and increased its price. Teletext mode for example, or that it was socketed for a floppy controller and sideways ROMs. The Electron was an attempt to fix those cost issues, but the slump in demand for PCs and cutting too many corners killed that.

        Meanwhile Acorn were working on a replacement, the Archimedes, that debuted the ARM CPU. The fact that they priced this too high for the home market also didn't help, but again the machine required expensive parts.

      2. Steven Jones

        Re: "zippy performance, something the original BBC Micro was not famous for"

        @ Jim 59

        Complacent? As in designed a brand new RISC processor and (for those days) very fast computer complete with a full graphical operating system using such things as scalable typefaces in the shape of the Archimedes? All on a small fraction of the resources available to the industry giants.

        On reflection, it was probably inevitable that Acorn were going to get steamrollered by the sheer mass and inertia of the IBM PC and all the clones that followed. Staying alive in a niche market is about companies can do in such a tidal wave of commoditisation, and even IBM had to bail out eventually. Only Apple have retained any sizeable market share for an alternative personal computer standard (at least prior to the smart phone/pad revolution). However, that complacent company you describe left the legacy of ARM, which now designs and licenses by far the most popular CPU architecture (by number) that has ever existed.

        1. Jim 59

          Re: "zippy performance, something the original BBC Micro was not famous for"

          BBC micro was great on launch but Acorn would have sold drastically fewer units had they not had the advertising resources of the BBC at their disposal. For years the BBC cheerled for the model A/B while studiously ignoring every other competing product. You never saw an Oric 1 on The Computer Programme and this insulated Acorn from the market, enabling the 400 price to persist long after commercial forces would otherwise have brought it down.

          I don't know what the profit margin was at Acorn but Herman Hauser became a millionaire very quickly.

      3. Peter Gathercole Silver badge

        Re: "zippy performance" @Jim 59

        The speed at which computing was moving at that time ensured that nothing would remain the fastest for any length of time. The B+, B+128 and Master 128 and 512 were the follow on products, and it was not speed that was the primary cause for the updates, it was memory.

        But some of these later systems were actually faster, due to the change in memory map, the move to faster ROM chips (early BBC micros had to actually slow down the system bus to read from the EEPROM that was shipped containing the OS and BASIC with issue 3 BBC micros), BBC BASIC 2 and 4 and later 6502 derived processors (IIRC, the Master used a 65SC12 which was a re-implemented design that altered the load/store timing shaved a few T-states off some instructions, while re-implementing the missing instructions that didn't work in the NMOS MOSTEK 6502).

        We were just beginning to see the move to 16/32 bit computing. I'm not going to argue that the BBC would best a 68000 or a true 16 bit 8086 or later system, but that did not stop them being very useful machines long after the C64, Spectrum and other micros of the time were consigned to storage.

    4. sdc
      Happy

      Re: "zippy performance, something the original BBC Micro was not famous for"

      wasn't the first version of BBC BASIC written by one savant programmer, who just entered the code in and there was ~ 2bugs before it ran nicely? Or a I confusing by savants?

  14. Bottle_Cap

    Ahh Elite.. the game that nearly made me fail my A-Levels! All over this tonight :)

    1. Graham Marsden
      Thumb Up

      Right on...

      ... Commander!

  15. Quentin North

    Elite

    Elite is a joy to behold in its 8-bit glory, or you you could get on the latest Elite redux bandwagon for a mere 100 quid, https://store.zaonce.net/elite-dangerous-cat/elite-dangerous-premium-beta.html

    1. Uncle Slacky Silver badge
      Linux

      Re: Elite

      Or there's always Oolite: http://www.oolite.org/

      1. Bottle_Cap

        Re: Elite

        I tried that - couldn't get on with the awkward controls tbh - maybe it's improved since then tho'

        1. Dave 126 Silver badge

          Re: Elite

          People seem to have enjoyed success with using Xbox 360 controllers with Oolite in some Linux distributions.

    2. Firefox

      Re: Elite

      zaonce.net, genious ...I wonder how many other Elite names i could remember if I put a few clock cycles into it - I'm sure I could remember the specs of half the ships.

      I make it 29 years ago that I wasted enough time to become Elite....still proud of it.

      You don't see many Thargoids around these days, I think collectively we saw them off!

  16. Richard Lloyd

    Can recommend the Android Beeb emulator...

    If you're on the Android platform, I'd recommend grabbing Beebdroid from the Play Store. It's not just the emulator that's impressive, but also the easy way you have access to almost all the classic BBC Micro games (not just Elite/Welcome), though I'm not sure about the legality of that...

  17. Caaaptaaaain kick arse

    MRM Video nasties

    anyone?

  18. KirstarK

    I am off to lave and will go looking for thargons

  19. Bottle_Cap

    iirc there was a keypress when you went into hyperspace that triggered the thargoids?

    1. Sir Runcible Spoon

      There was, and make you you have your escape pod equipped first!

  20. Phoenix50

    Goodness...

    ...I may now finally be able to complete Repton 2 - IIRC there was a bug that screwed the ending when you attempted to get past the last set of yellow skulls before grabbing the character map.

    I know, I know, I really should try and get over it.

    1. Andrew Richards

      Re: Goodness...

      Early versions only - this was fixed. It's possible to complete Repton 2 - being able to save machine state makes it achievable (and much less frustrating).

  21. Rick Giles
    Childcatcher

    Ewww

    JavaScript...

    1. Tom 7

      Re: Ewww

      yeh you cant do anything in that can you.

      Programmers can tho.

  22. Stevie

    Bah!

    Chap Cleverly Emulates BBC Micro Using JavaScript.

    Fixed it for you.

    No soldering irons, hacksaws or drills were used. Not even a 3D Printer was part of the process. No BBC Micro was rebuilt to rise from the ashes of yesteryear. A clever script was built (and probably rebuilt a good number of times) to emulate the BBC Micro, but that is different.

    1. Destroy All Monsters Silver badge

      Re: Bah!

      Our IP lawyers will be in touch....

  23. Will Godfrey Silver badge

    Then again

    Nice piece of work, but I still have a working BBC B and a BBC Master,

    Where's the 'smug bastard' icon then?

    1. Richard 12 Silver badge

      Re: Then again

      I have two and a half.

      One working Model B, a working Master and a 'break up for spares' Model B.

      If I remember correctly, the dead B had a failed PSU (very common) and dodgy keyboard, probably some other faults as well but I forget.

      That said, I haven't actually powered either of them up for ...some... years, so I might actually have three break-up-for-spares now.

  24. Anonymous Coward
    Anonymous Coward

    Pretend MIDI Rock Band ..

    "Atari ST .. was very successful in the professional music industry due to having MIDI ports as standard."

    There's a fake rock band playing in central London that uses a detachable MIDI interface attached to a guitar, pretending to play the rock classics. All they have to do is twang the strings in sequence and the computer does the rest ..

    http://www.gizmag.com/guitar-wing-wireless-controller/30589/

    1. Gareth Perch

      Re: Pretend MIDI Rock Band ..

      I mostly played an excellent Galaga clone (Zalaga) on the school's Beeb. I did play Elite, but on my Spectrum (once I'd conquered the Lenslok, I pressed the button on my wonderful Multiface to save copies for my friends, but I had bought the original for £15 or something - still have it in fact). I only knew one person at my school whose family could afford a Beeb, but he was too intelligent to hang about with for more than a few minutes at a time and didn't seem to be quite as much fun as all my Spectrum owning friends.

  25. Trigun

    swapped

    I swapped my (then) new Atari ST for a BBC B+ in my youth. Parents weren't at all impressed until they realised that I learned more on the beeb than on th ST by a long way.

    As for the js based emulator: very good indeed, although the real thing is better :)

  26. Gartal

    Ahh the past.....

    I have just been out in the workshop where I finished inventing a circular device with a central round bit which attaches to a stick. I plan to attach two of them to a box and thence to a dog or horse or 8 year old child. It should make the movement of items from one location to another significantly easier than loading everything up on the wife's back and whipping her.

  27. Spoddyhalfwit

    Fanboy Alert

    I wonder if I could kick off a fanboy war for the over 40s by mentioning that the BBC was shite/superior (delete as appropriate) when compared to the Commodore 64.

    Recalling some of the playground arguments of my childhood years, and some of the fanboy wars that go on here on the reg to this day its amazing that the technology has moved on leaps and bounds, but people really aren't that different.

  28. buyone

    The Beeb - an engineers machine

    In the real world the Beeb was superb. There were lots of connectors underneath for interfacing and Beebs were used all round the factory for test and measurement, Ken Jones wrote a data acquisition and FFT prog and the software for the Winchester Hard Drive. I think Derek Finch did the 3D display. We were a Geophysical company that somehow got into selling Beebs because we used them (the gross margin was 2% or 3%). We never used the network server ourselves though we sold lots to schools (£3000 for 10MB). A master and two pupils from Amersham wrote the network software in assembler. No documentation, it all appeared to be in their heads.

    I claim the world's first CB contact solely using the BEEB's voice synthesizer. The voice chip had just come out and it was a Saturday morning. The contact thought he was DX'ing due to all the QRM in the showroom. (Beeb's were unshielded.) He was disappointed it wasn't a DX and not at all impressed he had been contacted by a voice synthesizer.

This topic is closed for new posts.

Other stories you might like