Tuesday, 21 September 2021

Clive Sinclair's MK14 Microcomputer And My Career

 

 

This is not intended as an obituary of Sir Clive Sinclair, but it has been written just after news of his passing was received and is an attempt to go beyond the superficial responses and remember something which not every commentator and journalist in 2021 will know about. In honour of Sir Clive, the text of this article is being written using the Psion Quill word processor running on a Sinclair QL Emulator called QPC2 (itself an item of legacy software these days) and all of this is hosted on a rescued Windows 2000 machine, which for ten years now has not needed to be connected to the internet to be useful to me. An embedded video and a link or two will be added after the text is transferred to the dystopian world of Gatesware, but all of the words are being written in a Sinclair-friendly environment. Let me take you back to the world before the IBM PC or the Sinclair QL, before even the ZX Spectrum, ZX80/ZX81 or the Jupiter ACE that derived from them. Back to 1977-78.

I was fourteen and like many of my classmates I was learning to programme. Unlike most of the others, though, I learned to programme in four different ways at once. The way we all learned was under the supervision of the maths teachers and we had to learn, two at a time, on a single terminal at our school in Letchworth, which was connected at some expense to a DEC-10 mainframe computer at Hatfield Polytechnic. Time was limited and everything we did was tightly-controlled according to what somebody else thought we ought to be doing. It was mildly interesting, but if that had been all I learned about programming and computers it wouldn't have resulted in any creative impetus.

At about the same time, my eldest brother gave me a Texas Instruments TI-57 programmable scientific calculator. Programming this was like writing very short and simple "FORTRAN" programmes, but it would do maths to a higher level of precision than was available to fourteen-year-old scholars using the "BASIC" entry-level facilities on the DEC-10. It wasn't lost on me that something I could fit in my blazer pocket could do things I couldn't do with three tons of computer down a phone line in Hatfield.

Shortly after that, one of my friends bought and built a "Science of Cambridge" (Clive Sinclair's trading name at the time) MK14 Microcomputer kit. During the "getting it working to see what it does phase" he and I became interested in the simple physics of the LM7805 voltage regulator which powered the thing: The datasheet had graphs laying out the relationship between input voltage (which could be anything from 8V to 36V) output voltage (always 5V), load current and the surface-area of the improvised heat-sink required to stop it frying itself. There have been many occasions in the decades since then, when this understanding has given me an advantage over "software" engineer colleagues who learned about computers without burning their fingers even once.

My friend got the MK14 working, tried out all the sample programmes in the instruction manual and then lost interest. He had acquired a TI59 programmable scientific calculator which could store programmes on magnetic cards whereas permanent programme storage was a MK14 weak point. He sold the MK14 to me. I got more data on its INS 8060 "SC/MP" microprocessor (National Semiconductor had a physical site in Bedford) and began to think about the instruction set and what could be done with it.

Concurrent with this, our Physics Master (and he was a master of his subject) bought a kit to build a Nascom-One microcomputer, against the fierce opposition of the maths teachers who thought they should enjoy an absolute monopoly of teaching computing skills -and the even fiercer opposition of the senior French teacher who wanted to use all the available money for a complex audio-teaching system which I never saw or heard working once. This cost more than twenty times as much as the Nascom; quite possibly a hundred times as much. Every pupil in the "language lab" would be headphoned and wired up to a control panel, so that the French teacher could press a button to take control of any individual pupil and harrangue them without their classmates being able to hear what he was saying and give moral support, or bear witness to any psychological abuse. With the benefit of more than forty years of hindsight the language lab never worked, probably because another, wiser, teacher realised the potential for abuse and sabotaged it.

My friend and I weren't involved in the construction and commissioning of the Nascom One, but we were allowed to use and programme it. It was based on a Zilog Z80 microprocessor, which had a bigger and more powerful instruction set than the INS 8060 in the MK14, and which also had a whole family of (expensive) supporting chips to build a system with. Knowing the inner workings of two different microprocessors, each the product of a different design requirement and philosophy, taught me somewhat more than the sum of the two microprocessors concerned. I could see that both of them had strengths and weaknesses, and that "strength" and "weakness" were both defined by what you were trying to do and how you sought to do it.

Both the MK14 and the Nascom (at least in the configuration the physics lab had it in) had to be programmed in hand-assembled machine code. Both had a minimal set of programme editing tools in EPROM or PROM; that in the Nascom had been extended with an EPROM containing a library of useful subroutines which the user's programmes could call. (These had been written by the Physics Master and were not a feature of Nascoms in general.)

The MK14 had a twenty-key keypad and an LED display, somewhat like a calculator. Saving MK14 programmes to cassette tape was an extra which I never ran to. The Nascom had a QWERTY (48-key?) keyboard (a quality magnetic-switch affair that I've never seen bettered for feel) and a video display which worked through a 12" portable TV donated by the school caretaker. The Nascom had a cassette tape interface, which worked reasonably well, albeit slowly, and an I/O unit designed and built by the Physics Master, which allowed users to control and monitor hardware experiments. This introduced us to the concepts of digital and analogue inputs and outputs. (Something the maths teachers would never have done in a million years.) My friend soon had a programme to play computer-sounding music through a speaker connected to the I/O unit. I explored what simple mathematical functions sounded like, because this didn't need me to type in a digitised musical score. Some of these sounds were harmonious, but not all of them by any means.

The project the Physics Master had in mind for the Nascom, however, was a star-map programme and it was this which really highlighted the differences between the Nascom and the MK14. First off, the Nascom had a full-size if not very hi-res screen and the MK14 had none. Then, while the MK14 had a 256-byte (or was it 512-byte?) PROM (I don't think it could be erased and reprogrammed with updated software) and 256-bytes of RAM, the Nascom had a couple of 2KB EPROMS, containing the firmware and the subroutine library, as well as, I think, 4KB of ram and 1KB of video ram. It could be expanded to more than that, but it never was due to lack of funds. The Z80 could address 64KB of memory and another 64KB of I/O, but extra logic chips and buffers were needed to implement that, while the 8060 could address 4KB with very simple decoding of its control signals and 64KB with more complicated "paging" using what were otherwise dedicated I/O lines. I don't remember any support on the 8060 for dynamic ram: I think there were two 4-bit-wide static ram chips on the MK14.

So if you were seeking to do something simple with the minimum number of chips and other components (and a single-rail power supply), the 8060 was more attractive than the Z80, but for the star-map the Z80 and the other resources of the Nascom would be needed. (The Z80 chip itself only needed +5V, but I think the EPROMS and separate UART chip used with it needed +/-12v as well. The Nascom had a three-rail plus ground supply, at any rate.)

Even so, fitting the starmap on the Nascom was going to be a squeeze. If the movements of all the displayed stars were to be fully calculated by the Z80 as the programme ran, then a lot of memory (and programming work!) was going to be taken up by maths subroutines and the whole thing might be disappointingly sluggish to run. It was thought better to have some stored tables rather than lots of maths going on in real time. But doing all the calculations to compile those tables was going to be tiresome, unless... The Physics Master wrote down the necessary equations and a list of values he wanted fed into them, and commissioned me to write a programme for my TI57 calculator, which churned out all the necessary numbers (no printer: I had to write them down as they came) over the course of a single lunch hour. The star map programme went on to be a successful teaching aid!

By the time I left secondary school in Letchworth for a college of further education in Bedford, where I never saw a computer of any kind being used for any purpose whatsoever, I had learned that mainframes like the DEC-10 had enormous power (for the time) but it was served out in very small portions and in a restriction-rich environment where computer professionals had control of everything you did. I had learned that there were different types of microprocessor, suitable for different roles, and that if you had the right mindset you could do a lot with even the simple ones despite the relative lack of computing resources. (With that mindset it isn't even difficult.)

I also learned to keep some sort of programmable scientific calculator handy, because they can get you out of all sorts of holes when you are testing computer software or even analogue circuits, by giving you an idea of what at least a few correct outputs ought to look like! One of my brothers bought and I helped him build a Powertran SC80 computer, which was capable of supporting a disk drive and running CP/M. The MK14 was consigned to a drawer, but it and the processor it used were not forgotten.

Then I realised that I didn't want to be a doctor or a vet, which were the only reasonable excuses for studying five A'levels at the college, and I needed to get a job instead. Never having applied for a job before, I went to the careers service, near the college, and the lady there coaxed the basics of a CV out of me, including the fact that I'd programmed more than one kind of computer and that my brother and I had built and programmed our own Powertran computer. She wisely expunged all mention of assorted poaching techniques; I had matured in a rural setting.

She consulted her records and found that a company in Bedford, called "Comserve Computer Services" wanted a trainee under the Youth Training Scheme. She arranged an interview, warned me that other YTS trainees had found the proprietor "tall and frightening" and I went along to the interview, thinking that anyone taller and more frightening than my own father or one particular older brother (the others are less gigantic) would be worth seeing.

Dave Cox, the proprietor, turned out to be no larger, really, than my brother, but at the time he had a habit of frowning in thought, especially if he was listening intently to what you were saying. This was probably why my teenaged predecessor had allegedly fled in terror when interviewed. I showed no fear and was accepted on the spot, having indicated that I'd "built my own computer" which is Dave's recollection of the interview.

On my first day in the post of YTS trainee, I was handed a datasheet for the National Semiconductor 8060 and told to learn the instruction set. I was a bit surprised at this, but a nice Irish lady gave me a cup of tea and I glanced at the datasheet to see if anything had changed, which it hadn't. I waited for someone to actually give me some work to do, Dave waited until lunchtime for me to start learning the instruction set.

He said that he needed me to help him write some firmware for a firm in Rushden that was making drilling machines controlled by 8060 processors and I needed to learn the instruction set! I replied that I already knew the instruction set because I had an 8060-based computer at home. Dave expressed mild surprise, but he took me to Rushden (in Northamptonshire) that afternoon and I found myself learning about CNC drilling machines by helping to make one work by drawing flowcharts. I was on speaking terms with my new boss! Forty years later, we still are. My secondhand MK14 had got me a job, stopped me from getting sacked at lunchtime on the first day, and, as it turned out, the benefits of MK14 ownership didn't stop there. What I didn't realise at the time was that by that stage (late summer 1981) there were exactly three firms in the world still using the 8060 in new equipment and that the careers lady had, largely by chance, matched my highly-specialised skills set with about the only employer in Great Britain who had a use for them. On my first ever job application! If this story ended here, I would have something to thank Clive Sinclair for, but there's more.

Kempston Joysticks

Although Comserve was primarily intended to be a software consultancy, like several other similar firms it had been persuaded by the importers of the "Video Genie" microcomputer to become a dealer. (This worked out badly, mainly because the importer's trading practices were very much sharper than those of the erstwhile dealers.)

Amidst the problems were some opportunities: the machines were really designed, like the MK14, to allow users to teach themselves how to programme and use computers. They were (mostly) software-compatible with TRS80 microcomputers, but had a built-in tape-deck for programme and data storage and a somewhat bigger case, with room inside to accommodate a few well-chosen extras. What the customers wanted, though, was to play all the computer games which were available on tape in TRS80 format. The Video Genie, as imported at the time, lacked the essential sound output and joysticks.

Comserve had resolved the sound deficiency with a little amplifier circuit board that took an unused output from the computer's Centronics parallel printer interface, which was also how the sound worked on a TRS80, and drove a little 8-ohmn speaker fitted inside the case, with an on-off and volume knob installed on the side of the case. In the early 21st century I used the redundant Centronics printer interface on a PC104 embedded computer module to drive a phased-array microwave antennae controller. It is worth remembering every honest trick you learn in life. Forget the dishonest ones instead.

Back in the early eighties, I was learning all about Video Genies and microcomputer hardware in general, by fixing all the faulty machines that the importer dumped on Comserve and then refused to repair under warranty, which was most of them. Under the influence of some very strong Darwinian forces, I went from being a novice to the local expert in a few months. At which point someone in Kempston, near Bedford, came into ownership of a large consignment of (switched) joystick mechanisms with moulded cases and bare-ends leads, which had been ordered for a stand-alone video game and never used.

Now, the way people played TRS80 games on a Video Genie without joysticks, was to press the arrow keys and <enter> for one joystick, and five other keys (I have forgotten which, but <spacebar> was the fire button) in the middle of the keyboard for the other. This was obviously awkward, if intimate, for two-player games! But if the cache of joystick mechanisms could be interfaced to the Video Genie a widespread need might be met and Comserve would recoup some of the money lost in its dealings with the Video Genie importer. Time was of the essence, because a potential business partner needed to be shown this working before he did something else with the joysticks. I was asked to stay late one evening and work out the interface details. In the gap between the bus I would normally catch and the last one I could catch home, I achieved this.

The MK14 20-key keypad was organised, in electronic terms, as a 4x5 switch matrix. The Video Genie had a 64 key keyboard, organised as a 8x8 switch matrix. As on the MK14, there was no dedicated processor running the keyboard and feeding ASCII characters back to the main microprocessor: the main microprocessor or "CPU" scanned the switch matrix itself, through simple buffers. (This isn't quite what happened on the Nascom One and it's not what happens in any sort of IBM PC compatible.) On the special "Genie Two" business model of the Video Genie, the switches of the numeric keypad were simply wired in parallel with the corresponding keys on the main keyboard. On a modern PC they are scanned separately and can have separate functions. I reasoned that if that worked, so might wiring the joystick switches in parallel with the keys customarily used to represent joysticks for those who didn't have them.

The tricky bit was working out where to solder flying leads. I most emphatically did not want to solder anything to the back of the keyboard switches themselves, because that would look awful if the customer took the lid off and it might also cause heat-damage to the keyswitches concerned. It might also not work, if the connections clashed.

But I found that the keys chosen as the default joystick substitutes, were scanned in a logical-enough pattern that was compatible with the existing joystick leads if used right, with each axis of the joystick making the same 2x1 matrix as the keys! Fortunately, the keyboard was a separate PCB on the Video Genie, connected to the CPU board by a ribbon cable connector. (I cannot remember if this was also true of the TRS80: it might not have been.) Not only was it possible to wire a joystick onto the back of this connector without damaging anything, it even looked passably neat and tidy and the correct arrangement of wires was easy to reproduce in numbers.

We didn't want the joysticks directly and permanently wired to the keyboard, though: I put two DIN sockets in the side of the (plastic) computer case, which were wired to the keyboard connector, and the man who had the joystick mechanisms only had to put appropriate DIN plugs on! He managed to thoroughly insult me by repeatedly and scornfully demanding to know if I knew what I was talking about, but even he couldn't argue with the fact that the "interface" worked!

A lot of "Kempston Joysticks" were sold, and I have it on good authority that some of the individuals who founded the UK's thriving computer games industry were inspired to create their own games by this availability, but my immediate concern was to get home that night without having to sleep in Bedford Bus Station. (Spare a thought, please, for anyone who has to do this in 2021!)

Reflections on the last forty-four years

I knew about Turing's Universal Machine concept at some early point in the above saga, and it seemed to me that simple computers with no constraints on how they could be used, like the MK14, might even be a basis for realising this concept. But then came the IBM PC, and with it an architecture and software environment for microcomputers which was essentially the same as the DEC-10: over-complicated with all sorts of things which the ordinary user was never allowed to see, let alone delve into, which just happened to be where malware hides! The unvarying response of manufacturers and software companies to malware writers exploiting the over-complicated nature of their products was and still is to make everything more complex still, and here we all are: stuck in a forever war between not-very good at all and actual evil.

Computers and software are harnessed to the dreams and creativity of untold millions of users, but only in the occasional sales-pitch in a YouTube advert. The reality is that the money of millions or even billions of computer and software users is harnessed to the dreams and vaulted ambitions of a small handful of Big-Tech "Founders", however crazed they might be. It's a worse version of the nightmare vision that C.S. Lewis had, of billions of "conditioned" humans being controlled and exploited by a few hundred "conditioners". There are indeed billions of the conditioned, but less than two dozen of the conditioners.

I am not sure that we should go all the way back to Clive Sinclair's MK14 microcomputer to make a fresh start towards Dr Turing's Universal Machines, but I am utterly certain that we will never get there from where Microsoft, Apple and Google are going to leave us. And yet, if we are to actually survive the environmental and economic challenges which now face us, a technology based on universal, rather than inherently-restrictive, proprietary, machines is clearly needed.

 This article, but not the embedded video, is Copyright (c) Matthew K. Spencer 2021

 PS: The Video Genie, TRS80 and Powertran SC80 all had Z80 microprocessors. The Powertran also had a chip from a programmable calculator as an early "maths co-processor" and this worked in something called "Reverse Polish Logic" just like Clive Sinclair's first calculator and most Hewlet Packard calculators. I had a friend called "Czes" who constantly complained about the way that everyone assumed he would know how to use RPL. 

No comments: