HP Time Shared BASIC
During the 1970s two mini-computer manufacturers dominated the education market for computers. Last week I wrote about DEC, and this week I'm writing about Hewlett Packard.
As discussed last week, BASIC was an important language in the education market of the 1970s. Both DEC and HP had the foresight to realize that Dartmouth’s experiments with Time-Sharing could open up markets for secondary education. Schoolchildren did not have access to computers before the 1970s, nor did adults. Adults didn’t operate computers, only technicians did.
When I entered ninth grade in 1971, one of my friends kept telling me I should check out the computer room in our school. I envisioned a machine with Magtapes, but instead, I found two clunky Teletype machines. These machines made a loud racket, but you could type on them, press the carriage return key, and a computer 10 miles away would respond by typing a bunch of text at 10 characters per second. We had two Teletype machines, and each of them was connected to the same computer. The computer could handle two conversations at once. Not only that, there were 10 other schools with a single Teletype. This meant the computer could juggle twelve conversations at the same time. This was the gist of Time-Sharing and it gave each user the illusion of having a personal computer.
As I previously mentioned, Dartmouth College imagined personal computing and built a Time-Sharing system and a programming language, BASIC, to achieve this goal. When I first typed on that Teletype machine it was only seven years after Dartmouth first launched their system. Seven years earlier it would have been unheard of for a “normal” person to do anything with computers, let alone a ninth grader. I was immensely blessed to have access to a computer. When I went home all excited, my dad who was a chemist, had no idea what I was talking about. When my mom heard me talking gibberish to my friends she was concerned I was just playing games. My dad told her, I think he could make a career out of this, and I certainly did.
I became aware that there were different dialects of BASIC when my dad found a book titled BASIC BASIC, by James Coan. I learned a lot about programming, but there were just a few things that seemed odd. Array subscripts were brackets and not parentheses. There were no programs in the book that demonstrated the use of strings or files. I didn’t realize at the time that numerous dialects of BASIC had completely different ways of handling strings and files.
I first became aware of the dialects when I took a volunteer job at Project Delta in the summer of 1972. I plan to write an article about Project Delta, but for now, think of it as a computer service for secondary schools in northern Delaware. I took a job, along with other students, to convert HP-BASIC programs to BASIC-PLUS. HP had collected a nice library of programs that they obtained from their customers, and we wanted to add them to our library. DEC also had DECUS, the DEC User Society, and we wanted to augment the DECUS library with the HP Library.
When I took the job in 1972 my boss assumed that converting the programs from HP BASIC to BASIC-PLUS would be trivial, they’re both BASIC, right? Not so quick, the string handling and file access were quite different. We didn’t have any HP-BASIC manuals, and we didn’t have access to a machine we could experiment with. Not only did we have to understand the program that we were translating, but we’d have to figure out what the language constructs meant.
The changes do seem trivial to me now, but when I was 14 years old, and just learning how to program, it seemed like a monumental task. Even though I had access to a computer, on most days I was lucky if I had an hour of access time. That summer I spent one day per week at Project Delta, which was my equivalent of pay. I could have lived there if I was allowed to. So I had about eight hours of programming time consolidated in one day. The other six days all I had was paper and pencil. I was motivated to work as hard as I could. I knew my boss had favorites, and if I could demonstrate my worth, she’d give me more access to the actual computer.
I quickly learned from reading the HP code that they handled strings and files very differently. It wasn’t hard to grasp, it was just different. Seeing these languages side by side kindled in me a lifetime of fascination with different programming languages and APIs. Whenever I see a new language I check out its strings and files and then look for other modern data types like hash tables and lists.
Both BASIC-PLUS and HP-BASIC influenced the home computers of the late 1970s and through the 1980s. BASIC-PLUS had a strong influence over Microsoft, so much so that GW-BASIC is almost identical to the 1977 version of BASIC-PLUS. HP BASIC was an influence on Apple’s Integer BASIC, Atari BASIC, and North Star BASIC.
So, what do the differences look like?
Strings
Here’s an interesting test of strings in HP BASIC. This is an actual HP BASIC Time-Sharing System running on my laptop under the SIMH HP2100 emulator.
list
10 INPUT N$
20 PRINT N$
30 END
run
?
gary
BAD INPUT, RETYPE FROM ITEM 1
??
gar
BAD INPUT, RETYPE FROM ITEM 1
??
ga
BAD INPUT, RETYPE FROM ITEM 1
??
g
g
DONE
So what’s going on here? By default, strings have a maximum length of one character. If you need more characters, you must use a DIM statement to define the maximum length. Here’s another example:
list
BLOG
1 PRINT POS("hello","ll")
2 PRINT
3 PRINT
5 DIM N$[20]
10 INPUT N$
20 PRINT N$
25 PRINT "Length is ";LEN(N$)
30 END
run
BLOG
3
?
gary
gary
Length is 4
DONE
Line 1 demonstrates the POS function, which is very similar to the GW-BASIC INSTR function with the first parameter missing. The LEN function should look familiar.
Here’s what happens if I try to type a BASIC command in immediate mode:
DONE
let a = 1
???
print 5+4
ILLEGAL FORMAT
It doesn’t have an immediate mode, but it does check the syntax of new lines as they are entered. It may or may not have incremental compilation. There’s no way of telling:
list
BLOG
1 PRINT POS("hello","ll")
2 PRINT
3 PRINT
5 DIM N$[20]
10 INPUT N$
20 PRINT N$
25 PRINT "Length is ";LEN(N$)
30 END
27 if n$="gary" then print "hi"
ERROR
HP BASIC does not allow multiple statements on a line. You may only use line numbers after the THEN.
Here are some examples of string slices. They are quite easy to map to GW-BASIC because MID$ is allowed on the left side of an assignment statement. BASIC-PLUS doesn’t allow MID$ on the left side, instead, you must say something like A$=LEFT$(A$,2)+”XX”+RIGHT$(A$,1):
list
10 DIM A$[10]
20 A$="hello"
21 PRINT A$[3,4]
22 PRINT A$
25 A$[3,4]="xx"
30 PRINT A$
40 END
run
ll
hello
hexxo
DONE
What happens if I need a string array? It turns out there is no way of doing it in HP BASIC. The best I can do is create a random-access file to simulate it.
Files
Due to the timing of the mini-computer releases relative to the Dartmouth releases, the mini-computer companies were left to their own devices for file handling. Dartmouth BASIC 4th edition was somewhat of a defacto minimal standard for the mini-computer companies, but it did not define file handling. Neither company had an elegant solution, and unfortunately, GW-BASIC circa 1983, copied BASIC-PLUS circa 1977.
Comments
If you have any suggestions or comments, please leave them below.
I got into programming and BASIC a decade later, on my birthday in 1983, to be specific. To me, multi-user computers were something I had never experienced. A few years later, my school got computers: four single-user CP/M machines. Looking back, it's strange how fast the "face" of computing changed.
This is a great series, Gary, and I look forward to future installments.
It should be noted that the "HP BASIC" mentioned refers to only the early "HP Timeshared BASIC"., on early model of the HP Series 2000.
Later models, like for example the Series 200 has a much more advanced BASIC, and also the more technical/engineering/scientific oriented versions "Rocky Mountain BASIC" is well enhanced beyond what is described here.
Those can very well handle string arrays, where a DIM statement would like for example like "DIM Name$(12)[32]" define an array of 12 strings of up to 32 characters.
Those also they allow for multi line IF..THEN..ELSE, which also allows jumping to labels, not only line numbers, though it still requires only one statement per program line.