25 May 2018

BBC software archaeology

A couple of years ago, some friends of my parents were looking for a good home for their BBC Master computer, and of course I put up my hand. The machine works well, with its primary purpose being to play Chuckie Egg. Recently, though, a friend brought over a pile of BBC 5¼" discs from his long-forgotten youth, and we were pleased to discover that they read successfully. He asked me to retrieve his early attempts at programming, so Zach and I took this on as a project.

PC to BBC serial connection

A bit of Googling revealed that the BBC could talk over its serial port, so this seemed an obvious way to communicate with a modern-day computer. The BBC has an RS423 port, which uses ±6V signalling. A typical USB serial port provides logic-level signalling (0V and 5V). There were a few reports on the web of people making this work just by connecting the BBC to a serial port, but it looked like they were using proper serial ports, not logic-level ones. So I thought it best to do it properly and include a level converter.

A couple of trips to eBay provided the required parts, and then we used the wiring diagrams from Sprow's webpages. Quite a bit of sawing, screwing, hot-gluing, cable-tying, and soldering later, we ended up with this elegant USB device:

From the left, we have a USB serial port connected to a level converter built onto a 9-pin connector, whose RS232-level signals (compatible with RS423) come/go along the grey wire off to the right, terminating in a 5-pin 'domino' plug.

Our device wasn't mechanically especially well designed:

but a USB extension cable sorted that out.

The BBC then needs to be told details of the serial protocol, and that it should take console input from the serial port, and copy output to the serial port as well as to its normal screen. This is done via *FX commands (full list starting here in the User Guide):

  • *FX 7,7 — receive at 9600 baud
  • *FX 8,7 — transmit at 9600 baud
  • *FX 3,5 — send output to screen and RS423
  • *FX 2,1 — read input from RS423

Everything I could find on the web said that the BBC used 8-bit characters, no parity, and 1 stop bit, but this didn't work. Some characters got through from the PC to the BBC but not others. The pattern was definitely because of parity; only even-parity characters got through. The serial port driver in my old Ubuntu installation was too old to control parity, so we used a laptop which had a newer version. Finally, it turned out that 7E1 worked. Maybe this is a difference between the standard BBC and the BBC Master?

Extraction script

To develop the script, we set up Jupyter on the laptop, and used it remotely via its notebook webserver.

There are utilities out there (DFS Explorer, BBC-Xfer) which will allow the PC to steer the BBC and extract files from discs, but I suspected they all would need an 8-bit-clean line. So we needed an alternative.

I found the *INFO and *DUMP DFS commands by applying the RTFM principal, where the 'M' is the Disc Filing System User Guide. I could then put together something which uses the *INFO command to list the files on the disc. For each file, it uses the *DUMP command to produce a hex dump, which it then decodes. This is slower than other methods would be, but works over the 7-bit line.

Initially, we tried 4800 baud, and this was reliable but slow, as the time to send a chunk of file contents over the serial line was just long enough that the disc drive got bored and turned off its motor. Communicating at 9600 still worked fine, and meant that the motor ran continuously for each file, making everything much quicker.

A small handful of files wouldn't read, with disc errors (list of codes at this mailing list post). The simplest solution was just to add functionality to skip a given list of files, and then try again on the rest; hopefully those files weren't too important.

Both sides?

About three quarters of the way through the pile, I had a bit of a Karate Kid moment — I realised the discs were double-sided, and had to update the script and feed them in again.


It was pretty pleasing how the 30-year-old discs could be read with very few errors. They must have been well kept. Looking through the contents, it was good to be reminded of some of the games from that time. (In particular, Zach found Granny's Garden, and worked out the puzzle with the baby dragons, which I had never got to the bottom of when I played it at about his age.)

I didn't seriously attempt to decode the BASIC programs, but the file format is given at Matt Godbolt's blog, and it didn't look like it would be too difficult to port the script there to Python 3.

Compressed with gzip, the contents of the whole pile of 24 discs came to 1·5MB.


In case it's of use to anyone else:

Comments are closed.