31KW Version of MSU BASIC

MSU BASIC is a four-user time-sharing BASIC system for a HP2116 minicomputer from Montana State University, the source code for Revision A is dated December 1971. Each user was connected to a separate TTY console interface and the system logged activity on a separate TTY (or perhaps one of the user TTY's, not sure if that works). The system was slightly modified in early 2008 to disable logging, and settings were discovered to permit proper simulation under SimH HP2100, I got ahold of the files and slightly modified them to permit configuring a system for a 31KW memory configuration (to leave the top 1KW free for integration and swap/save code), and figured out how to get it to boot straight to the READY prompt, without logging on and clearing memory, thus permitting programs to be entered and saved in binary form.


The HP BASIC Language supported by MSU BASIC

The MSU BASIC language is very similar to HP paper-tape BASIC (even the error codes are the same), the main difference is there are no CALL and WAIT functions. Regular variable names are a letter followed by an optional digit, array variable names are restricted to a single letter. String variables are not supported. Program lines must begin with a number between 1 and 9999, the last line must be END. When entering lines, the "_" character logically erases the previous character (if desired this can be changed to a regular backspace, change the octal 137 value in the top memory page to 10 octal, location 75530 in the 31KW version). Press Esc to abort the line and start over. Lines with valid syntax replace existing lines with the same line numbers. A running program can be aborted by entering S at an input prompt, or by pressing any key while computing.

Operation commands...

These are commands given without a line number.

RUN - runs the program in memory
SCRATCH - erases the program in memory
RENUMBER - renumbers the program, starting at line 10 and incrementing by 10
LIST - lists the entire program
LIST 100 - lists lines from line 100 to the end of the program.
TAPE - load a program from the photo reader (not supported under simh?)
PUNCH - lists the program, and punches a binary version (simh device tty2)
MESG message - sends a message to other users (not possible under simh)
BYE - ends the session (location 101 contains the address to jump to)

Program statements...

These are instructions preceded by a line number which form the program. An error number is displayed if it doesn't understand and the matching line in memory (if it exists) is not affected. Parameters can be simple floating point numbers using standard "E" notation, or expressions of multiple numbers and variables per normal BASIC technique. Supported simple mathematical operations include + - * / and ^ (exponent). When used in expressions, AND OR NOT < > <= >= = and # (not equal) return either 0 or 1 depending on if the expression is true or not. Use parenthesis to force a particular evaluation order. For example PRINT (2*3) + (3#5) prints 7. NOT inverts the logic of the following item. Bit logic is not supported.. i.e PRINT 3 AND 4 prints 1 because both 3 and 4 are not 0.

DIM

Dimensions a one or two dimensional array. The array name must be a single letter, the dimension specifications must be numbers between 1 and 255, not expressions. Subscripts range from 1 to the number of elements dimensioned (or redimensioned by a matrix operation). Multiple arrays can be dimensioned with a single DIM statement, separate with commas. If DIM(specs) is entered the line will be converted to DIM[specs]. Array elements are initially undefined and must be assigned values before using in assignments and calculations.

100 DIM X[100],Y[10,20]
110 DIM Z[255]

LET

Assigns an expression to a variable or array element, variable names must be a single letter optionally followed by a digit. Multiple variables and array elements can be set to the same value on one line, separate with additional = symbols.

100 LET A1=100
110 LET C=A1/10 [C contains 10]
120 DIM B[5,5]
130 LET B[1,1]=C+A1 [element 1,1 of array B contains 110]
140 LET X=Y=Z=5 [X Y Z all set to 5]

COM

Like DIM but does not clear the array, useful for multi-part programs that won't all fit in memory at once and for running existing code. Without a working TAPE command the next part has to be pasted or otherwise uploaded to the console after using the SCRATCH command.

100 COM A[2]
110 LET A[1]=5
120 LET A[2]=10
130 END
RUN

READY
SCRATCH

READY
100 COM A[2]
110 PRINT A[1];A[2]
120 END
RUN
 5 10

PRINT / TAB

Prints an expression and/or quoted text list. Separate list elements with commas to separate into fields or with semicolons to space together. Semicolons are not needed to separate quoted text from numerical data. Numbers always print with a certain field size (adjusted if more room is needed) with the sign in the first position. If the last character is ; then no CRLF is emitted, but if the total line length exceeds 72 characters one will be emitted anyway at the beginning of the line that won't fit. TAB(column) moves to the specified column provided the specified column is greater than the current column, if a numerical expression follows separate with a comma or semicolon, not required for quoted text.

100 LET X=5
110 PRINT "X ="X;TAB(20)"X*2 ="X*2
120 END
RUN
X = 5 X*2 = 10

100 LET A1=2
110 LET A2=-1.41837E-23
120 PRINT "A1 ="A1"NEXT PRINT"
130 PRINT "A2 ="A2"NEXT PRINT"
140 END
RUN
A1 = 2 NEXT PRINT
A2 =-1.41837E-23 NEXT PRINT

INPUT

Obtains entry from the console into a variable or array element. To input multiple values separate the variables by commas, when entering the elements can be separated by commas or entered on separate lines. If non-numeric data is entered it prompts again, if S entered it stops the program.

100 PRINT "ENTER A ";
110 INPUT A
120 PRINT "ENTER B,C ";
130 INPUT B,C
140 PRINT "A*B*C ="A*B*C
150 END
RUN
ENTER A ?5
ENTER B,C ?7,9
A*B*C = 315

DATA / READ / RESTORE

DATA statements provide lists of comma-separated numbers to READ into variables or array elements. Multiple variables can be read with successive data items by separating the variable names with commas. The RESTORE statement moves the read pointer to the beginning of the first data statement.

100 DIM X[4]
110 DATA 1,2,3,4
120 READ A,B,C,D
130 RESTORE
140 READ X[A],X[B],X[C],X[D]
150 PRINT "X[] ="X[1];X[2];X[3];X[4]
160 END
RUN
X[] = 1 2 3 4

IF / THEN

Provides conditional branching.. IF expression THEN line#. If the expression is true (non-zero) then the program continues at the specified line, otherwise drops through to the next line. The expression usually is a condition as in something relation something where relation is < > <= >= = or # (<> is converted to #) with multiple conditions separated by AND or OR, but any valid expression seems to be accepted.

100 LET A=5
110 IF A THEN 150
120 IF NOT (A-5) THEN 160
130 PRINT "BOO!"
140 IF A>4 AND A<6 THEN 120
150 IF A=5 THEN 130
160 END
RUN
BOO!

GOTO

Transfers to a specified line.

100 PRINT "PRESS CTRL-C TO STOP"
110 GOTO 110
120 END
RUN
PRESS CTRL-C TO STOP
[control-C pressed]
STOP

GOSUB / RETURN

GOSUB calls a subroutine, when RETURN is encountered the program continues at the line following the subroutine call.

100 GOSUB 200
110 GOSUB 300
120 GOTO 400
200 PRINT "HELLO ";
210 RETURN
300 PRINT "WORLD"
310 RETURN
400 END
RUN
HELLO WORLD

STOP / END

The last statement of a program must be END, however STOP or END may be used before the end of a program to halt execution. Either one will do, STOP can be used to visually distinguish it from the END line.

FOR / TO / STEP / NEXT

FOR loopvar = expr TO expr [STEP expr] - repeats a group of lines while modifying a loop variable (not an array element). The loop variable is initially set to the expression preceding TO and looping stops when the loop variable exceeds the expression after TO (greater or lesser depending on if stepping backwards). If the loop variable already exceeds the termination expression then the lines are skipped. By default the loop variable is incremented by 1 but other positive or negative increments can be specified by STEP.

100 DIM A[2]
110 LET A[1]=1
120 LET A[2]=5
130 FOR I=A[1] TO A[2]
140 PRINT I;
150 NEXT I
160 PRINT
170 FOR J1=10 TO 1 STEP -2
180 PRINT J1;
190 NEXT J1
200 END
RUN
 1 2 3 4 5
 10 8 6 4 2

MAT

MAT can specify a variety of things depending on what follows...
MAT arrayname = ZER  sets all elements to 0
MAT arrayname = CON  sets all elements to 1
MAT arrayname = IDN  sets a square array with 0 with a diagonal of 1's
MAT array1 = TRN (array2)  transposes dimensions.. [1,2] put in [2,1] etc
MAT array1 = array2  copies array 2 to array 1
MAT array1 = array2 + array3  adds elements of arrays (one-to-one)
MAT array1 = array2 - array3  subtracts elements of arrays (one-to-one)
MAT array1 = array2 * array3  multiplies arrays (by weird rules, see here)
MAT array1 = (expression) * array2  multiplies by expression (one-to-one)
MAT PRINT arrayname  prints all elements of an array
MAT INPUT arrayname  inputs all elements of an array
MAT READ arrayname  reads DATA elements into all elements of an array
Some or these can redimension the array, such as MAT X=ZER [2,2]

100 DIM X[4,4],Y[4,4],Z[4,4]
110 DATA 1,2,3,4
120 DATA 5,6,7,8
130 DATA 8,7,6,5
140 DATA 4,3,2,1
150 MAT READ X
160 MAT Y=TRN(X)
170 MAT Z=(2)*X
180 MAT X=Y+Z
190 MAT Z=X*Y
200 MAT PRINT Z
210 END
RUN
 111 263 231 79

187 467 443 163

163 443 467 187

79 231 263 111

SIN / COS / TAN / ATN / EXP / LOG / SQR / INT / ABS / SGN

Mathematical functions that can be used in expressions, these operate on an expression that follows enclosed in parenthesis. SIN thru ATN are trig functions sine, cosine, tangent and arctangent, which operate in radians. EXP and LOG are base "e" exponent and logarithm. SQR takes a square root. INT rounds down to integer. ABS returns the absolute value, and SGN returns the sign of an expression, -1 0 or 1.

100 PRINT SIN(4)
110 PRINT COS(4)
120 PRINT TAN(4)
130 PRINT ATN(4)
140 PRINT LOG(4)
150 PRINT EXP(4)
160 PRINT SQR(4)
170 PRINT INT(-77.7)
180 PRINT ABS(-1.23)
190 PRINT SGN(-10)
200 END
RUN
-.756803
-.653643
 1.15782
 1.32582
 1.38629
 54.5982
 2
-78
 1.23
-1

DEF FNx

Permits defining custom functions to use in expressions, x=single letter defining the function name which always begins with FN. A variable in parenthesis defines the variable name to use for the context of the definition (doesn't affect existing variables with the same name). After defining, FNx(expression) can be used in other expressions.

100 DEF FNA(X)=X*2+1
110 PRINT FNA(2);FNA(3);FNA(4)
120 END
RUN
 5 7 9

RND

A function that returns a "random" number between 0 and 1. Not really random, the sequence is always the same for each run, and the initial values are a bit jumpy. A parameter is required but doesn't seem to do anything.

100 FOR I=1 TO 5
110 PRINT RND(0)
120 NEXT I
130 PRINT "ENTER SEED";
140 INPUT S
150 FOR I=0 TO S
160 LET N=RND(0)
170 NEXT I
180 FOR I=1 TO 5
190 PRINT RND(0)
200 NEXT I
210 END
RUN
 1.52602E-05
 .500092
 .500412
 1.64799E-03
 6.17992E-03
ENTER SEED?1000
 .263123
 .800767
 .936496
 .912073
 .543973

REM

Adds non-executing remarks, program flow continues to the next line.

100 REM MY GOOFY PROGRAM
110 REM PRESS CONTROL-C TO STOP
120 FOR I=1 TO 72
130 IF RND(0)<.5 THEN 160
140 PRINT "*";
150 GOTO 170
160 PRINT " ";
170 NEXT I
180 PRINT
190 GOTO 120
200 END

Error numbers...

This was extracted and edited from the MSU BASIC "monitor" assembly source.

--------------------------------------------
1 PREMATURE STATEMENT END
2 INPUT EXCEEDS 71 CHARACTERS
3 SYSTEM COMMAND NOT RECOGNIZED
4 NO STATEMENT TYPE FOUND
5
6 NO LETTER WHERE EXPECTED
7 LET STATEMENT HAS NO STORE
8 ILLIGAL COM STATEMENT
9 NO FUNCTION IDENTIFIER (OR BAD)
10 MISSING PARAMETER
11 MISSING ASSIGNMENT OPERATOR
12 MISSING 'THEN'
13 MISSING OR IMPROPER FOR-VARIABLE
14 MISSING 'TO'
15 BAD 'STEP' PART IN FOR STATEMENT
16
17
18 NO CONSTAND WHERE EXPECTED
19 NO VARIABLE WHERE EXPECTED
20 NO CLOSING QUOTE FOR STRING
21 PRINT JUXTAPOSES FORMULAS
22 IMPROPER WORD IN MAT STATEMENT
23 NO COMMA WHERE EXPECTED
24 IMPROPER ARRAY FUNCTION
25 NO SUBSCRIPT WHERE EXPECTED
26 ARRAY INVERSION INTO SELF
27 MISSING MULTIPLICATION OPERATOR
28 IMPROPER ARRAY OPERATOR
29 ARRAY MULTIPLICATION INTO SELF
30 MISSING LEFT PARENTHESIS
31 MISSING RIGHT PARENTHESIS
32 UNRECOGNIZED OPERAND
33 MISSING SUBSCRIPT
34 MISSING ARRAY IDENTIFIER
35 MISSING OR BAD INTEGER
36 CHARACTERS AFTER STATEMENT END
37
38 PHOTO READER NOT READY
39 FUNCTION MULTIPLY DEFINED
40 UNMATCHED FOR STATEMENT
41 UNMATCHED NEXT
42 OUT OF STORAGE-SYMBOL TABLE
43 INCONSISTENT DIMENSIONS
44 [missing END]
45 ARRAY DOUBLE DIMENSIONED
46 NO OF DIMENSIONS UNSPECIFIED
47 ARRAY TOO LARGE
48 OUT OF STORAGE-ARRAY ALLOCATION
49 SUBSCRIPT TOO LARGE
50 UNDEFINED OPERAND ACCESSED
51 NEGATIVE BASE POWERED TO REAL
52 ZERO TO ZERO POWER
53 MISSING STATEMENT
54 GOSUBS NESTED 10 DEEP
55 RETURN FINDS NO ADDRES
56 OUT OF DATA
57 OUT OF STORAGE - EXECUTION
58 RE-DIMENSIONED ARRAY TOO LARGE
59
60 MATRIX UNASSIGNED
61 NEARLY SINGULAR MATRIX
62 ARGUMENT TOO LARGE
63 SQRT HAS NEGATIVE ARGUMENT
64 LOG OF NEGATIVE ARGUMENT
** RECOVERABLE ERRORS FOLLOW **
65 OVERFLOW
66 UNDERFLOW
67 LOG OF ZERO
68 EXPONTIAL OVERFLOW
69 DIVIDE BY ZERO
70 ZERO TO NEGATIVE POWER
--------------------------------------------

100 LET A=1/0
110 PRINT "RECOVERED"
120 LET A=SQR(-1)
130 PRINT "WON'T PRINT"
140 END
RUN

ERR 69:100
RECOVERED

ERR 63:120

140 FOR XX=1 TO 4
ERR 11:140

140 FOR X=1 T 4
ERR 14:140

140 DIM X[255]
140 DIM X[256]
ERR 35:140

HP BASIC Programs

Most of the existing vintage HP BASIC games in various archives is written for Time Share Basic, which supports "fancy" features like strings, multi-way GOTO, print formatting and terminal codes and won't run as-is under numeric-only BASIC. In the early days of TSB strings were used mostly for non-essential functions like typing YES for instructions or other command entries that could just as easily be numeric, so at least some of the old classic games can be made to run reasonably well under MSU BASIC (or HP papertape BASIC which for the most part has identical syntax). Conversion typically involves adding LET to all assignments, removing terminal codes, replacing all GOTO n OF statements with equivalent code, replacing PRINT USING with normal PRINT statements, usually adding an integer print subroutine to avoid odd spacing when printing numbers, and replacing string code and inputs with code that fakes it as best practical. Obviously switching from alphabetic to numeric input changes the feel of the program, but most other uses of strings can be simulated using PRINT statements. Numeric BASIC's RND function returns the same sequence every time, so often a prompt to enter a seed number is added.

To use these programs, first get MSU BASIC (or HP BASIC) running under simulation or on real hardware, then copy/paste the BASIC code into the terminal. To make sure there are no errors some kind of paste delay has to be implemented, for the SimH HP2100 simulator d tty ttime 1000 and d tty ktime 40000 should do the trick. For real hardware, use a terminal emulator (such as HyperTerminal) that supports specifying character and line delay when pasting, find settings that permit reasonable paste speed but avoid errors. HP BASIC supports attaching BASIC source to PTR and using PTAPE to load, however MSU BASIC does not support loading from a normal PTR unit (it was apparently designed for a terminal with a reader which does the equivalent of pasting at a controlled speed, no luck so far getting ordinary PTR to work). Once the code has been pasted into an interpreter, HP-IPL/OS can be used to save the resulting binary to disk using the hpos6i.abs disk menu build, or the program can be punched to a stand-alone binary using the hposutil.abs utility build. The run_util.sim simulator script in the scripts directory is already set up for doing this, execute the script using the HP2100 simulator and follow the instructions.

BEASTIPT.txt - BEASTI is a game where you have 50 turns to eat all the organisms on the board, without being consumed...

THE BEASTI CAN MOVE HORIZONTALLY, VERTICALLY, OR DIAGONALLY ONE
SPACE EACH HOUR. IF YOU MOVE OFF THE BOARD, YOU WILL REAPPEAR
ON THE OPPOSITE SIDE.
* = YOU
+ = *BEASTI*
O = ORGANISMS
THE BEASTI IS INTELLIGENT, SO BE CAREFULL !! ENTER SEED NUMBER ?432


TIME = 1
.---------------------.
: * :
: 0 0 0 :
: 0 0 0 0 :
: :
: + :
: 0 :
: :
: 0 0 :
: :
: :
`---------------------'
MOVE ?

The move keys have been reassigned to 2 4 6 8 to correspond to the numeric keypad.

GOLFPT.txt - The classic GOLF game, converted to single user...

WELCOME TO THE TIES TIMESHARING 18 HOLE CHAMPIONSHIP COURSE
TO GET A DESCRIPTION OF CLUBS, ETC.
TYPE 0 FOR A CLUB NK. WHEN REQUESTED
WHAT IS YOUR HANDICAP ?2
OH-OH, A HOT SHOT!
DIFFICULTIES AT GOLF INCLUDE:
0=HOOK, 1=SLICE, 2=POOR DISTANCE, 4=TRAP SHOTS, 5=PUTTING
WHICH IS YOUR WORST ?4
ENTER 1 IF READY TO GO ?1
YOU ARE AT TEE OFF HOLE 1, DISTANCE 361 YARDS PAR 4
ON YOUR RIGHT IS ADJACENT FAIRWAY.
ON YOUR LEFT IS ADJACENT FAIRWAY.
WHAT CLUB DO YOU WANT ?0
---------------------------------------------------------------------
HERE'S YOUR BAG OF CLUBS
WOODS (FULL SWING ONLY): 1 DRIVER 2 BRASSIE 3 SPOON
IRONS (FULL SWING ONLY): 12 TWO IRON 19 NINE IRON
IRONS (LESS THEN FULL SWING)...
22 TWO IRON - PARTIAL SWING
29 NINE IRON - PARTIAL SWING
WHEN YOU REACH THE GREEN IT WILL BE ASSUMED THAT YOU ARE
USING A PUTTER. THE PUTT POTENCY NO. REFERS TO THE STRENGTH
WITH WHICH THE BALL IS PUTTED. USE NUMBERS GREATER THAN
ZERO, INCREASING THE NUMBER FOR GREATER DISTANCE.
YOU WILL BE ASKED FOR 'PERCENT FULL SWING' ON CLUBS 22-29.
THIS SHOULD BE A NUMBER FROM 1 TO 99.
---------------------------------------------------------------------
WHAT CLUB DO YOU WANT ?2
SHOT WENT 249 YARDS - IS 112 YARDS FROM HOLE.
BALL IS 7 YARDS OFF LINE IN FAIRWAY.
WHAT CLUB DO YOU WANT ?22
PERCENT FULL SWING ?40
SHOT WENT 85 YARDS - IS 27 YARDS FROM HOLE.
BALL IS 3 YARDS OFF LINE IN TRAP.
WHAT CLUB DO YOU WANT ?

GOMOKUPT.txt - This is a conversion of the GOMOKU game, or five-in-a-row...

ENTER 1 FOR INSTRUCTIONS  ?1

GOMOKU IS A TRADITIONAL JAPANESE GAME PLAYED ON A 19X19 BOARD.
THE OBJECT IS TO OCCUPY FIVE ADJACENT POINTS IN A STRAIGHT LINE
(HORIZONTAL, VERTICAL, OR DIAGONAL) ANYWHERE ON THE BOARD.

THIS PROGRAM PLAYS GOMOKU ON A 9X9 BOARD.
EACH MOVE IS A TWO-DIGIT NUMBER - THE FIRST DIGIT IS THE ROW
AND THE SECOND IS THE COLUMN.

YOU CAN CHANGE THE CURRENT BOARD-PRINTING OPTION BY ADDING
A THIRD DIGIT TO THE MOVE NUMBER:

0 SUPPRESS PRINTING ENTIRELY
1 PRINT ONLY THE OCCUPIED POINTS
2 PRINT THE ENTIRE BOARD (DEFAULT)

(FOR EXAMPLE, IF YOU MOVE 372 THEN YOUR MOVE IS
THE POINT AT ROW 3, COLUMN 7 AND THE ENTIRE BOARD WILL BE
PRINTED UNTIL YOU CHANGE THE PRINT OPTION.)

ON THE BOARD, O = YOU, X = ME, AND (IF OPT.2) . = EMPTY.


ENTER 1 TO MOVE FIRST ?1

1 2 3 4 5 6 7 8 9
1 . . . . . . . . .
2 . . . . . . . . .
3 . . . . . . . . .
4 . . . . . . . . .
5 . . . . . . . . .
6 . . . . . . . . .
7 . . . . . . . . .
8 . . . . . . . . .
9 . . . . . . . . .
WHAT IS YOUR MOVE ?54
I MOVE TO 55

1 2 3 4 5 6 7 8 9
1 . . . . . . . . .
2 . . . . . . . . .
3 . . . . . . . . .
4 . . . . . . . . .
5 . . . O X . . . .
6 . . . . . . . . .
7 . . . . . . . . .
8 . . . . . . . . .
9 . . . . . . . . .
WHAT IS YOUR MOVE ?44
I MOVE TO 64

1 2 3 4 5 6 7 8 9
1 . . . . . . . . .
2 . . . . . . . . .
3 . . . . . . . . .
4 . . . O . . . . .
5 . . . O X . . . .
6 . . . X . . . . .
7 . . . . . . . . .
8 . . . . . . . . .
9 . . . . . . . . .
WHAT IS YOUR MOVE ?

Despite the simple concept this is one tough game to beat (for me anyway).

HAMRBIPT.txt - This is the game of HAMURABI, a rather silly vintage computer game...

HAMURABI - WHERE YOU GOVERN THE ANCIENT KINGDOM OF SUMERIA.
THE OBJECT IS TO FIGURE OUT HOW THE GAME WORKS!!
(IF YOU WANT TO QUIT, SELL ALL YOUR LAND.)


HAMURABI, I BEG TO REPORT THAT LAST YEAR

0 PEOPLE STARVED AND 5 PEOPLE CAME TO THE CITY.
THE POPULATION IS NOW 100.

WE HARVESTED 3000 BUSHELS AT 3 BUSHELS PER ACRE.
RATS DESTROYED 200 BUSHELS LEAVING 2800 BUSHELS IN THE STOREHOUSES.

THE CITY OWNS 1000 ACRES OF LAND.
LAND IS WORTH 20 BUSHELS PER ACRE.


HAMURABI . . .

BUY HOW MANY ACRES?

LANDERPT.txt - The classic LANDER game...

WELCOME TO THE PUC SCHOOL FOR BUDDING ASTRONAUTS!

YOU ARE AT THE CONTROLS OF A ROCKET LANDING VEHICLE.
INITIALLY YOU ARE A GIVEN DISTANCE ABOVE THE SURFACE MOVING
DOWNWARD (VELOCITY IS NEGATIVE). YOU CHOOSE THE AMOUNT OF FUEL
TO BE BURNED DURING THE NEXT ONE SECOND OF TIME.

IF YOU BURN ZERO, THEN YOU WILL FALL FASTER BECAUSE OF GRAVITY.
IF YOU BURN EXACTLY THAT REQUIRED TO OVERCOME GRAVITY, THEN
YOUR VELOCITY WILL BE CONSTANT.
IF YOU BURN MORE, THEN YOU WILL SLOW DOWN OR EVEN START TO MOVE
UPWARD (VELOCITY IS POSITIVE)!

THE IDEA IS TO GET THE LANDER DOWN TO THE SURFACE,
LANDING WITH AS LITTLE VELOCITY AS POSSIBLE. THERE IS
MORE THAN ENOUGH FUEL, BUT BE CAREFUL NOT TO WASTE IT!

LANDING ON THE MOON IS EASIER, TRY THAT FIRST.


GOOD LUCK AND HAPPY LANDINGS!


LOCATION: 1)MOON 2)EARTH ?1
INITIAL CONDITIONS: 1)STANDARD 2)OLD 3)NEW ?1

INITIAL HEIGHT: 500 FEET
INITIAL VELOCITY: -50 FEET/SEC
TOTAL FUEL SUPPLY: 120 UNITS
MAXIMUM BURN: 30 UNITS/SEC
AMOUNT OF BURN TO CANCEL GRAVITY: 5 UNITS/SEC


TIME HEIGHT VELOCITY FUEL BURN

0 500 -50 120 ?6
1 450.5 -49 114 ?6
2 402 -48 108 ?6
3 354.5 -47 102 ?7
4 308.5 -45 95 ?7
5 264.5 -43 88 ?8
6 223 -40 80 ?10
7 185.5 -35 70 ?10
8 153 -30 60 ?20
9 130.5 -15 40 ?16
10 121 -4 24 ?15
11 122 6 9 ?9
12 OUT OF FUEL
12 130 10
13 137.5 5
14 140 0
15 137.5 -5
16 130 -10
17 117.5 -15
18 100 -20
19 77.5 -25
20 50 -30
21 17.5 -35
21.4833 0 -37.4166 0


YOUR NEXT OF KIN WILL BE NOTIFIED.

It is possible to land without wrecking.

TREKPT.txt - This is a conversion of the original TREK program, one of my all-time favorites...

                          STAR TREK



ENTER 1 OR 2 FOR INSTRUCTIONS (ENTER 2 TO PAGE) ?0

ENTER SEED NUMBER ?455
INITIALIZING...

YOU MUST DESTROY 20 KINGONS IN 30 STARDATES WITH 3 STARBASES

-=--=--=--=--=--=--=--=-
<*>
* STARDATE 3400
CONDITION GREEN
* QUADRANT 1,4
* * SECTOR 7,1
ENERGY 3000
SHIELDS 0
* * PHOTON TORPEDOES 10
-=--=--=--=--=--=--=--=-
COMMAND ?-1

0 = SET COURSE
1 = SHORT RANGE SENSOR SCAN
2 = LONG RANGE SENSOR SCAN
3 = FIRE PHASERS
4 = FIRE PHOTON TORPEDOES
5 = SHIELD CONTROL
6 = DAMAGE CONTROL REPORT
7 = CALL ON LIBRARY COMPUTER

COMMAND ?2
LONG RANGE SENSOR SCAN FOR QUADRANT 1,4
-------------------
0 : 7 : 3
-------------------
0 : 6 : 7
-------------------
0 : 2 : 6
-------------------
COMMAND ?0
COURSE (1-9) ?1
WARP FACTOR (0-8) ?3
COMBAT AREA CONDITION RED
SHIELDS DANGEROUSLY LOW
-=--=--=--=--=--=--=--=-
<*>
STARDATE 3401
+++ * CONDITION RED
QUADRANT 4,4
* SECTOR 7,1
+++ ENERGY 2981
* * SHIELDS 0
* PHOTON TORPEDOES 10
-=--=--=--=--=--=--=--=-
COMMAND ?5
ENERGY AVAILABLE = 2981
NUMBER OF UNITS TO SHIELDS ?1000
COMMAND ?4
TORPEDO COURSE (1-9) ?5.33
TORPEDO TRACK:
6,1
5,2
4,2
3,2
2,3
1,3
*** KLINGON DESTROYED ***
10 UNIT HIT ON ENTERPRISE AT SECTOR 1,6 (989 LEFT)
COMMAND ?

This was the first numeric BASIC conversion I did, and at the time I wasn't familiar with papertape BASIC and converted more than I needed to (in particular variable names which could have mostly stayed the same), rather was excited about . During the string removal process the coordinates got converted to conventional X,Y notation (the original AFAICT was reversed), this matches most of the other decendents of this game for other computers that I'm familiar with so I like it better this way. Other things got changed to my liking such as the -=--=- border "tics" which I use to calculate move and torpedo direction (i.e. 6 to the left and 2 down would be direction 5.33), and added WARP UNITS output to the computer to assist in navigation.

TTYTRKPT.txt - This is a different TREK game where the enemy ships move around and attack star bases...

WELCOME TO TTY TREK 3
1)LIST ALL 2)PAGE INSTRUCTIONS, OR ENTER SEED ?332
DIFFICULTY FACTOR(1-10) ?3
KINGON ATTACKING BASE AT 2,4
. . . . . . . .
. . . . . . . .
. . 'O' . . . . . HULL TEMP 55
. . . . . . . . ENERGY 1000
. . . . . . . . PHOTONS 10
. . . . . . . . SHIELDS 0
. . . . . . . . QUADRANT 5,5
. . . . . . . .
?0
1)MOVE 2)PHASER 3)TORPEDO
4)ENERGY AL. 5)LONG SCAN 6)SHORT SCAN
7)REPORT 8)AUTO SCAN 9)GALACTIC RECORD
?5
.. B. ..
.. .. ..
.. B. ..
?9
E3 .3 .. .. .. .. .. ..
.3 .3 .. .. .. .. .. B.
.. .. .. .. .. .. B. ..
.. B1 .. .. B. .. B. ..
.. .. .. ..>..<.. .. ..
.. .. .. .. B. .. B. ..
.. B. B. B. .. B. .. ..
.. .. B. .. .. .. .. ..
?1_4
AVAILABLE ENERGY 1000
HOW MANY UNITS TO SHIELDS?500
500 UNITS LEFT.
?1
COURSE(1-9),WARP(0-3) ?3,1
. . . . . . . .
. . . . . . . .
. >!<'O' . . . . . HULL TEMP 27
. + . . . . . + ENERGY 500
. . . . . . . . PHOTONS 10
. . . . . . . . SHIELDS 500
. . . . . . . . QUADRANT 5,4
. . . . . . . .
?1
COURSE(1-9),WARP(0-3) ?5,.2
COLLISION WITH BASE. DOCKING.
KINGON ATTACKING BASE AT 2,4
?1
COURSE(1-9),WARP(0-3) ?7,.25
KINGON ATTACKING BASE AT 2,4 AHRGH!
. . . . . . . .
. . . . . . . .
. >!< . . . . . . HULL TEMP 45
. + . . . . . + ENERGY 2500
. . 'O' . . . . . PHOTONS 15
. . . . . . . . SHIELDS 500
. . . . . . . . QUADRANT 5,4
. . . . . . . .
?5
.. .. ..
.. B. ..
.. .. ..
?1
COURSE(1-9),WARP(0-3) ?7_5,3
INCOMING! 100
INCOMING! 100
INCOMING! 100

. . . . . . . .
. . . . . . . .
. . . . . . . . HULL TEMP 108
. . . . /^\ . . . ENERGY 2500
. . 'O' . . . . . PHOTONS 15
. . . . . . . . SHIELDS 200
. /^\ . . . . . . QUADRANT 2,4
. . . . . . . /^\
?

The original program used letters to represent commands, these were changed to numbers. The original logic has been preserved (already used X,Y coordinates), some of the output was slightly modified to compensate for the numerical control system, display correct pluralities (plenty of memory now for code to add or not add an S), and indicate the current quadrant on the galaxy map. This is a new conversion so there might be further tweaks.

WUMPUSPT.txt - The classic "Hunt The Wumpus" game, modified for numeric control...

HUNT THE WUMPUS


YOU ARE IN ROOM 8
TUNNELS LEAD TO 1 7 9

SHOOT OR MOVE (1-2)?2
WHERE TO?7

I SMELL A WUMPUS!
YOU ARE IN ROOM 7
TUNNELS LEAD TO 6 8 17

SHOOT OR MOVE (1-2)?1
NO. OF ROOMS(1-5)?2
ROOM #?6
ROOM #?17
AHA! YOU GOT THE WUMPUS!
HEE HEE HEE - THE WUMPUS'LL GETCHA NEXT TIME!!
SAME SET-UP (1 FOR YES)?

Lucky shot.

SEABATPT.txt - The game of Sea Battle...

*** SEA BATTLE ***
ENTER RANDOM SEED NUMBER ?123
DIFFICULTY LEVEL 1-EASY 2-MEDIUM 3-NORMAL ?2

YOU MUST DESTROY 15 ENEMY SHIPS TO WIN.
. . . . . . . . . . $ . . . . \S/ . . . .
. $ .
. \S/ . .
. \S/ .
. $ .
. \S/ . .
. ********* $ .
. $ ************ \S/ .
. \S/ ********* ****** -#-\S/ .
. ****** (X) *** .
. ****** ****** .
. ****** $ *** .
. *** $ \S/ .
. .
. $ -#- .
. . . $ \S/ .
. $ .
. $ -#- .
. .
. . . . \S/ . . !H!\S/ . . . . . . . . . . .
WHAT ARE YOUR ORDERS ?-1

THE COMMANDS ARE:
#0: NAVIGATION - MOVES YOUR SUBMARINE
#1: SONAR - OPTION 0 PRINTS MAP, 1 SENSES DIRECTIONS
#2: TORPEDO CONTROL - FIRES A TORPEDO
#3: MISSILE CONTROL - FIRES A POLARIS MISSLE
#4: MANUEVERING - SETS DEPTH
#5: STATUS/DAMAGE REPORT
#6: HEADQUARTERS - MUST BE IN DOCKING RANGE
#7: SABOTAGE - SEND MEN ON A SABOTAGE MISSION
#8: POWER CONVERSION - FUEL TO POWER AND VICE VERSA
#9: SURRENDER
#10: PASS TIME - USE THIS TO REPAIR DAMAGE
#11: TOGGLE AUTOMAP - IF DISABLED USE SONAR OPTION 0
#12: PRINT SYMBOLS AND DIRECTIONS

WHAT ARE YOUR ORDERS ?12

MAP SYMBOLS...
*** DRY LAND
(X) YOUR SUBMARINE
!H! YOUR HEADQUARTERS
\S/ ENEMY SHIP
-#- SEA MONSTER
$ UNDERWATER MINE
. UNKNOWN
DIRECTIONS...
8 1 2
\'/ WHEN NAVIGATING IT TAKES 100 UNITS OF
7-*-3 POWER TO MOVE ONE POSITION. MISSILES
/.\ REQUIRE 75 LBS FUEL FOR EACH POSITION.
6 5 4

WHAT ARE YOUR ORDERS ?

This game has been around.. was originally written by a student for a TSB system, converted to PC-style BASIC and published in David Ahl's More Computer Games, converted to a TRS80 system, which I found on the net and converted to single-user numeric BASIC. Made my own mods to add commands (10-12), fix bugs, make the monsters move differently and do other stuff.

OREGONPT.txt - a paper-tape version of The Oregon Trail...

OREGON

ENTER A RANDOM NUMBER ?123
DO YOU NEED INSTRUCTIONS (0/1) ?0


HOW GOOD A SHOT ARE YOU WITH YOUR RIFLE?
(1) ACE MARKSMAN, (2) GOOD SHOT, (3) FAIR TO MIDDLIN'
(4) NEED MORE PRACTICE, (5) SHAKY KNEES
?1


HOW MUCH DO YOU WANT TO SPEND ON YOUR OXEN TEAM?200
HOW MUCH DO YOU WANT TO SPEND ON FOOD?0
HOW MUCH DO YOU WANT TO SPEND ON AMMUNITION?50
HOW MUCH DO YOU WANT TO SPEND ON CLOTHING?50
HOW MUCH DO YOU WANT TO SPEND ON MISCELLANEOUS SUPPLIES?50
AFTER ALL YOUR PURCHASES, YOU NOW HAVE $ 350

MONDAY MARCH 29 1847

YOU'D BETTER DO SOME HUNTING OR BUY FOOD AND SOON!!!!
TOTAL MILEAGE IS 0
FOOD BULLETS CLOTHING MISC. SUPP. CASH
0 2500 50 50 350
DO YOU WANT TO (1) HUNT, OR (2) CONTINUE?1
RIGHT BETWEEN THE EYES---YOU GOT A BIG ONE!!!!
FULL BELLIES TONIGHT!
DO YOU WANT TO EAT (1) POORLY (2) MODERATELY OR (3) WELL?2
OX INJURES LEG---SLOWS YOU DOWN REST OF TRIP

MONDAY APRIL 12 1847

TOTAL MILEAGE IS 130
FOOD BULLETS CLOTHING MISC. SUPP. CASH
36 2486 50 50 350
DO YOU WANT TO (1) STOP AT THE NEXT FORT, (2) HUNT,
OR (3) CONTINUE?3
DO YOU WANT TO EAT (1) POORLY (2) MODERATELY OR (3) WELL?2
RIDERS AHEAD. THEY LOOK HOSTILE
TACTICS
(1) RUN (2) ATTACK (3) CONTINUE (4) CIRCLE WAGONS
?1
RIDERS WERE HOSTILE--CHECK FOR LOSSES
BAD ILLNESS---MEDICINE USED

MONDAY APRIL 26 1847

TOTAL MILEAGE IS 343
FOOD BULLETS CLOTHING MISC. SUPP. CASH
18 2336 50 30 350
DO YOU WANT TO (1) HUNT, OR (2) CONTINUE?

This program is adapted from the 1978 version of OREGON that was posted to the HP2000family Yahoo group. The listing was somewhat corrupted so in a couple places I guessed. Since then more information about the game and better listings have been shared, refer to links from the Oregon Trail Wikipedia page. The original version used the timing facilities of Time Share BASIC to measure how fast the user could type "BANG", in this paper-tape conversion the initial "HOW GOOD OF A SHOT ARE YOU" entry is used to specify the chances of hitting targets - the game is easier if you say you can shoot better. Other mods include disabling the extra prompts at the end of the game and slightly changing some of the text formatting, in addition to the usual paper-tape mods (removing strings, converting ON var GOTO, adding LET, shortening lines, etc).

The following are not vintage, just programs I wrote to amuse myself...

OTHPT.txt - This is a program that plays the game of Reversi, also known by a name that begins with the letters "OTH". The goal of the game is to flip the computer's pieces (X) to your pieces (O) by surrounding them...

COMPUTER IS X, YOU ARE O
ENTER MOVES AS YX (11-88)
TO PASS ENTER 0 FOR MOVE
LEVEL 0 OR 1?0

1 2 3 4 5 6 7 8
1 1
2 2
3 3
4 X O 4
5 O X 5
6 6
7 7
8 8
1 2 3 4 5 6 7 8

YOU: 2 ME: 2
MOVE ?56
MY MOVE IS 46

1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
1 1 1 1
2 2 2 2
3 3 3 3
4 X O 4 4 X X X 4
5 O O O 5 5 O O O 5
6 6 6 6
7 7 7 7
8 8 8 8
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8

YOU: 3 ME: 3
MOVE ?34
MY MOVE IS 43

1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
1 1 1 1
2 2 2 2
3 O 3 3 O 3
4 O O X 4 4 X X X X 4
5 O O O 5 5 O O O 5
6 6 6 6
7 7 7 7
8 8 8 8
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8

YOU: 4 ME: 4
MOVE ?

The program isn't exactly fast, on real hardware it takes a minute or two per move when set to level 1. To see what the computer is thinking about while looking ahead, add the following lines...

4960  PRINT "CONSIDERING";(Y-1)*10+(X-1);G;G8;
4962 PRINT TAB(35);"HUMAN DOES";P;G4;G1

MANDPL1.txt - This program (crudely) plots the Mandelbrot Set...

MANDELBROT SET PLOTTER
WHEN ZOOMING ENTER REGION AS:
.-----------.
| 1 | 2 | 3 |
|---+---+---|
| 4 | 5 | 6 |
|---+---+---|
| 7 | 8 | 9 |
`-----------'
0) RUN WITH DEFAULTS 1) ENTER PLOT VARIABLES ?0

X =-.5 Y =-.5 RANGE = 2.2 LIMIT = 200
------------------------------------------------------------------------
-------------------------------------:::::::::::::::::------------------
---------------------------------:::::::::::::%::::::::::::-------------
-----------------------------:::::::::::::::::%$%%$%:::::::::-----------
--------------------------::::::::::::::::::::%%&%%::::::::::::---------
-----------------------:::::::::::::::::::$&$$* $%%&::::::::::::-------
---------------------:::::::::::::::::::::%&@ @%::::::::::::::-----
------------------::::::::::::::::::::::%%%%& &%%::::::::::::::----
---------------::::::::::::::::%%@$$%%%*#$: #-$&*%%::%%@:::::---
------------:::::::::::::::::::%%& % $$ $#:::::--
--------:::::::::::::::::::::%%%%$ $%:::::::-
---:::::::::::::::::::::::::%@& $&::::::::
::::::::::%%%::::%%%:::::::%&*- $ $%:::::
::::::::::%%$&$%%%$*%$%%%%%%@ $%::::::
::::::::::%%%& &%%$ $%:::::
:::::$%%%%%& $$ *$::::::
::::%%$$@&$ $::::::::
%%%$$& %%:::::::::
:::%%%%&- & %::::::::
:::::%%%%%%$ &% $:::::::
:::::::::%%%&@ $%$ #$::::::
::::::::::%%%*@$$@ $$$$%%%%$ *%::::::
1-9) ZOOM 0) UNZOOM 10) CHANGE VARS ?

...never mind this had not been discovered yet when these machines were popular... good for burning in hardware...


Last modified 7/6/2011