1998 printer port hack
The BBC Micro, featuring a design that invites the connection of customised interfaces and peripherals, is made for experimentation. I was seduced by this open philosophy, missing on most contemporary machines. Soon enough, I was able to control prototypes connected to the machine. I am using mainly two of the available ports:
- The Analog to digital port, featuring 4 analog inputs, allows the connection of various sensors. It can be used to measure values from the real world such as temperature, luminosity, audio level, motion, etc... It also provides to digital inputs for detecting the state of switches.
- The user port, providing 8 digital lines, programmable as input or outputs. An input line can be used to monitor the state of a switch while an output line can control an external device such as motor, solenoid, LED, relay, transistor, etc...
I soon needed more than eight lines. Looking into various BBC manuals I found out that the printer port could be physically re-routed to provide 8 extra I/O lines.
Printer port re-routed
|1998 BBC/Mac interface
Both Macs (prior to Blue and White G3s) and BBC micros use a serial communication protocol based on the RS232 standard. It is possible to transfer data between the two machines.
using this protocol. First you need to make a cable.
Mac serial connector (modem or printer):
||Input Handshake or External Clock
||Transmit Data (-)
||Ground (centre pin)
||Receive Data (-)
||Transmit Data (+)
||General Purpose Input
||Receive Data (+)
BBC RS423 serial connector (looking at computer):
There are more connections on the Mac side. Three will be ignored, in my experience without inconvenient.
BBC to Mac serial cable
The symetrical design of the connector on the BBC micro is confusing. Mark the top of the cable connector to avoid trouble.
BBC BASIC program
Two procedures will handle the BASIC RS423 exchange
100 DEF PROCout
110 *FX8,7 REM 9600 Baud transmit
120 A%=138:X%=2:Y%=B REM insert variable B into RS423 out buffer
130 CALL &FFF4
B is the value of the ASCII character to be sent to the Mac
200 DEF PROCin
210 *FX2,1 REM gets characters from the RS423 port
220 *FX7,7 REM 9600 baud receive
230 *FX145,1 REM gets character from RS423 buffer
M is the ASCII value of a character sent by the Mac
*FX2,0 will enable keyboard input on the BBC
On the Mac you will need a program that can handle RS423 connection. Find lots of details about that at
a site dedicated to serial communication on the Mac. A C program would do fine, or a shareware such as Z Term should also cover most needs.
I use for my purposes Macromedia Director, that comes with a serial port XObject (up to version 6). Director is not the ideal program to handle transfer of text files, but is great for controlling sounds and graphics triggered from BBC run home made interfaces.
Director Serial control Lingo code
put SerialPort(mNew,1) into gPort
gPort(mSetUp, 9600, 10, 0)
global gPort, macCharOut
global gPort, macStringOut
global gPort, bbcCharOut
put gPort(mReadChar) into bbcCharOut
global gPort, bbcStringOut
put gPort(mReadString) into bbcStringOut