The BBC Lives!

While I use Raspberry Pi for various things, getting them to run old arcade games was always up there in the list. Initial experiments with xboxdrv and MAME got me a system capable of running the arcade game that a friend and I would cycle 3 miles down the canal to the arcade to play, and relieve ourselves of several weeks' pocket money at one sitting. To the extent that the chap in the arcade actually threw us out a couple of times because he was worried our parents would come round demanding to know why he'd let their sons fritter away so much cash on something so irrelevant as an arcade game.

(Well, you're only 12 once!)

Having played around with Carles Oriol's ChameleonPi, which was great, I was able to play a load of my old BBC B games, in slightly less pleasing form using the fuse zx spectrum emu. This always rankled a bit. The R-Pi 1 model B needed you to install RiscOS to run an emulator capable of simulating the mighty BBC.

Gave up on that for a bit, but now as the proud owner of a Raspberry Pi 2, I did wonder if it'd be meaty enough to run a few Playstation 1 games which used to entertain other family members who were working very odd shift patterns in 1999. And lo and behold - it did, once I installed RetroPie and messed about with it a bit. The biggest pain was PSX button re-mapping, which (if anyone is interested) can be solved for P1 at least with the following file:


  ## pcsx_rearmed retroarch.cfg 
  rewind_enable = false
  input_player1_b_btn = "0"
  input_player1_y_btn = "2"
  input_player1_a_btn = "1"
  input_player1_x_btn = "3"

So anyway - to the point of this post, I wondered if the BBC B would now run at a decent rate on the Pi 2 *without* having to run RiscOS.

It does!

To compile it, you can start from vanilla Raspbian (I haven't tried this) or from RetroPie (which I have). The UNIX variant of BeebEm is what you need:

Follow the instructions at

i.e. download:

Then transfer these to the pi via SSH and...

  tar -zxvf beebem-0.0.13.tar.gz
  patch -p0 < beebem-0.0.13_64bit.patch
  patch -p0 < beebem-0.0.13-keys.patch
  patch -p0 < beebem-0.0.13_menu_crash.patch
  sudo apt-get update
  sudo apt-get install libgtk2.0-dev libsdl1.2-dev
  cd beebem-0.0.13
  sudo make install

ROMS (Basic, OS1.2, Acorn DFS etc) are all bundled with it. It does not require X-windows, SDL alone will do, so this install method should work on a headless Raspbian distribution. F12 gets you a system menu which you can use [TAB] and [ENTER] to navigate.

Download the .ssd (BBC Micro Disk Image) of your choice from;

  beebem <disk-image-name>.ssd

And it ran full screen, and at full speed on a 39-inch HDMI TV (wow we didn't have those back in '82!).

Next step was to set up EmulationStation on the RetroPie to have a BBC Micro option.

Added this to /etc/emulationstation/es_systems.cfg

    <fullname>BBC Micro</fullname>
    <extension>.ssd .SSD</extension>
    <command>/opt/retropie/supplementary/runcommand/ 1 "beebem %ROM%" "beebem"</command>

And added a beeb directory to /home/pi/RetroPie/roms to put my .ssd files in.

EmulationStation will want some graphics for its front-end. I manufactured a few jpgs using GIMP, by copying the SCUMMVM ones.
Copy the /etc/emulationstation/themes/simple/scummvm directory to be called /beeb in the same location.
Then drop your .jpg/.png files into the /etc/emulationstation/themes/simple/beeb/art subdirectory. I blurred a picture of the Snapper (v2) as it was pretty much the first proper computer game my family ever owned (thanks Dad, you're the best!).
Finally edit the file themes.xml in /etc/emulationstation/themes/simple/beeb to point to your nice new images. {Note, if you try & use a bad SVG image this can cause emulationstation to crash at startup. Bizarrely when that happened to me, my Pi seemed to start ignoring keyboard input as well. Thank goodness for SSH.}

And voila!

For some reason beebem doesn't shut down cleanly via this method - it needs hard powering off which isn't ideal. It's probably something to do with the EmulationStation startup script command, but I'll work that out later.

* Update 26th May 2015 *

While it seems that the UNIX BeebEm load/save state options in the F12 menu don't work (they crash the emulator), and sound support is pretty patchy (toggling to a new samplerate puts sound back for a bit, then it disappears again), I also had some issues with Caps Lock which was preventing my playing some games like Thrust, Deathstar etc.

Windows/Mac BeebEm have a modification to map CapsLock/Ctrl to A/S, but the UNIX version doesn't. Nor does it have the capability to accept Preferences.cfg files nor user-defined keymaps.

Game Over? Not quite.

Having looked at the source code in BeebEm for UNIX, the file to modify is sdl.cpp (in the /beebem-0.0.13/src directory). This file contains the keymapping from the UNIX SDL library keymap to the BBC Micro one. Interestingly there are a load of comments in there about how Caps lock handling is total rubbish in SDL (no key-up event or somesuch, plus the usual developer swearing in the comments). As a result the author has tried to map Caps to Alt Gr, but that wasn't working on my keyboard for some reason. If you have any keyboard issues you can probably fix them by editing this section of the file if you know the SDL Key Codes ( last column in ).

Modification of the following lines in sdl.cpp worked for me - I just modified the SDL key to be SDLK_RALT for the right Alt key - (as this didn't exist on the beeb) About 80% of the way through the file you find this section:

static struct BeebKeyTrans SDLtoBeebEmKeymap[]={
// SDL          BBC     BBC KEY NAME (see doc/keyboard.jpg)

{SDLK_TAB, 6,0},    // TAB  
{SDLK_RETURN, 4,9},    // RETURN

{SDLK_LCTRL, 0,1},    // CONTROL
{SDLK_RCTRL, 0,1},    // CONTROL


{SDLK_CAPSLOCK, 4,0},    // CAPS LOCK (Totally fucked up in SDL..)
{SDLK_LSUPER, 4,0}, // CAPS LOCK (so Alt Gr is also CAPS-LOCK..)

{SDLK_ESCAPE, 7,0},    // ESCAPE
{SDLK_SPACE, 6,2},    // SPACE

And I then commented out the two CAPS LOCK lines, replacing them with the correct SDL key for Right-Alt.

//{SDLK_CAPSLOCK, 4,0},    // CAPS LOCK (Totally fucked up in SDL..)
//{SDLK_LSUPER, 4,0}, // CAPS LOCK (so Alt Gr is also CAPS-LOCK..)
{SDLK_RALT,             4,0},   // use SDL right alt instead.

BeebEm then requires a quick recompile - ./configure followed by make and make install as per the original install instructions.

And I could use Right Alt instead to turn left in Thrust. Unplayable, but working.

Who needs keyboards anyway? - I was able to then use xboxdrv (as I use wired xbox360 controllers) to map to the right ALT key. Worked like a charm, only thing I need to do now is work out how to call a custom script to load the games rather than the direct loading approach in EmulationStation.

I wrote a little command line script to launch games manually from the prompt just to see. It identifies the controller by USB id (use lsusb to work this out if you need to):

rmmod xpad
xboxdrv --device-by-path 001:006 --type xbox360 -i 0 -l 2 --config /home/pi/RetroPie/roms/beeb/$ --silent &
beebem /home/pi/RetroPie/roms/beeb/$1.ssd

Saved this as in /home/pi, and chmod +x on it.

Then sudo ./ Thrust would launch Thrust with my xbox360 controller driving it. :-) (sudo is needed to kill xpad, otherwise xboxdrv doesn't work)

Note - you will need a working/modified "Thrust" xbox keymap file. I saved the below as in the /home/pi/RetroPie/roms/beeb directory:








This approach works pretty well, only problem is that I have to manually kill xboxdrv off after running games. (ps -ef | grep xboxdrv and sudo kill <whatever the root process id is> followed by CTRL-C)

I will work out how to jig all this up so I can run it from EmulationStation soon. Been too busy rewriting keymap files for ChuckieEgg and Repton this afternoon.

Hopefully that helps somebody!


  1. Hi bud,

    I've got beebem up and running using your instructions and it seems to work fine with the exception that it crashes if you try to change discs in the menu. Any idea why that might be occurring?

  2. Glad you got it working. Changing disks is an issue with BeebEm - I had crashes trying to access filesystem as well. The code concerned is something to do with SDL and looking for a window manager to display the file browser in X-windows, I seem to recall.

    Basically what happens is it tries to spawn a further window, but since we are running this without X, it can't find the right thing to do and crashes. Unfortunately the Pi2 doesnt run BeebEm at a reasonable framerate even with overclocking if you have a full-blown X windows desktop environment running as well.

    There *may* be command options you can use to specify disks. However I couldn't work that out and you wouldnt be able to pick. I basically just restart the Pi when i want to switch games. Getting it running at all was good enough for me.

    If someone wants to maintain the BeebEm on UNIX code and write a file-system browser that works without X, that would be good. But it's beyond my capability.

    1. I also got Beebem working on my Pi2, but for me, the biggest problem is that the sound is not working well, or to be precise does not work at all.
      I could not get the sound to make it work in options and without that the use of emulators is fairly limited and incomplete.
      Is there any way to make sound work, any idea would be helpfull?

  3. Sound used to work on older builds of RetroPie.

  4. Which version exactly?
    I still use v3.0 final, from august 2015, so it must be older than this?

  5. Not sure tbh, probably 2.6.

  6. This comment has been removed by the author.

  7. This comment has been removed by the author.

  8. This comment has been removed by the author.

  9. i put this in emulators.cfg and every game will directly run beebem from emulationstation:
    beebem="/opt/retropie/supplementary/runcommand/ 1 "beebem %ROM%"

    the only thing needed is sound!
    and is there any way get the joystick für ps3 controller working?

  10. sound is running now with beebem.
    set this in your /opt/retropie/configs/all/retroarch.cfg:
    audio_driver = "alsa"

    in the menu click "sound" and tick the following settings (all others untick):
    sound support
    sound latency
    22'000 khz
    full volume

    somehow those settings won't be saved. but i've found a config file called "beebem.registry" where all settings can be edited manually:

    let me know if this works for you too!

  11. unfortunately the configs can't be saved because Bebeem is crashing when clicking on "DISCS". On there you could actually save all your configurations you've set before.

  12. Which version of beebem are you using? The one in this blog? Sound isn't working for me even if I use your settings.

  13. I compiled it by the following instructions above.

  14. there's also another way installing Bebeem:

  15. Hmmm. I've tried both and sound still doesn't work. Occasionally, changing options in the gui cashes a split second of sound to be played but it never works full time. Could you
    post a copy of your beebem.registry file? Also, why would changing a retroarch configure file make any difference to the beebem emulator?

  16. After testing it a little longer audio is laging and it gets out-of-sync. It really doesn't matter what you set in the audio settings

  17. Dunnoh, but after setting audio_driver to alsa the audio worked when chaning the settings in the menu.

  18. here's my "bebeem.registry" file:

  19. here's the prove:

  20. Rebuilding beebem from source and using your registry config still doesn't enable sound for me. Are you using HDMI or analogue out for audio? What type of Pi - pi1, 2 or 3? What version of retropie?

  21. Sound works if I start beebem through the desktop but not through emulationstation. Any thoughts why that might be?

  22. I got it better running on advmess because there's no sound issue. you just need to type CHAIN"LOAD" and the game which I chose from emulationstation will load correctly.
    still have to figure out how to adjust the right video size since somehow the tab button doesn't work, even it's set to "auto".

    here's how I set the emulators.cfg for advmess:
    advmess="/opt/retropie/emulators/advmame/bin/advmess bbcb -floppy %BASENAME%.ssd"

  23. I've finally (partially) worked out the sound problem I've been having. It turns out that there were two versions of beebem on my system - an executable that is 1.6mb in size and one that is 600k in size. Both work perfectly when run from the desktop, but I worked out that sound only works with the 1.6mb beebem but only for a handful of programmes when run from the command line, and the games I've been testing with (the Master version of Elite and Exile) just happened to be two that sound was broken! Anyway, the 600k executable enabled sound correctly in the commandline. All good so far.

    But then I could not get Retropie to run the correct executable until I finally figured out that the beebem it runs does not live in the normal /opt/retropie/emulators subfolder as I expected, but instead in /usr/local/bin/, so deleting the 1.6mb beebem and replacing if with the 600k one did the trick.

    I doubt anyone will have the same sound problems as me with this but this post might prove useful to someone!

    Anyway, I say it's partially fixed because I now get the audio going out-of-sync like is mentioned above, but at least there's some progress.

  24. Fantastic work, and congratulations on recognising Thrust as a priority!

    There's parts I don't understand as Linux is new to me, but I'll endeavour to work it all out.

    Any update on the small problems you encountered?


  25. I couldn't get sound working using any of the above tips, however I finally found that just going into the menu (F12) and un-ticking and re-ticking Sound Support gets it working. However, you have to do this every time the emulator is loaded :(