Recently, I did not buy a new old computer. I did not buy it because I was outbid in a real auction in the UK (by twice the amount I was ready to pay, not to mention the 33% fee on that price for the auction house and the VAT, nor the additional cost to package and ship the whole thing). However, I am very ok with not having bought it, because it would have been a kit computer of unknown state, there wasn’t any documentation with it, and it featured only a Z80 CPU. The only three redeeming qualities of this model are its rarity, its use of a mathematical co-processor, and its unusual programming language. So, I decided to proceed as if I had bought the computer, and write about the programming language.

The computer was a Powertran PSI COMP 80 computer (sold for 420 GBP + commission). It is a relatively early (1979) design published by the British magazine Wireless World and used as a basis for a singleboard computer sold as a kit by a British company called Powertran. Z80 CPU, 8 kB of RAM and EPROM, 2 kB of video RAM, monochrome graphics of 128×64 pixels or 64×32 characters: not an usual design for that time. What made this model a little bit special was the use of a mathematical co-processor, a National Semiconductor MM57109N.

But let’s start at the programming language of this computer. It is called BURP, “BASIC Using Reverse Polish”. The reverse polish notation is the thing where you first specify the parameters of a function (which are pushed on a stack), and then you specify the function name. When the function is called, it takes its parameter from the stack, calculates the result, and pushes it back on the stack. This is the (still quite exotic) basic principle in Forth, some early HP pocket calculators, and Postscript. So, if you would write something like add(10,33) in any conventional programming language (requiring a parser to translate this code into something a computer understand), in reverse polish notation that would become “10 33 add” with the semantics “put a 10 on the stack, then a 33, then call the add function, who will take the two parameters from the stack and put the result (43) back on the stack for the next function to use”. This notation allows for quite compact interpreters, but the programmer has to manage the stack herself.

I like Forth a lot so I thought, ok, this is funny, a BASIC with a reverse polish notation should be quite quirky, ending up in programs like ’10 “Hello, World” print 20 10 goto’ if this type of basic also supports line numbers. However, BURP is even more strange than that because not all commands use the reverse polish notation, but only expressions. The rest of the syntax is still conventional infix notation.

All this strangeness has a reason: the mathematical co-processor. As [Carver] puts it, “The constraints of the MM57109, which was essentially a dedicated calculator chip with a 4-bit microcontroller interface bus, strongly affected the design of the language. Significant features of the language include a fixed set of 26 numeric variables (A-Z), a maximum of 256 lines of code, a three-deep hardware stack for expressions, a limit of one for-loop at a time (so no nesting, not even in GOSUBs) and no string processing (except implicit concatenation of static text and numbers during output.)” Oh yes, plus the MM57109 talks to the world in reverse polish notation.

Ok, so the number calculating part of this BASIC by and large represents the format which the math processor needs. So, how does a BURP program looks like?

Example: LET C = 3 SQ 4 SQ + ROOT

Here, we assign a value to a variable C. This value is SQRT(3^2 + 4^2). First, the 3 is put on the stack. Then, a “squared” operation is called on the 3, replacing it by 9. Then, the 4 is put on the stack, and then replaced by 16. Now, and add function adds the 16 and the 9, replacing it by 25. Finally, the square root is taken, so in the end, the only number of the stack is 5, which is assigned then to the variable C (actually put in register C of the math chip).

The National Semiconductor MM57109 (the original data sheet titles it as a “Number Cruncher Unit”) is from 1977. It is the mask-programmed derivate of the MM5799 chip, which is the 2-chips-in-1-version of the 5781/2 chip set, the calculator chip family of National Semiconductor. It added 70 mathematical functions to the MM5799 design. From the viewpoint of a computer manufacturer, this is very attractive, because a) you don’t have to write all this math code yourself, b) it is efficiently executed. However, the MM57109 was not really an FPU (floating point unit) like modern math co-processors (which are nowadays integrated into the CPUs). First, the unit processed numbers that came in up-to-8 decimal digit packets (coded as 4-bit BCDs). Second, “Instruction execution times range from 1 ms to 1 second” (according to the data sheet). ONE second. That makes total sense for a calculator, but not too much sense for a computer. However, “real” FPUs did not exist much before 1977, with AMD’s AM9511 being one of the first.

So, here you have it. An early kit computer with a calculator chip as a mathematical co-processor and a crazy BASIC that makes complete sense in this design. Burp. Happy digesting.

## References

- https://en.wikipedia.org/wiki/PSI_Comp_80
- http://www.vcfed.org/forum/showthread.php?2624-Wireless-World-Powertran-PSI-Comp-80-info-wanted
- [Carver] https://github.com/raspberry-alpha-omega/burp
- http://www.projects.scorchingbay.nz/dokuwiki/_media/electronic/datasheet/national/an-186_mm57109_interface_to_microprocessor.pdf
- http://www.cpushack.com/2014/09/27/national-semiconductor-the-cop-before-the-cops/

## Leave a Reply