code for this project is at https://github.com/sheepdoll/PTExtendedBasicArduino.git
My first computer was based on the Processor technology VDM-1 and CUTS board. Processor technology was one of the first home computer makers. Starting at the same time as Apple around 1975. Where Apple sold a few hundred, Processor Tech often called PT sold thousands of units. In 1977 my high school was able to get two of the sol 20 models.
Like most computers of the era PT Sol-20s ran BASIC. This was loaded in from cassette tapes. PT produced two versions of BASIC 5K and Extended cassette Basic, which loaded in 15K. The latter was a full implementation of the language. Like the BASIC that ran on the local community college, and the computers at the Lawrence hall of science, Extended cassette BASIC had matrix operators. These seemed like magic to a student, who had trouble passing Math classes. These operators could solve simple simultaneous equations. Matrix operators are now mostly used for audio and video compression. GPU processors are designed to do a lot of these operations fast. It his how the text in a GUI is rotated and scaled.
PT basic was not all that fast. The computers only ran at one or 2 megaHertz and had a lot of cycles per instruction. The interpreter did however, like a calculator, use Binary Coded Decimal or BCD for the floating point. This held 8 digits of precision with an exponent of one byte. The sign took a separate byte, so the floating point number fit into 6 bytes or 48 bits. The mini computers of the time used 32 bits for floats. These give about 5 digits of accuracy. Some of the larger computers had double precision or 64 bit floating point numbers. The 32 bit floating point would evolve into the IEEE standard, that standard was to be years in the future.
The advantage of these BCD floating point numbers, is that PT BASIC also had a maths package. Slide rules were still popular in the late 1970s, so the maths package was based on the log of e or 2.7182818… This way the interpreter could quickly calculate sin(),cos(),tangents() as well as squares, cubes and square roots using a polynomial expansion. These were called Chebyshev polynomials. The other way to solve this is through Taylor expansion of factorials.
The cassette era did not last long, By 1978 floppy disks existed. These were large squares of plastic with a thin magnetic coated disk inside. Such came in two popular sizes 5 inches and 8 inches.
The early days of the Homebrew computer era was a bit chaotic. Processor Technology was located in Emeryville (now where Pixar is located.) This is near the University of California, Berkley. There were the usual personality clashes, between the founders and users. A competing company Northstar Computing, Split off from the hobby groups and came out with 5 inch disks. They had their own basic interpreter which ran under the C/PM operating system. There were also pirated copies of MITS basic (which was to evolve into Microsoft Basic.) that were patched for cassette or floppy disk operation. There was a lot of arguing over intellectual property and claims for territory. A new market was evolving, small professional offices that could affords a dedicated computer for billing invoicing, financial planning and tax evasion, Um er Itemized deductions.
I graduated from high school in 1978, A bit young to be in the think of things. I only used the PT system for about a year before starting the community college, My main desire was to be a Disney type animation artist. The computers interested me as even then it was evident, that animation was so time consuming that computers were the way of the future. Sigraph had some amazing demo reels, and the motion control of ILM was well established. Most of my classes were in stage and film. I had the fore site, to take computer classes and then electronics classes so I could build my own graphics boards. I wound up as a computer sales tech, I did however get to do some apprentice work at Sprocket systems although in the sound post production and foley areas.
Processor technology was developing it’s own 8 inch floppy disk system. As I recall they were also working on a rigid disk system under the name of Helos, which like sol is a name for the sun. They had their own OS, which even today seems klunky and dated. A lot of the interest was making these old systems be more unix like, with batch processing scripts and code libraries.
The Sol-20 was not named for the sun. It was actually named for the editor of an electronics magazine, which printed projects you could build in your basement. Most of these were from a company called Heathkit that made kits for everything from volt meters to color TVs. This was one of a myriad of kit suppliers. In the back you could mail away for chips and other electronic parts. A Maker could even get kits to build electronic keyboard organs which were quite popular at the time. This magazine was for people who liked making things for themselves. Making ones own computer at the time was like the Holy grail of the hobbyists. Most of these hobbyist were into amateur radio. They called themselves Hams. For most people in the 1970s electronics was identified with radio and television which was radio with pictures.
While the plans for the SOL computer were published in the magazine the Sol-20 was not really a kit. It came in an IBM-Blue sheet metal case with walnut sides and a built in keyboard that had a Keypunch or teletype ASCII layout with the (“) over the 2. It was sold as a turnkey system, with little setup effort And thin manual, Cause no no one liked to type long documents. The popular programs were a word processor called Electric Pencil, Some development tools, and the Basic. Spreadsheets were still a bit in the future, there were some accounting databasing and mailing list programs. Most of these were custom written for the client. A student could make good money writing such systems. Printers were done with spinning hard plastic disks of letters called daisy wheels, from the resemblance to the flowers. The type intended to mimic executive typewriters.
Processor technology was never able to ship it’s Helios disk system. At least in any quantity. The company moved from Emeryville to Pleasanton. Pleasanton a suburban community in the hills east of San francisco, had one industry at the time, It was where Kodak had it’s west coast operations and processed film. (I still have an animation tower rotting in the back yard from that operation, got from a surplus dealer) Most of the regional 8mm film was processed there. There was a dedicated train line to the KODAK plant. The train tracks now a jogging trail. An 8 lane superhighway now cuts through the canyon to get people quicker to the Silicon Valley proper. Many large corporations now have offices in the area and the population increased 10,000 fold, then it was the back of beyond. Processor technology moved too soon, ahead of its time the company was bankrupt by 1979. The assets sold at auction.
By this time I was attending the community college, working as a lab assistant. So I had some income to acquire my own personal computer. A lot of the parts like the CUTS board were sold by surplus dealers, which were located in warehouses around the back part of the Oakland airport. These were Mike Quinn;s and Godbouts. I was able to get a Godbout S100 back plain. The local byte shop had an 8080 cpu board. You programmed this with switches from the front panel. The CUTS board provided the cassette tape interface, The VDM-1 was a 60×16 display. The operating system was called CUTER which was pronounced to rhyme with cute. This was the same as the SOL-20 personality module which was called SOLOS.
Keyboards for a home system were more difficult. I had one which I still wish I kept. It was a bare matrix keyboard, so difficult to interface, it used magnetic reed switches and had a nice feel to it. Spent hours tracing the matrix. Parts were not easy to get so building the matrix decoder proved difficult. What existed on the internet was academic and non commercial. When the College scrapped out some old Hazeltine terminals I had better luck interfacing they keyboard module to the parallel port. Somehow I was also able to get a 32K memory board. It was not too reliable. Still with effort I could boot into the system, get the cassette to load and I had my own system at home. I could then load in my favorte games, Kingdom or Ratrun. Loading and saving programs was time consuming, so I did not use it much. I did have a modem and had managed to learn the number of the community college’s computer I was a lab assistant for. There was also the ARPANET, but anything you did was gone the next day. There was also Usenet, which was academic, apart from a handful of science fiction writers and their fans.
The one thing I never had, was the program listings to the Processor Tech basic. The computer lap at the college had HP200F basic. There was a bookshelf next to the computer with the program listings for HP basic. There was a lot of arguing over IP and coding rights. Those of us who were for open source were called Berkley computer communist. Lead by Lee Felsenstein, creator of the Sol Hardware. He seemed to consider me an annoying kid. I don’t think he ever remembered my name. I doubt Lee ever was near the basic source, he was the hardware guy. I did get a few communist manifestos from him. Mostly about water rights, how water should belong to everyone and wars fought over water.
By 1982 I was able to graduate. 4 years in a two year school, but I did take both an Associate of arts degree, and another two years for an electronics engineering technology certificate. I was also the senior lab assistant. I attempted a few times to reverse engineer the PT BASIC, then gave up and decided to write my own interpreter from scratch.
By this time the Ol HP2000F was long in the tooth. It dated to 1969, which by 1981 was 11 years old. Some of the program problems in the classes dated to the late 1950s when the school was create. The HP BASIC interpreter was also limited, while it had the matrix math functions, It lacked the string handling capabilities present in the personal computer basics that ran on the Apple and Pet computers. The school administrators decided to replace the HP. For some reason, while the students wanted a VAX, the administration got sold a Pr1me computer. The Pr1me was more of a BBS system, It ran early social networks like the Source and I think he Well. Although the Pr1me had compilers for all the popular languages, Fortran, Cobol, and especially PL/I. While it had a basic interpreter, All the old programs on the old system needed to be migrated.
As both systems had 9 Track tape drives, this was not too much of an issue. I figured out how to read the HP tapes, and detokenize the Basic. So I got paid to do write my own interpreter. I also got college credit, as I chose to write this in PL/I, which at the time was my favorite language as It could be coaxed into a bit of a C like nesting structure, and could use lower case, SO YOU WERE NOT SHOUTING ALL THE TIME.
On graduation, from college, I quickly found a job at the local Apple dealer. By 1984 I had both an Apple //e and a Mac. A friend from the college wanted my old computer, for nostalgic reasons, as I had used parts salvaged from the schools old terminals. I was able to transfer some of my programs to the mac, for reading the 9 track tapes. I never was able to have the 9 track tapes read. Eventually they went to the Salvation Army. I had not intended to get rid of the tapes, but they said that they would take them. Shortly thereafter I found a website where others had managed to save a lot of the HP2000 library. So in the long run not much was lost.
For sentiment I kept a folder for the CUTER program and some utilities I had written back in the late 1970s early 1980s. For a long time I kept the paper copy manual to the extended cassette basic. This included a dump of the VDM char generator rom. At a reunion meeting of early Homebrew enthusiast I learned of a similar emulator/website for the sol-20. Sadly the source code to the extended basic was lost. I bookmarked the website, the simulator was for win95, So I forgot about the website.
I always had a nostalgic soft spot for the Extended cassette basic. A desire to dump and reverse engineer the program to see how it worked. When I was studying computers in the late1970s early 1980s, there were not a lot of textbooks. My high school computer teacher, who also taught physics, wrote one of the first. “Microsoft BASIC made easy.” I think he also wrote “Wordstar Made easy” which was the program that replaced Electric pencil. He was friends with Adam Osborne, who sometimes visited the high school classroom. Lee came to visit a few times too, Not sure if Bob Marsh ever came. The history books have not been kind to Bob, a victom of his own success they say.
The best textbook for BASIC programming was and remains one from 1976 by William R Bennett. It came in two versions, One titled “Scientific and engineering problem solving with the computer” the other was titled “Computer problem solving for non scientists or engineers.” the text between the two is identical, although the former book has more chapters.
This is a fun book. Prof Bennett’s classes must have been fun too. The first chapter (and probably his first lecture) is taking the temperature of a firestorm. So after a brief introduction to the basic language, he jumps right in, with a a page of data statements from a thermocouple. Not to unlike a getting started With Arduono book. The Bennett book then goes into a bit of advanced mathematics. Math was never a strong point, I struggled and could never pass algebra or arithmetic classes. One reason I got into computers, it was thought that I could be drilled in the mathematics by the computer. For some reason, I was able to understand the concepts behind some of the more advanced math (Trigonometry, statistics, computer programming.) The computer does the grunt work.
There are chapters in this books on the fundamentals of drawing pictures with the computer, In 3D too. This is why I liked the book so much. Later chapters deal with music synthesis. There are pages of data statements of instrument wave forms. It was amazing to be able to get sound from a book, that was not written in music notation. This is one of my favorite books, The bedside reader I often take with me. I have had it over 40 years. There are a few other books I have from this era, There was a good clerk in the mall bookstore. The other book I have is for taking photographs from spacecraft, as well as an introduction to graphics programming from the guys at XEROX PARC. I was able to recover Mars mariner 9 images from the spacecraft book. The subject of a potential blog, then I have projects to keep me busy for 500 or more years. There always seems to be a piece missing, so the post never published.
Now lets step forward 40 years to a fun project. The heart of this blog posting. A small board like the Arduino has the power of that first computer from 1979. I have often wondered if It could run the PT BASIC. While I still have some of the PL/I source, and there are emulators online, It was this and only this source that I had any desire for.
I had some TFT screens, that were trade show giveaways, which took some effort in getting to work. 5 years of sitting on the shelf, waiting in the Urgent in pile. When I did get one to work, I wanted to put some text on it. Not just any text, The character fonts from the VDM-1 board. I looked on my shelf, and there was no Processor tech extended basic manual. It was purged in some cleanup effort, where I had applied the 10 year rule. Which is that if I have not done something with a project in 10 years, it can be purged for newer or older projects. I looked on my hard drive, and could not find the folder with the font in it. I found the old bookmark to the SOL-20.org website. Probably broken link by now, I thought to myself.
To my surprise, the link still worked. Sol20.org It even looked like the site was somewhat alive, with updates in the last year or two. Even the last month. The site was comprehensive. Here were the manuals I misplaced or lost. I wrote the site administrator, who like myself can take years or months to get back to a project. The best thing was that was the emulator (Windows 95 based) was still on the website as was code from the day. Even my favorite Game Kingdom was listed. Ratrun was a program on the pet, I was working on a port of it to the HP and processor tech basic. This was a version of Maze wares or super maze wars, so it looked like you were inside a maze.
While there was source to the 5K basic, there was no source just binary to the ext cassette basic. Browsing around there was source to the ill fated Helios project. One of the source folders was for a dos basic. This was the Eureka moment.
Having written a simple disassembler in postscript for 68K , I decided to see if I could compare the 5 K source to the 15 k basic. The tokens were different. I dumped the codes, but could not find any matching sections. In looking at the dos based source, This had the maths package. In looking at the tokens, they looked close. Could the DOS basic source be the missing source to the EXT cassette basic? There were forms of IF defs that were for SOLOS/CUTER. So I set out to see if I could match things up.
My reverse engineering tool is written in postscript, which can parse any language. One can work in French Hex,, English, EBCDIC or even Arebic, (although I have not done the latter other than some monkey testing at apple.) Postscript is also good at handling the math formulas like (FFTs) from the Bennett book. It even can produce a printed page if one so desires.
The Postscript language uses Key/value dictionaries. The NeXT OS was based on postscript, although I find the modern Mac implementation too backwards when it comes to objective C or Swift programming.
Using this tool I was able to match up the comments in the DOS basic, to the binary code in the ext basic. Most of it was a 1 to 1 match. There were a few bugfixes here and there. The file and program storage I/O code was of course completely different. The most interesting thing was the code contained anti-reverse engineering sections, Namely a hidden copyright statement. They were a bit paranoid back in the 70s. I still think the company failed by attempting to move too much into the Intellectual Property phase, too soon. Apple made the same mistake with the Apple ///. Almost killed that company too. The apple //e was completely open. Ironically the apple //e was the Apple /// in an Apple ][ style case. This was overshadowed by the Mac, so most of this paragraph is of a historical footnote.
Matching the comment code to the binary was tedious work. While it takes a few seconds to scan a page of listing, It can take 20 or 40 minutes to cut and paste the comments into the key value dictionary. At least the cut and paste only had to be done once. I suppose one could write an assembler to look at the op-codes and match that way. The result was the same as if the code had been assembled.
What I really wanted, after 40 years, was to see the extended basic source listing. Here it was appearing page by page, bad misspellings and all. I wanted to see it live again, and not in a windows emulator.
There were also these cute little TFT displays on the shelf, as well as some Arduino UNO clones. The pipe organ projects need a simple terminal. I use the mega328 in my pipe organ projects connected to a 2×40 character display. One of the boards which is a Kitchen sink board. I had laid out the FPC connector and a breakout header on it. Experiments with the 320×240 displays showed I could get 60 chars x 16 on the screen. Problem was these were given out as trade show samples. They only work in 9 bit mode, and are really slow at updating. The VDM-1 was 64×16. Stretching the font to 8×20, I had all the old characters back on the screen.
With the I/O sections of the Extended Basic source code, disassembled, I had the epiphany that Postscript does not care what the opcodes are. What if I change them to AVR codes. Some inquires to the AVR Freaks group, showed this was not a good or popular idea. All the more reason to try it. There was a close mapping of the upper register set of the AVR where the index pointers are to the 8080 registers. The letter nomenclature would be backwards. I still name r24, and r25 ACC and BCC in my assembly code (old habits die hard) Problem is that the mapping split the B register into the high part of the index register X (If i wanted to retain the BC pair) this left r25 for a flag shadow register.
With the I/O and instruction parser reverse engineered, I did the name changes. Put the code into studio 4 and assembled it. Massive amounts of branch out or range errors. I swapped the tests to do PC+2 jumps. Bit tricky as the offsets are in 8080 space. While AVRs are 8bitters they have 16 bit instruction words. Complicated that jumps and calls are three words. Some of this it was easier to clean by hand.
So for the big test, would the code even fit? With just the I/O and the parser working. It ran. The copyright screen showed up followed by the first READY prompt. How to get date into the thing. I had a folding Palm keyboard that worked at 9600 baud. The first tests were done with a term program. The Palm keyboard only sends the matrix. Writing a driver, only to find out that one of the columns is out. The column with the TAB,2,Q,and A key. Quick fix use the function key to shift these over one. Good enough.
More entering into the postscript database of some of the statements. Will the print statement work? Using Mnemonic overlays for the registers, created a strange problem. The assembler does not like these redefined. There is directive called .overlay I added this to see if I could make the warning go away. I quickly ran out of memory. Code dumps only indicated half the memory being used. The other half was static data. In the 1970s, memory was expensive. Every bit was counted. So constants like error messages were shortened to 2 bytes. The main Error message is BS ERROR. BS standing for BASIC SYNTAX. The HP interpreter just gave three ???, so this was a step up. I suspect the guys programming got a laugh out of the pun.
Removing the .overlay directive returned the missing half of the flash memory to code. Only about 2K of the 15k was used for static values. Mostly the interpreter statements and the log math tables. The problem was the SRAM. About 700 bytes is used for thinks like IO buffers, the call stack, and the interpreter database,
Switching the register names back to the AVR, actually made the code easier to read. While the comments might read to DE or to BC, much of the code delves into moving things into HL or the accumulator. As H&L are now ZH, and ZL there is not that much difference. AVR can accumulate in any register, so the converted code is horribly bloated, and probably somewhat inefficient. Still it runs, and probably runs quite a bit faster that the original. This gets masked by the slow updating of the TFT display.
Playing about with the skeleton of the interpreter was quite fun. The tricky part of separating out the data memory space from the SRAM lead to another gocha, This one I was warned about on AVR Freaks. That macro translations can munge the flags. R25 was a good place to store the flags. I did not bother to change the bit order. This is now a native AVR app after all. Problems showed up in the 16bit increment instruction, In AVR this clears the carry flag. To save bytes, the old programmers used the carry as a general purpose flag. The shift rotate also munges the carry. These all had to be edited by hand.
Easy in a way to find the munge points, the math functions returned off the wall numbers. Once the flags protected, the numbers started matching the numbers in the windows95/ emulator running on windows 98. This brings up a question. The source code is for the 1979 dos version. The code I wanted was the 1977/1978 cassette version. There are a number of bug fixes in some of the math package. My desire for the last 40 years was to have the 1977 version. The code was also written to support a number of precision steps between 6 and 40 at compile time. The 40 digit log tables were not included. 16 digits being the largest recommended. The user group seems to have faded around 1983. So this basic was only really popular in use in the 1977 to 1981 timeframe. Mostly used in small professional officers like dentists, accountants, writers, and financial planners. 10,000 is a fair amount of product and many of these computers still exist. Electric pencil was the first popular word processing program.
From the surviving documents, it looks like one of these Dentists, purchased the source code at the bankruptcy auction. Seems he ran the users group until 1983 or so. Some online historians who contacted him learned that most of his collection was lost in a move. It seems a few of us in the last decade (of the writing of this missive) have had a nostalgia for this software. The part of the Basic interpreter that interested me was the Matrix math package. According to the 1982 comments 2/3s of this source code was already lost and had to be reconstructed from the object.
This was the last section to be translated into AVR. Surprisingly it seems to work, although it still has not been tested, other than it produces no syntax errors. The 320 x 240 TFT display proved to be too slow. An ILI9341 was substituted, these are half the resolution, so only a 40×16 line screen can be run. The VDM-1 memory mapped the display into 1K of SRAM. This is half The memory of a 328. Reducing the display to 40 columns frees up a number of bytes. Printers on these computers could produce about 120 or 130 columns of text. The cards could have 80 characters, of which 72 were valid. So the input buffer is 133 characters. For most use the 72 chars is just fine and in keeping with the rules of coding in the 1970s.
One more section needs to be handled. The program store. This is after all extended CASSETTE BASIC. The programs were stored on Audio tape, using a modulation that could be recorded over the telephone. The buffers for this take about 20 bytes per file. There were only 3 files allocated, the first was used by the command interpreter and served as a template. The SOL had relays for pausing the tape player, There were two tape devices. While a modulator/demodulator could be used, More practical in the current era would be to use SD cards. This is still to be worked out. The tape player works like a Turing machine, there is no directory, one plays the tape and lists the headers, or positions the player to the start of where the file should be.
There are only about 700 bytes available on the 40 column version for the program and data storage. This is not quite enough to run even some of the simplest games, which had blocks of comments or instructional text. Most of the smaller programs, in the tape library are memory test programs, which are of little value. Others do things like print math tables. As noted Slide rules were still trusted more than calculators. Printing out the tables on computer paper was a real geeky thing to do. This was also an era where the value of P was 22/7 to four digits.
So what can this thing do? It can actually run most of the example programs in the first chapters of the Bennett book. An interesting side effect of the direct port is that there were statements and functions for accessing the hardware of the SOL-20. These were called Peek, Poke and Call. Call is of little use as it can only call into the program memory. Peek and Poke can affect the Video memory, So I implemented them. The AVR also memory maps it’s I/O into the first 256 bytes. PT extended basic, also provided access to the I/O space of the 8080. This was a separate largish memory space where things like Floppy drive controllers were located. The serial, and parallel ports connected to this memory area.
So it turns out that all this exists within the AVR environment. So there is ready access to the GPIO pins of the UNO. This includes the ADC pins. This means that the first problem in the Bennett book, taking the temperature of a firestorm is can actually be done, exactly as instructed.
I have a Mega 1284P=Xplained, so the next step will be to run the code on that, which should give 16K of ram, more than enough to run the code games and other programs archived on SOL20.org The Xplaned board only runs at 11 Megahertz, so will be too slow for the TFT, although the TFT can run as a terminal. There is also work needed to write drivers for emulating the tape drive on SD memory cards.
Here is an example of about the largest program that can run, which inverts some random numbers added to an identity matrix. It is not much of a program, but more interesting than 10 PRINT “SOMETHING”:20 GOTO 10:99END. Although from the palm folding keyboard CTL-ALT-DEL works and typing bye presents a blue screen of death. Which CTL-ALT-DEL recovers from. Had to do something with the ALT key.