BASIC

With a Teletype Model 33 ASR and an emulator, one can experience what computing was like for many before microcomputers.

Sharing Time

In the early 1960s, computer installations used batch processing on mainframe systems by scheduling jobs in a queue and running them one by one. The reason behind this practice was clear: there were relatively few computers available in industry, government, and academia, and computer time was a limited and valuable resource. The machines were to be used to the fullest extent possible. Computing was different from what we experience today, with our immediate access to processing power, multitasked applications, compilers, executables, input and output files, and other coding tools and resources.

The shift to "personal computing" -- immediate and direct access to a computer -- was deliberate and sometimes controversial. It first appeared in the form of time share systems and one of the earliest examples was the Dartmouth Time Share System (DTSS) in the mid-to-late 1960s. DTSS was an important development that broadened access to computers (see Finding LOVE).

Time sharing rapidly switched a computer processor between dozens (then hundreds) of users who worked on a machine interactively. Quick turnaround times for its users led to higher productivity despite dedicating more computer cycles to polling. Time sharing led to new computing communities and especially advanced burgeoning acts of creative coding. [1] Companies built time share services that could be accessed by modem, and one of the largest was General Electric's Information Services Department -- which would later evolve into the proto-online service GEnie. Early in the history of Apple Computer, Randy Wigginton used one time share service to develop AppleSoft BASIC -- a process that demonstrated its downside when their provider, Call Computer, inadvertently erased several user accounts and backup tapes, causing him to lose weeks worth of work with a looming deadline. [2]

By the 70s, Hewlett Packard, Digital Equipment Corporation, and other computer manufacturers, were selling computer systems that were adapted specifically for the time sharing market. Their minicomputers were relatively inexpensive machines that school districts and universities could purchase to establish campus or district-wide time sharing systems. These replicated many aspects of the pioneering Dartmouth system. Hewlett Packard's HP-2000 and DEC's PDP-11 minicomputer lines were popular choices. One example of a school district computer education program was Project DELTA ("Delaware’s Total Approach to computer knowledge"), which operated a time share service for the state of Delaware, including districts in its two rural southern counties. [3] Like DTSS, Project DELTA sought to engage students beyond only math and science classes and "...to make clear to teachers the difference between CAI [computer aided instruction] and computer knowledge." By 1975 about 50% of the high schools in the state of Delaware were affiliated with Project DELTA. Similarly, many students across the US, including Bill Gates and Paul Allen, had their first computer and programming experiences with time share services in schools. [4]

An emulated time share system

I was inspired to explore time share systems after reading Joy Lisi Rankin's book, A People's History of Computing in the United States [1], especially because these systems played an important role in the development of creative coding. Around the same time, a friend had dug out a few old rolls of paper punch tape from storage. These tapes held copies of programs that he and his friends had written in junior high school, around 1975, when the Philadelphia School District ran its own time share system and used it for instruction. It was an HP ACCESS BASIC system.

With a working Teletype Model 33 ASR, I had half of the typical time share user experience already on hand. The light duty Model 33 was a common terminal for time sharing because it was relatively inexpensive and it could connect to a distant computer facility with a modem (at 110 baud). In the late 60s and early 70s, the expanding Kiewit network at Dartmouth used teletypes and modems to provide service to high schools across New England and as far away as New Jersey.

Setting up an emulated HP ACCESS BASIC system is straightforward. The simh "History Simulator," an emulator for multiple historic computer systems, has an advanced HP-2000 simulator. [5] The emulator runs in two separate instances that replicate the function of the two HP-2000 processors of a real installation: one is dedicated to most of the system and user commands and the other directs the time sharing for up to 32 simultaneous users. I first started running the simulator on a Raspberry Pi model 1 A+. The single board computer ran well enough for the teletype console I/O, but I had problems using the paper tape reader.

HP ACCESS BASIC has two commands that made use of the teletype's paper tape reader and reperforator (tape punch): TAPE and PUNCH. (Each ACCESS BASIC command can be substituted with its first three characters, in this case, TAP and PUN.) The latter command is like LIST, the familiar BASIC command that generates a program listing, but PUN also adds a leader (and trailer) of NULL bytes, which help later when one loads the tape in the reader. So, the PUN command can be used to make a punch tape archive of a program. The TAPE command reads a punch tape in by issuing the control characters that start and stop the reader: CNTL-S (DC3 or XONx) and CNTL-Q (DC3 or XON). This software-side flow control should be familiar to terminal users when they needed to temporarily halt a scrolling display, a function that was actually borrowed from the older teletypes. In the HP ACCESS BASIC system, as a tape is read in, each program line ends with carriage return and line feed characters. The system temporarily pauses the tape reader while the line is processed, and then restarts the reader to read in the next line.

After some troubleshooting, I found that the Pi wasn't fast enough to use the tape reader. The TAPE command would start the reader, but it would become garbled after a line or two. It took some time to determine that all of the appropriate flow control signals were being transmitted back and forth. Running the emulator on a faster (but still about 10 year old) system under Debian solved the issues with the TAPE command. Headless operation on the remote server only required one small modification to the start.inc script, which starts the second simh instance:

! nohup stdbuf -i0 -o0 -e0 '%SIM_EXEC%' %1 %2 %3 %4 %5 &

I normally run the startup script hp2100 tab-auto.sim under screen, which can be detached for later monitoring. In all, the Pi was likely running with just enough lag that the flow control wasn't synchronizing properly.

Currently, the Model 33 Teletype connects to a local machine by a wifi232 modem. From there, I run ssh and log into the emulated system. The ssh session starts a telnet to the HP ACCESS emulation. If the machine was local, I could telnet directly to HP ACCESS, but my (cough, cough) service provider blocks many incoming ports. I've also had the Model 33 connected to the ttyAMA0 serial port of the Raspberry Pi (which can handle 110 baud) and used that to telnet or ssh into the emulation.

1973 UXP

The Teletype and remote HP ACCESS BASIC system replicate the user experience on time share systems in the 60s and 70s. It's slow and loud. It takes a long time to print a program, or even the file directory. (Hopefully the LIBRARY isn't too large.) Entering programs is error prone and fraught. It's amazing.

I used the emulated system to run programs that were shared widely during 70s: AMAZE, LOVE, and others, and also to write my own BASIC programs (see PUNW3 below). The HP ACCESS BASIC dialect differs substantially from microcomputer BASICs (the most widely distributed were the earliest products of Microsoft -- see Version1 on running the earliest version, Altair BASIC), but it's likely similar to its Dartmouth ancestor: there is only one statement per line; [6] the matrix calculations are significant and missing from any microcomputer dialect that I've used; and PRINT statements can be formatted using PRINT USING or IMAGE commands that resemble FORTRAN. The line numbers in BASIC were a design decision that made it possible for fast compilation times (BASIC was originally a compiled language). Compared to the practice of using indenting and other structural designators like brackets in modern languages, the uniform vertical and horizontal spacing of a BASIC program makes it significantly more difficult to read.

My time is tracked on the system. In the past, I would have been allocated a certain amount of time or billed for the time that I used. I'm wary of keeping myself logged on. Plus, the teleprinter is loud and heats up as it idles, waiting for input. Schools connected to time shared systems would typically have had one or two machines at most, [3] but some colleges and universities, including Dartmouth, had dozens of teletypes. It must have made quite a racket. How did anyone work through that electromechanical din?

The teletype speed is 10 characters per second. The punch program below is about 2700 characters. Each printout of the program takes four and a half minutes to generate. A punch tape archive of the program will always list the program, too. There's no way for the teletype to separate its punching and typing operations. Reading the program back in through the tape reader, though, it is possible to turn off the system echo with the command ECHO-OFF and suppress the printout. The tape reader chugs along in its staccato rhythm. Again, it takes four and a half minutes, after which normal operation is resumed with the command ECHO-ON.

07debc3fa9667042 b45d178411b3af86 6e1ece21d00dff5b 98a37cbb0304a654

Try HP ACCESS BASIC

Give HP ACCESS BASIC a test drive. Directions for logging on to an emulated service are here: HPBASIC.

In action

A video of the Teletype Model 33 ASR in action, reading in a ca. 1975 HP ACCESS BASIC tape.

https://youtu.be/XY_0_Q2lkT8


ACCESS BASIC programs

PUNW3

This HP ACCESS BASIC program punches ASCII letters using the teletype (or other teleprinter) paper tape punch. The program starts and stops the tape using DC2 and DC4 control characters. The bit patterns of the punched letters are generated by a sequence of two to six ASCII characters.

Here's a sample run:

RUN
PUNW3 

?HP BASIC
@@@@_DD_@_EEB@@@@_UUN@^EE^@RUUI@_@NQQJ@@@@
DONE

Without a physical paper punch, the program output can be viewed using the BSD games ppt command:

$ ppt @@@@_DD_@_EEB@@@@_UUN@^EE^@RUUI@_@NQQJ@@@@
___________
| o   .   |
| o   .   |
| o   .   |
| o   .   |
| o oo.ooo|
| o   .o  |
| o   .o  |
| o oo.ooo|
| o   .   |
| o oo.ooo|
| o   .o o|
| o   .o o|
| o   . o |
| o   .   |
| o   .   |
| o   .   |
| o   .   |
| o oo.ooo|
| o o .o o|
| o o .o o|
| o  o.oo |
| o   .   |
| o oo.oo |
| o   .o o|
| o   .o o|
| o oo.oo |
| o   .   |
| o o . o |
| o o .o o|
| o o .o o|
| o  o.  o|
| o   .   |
| o oo.ooo|
| o   .   |
| o  o.oo |
| o o .  o|
| o o .  o|
| o  o. o |
| o   .   |
| o   .   |
| o   .   |
| o   .   |
___________
$

Below is the PUNW3 code listing. There are nine strings of 10 character bitmaps and one of five bitmaps for a total of 95 printable ASCII characters (between 0x20 and 0x7E). Two arrays (L and M) keep track of the number of letters for each character and the position relative to the concatenated character strings. The maximum string length in HP ACCESS BASIC is 72 characters and strings can be named with a letter or a letter and the number 0 or 1 for a total of 78 possible names. Some characters aren't accessible using an ASR-33 because the teletype uses ASCII-63; hence, there is no tilde, underscore, or vertical bar, for example.

LIST
PUNW3 

10  REM PUNCH A MESSAGE TO TAPE
20  REM LARGER LETTER VERSION
25  REM ALL ASCII LETTERS
30  REM E. FURST, DECEMBER 2022
40  DIM A0$[52],A1$[52],B0$[52],B1$[52],C0$[52]
50  DIM C1$[52],D0$[52],D1$[52],E0$[54],E1$[20]
70  DIM T$[72],S$[4],P$[6]
100  DIM L[95],M[95]
120  LET A0$="@@@W@C@C@J_J_J@R]WI@C[D[X@JUVHQ@C@NQ@QN@"
121  LET A1$="JD_DJ@DD_DD@PH@DDD@P@XDC@NQQN@Q_P@YUUR@QQUUJ@"
122  LET B0$="GD_D@WUUI@NUUH@AYEC@JUUJ@BUUN@J@PJ@DJQ@JJJ@"
123  LET B1$="QJD@AUEB@NQWUB@^EE^@_UUN@NQQJ@_QQN@_UUU@_EEE@NQUM@"
124  LET C0$="_DD_@_@HPPO@_DJQ@_PP@_BDB_@_BDH_@NQQN@_EEB@NQIV@"
125  LET C1$="_EMR@RUUI@A_A@OPPO@CLPLC@OPNPO@QJDJQ@AB\BA@YUS@_Q@"
126  LET D0$="CDX@Q_@BAB@PPP@AB@^EE^@_UUN@NQQJ@_QQN@_UUU@"
127  LET D1$="_EEE@NQUM@_DD_@_@HPPO@_DJQ@_PP@_BDB_@_BDH_@NQQN@"
128  LET E0$="_EEB@NQIV@_EMR@RUUI@A_A@OPPO@CLPLC@OPNPO@QJDJQ@AB\BA@"
129  LET E1$="YUS@D[Q@_@Q[D@BABA@"
150  LET S$="@@@@"
160  M[1]=1
165  READ L[1]
170  FOR I=2 TO 95
180  READ L[I]
210  LET M[I]=M[I-1]+L[I-1]
220  NEXT I
230  INPUT T$
240  PRINT '18;
250  PRINT  USING "#,4A";S$
260  FOR I=1 TO LEN(T$)
270  LET S=NUM(T$[I,I])-31
310  LET N=L[S]
330  IF S>10 THEN 360
340  LET P$=A0$[M[S],M[S]+L[S]]
350  GOTO 710
360  IF S>20 THEN 390
370  LET P$=A1$[M[S]-M[11]+1,M[S]-M[11]+L[S]]
380  GOTO 710
390  IF S>30 THEN 460
420  LET P$=B0$[M[S]-M[21]+1,M[S]-M[21]+L[S]]
440  GOTO 710
460  IF S>40 THEN 500
470  LET P$=B1$[M[S]-M[31]+1,M[S]-M[31]+L[S]]
490  GOTO 710
500  IF S>50 THEN 530
510  LET P$=C0$[M[S]-M[41]+1,M[S]-M[41]+L[S]]
520  GOTO 710
530  IF S>60 THEN 560
540  LET P$=C1$[M[S]-M[51]+1,M[S]-M[51]+L[S]]
550  GOTO 710
560  IF S>70 THEN 590
570  LET P$=D0$[M[S]-M[61]+1,M[S]-M[61]+L[S]]
580  GOTO 710
590  IF S>80 THEN 620
600  LET P$=D1$[M[S]-M[71]+1,M[S]-M[71]+L[S]]
610  GOTO 710
620  IF S>90 THEN 650
630  LET P$=E0$[M[S]-M[81]+1,M[S]-M[81]+L[S]]
640  GOTO 710
650  LET P$=E1$[M[S]-M[91]+1,M[S]-M[91]+L[S]]
710  REM PRINT ROUTINE
720  IF N>2 THEN 750
730  PRINT  USING "#,2A";P$
740  GOTO 820
750  IF N>3 THEN 780
760  PRINT  USING "#,3A";P$
770  GOTO 820
780  IF N>4 THEN 805
790  PRINT  USING "#,4A";P$
800  GOTO 820
805  IF N>5 THEN 810
806  PRINT  USING "#,5A";P$
807  GOTO 820
810  PRINT  USING "#,6A";P$
820  NEXT I
825  REM FINAL SPACE AND STOP TAPE
830  PRINT  USING "#,3A";S$
840  LET S$='20
850  PRINT  USING "#,A";S$
860  GOTO 1000
900  DATA 3,2,4,6,5,6,6,2,3,3
910  DATA 6,6,3,4,2,4,5,4,5,6
920  DATA 5,5,5,5,5,5,2,3,4,4
930  DATA 4,5,6,5,5,5,5,5,5,5
940  DATA 5,2,5,5,4,6,6,5,5,5
950  DATA 5,5,4,5,6,6,6,6,4,3
960  DATA 4,3,4,4,3,5,5,5,5,5
970  DATA 5,5,5,2,5,5,4,6,6,5
980  DATA 5,5,5,5,4,5,6,6,6,6
990  DATA 4,4,2,4,5
1000  END 

The code has to circumvent an interesting feature of HP BASIC: after 72 characters (the length of a line on a Teletype Model 33 ASR teleprinter) the output routine in HP ACCESS BASIC inserts the control characters X-OFF, CR, and LF. With the PRINT USING and IMAGE statements, we can suppress the control characters,

30  PRINT USING 100;J
100  IMAGE #,D

or the string can be included directly:

30 PRINT USING "#,D";J

It's a bit of a hack, but it works. It prevents the control characters from showing up in the punched tape.

Notes and references

  1. Joy Lisi Rankin, A People's History of Computing in the United States. Harvard University Press: Cambridge, Massachusetts, 2018.
  2. Steven Weyhrich, Sophistication & Simplicity: The Life and Times of the Apple II Computer. Variant Press, 2013.
  3. F. Neil Walzl, The Development and Implementation of a District Computer Education Program. Doctoral dissertation, NOVA University, 1975.
  4. Paul Freiberger and Michael Swaine, Fire in the Valley: The Making of The Personal Computer, 2nd edition. McGraw-Hill: New York, 2000.
  5. Dave Bryan, Hewlett-Packard 21xx/1000 and 3000 Simulators, http://simh.trailing-edge.com/hp/ Retrieved 1/2/2023.
  6. Multiple commands per line were possible in some minicomputer and time share BASIC dialects, and were much more common for microcomputers. The density of the multi-line commands can further obscure the code, making it even more difficult to read. But it the practice of using them makes sense, given the I/O available at the time. For time share systems using hardcopy terminals like the teletype, the output is a permanent and long sheet of paper. For microcomputers and time share systems that would later use "glass ttys" (video terminals) the window into the code was much smaller -- usually about 24 rows. Text scrolled quickly, and so it made sense to use as much of the screen as possible by condensing the code into multi-statement lines. It also made for more compact printouts in documents and publications.