
   Simulated TSB-E System with Games and Stuff
   ===========================================
   
This is a simulation of a HP2000E Time Share BASIC system running on
a 16KW HP2116 minicomputer with a HP7900 disk drive and a HP7970 magtape
drive. The simulation attaches the "MUX" device to localhost port 4000
and supports up to 16 simultaneous connections using the telnet protocol.

It requires the SimH hp2100 simulator. Two main branches are available...
The "classic" SimH HP simulators page: http://simh.trailing-edge.com/hp/
The GitHub version 4 branch of SimH is at: https://github.com/simh/simh

New Windows builds of hp2100 are available from the SimH HP simulators page.

I have old (v3.8-0 from 2008) modified 32-bit hp2100 binaries for Linux
and Windows at: https://newton.freehostia.com/net/oldcomp/hp2100mod.html
(the mods were made to emulate some HP terminal codes, also emulates
 "fake" TSB codes made by moving the '10 '27 etc to within the quotes)

For Linux, an older version might be available from your package manager
as part of the simh package (or use my old binary), but generally you will
have to build it from source code to get a newer version. It isn't difficult,
the hp2100 program doesn't have many dependencies and generally installing
"build-essential" or similar will install the needed tools.

To compile the hp2100 simulator from the SimH HP simulators page, make a
directory (say HPsim but can be anything) then unpack the HP2100-Source
archive from within That directory - the reason is that when building from
the enclosed "SCP" directory it uses its parent directory and leaves the
hp2100 binary there. To build the hp2100 binary, in a terminal opened
to the SCP directory, enter the command: make

The hp2100 binary is normally placed in a path directory to be able to
use it from any directory, but can be placed in this directory if desired.
If hp2100 exists in this directory then it will override another version
installed in a path directory.

The simulation itself works with about any version of the simulator,
however the automated "newgen.sim" script requires the version of hp2100
from the SimH HP Simulator page because of the automated commands.


Files
-----

7900N.dsk - disk image containing TSB-E and BASIC programs
boot.bat - Windows batch file for launching the simulation
boot.sh - Linux script for launching the simulation in xterm windows
boot.sim - hp2100 script for booting the system (hp2100 boot.sim)
fix.sim - hp2100 script for fixing the system (run from broken system)
newterm.sh - Linux script for launching a new telnet terminal
readme.txt - you are here
tapes directory - HP papertapes and the newgen script...
 24280-60001_Rev-1534.abin - TSB-E system part 1
 24280-60002_Rev-1534.abin - TSB-E system part 2
 24285-60001_Rev-1534.abin - TSB-E utility
 24286-60001_Rev-1534.abin - TSB-E loader
 newgen.sim - hp2100 newgen.sim creates new blank system disk

After running the system it creates the system.tap file, after properly
"sleeping" the system this file will contain a backup of the system that
can be used to restore the disk image. 


Operation
---------

For Linux, run the boot.sh script to start. Xterm must be installed and
the hp2100 binary must in the current directory or in a path directory.
Edit boot.sh to use another terminal if you don't want to use xterm.
If double-clicking from a file manager, if prompted choose "Run".
The script launches the simulator in a xterm window with the default
fonts, then 2 seconds later launches telnet in another xterm window
with larger green-on-black fonts. Move the telnet window out of the
way if necessary, focus the simulator window and follow the directions
to start up the system then log in using the telnet window (see below).
Additional telnet windows can be launched by running the newterm.sh script.

For Windows, modify the boot.bat as needed depending on what's used
for telnet. As written it just runs: telnet localhost 4000
I couldn't get that to work in my old Win 7 VM but PuTTY worked.

In general, run the command hp2100 boot.sim in a console to boot the
operator control console, then start a telnet connection to localhost
port 4000. That's all the boot.sh and boot.bat scripts do, they just
make it easier to run without having to open a console/terminal.

Once telnet is working it'll say connected to the hp2100 simulator.

Follow the instructions in the control console window to start
the simulation. At the first prompt enter Y then for date enter 111/77
or a proper date, for time enter 1111 or a proper time.

Once READY you can log in using the telnet window, enter: HELLO-A000,ST
You might have to try it again, some telnet clients send extra noise.

Once logged in it displays brief command summary. When done enter BYE.
You don't necessarily have to log off (shutting down the system logs off
active users), just don't close the telnet window while logged in or it
might cause the simulator to hang and break the system.

Important - the system must be shut down properly or it WILL break.
When done, in the control console window enter SLEEP then enter Y
then enter 20 for the select code. Do not exit or close the window
until the * prompt shows. To exit press control-E then enter: exit

Once properly shut down, it writes the system to the system.tap file,
which can be used to restore the system if not slept properly. If you
get the dreaded SYS NOT SLEPT message, then at the sim> prompt enter...
do fix.sim   ...and follow the instructions to restore the system.
Be sure to follow the instructions to press ctrl-E once or twice
(with the new hp2100 it takes two) to halt the system and continue after
the READY prompt, this is required to detach the magtape and reattach it
because the utility places the simulated magtape unit off line. Note that
the new tape is named scratch.tap to avoid overwriting system.tap in case
something else is wrong with the system.

(or you can simply re-extract the disk image from the zip file...)

If you get a "file open error" for mux when starting up the system again,
just wait a minute or so for the connection to clear. On my Ubuntu 20.04
system it takes several seconds after shutting down the system before it
will let me start it back up again.

This fragility is a byproduct of simulation - the real system from the
early '70's was not nearly as fragile. For one thing the original HP2116
minicomputer used "core" memory which did not lose its contents when power
was lost. The system had hardware which (if I understand correctly) would
resume operation once power was restored. Most of all, you can't accidentally
"close the window" on a real minicomputer! If the system wasn't too active
at the time it "crashed" (say someone flipped it off without sleeping) then
usually just a flag was flipped and if you knew where it was on disk then
with the right utility it could be flipped back and booted back up without
restoring the system. I used this method with an older simulated TSB-E system
and even when the OS got confused it worked well enough to get in there and
copy/paste out whatever I was working on at the time I had a moment and
accidentally closed the sim without sleeping.


Sources and Documentation
-------------------------

These files were derived from the HP2000E Software Kit, downloaded
from: http://simh.trailing-edge.com/hp/kits/2000E-kit-release-3.zip

User documentation for the TSB-E operating system is at BitSavers:
http://bitsavers.trailing-edge.com/pdf/hp/2000TSB/2000E_UsersMan.pdf
http://bitsavers.trailing-edge.com/pdf/hp/2000TSB/2000E_OperGuide.pdf

An extensive examination of the system internals is at:
http://bitsavers.trailing-edge.com/pdf/hp/2000TSB/2000E-ims-300.pdf

The original binaries and source code for this and other HP2000 and
HP1000 systems has been provided by HP for non-commercial purposes.
The entire collection is available at:
http://www.bitsavers.org/bits/HP/HP_1000_software_collection/

The source code for this system has been separated out and is at:
http://www.bitsavers.org/bits/HP/tapes/2000tsb/TSB_E_F_srcs.tar
The files beginning with 24280- 24285- and 24286- apply to this system.
Note - these source files contain binary characters, modern editors
might complain. For Linux the following script might be useful...

--------------- begin file CombineAllFiles -------------------------
#!/bin/bash
#
# Combine All Files in a directory into a text file - uses strings
#
outfile="AllStrings.txt"
sep="=-=-=-=-=-=-=-"
echo -n "" > "$outfile"
find -maxdepth 1 -type f | sort | while read -r f
do (
 f=$(basename "$f")
 echo "$f" | if grep -qv "$outfile"; then
  echo "$sep$sep FILE $f $sep$sep$sep" | head -c 77 >> "$outfile"
  echo >> "$outfile"
  strings "$f" >> "$outfile"
  echo >> "$outfile"
 fi
) ; done
--------------- end file -------------------------------------------


Programs included on the disk image
-----------------------------------

This is from the initial "HELLO" startup and a CAT command...

--------------------------------------------------------------------------
HELLO-A000,ST


*** TSB-E GAMES AND STUFF ***

CAT            LIST FILE CATALOG (ENTER FOR NEXT LINE)
GET-PROGNAME   LOAD A PROGRAM FILE INTO MEMORY
RUN            RUN THE PROGRAM CURRENTLY IN MEMORY
LIST           LIST THE PROGRAM CURRENTLY IN MEMORY
NAME-PROGNAME  SET THE FILE NAME FOR THE SAVE COMMAND
SAVE           SAVE THE PROGRAM IN MEMORY TO A FILE
SCRATCH        ERASE THE PROGRAM IN MEMORY (NEW)
KILL-FILENAME  REMOVE A DISK FILE
BYE            LOG OFF THE SYSTEM

TO STOP A RUNNING PROGRAM PRESS CONTROL-C THEN PRESS ENTER
TO CORRECT MISTAKES PRESS UNDERSCORE FOR EACH CHAR TO RUB OUT
DON'T FORGET TO SLEEP THE SYSTEM FROM THE OPERATOR CONSOLE

CAT
FTBL    2864  GOLF    2729  HELLO   0377  LANDER  2250  LNAUTO  0629  
MANDPL  0959  OTH     2696  OTHEL   1016  OTHELL  1986  STTR1   0889  
STTR1A  3413  STTR1B  3406  STTR1C  1592  TREKD   3088  TTYTRI  1364  
TTYTRK  3447  WUMPUS  2537  
--------------------------------------------------------------------------

Source code for these programs (except HELLO) is at:
https://newton.freehostia.com/net/oldcomp/hpgames/tsbegames.zip
https://newton.freehostia.com/net/oldcomp/hpgames/tsbother.zip

Some of these programs are just like I found them but many have been
modified by me to work in the limited memory of the TSB-E system. Some
were written from scratch because I just like to play with stuff like this.
To run a program, enter GET-PROGNAME (i.e. GET-WUMPUS) followed by RUN
To stop a running program press control-C then press the Enter key.
If a program is not at a prompt then press control-space to stop it.
After loading or stopping a program enter LIST to list its code.
To create a new program enter SCRATCH then copy/paste or type in
the code. When done enter NAME-PROGNAME to give it a name then enter
SAVE to save the program. If the program already exists on the disk then
enter KILL-PROGNAME first to remove it, then save it.

The TSB-E system does not have a regular backspace (it was written for
a teletype machine), instead to correct mistakes press the "_" key for
each character to "rub out" and replace. You'll get used to it.

Here are brief descriptions of the included programs...

FTBL - a contributed football game (as I found it)
GOLF - a contributed golf game (as I found it)
HELLO - this program is run by the system when logging on
LANDER - the classic LUNAR LANDER program (as I found it)
LNAUTO - a program I made in 2006, generates 1D cellular automata
MANDPL - a program I made in 2006, generates Mandelbrot plots
OTH - a program I made in 2007, OTHELLO with level 0 or 1
OTHEL - an OTHELLO program I found, made minor mods to make it work
OTHELL - an OTHELLO program I made in 2006, level 0 only
STTR1 - a conversion of Mike Mayfield's STTR1 program I made in 2006
STTR1A,STTR1B,STTR1C - called from STTR1, don't run directly
TREKD - a different kind of trek program, mostly as I found it
TTYTRK - a trek game written by Joe Altmaier, mod'd in 2006 for TSB-E
TTYTRI - brief instructions I made for TTYTRK (what I figured out anyway)
WUMPUS - the classic HUNT THE WUMPUS program, should be close to stock


Generating a fresh TSB-E system
-------------------------------

In the tapes directory there's a newgen.sim script that was adapted from
a script included with the HP2000E software kit, modified to produce a
single blank A000 account with the password ST. It requires the version
of hp2100 from the SimH HP simulators page because of the automation.
To use, from a terminal in the tapes directory enter: hp2100 newgen.sim
(hp2100 must be in a path directory or specify path to it)
It creates a disk image file named 7906NEW.dsk and a sleep tape
named 7900NEW.tap in the tapes directory. The new system can be
booted using scripts similar to the main boot.sim script, renaming the
disk image or editing the filenames in the script(s) as needed.


History
-------

2/27/2021  Prepared this system from the file "2000E-kit-release-3.zip"
2/28/2021  Loaded up the system with some of the old TSB-E software I had.
           Prepared boot.sim and fix.sim scripts that should work with
           any version of the hp2100 simulator. Made boot.sh and boot.bat
           that can be adapted to boot the system without opening consoles.
3/1/2021   Worked on the docs, added newterm.sh to launch a new terminal.

This material is provided as-is and without warranty. Use at your own risk.
This material is intended only for non-commercial purposes.

- Terry Newton (wtn90125@yahoo.com)

