PDP-11 Paper Tape BASIC: Strange behavior?

330 views
Skip to first unread message

Steve Tockey

unread,
Mar 22, 2020, 7:14:23 PM3/22/20
to [PiDP-11]
All,
For fun I was playing around with PDP-11 Paper Tape Basic to see how well it worked on the PiDP-11/70. I noticed some very strange behavior, I was wondering if someone else would be willing to try it out and see if you also get the same behavior. I am running a modification of the configuration described here:



I created a new PiDP-11/70 system folder:   /opt/pidp11/systems/ptbasic

In the ptbasic folder I put the attached boot.ini file along with paper tape images of both Absolute Loader and Paper Tape Basic.

Absolute Loader can be found here: 


Paper Tape Basic can be found here:



I also edited the "selections" file in /opt/pidp11/systems to add the entry "0006 ptbasic". Note that ptbasic must have an even number for its selection code. Absolute Loader senses the switch register and halts if bit 0 is set. That's why I chose 0006, but any other even number should be fine.


Now, for that strange behavior ... One manifestation is in the trig functions. SIN(), COS(), and ATN() all appear to be broken. For example:

READY
PRINT SIN(0)
 0 
PRINT SIN(1)

ERROR   125 AT LINE    0 

ERROR   125 AT LINE    0 

ERROR   125 AT LINE    0 

ERROR   125 AT LINE    0 
 .1073016E 5062 


Another strange behavior is the Example 1: Loan Payment Calculator program on the avitech.com.au page. If I run that program with the sample inputs I do not get the same output. Instead I get:

RUN
INTEREST IN PERCENT?9
AMOUNT OF LOAN?2500
NUMBER OF YEARS?2
NUMBER OF PAYMENTS PER YEAR?4

ERROR   127 AT LINE   75 

AMOUNT PER PAYMENT = 56.25 
TOTAL INTEREST     =-2050 

It then goes into an infinite loop (hint: ctrl/p is like ctrl/c elsewhere):

 INTEREST     APP TO PRIN   BALANCE
 56.25         0             2500 
 56.25         0             2500 
 56.25         0             2500 
 56.25         0             2500 
 56.25         0             2500 
 56.25         0             2500 
^P
READY


So, is anyone else willing to try this out? If so, are you getting this same strange behavior? Can anyone explain why it is happening?


Thanks,

-- steve


boot.ini

Steve Tockey

unread,
Mar 22, 2020, 7:23:35 PM3/22/20
to [PiDP-11]

PS. Error 125 is "Divide/multiply overflow or underflow". Error 127 is "Logarithm of negative or zero number or exponential overflow"

Martin Renters

unread,
Mar 22, 2020, 8:52:46 PM3/22/20
to [PiDP-11]
I'm seeing the same thing, both in the emulator and on a real PDP 11/05.

As far as your boot.ini file goes, simh has a 'load' command you can use which doesn't require the use of the bootstrap loader/absolute loader.

ECHO Preparing to boot and run PDP-11 Paper Tape BASIC


; Set CPU parameters - PDP-11/05 with 8kW (16kB) of core memory

SET CPU 11/70

SET CPU 16K


; Throttle SIMH to limit CPU usage, heat and fan noise

SET THROTTLE 5%


; Disable devices that we don't need

SET HK DISABLE

SET RHA DISABLE

SET DZ DISABLE

SET RL DISABLE

SET RX DISABLE

SET RP DISABLE

SET RQ DISABLE

SET TM DISABLE

SET TQ DISABLE

SET RK DISABLE


; Enable the high-speed paper tape reader/punch

SET PTR ENABLE

SET PTP ENABLE


; connect to PiDP-11/70

set realcons host=localhost

set realcons panel=11/70

set realcons interval=1

set realcons connected


load DEC-11-AJPB-PB.ptap

go 16104


I discovered the load command while trying to put together a boot.ini file for a bare metal GCC development environment. I will be doing a write-up and software distribution of a the compiler and a simple 'Hello World' program as well as a more sophisticated banner printing program shortly. The end goal is to build software for my real PDP 11/05, but the simulator really makes the debugging so much faster.

Martin

Neal G.

unread,
Mar 23, 2020, 12:35:32 AM3/23/20
to [PiDP-11]
Steve,

You might want to go to the Realcons site, the distribution upon which the SimH that is part of PiDP-11 is based. They have a set of simulated configurations for various PDP-11 models and software packages. One is configured with paper tape BASIC.
There were only two quirks I encountered when trying it out several months ago.
First that version of BASIC requires the terminal to be set for uppercase; any lowercase character entered will generate an somewhat cryptic error.
Second, when BASIC first starts it asks if it should load the exteneded math functions. If you don't say yes; it will not load the trig and log functions to conserve memory.

- Neal G.

Tom Lake

unread,
Mar 23, 2020, 4:29:43 PM3/23/20
to [PiDP-11]
Is there a way to allow multiple users with PT BASIC? I'd have to assign the serial ports somehow so I could use my Teletype ASR 33s with it.

Tom L

Martin Renters

unread,
Mar 23, 2020, 4:36:35 PM3/23/20
to [PiDP-11]
No, there isn't. It only runs on the console device and can read/punch tapes on the high speed reader/punch if it exists. I suppose in the emulator you could redirect the simh console port, but I'm not sure how the signal to read a character from the paper tape reader on the ASR33 would work.

I was partially successful patching the paper tape image to work on a different DL11, but I didn't get far enough to make it completely work. There is an interrupt handler so that you can stop a running program.

Martin

Neal G.

unread,
Mar 28, 2020, 6:19:58 PM3/28/20
to [PiDP-11]
Steve,

I spent a few moments digging through my notes from when I tried Paper Tape BASIC several months ago.
All works well when run on SimH configured as an 11/20; the strangeness occurs when other CPU configurations are used (11/05, 11/70)

pi@raspberrypi:~/Documents/ptbasic-test $ ./simh boot.ini

PDP-11 simulator V4.0-0 Current  REALCONS build Aug 14 2019
Disabling XQ
POS:    0

HALT instruction, PC: 157500 (MOV PC,SP)
POS:    442

PDP-11 BASIC, VERSION 007A
*O
READY

PRINT SIN(0)
 0

PRINT SIN(1)

ERROR   125 AT LINE    0

ERROR   125 AT LINE    0

ERROR   125 AT LINE    0

ERROR   125 AT LINE    0
 .1073016E 5062

Simulation stopped, PC: 000702 (INC 13710)
sim> sh cpu
CPU    11/05, autoconfiguration enabled, idle disabled
    56KB
sim> set cpu 11/20
sim> cont

PRINT SIN(0)
 0
PRINT SIN(1)
 .841471


Browsing the manual for Paper Tape BASIC, I see that the 11/20 is specifically mentioned here and there. My assumption is Paper Tape BASIC was specifically written for that model and contains some dependency that prevents it from running properly on other models. It would be interesting to know what the actual problem is; but that is a project for another day.

- Neal G.


On Sunday, March 22, 2020 at 6:14:23 PM UTC-5, Steve Tockey wrote:

... are you getting this same strange behavior? Can anyone explain why it is happening?


Steve Tockey

unread,
Mar 28, 2020, 8:58:17 PM3/28/20
to [PiDP-11]
Neal,
Thanks, yes, that does fix the immediate problem of SIN() not running correctly. Very strange that the avitech.com.au web site claims to run with an 11/05. And, "DEC-11-AJPB-D Paper Tape BASIC Programming Manual Dec 70" says nothing about needing an 11/20 either.

The problem was obvious in the trig functions, but I was also seeming to get some strange behavior with normal multiply & divide in some cases. So it does seem to be specific to some multiply or divide code or floating point hardware incompatibility somewhere. Everything else seems to work fine. It will require deeper investigation.

I also need to figure out an incompatibility between running as an 11/20 and the blinkenlights on the PiDP-11/70 front panel:

*** booting ptbasic ***
*** Start client/server ***
*** RPi 2/3/Z detected

PDP-11 simulator V4.0-0 Current  REALCONS build Mar 21 2020

Starting PDP-11/70 with Paper Tape BASIC
Disabling XQ
Searching realcons controller "11/20" ...
Connecting to host localhost ...
Required input control "LOAD_ADDR" not found
boot.ini-52> set realcons connected
Unit not attachable
... Execute Bootstrap Loader (to load Absolute Loader from paper tape)

HALT instruction, PC: 037500 (MOV PC,SP)
... Execute the Absolute Loader (to load BASIC from paper tape and run it)

PDP-11 BASIC, VERSION 007A
*O 
READY


Thanks, I appreciate it,

-- steve

David Johnson

unread,
Mar 28, 2020, 9:40:07 PM3/28/20
to Steve Tockey, [PiDP-11]
I just read the avitech.com.au description of paper tape basic, and noticed this statement (referring to the same loan program):
Note: There is a problem with this program. BASIC under SIMH does not calculate exponential values correctly (such as “PRINT 2^3”) unless “E” is entered at the “options” prompt when PDP-11 BASIC first starts. I am not sure whether this is a problem with the PDP-11 paper tape, or the SIMH program.


The options prompt is *O


--
You received this message because you are subscribed to the Google Groups "[PiDP-11]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-11/93dd8838-fc5d-4d4a-94a8-ed6888ad0176%40googlegroups.com.

Steve Tockey

unread,
Mar 28, 2020, 10:04:44 PM3/28/20
to [PiDP-11]
See http://archive.pcjs.org/pubs/dec/pdp11/basic/BASIC_Programming_Manual_Dec70.pdf

Page 7-1.

The E option on start up deletes EXP(), LOG(), as well at the trig functions SIN(), COS(), ATN(), and SQR(). SIN() would not even be available if one selected that, not that it would return a wrong result. At least I would expect that behavior.

David Johnson

unread,
Mar 28, 2020, 10:16:03 PM3/28/20
to Steve Tockey, [PiDP-11]


--
You received this message because you are subscribed to the Google Groups "[PiDP-11]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.

David Johnson

unread,
Mar 28, 2020, 10:47:23 PM3/28/20
to Steve Tockey, [PiDP-11]
Sorry if this was irrelevant to your original question, but I had recalled an earlier message on this
list that had infinite loops and error when running the interest payment calculation.  I thought
you were working on that, and didn't read all the way to the end.

-- ddj

On Mar 28, 2020, at 10:15 PM, David Johnson <david_...@brown.edu> wrote:

<Screen Shot 2020-03-28 at 10.15.16 PM.png>

Neal G.

unread,
Apr 4, 2020, 6:03:18 PM4/4/20
to [PiDP-11]
Tom,

One way this could be done would be to run multiple instances of simh, assign the console of each to different serial ports, and have each run its own copy of Paper Tape BASIC. Even the older Pi-2 I use is capable of running several concurrent instances of the simh you just need to enure that each is configured so they do not compete or attempt to access the same resources.

Just curious, why run Paper Tape BASIC? BASIC-11 in the RT11 system is also a fairly simple interpreted BASIC, but adds the ability to access the file system, making it easier to save your programs, easier than than writing/reading simulated paper tapes.

- Neal G.

Tom Lake

unread,
Apr 4, 2020, 10:12:00 PM4/4/20
to [PiDP-11]
It's pure nostalgia. The first computer I programmed that I actually got to see was a Wang 3300. It had 64K memory, used a 4-bit 74181 ALU and supported four users. The BASIC was a paper tape BASIC loaded from one of the four Teletype ASR-33s. It was an extended BASIC that had all the MAT functions included which is something the DEC BASIC doesn't have. The more I see the capabilities of other systems of the time (circa 1971) the more I'm impressed by the 3300.

Tom L

Terry Kennedy

unread,
Apr 4, 2020, 11:43:19 PM4/4/20
to [PiDP-11]
On Saturday, April 4, 2020 at 10:12:00 PM UTC-4, Tom Lake wrote:
It had 64K memory, used a 4-bit 74181 ALU and supported four users.

The '181 remained the go-to ALU for building 16 bit minis for a long time. The PDP-11/44 and the Data General Eclipse S/2xx systems were all built out of '181s.

Even before those, you could build some substantial systems out of seemingly primitive harddware. There was a credit checking service (before lots of people used credit cards for major purchases) where merchants would call in and ask if a potential customer had ever bounced a check, before they would accept the customer's check. The standard level of service was manual lookup from books which were updated over a monthly cycle, and the agent would pull the appropriate book off of one of the tables, look up the customer, and then give the merchant the answer. There was a premium level of service which used multiple PDP-8 computers and RPxx disk drives to provide near-instantaneous results to merchants. And the credit-worthiness data was updated nightly. When I was given a tour of it (it was the major new high-tech business in my sleepy hometown of 1500 people) I was just a kid and didn't realize what an amazing feat of engineering it was to accomplish that with the hardware of the era. Probably the most impressive single assemblage of computer stuff I ever saw "back in the day" was the INSCO underground datacenter. Imagine the warehouse from the ending of "Raiders of the Lost Ark", filled with IBM hardware (mostly 3340 disk drives) as far as the eye could see in all directions.
Reply all
Reply to author
Forward
0 new messages