I love the smell of solder in the morning

Main menu

Monthly Archives: September 2014

If you’re a luddite (like me) who still enjoys frollicking in the world of the BBC Micro, there’s often a need to link it via serial connection to a more modern computer.

Common reasons include using the Beeb as a 5.25-inch floppy drive controller, so you can create “images” of your old floppy disks to use on your PC through emulation. Or – as I have needed, this week – you might want to transfer a BASIC program or two from your PC to the Beeb, but can’t be bothered to type it all out manually.

The general gist of the process is that you make the hardware connection via RS-232, then tell the Beeb to accept text via the serial port rather than the keyboard. Then you can send whatever text you like to the Beeb from your PC, using any standard comms package.

Making a serial cable

The connection at the PC-end is almost always a 9-pin D plug. At the Beeb-end, you’ll need a 5-pin DIN plug where the pins are in a “domino” arrangement (four pins making a square, with the fifth pin in the centre). Some people have claimed that this plug is getting harder to acquire, but personally I’ve never had a problem.

If you’re not up to soldering then suitable cables can be had from eBay – expect to pay about a tenner. It’s not that the task is particularly difficult, but it can be fiddly.

I have found two different wiring diagrams for this cable; one here (by Mr Cowsarenotpurple) and one here (by Sprow). Of the two, I’ve only ever had success with Sprow’s design. Which is not necessarily a reflection on Mr Cow – it’s almost certainly that I’m an idiot. But there we are.

(Plugs are drawn as if looking at them from the soldering side.)

The domino socket in the back of the Beeb has two notches on it – one on the left, one on the right. This makes it possible to connect it the wrong way around! The above diagram assumes that the notch on the plug is on the left (pointing towards the RGB socket) when viewed from the back of the computer. When you’ve built the cable, it’s a good idea to mark the top of the plug’s rubber case with a knife (or even just a bit of tipp-ex) so that you know which way is up.

Now, the more modern your PC is, the less likely you are to have an RS-232 port! They’ve fallen out of favour with the average PC consumer (if you’re trying to tinker with 8-bit computers then be proud – you’re not the average consumer!) and have been squeezed out of motherboards to make room for more USB ports. If this is the case for you, you’ll need to buy yourself a USB-to-RS232 converter, or an RS232 expansion card.

Initial commands on the beeb

We enter a few commands to tell the Beeb how fast the serial data will be transmitted, and to tell the Beeb to accept data from the serial port rather than the keyboard.

The faster the baud rate, the quicker you’ll transfer data. However … I’ve never had a BBC model B transfer data reliably at 19200 baud, and my current setup only seems to work reliably at around 2400 baud. I’m not sure whether it’s my dodgy soldering, crap quality of the USB-to-RS232 convertor I’m using, or what. My advice is to pick a slow speed (start with 1200 baud) and then bump it up whilst performing some tests to see how reliable your setup is.

For example, to choose a baud rate of 2400, enter:
*FX 7,5
*FX 8,5

Lastly, tell the Beeb to listen to the serial port rather than the keyboard:
*FX 2,1 - sets the serial port as the "input" device

Note that escape and break will still function on the keyboard, as normal.

Software on the PC

Communication at the PC-end is entirely up to your preference for serial comms software. If you’re on Windows, then Hyperterminal comes free and is … OK, I suppose. For a comprehensively-geeky experience, I tend to use Realterm, but that can be daunting if you’re not used to it. And every major OS has a collection of free comms packages.

The important thing is to know which COM port your OS believes you’re using, and to set the correct baud rate (2400, if you’ve entered the example *FX commands) and to choose eight data bits, no parity, one stop bit (some software may just call it 8N1) and no hardware flow control.

Assuming it all works, you should find that typing text in the comms software makes it appear on your Beeb.

Things to try

Serial comms packages all tend to offer the facility to “send” a file by transferring it, byte by byte. In Realterm it’s called “Dump File to Port” (accessed from the “Send” tab), in Hyperterminal it’s “Send Text File…” (in the “Transfer” menu). So, to send a BASIC program you need to have it in a plain text file, just as if you’d typed it.

In case you want some simple eye-candy examples to prove it all works, try mandy1 and mandy2 – two BASIC programs that generate the mandelbrot fractal in different ways. They should both work fine on a standard model B, but you may need to leave them running overnight to see the final results!

And when you’ve finished …

Ctrl+break on the Beeb will still work, even when it’s pulling data from the serial port. On the other hand, if you just want to kill the connection and return control to the keyboard without resorting to something that drastic, just type
*FX 2,0

through your PCs comms software, and the beeb will cease to listen to the serial port.