MK14 meets 7Bot

I recently got my first ever computer out from the cellar. The Science of Cambridge MK14 was a combined birthday and Christmas present and it cost £39.99, which was a princely sum back in 1977. It was the first offering from what became Sinclair Research (the guys who later launched the ZX80, ZX81, ZX Spectrum and QL).  In my search for the information I needed to get it working again I found that an MK14 can be a little more valuable now – it looks like one changed hands on EBay for £800 in 2014 (unlike the far more popular ZX Spectrum from the same stable, some of which still change hands on EBay for as little as 99 pence).

Nearly Original MK14


My MK14 superficially doesn’t look much like the original due to that fact that I re-housed it in the case of an old Sanyo calculator (dating from 1969). This allowed me to replace the spongy membrane keypad and tiny 7 segment display.  Under the hood the main board is present if a little obscured by the additions I made way back then.

MK14 in old calculator case

My MK14 in its old calculator case

The computer itself is a VERY basic affair:

  • INS8060 (SC/MP pronounced SCAMP) processor
  • 4.4MHz clock but only capable of 0.2 MIPS (million instructions per second) – by comparison current smartphones are capable of over 10,000 MIPS
  • 256 bytes of memory – some of which were used by the “operating system”
  • No disk or any kind of writable permanent storage
  • No video or sound capability

Plugging In

After so many years it was with no little trepidation that I finally came to plug it in.  The sharp bang and puff of vaguely violet-coloured smoke immediately brought back to mind previous experiences with exploding tantalum capacitors. Do people still use them I wonder? I can’t recall having smelled that distinctive smell in the last decade or two – despite having had a few “wall-warts” explode on me. Of course my first thought was to wonder if the explosion had damaged the MK14 itself and it’s taken me a while to pluck up courage to start dismantling the box to find out.

My MK14 is in the back of this calculator case

After unearthing the power supply – buried deep in the case – I’ve found the errant capacitor but have now decided that the whole power supply isn’t worth trying to rekindle. Looks like I’d had a bit of fun winding my own mains transformer all those years ago – and I feel it might be unwise to rely on my 14 year old self’s knowledge of mains insulation safety. Also, since the unit only consumes around 600mA at 5V a much neater solution presents itself in the form of an afore-mentioned “wall-wart”.

“Operating System”

Having installed a 5V connector and wired up the power I turned on and, this time, the very basic “operating system” starts up, showing “—- –” on the display and I’m in seventh heaven for a short time. What a nice feeling to see something so familiar after so long. I really can’t remember having used the computer after I built a Z80 CP/M based machine for myself a year or so after getting the MK14. It really might be almost 40 years since I last saw that!

The euphoria is quite short lived though as I can’t remember what to do next. Stabbing the four buttons that don’t have hexadecimal characters on them I can see that “MEM” seems to show a memory location but I’m at a loss as to what the “TERM” button does.

Fortunately I’m not the only one who has rekindled an MK14 – although the last to have documented having done so seem to have been most active in the late 1990’s.  A guy called Paul Robson seems to have the most complete information and, with a little  reading I’m ready to try a simple program.

The following program adds two 8 bit numbers together:

0f20 ccl 02 Clear the Carry/Link bit
0f21 ldi $25 c4 25 Load the accumulator with 25 hexadecimal
0f23 dai $29 ec 29 decimal add 29
0f25 st 0f27 c8 02 save 2 on from program counter
0f27 xppc 3 3f return to SCIOS
0f28 [result] 00 result goes here

That’s 5 instructions and 8 bytes that have to be entered into memory before running the program. Believe it or not what’s involved in the entering the program are the following key presses:

Step Key presses Meaning Cumulative number of key presses
1 MEM Prepare for address entry 1
2 0,F,2,0 Address to start program 5
3 TERM Data entry mode 6
4 X, Y Byte of program 8, 13, 18, 23, …
5 TERM Store byte
6 MEM Move on 1 address
7 …. Go back to Step 3 for each byte in program
8 ABT, GO Ready to start the program Num program bytes * 5 + 7
8 0,F,2,0 Address of program start Num program bytes * 5 + 11
9 TERM Run program Num program bytes * 5 + 12

So even that simple program to add two 8 bit numbers requires 52 keystrokes. Just to calculate 25 + 29!

Programs I’d like to run on the MK14

Looking further on the Robson’s site I see some programs that I recall entering into the MK14 all those years ago:

  • Duck Shoot – a symbol moves across the 7 segment LED display at a fair speed and then bounces back in the opposite direction – the “shooter” needs to press a key just as the symbol reaches a certain position near the middle of the display and, if they get the timing right the symbol changes and they win having shot “the duck”. The program is around 70 bytes long and takes around 10 minutes to enter into the MK14 by hand.
  • Moon Landing (shown here on YouTube) – the display shows the altitude, rate of descent and fuel and the goal is to make a soft landing without running out of fuel. The program is about 250 bytes long (so I guess it required the extra 128 bytes of memory!) and, by my calculations, would require around 5x this number of keystrokes – i.e. around 1250! This would probably have taken about 30 minutes even if you didn’t make any mistakes.

So clearly entering programs into the MK14 in this fashion is a tedious option and, as you can see below, I’m not the first person to figure that out.

Other ways to get a program into the MK14

All those years ago I remember building a cassette tape interface because that was the only means to save a program “permanently”. But I don’t have a cassette recorder any more. And frankly, even if I did, I feel we should be able to do better in these days of the internet.  My first thought is to connect the MK14 to a more powerful computer and dump data down to it through a small program on the MK14 – but even that will require some of those tedious keystrokes to enter a program to accept the data and that program itself would take up some of the precious memory.

An alternative approach which involves no keystrokes on the MK14 is shown in this YouTube video which is pretty cunning. The idea here is to build a piece of hardware which is controlled by a Raspberry Pi and which emulates the key presses on the MK14 keyboard electrically. It demonstrates excellent speed and is a really smart way to solve the problem. The only issue is that it has been done already and doesn’t involve playing with a robot. So …

… I’ve decided to do something similar but program the MK14 physically with the 7Bot robot arm which I backed on Kickstarter a uear or so ago.

Of course there are more keystrokes involved in writing the program to control the 7Bot than there would be in entering a short MK14 program – but it is the challenge that counts – right? The 7Bot’s “end-effector” isn’t much like a finger so I have made one out of an M4 bolt with some self-amalgamating tape wrapped around the end to form a soft “fingertip”.


MK14 Programming in Action

Source Code

The code to do this is on GitHub here.

7Bot Firmware Problems

Getting the 7Bot working is a bit more challenging than I expected because the firmware for the 7Bot was in flux when I started. A few people have experimented with standard Arduino Firmata (the 7Bot has an Arduino Due inside) and that seems to work fine but in the end I had so little time available that the standard 7Bot firmware has stabilized and works just about well enough – more on this later.

The position instructions are sent using some Python code. I started by recording the positions of each joint for each key but that wasn’t accurate enough to get a good reliable press. So I’ve used those positions as a starting point and added corrections into the keyPositions table to tune it.

I also found that keeping the 7Bot and MK14 in the same position in relation to each other was a challenge. Each time a small change occured all of the position values were affected. So I laser cut an acrylic sheet and attached it to the bottom of the 7Bot. It has two holes cut-out for the feet of the old calculator case to keep it in relative position and works well.

Playing Duck Shoot and Moon Landing – did it work?

I’m pleased to say that I have eventually programmed the game Duck Shoot using the robot arm. It takes about 20 minutes for the arm to do its work (about twice as long as a human would take) even though the game is only about 70 bytes long.

But I’m afraid the I haven’t yet managed to get Moon Landing onto the MK14 in this fashion.  I’m finding that the accuracy of the 7Bot is fine (good enough to reliably hit a key that’s around 10mm x 10mm) but sometimes, for some inexplicable reason (which I believe has more to with the firmware than the hardware) the servo positioning is off every now and then. When this happens either the wrong key is pressed or the robot stabs the case and misses the key altogether.

So for short programs there’s a reasonable chance of getting the whole program in before an error occurs but there’s not much likelihood of getting Moon Landing in by this method unless I can figure out what is wrong with the firmware – ah well!

Brief asides

At least a couple of people are crazier than me it seems! There is a fantastic project documented here where a complete clone of an MK14 is created in hardware but using modern components. Here it is playing Moon Landing.

And here is a version of the MK14 made using a more modern microcontroller 

And finally – here are my family looking in amazement at the thing that has burned up so much of my free time – and for what they might (but didn’t) say?

My MK14