A Basic Program w Error Messages?

320 views
Skip to first unread message

Kent B.

unread,
Jun 24, 2018, 5:07:49 PM6/24/18
to PiDP-8
I have not worked with my PiDP8I for a while so it is a little like starting over trying to remember interpreting BASIC error codes... :-((.

I have managed to write, save, and load programs into the PiDP8i successfully several months ago. The program that I entered by hand, below, does not work and there are several error messages, which I am having trouble deciphering?  The error codes that I have suggest that line 10, and 80 have "missing  equals sign in LET"; while line 20 and 60 have parenthesis error.

Not sure what the problem is unless...these are different Error Codes  from the ones I found in the BASIC handbook on page 6-57.

10 LET MAX = 5000
20 LET X = 1 : LET Y = 1
30 IF (X > MAX) GOTO 100
40 PRINT X
50 X = X + Y
60 IF (Y > MAX) GOTO 100
70 PRINT Y
80 Y = X + Y
90 GOTO 30
100 END

LS 10
XC 20
MP 30 
MP 60
LS 80



William Cattey

unread,
Jun 25, 2018, 12:33:15 AM6/25/18
to PiDP-8
Try sticking to single letter variable names.
I think the delimiter for multi-statement lines is backslash.

slob

unread,
Jun 25, 2018, 12:44:49 AM6/25/18
to PiDP-8
Off of the top of my head, in an unfamiliar BASIC I’d assume the minimal features. So...1 char variables, no colons separating statements (use new line number), assume THEN and END IF not optional, that sort of thing.

I haven’t tried anything nontrivial in PDP8 BASIC, but the BASIC versions are fairly rudimentary from what I recall, the TSS-8 version especially so. Still, absolutely amazing given the resource constraints.

Warren Young

unread,
Jun 25, 2018, 7:24:13 PM6/25/18
to PiDP-8
On Sunday, June 24, 2018 at 11:44:49 PM UTC-5, slob wrote:
no colons separating statements (use new line number)

OS/8 BASIC does allow multi-statement lines, but the separator is the backslash, not the colon, as with Microsoft-family BASICs.

There are a couple of BASIC-related articles in the PiDP-8/I project wiki that may help you get started with OS/8 BASIC:

 
assume THEN and END IF not optional, that sort of thing.

You're pretty far off base, actually. There is no "END IF" at all because there are no multi-statement IF blocks! The only IF allowed, as I recall, is basically a conditional GOTO, so it's always only a single statement. 

As I further recall, you can't have anything after the IF/GOTO, so you effectively also have no ELSE, other than whatever follows that line in the program. This then requires that you write the conditional backwards from normal best practice: instead of "IF normal-case THEN do-normal-thing" you write "IF exceptional-case GOTO exception" followed by the normal-case code. Otherwise, you'd end up putting the normal-case code at the GOTO target, which means as you read the code, you're reading all the exceptions first and have to go chasing all over your creation to find the normal code path.

This is the environment that birthed "GO TO Statement Considered Harmful," and you can now see why!

clasystems

unread,
Jun 26, 2018, 8:02:14 PM6/26/18
to PiDP-8
And also debunked that foolish notion.

At a DECUS symposium some naive fool attempted to [seriously] "educate" the crowd about using "Structured" approaches in TECO.  In the end, when it was easily proven the techniques were grotesquely inefficient, the audience literally ridiculed here.  Years later, the author of the piece you mentioned admitted that he was wrong and it was merely for "political" purposes he did what he did.  Also, the PASCAL language has rich symbols except the goto statements only support numbers, thus effectively also making a "political" statement.

cjl 

Neil Higgins

unread,
Jun 26, 2018, 11:11:57 PM6/26/18
to PiDP-8
Programers can - with or without gotos (they have the knack); others can’t (they don’t). Then there are those who earn a living by programming, even if they can’t. The evidence suggests that there are millions of them. On balance, providing ways to program with less gotos probably makes the world a safer place. I did find thought provoking Dijkstra’s distinction between linear text and linear time.

Steve Tockey

unread,
Jul 8, 2018, 3:11:43 PM7/8/18
to PiDP-8

IIRC, variable names in PDP-8 BASIC can be just a letter, or a letter and a number. For example, A, A0, A1, A2, B, B0, B1, B2, ... should all be valid variable names

AndyB

unread,
Jul 10, 2018, 10:26:37 AM7/10/18
to PiDP-8
Long shot and quite off topic (apologies): I've been looking for a few years for a BASIC program to calculate Pi on a PDP, ideally TSS/8.  I spent a lot of time googling and trying to get Apple and other BASIC programs to work on the PDP... but mostly the Pi program are on more modern versions so don't easily downgrade to the simple PDP8 BASIC. I remember copying a BASIC program from a computer magazine in the 1980s which ran with little modification on a PDP-10 BASIC... but no luck tracking that down :-)

Any thoughts? 
cheers!
Andy

Steve Tockey

unread,
Jul 10, 2018, 11:53:32 AM7/10/18
to PiDP-8
Andy,
Is there anything useful here:

http://numbers.computation.free.fr/Constants/PiProgram/pifast.html


Cheers,

— steve

AndyB

unread,
Jul 12, 2018, 9:23:36 AM7/12/18
to PiDP-8
Hi Steve, thanks for the reference. The link is for an executable that does rapid pi calculations. Sadly they do not share the source.

cheers
Andy

Andrew Yeomans

unread,
Jul 12, 2018, 11:02:58 AM7/12/18
to PiDP-8
Approximating pi using the "dart throwing" method should be easy to program, though not very accurate.
The idea is that you throw a dart at random into a dartboard in the shape of a quadrant of a circle, and see if it is inside or outside (by Pythagoras' theorem).
Something like:
10 LET A=0
20 LET B=0
30 LET X=RND
40 LET Y=RND
50 IF ((X*X +Y*Y)>1) THEN 70
60 LET A=A+1
70 LET B=B+1
80 PRINT 4*(A/B)

90 GOTO 30
100 END

(Not tested on a Pi!)

Maybe the weird C program can just fit:
     int a=10000,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5;
     for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);}

Ed Spittles

unread,
Jul 12, 2018, 11:10:03 AM7/12/18
to AndyB, PiDP-8
Long shot and quite off topic (apologies): I've been looking for a few years for a BASIC program to calculate Pi on a PDP, ideally TSS/8.  I spent a lot of time googling and trying to get Apple and other BASIC programs to work on the PDP... but mostly the Pi program are on more modern versions so don't easily downgrade to the simple PDP8 BASIC. I remember copying a BASIC program from a computer magazine in the 1980s which ran with little modification on a PDP-10 BASIC... but no luck tracking that down :-)
Any thoughts? 
cheers!
Andy


I'm sure you've perused the various pi calculations at
and perhaps you aim to add one for the PiDP-8...  there is an old Apple Basic program: see here
It's a page of Basic and uses PEEK and POKE for direct access to an array of bytes in RAM.

Perhaps translating this C program will be a good way:

Just possibly it will be worth converting a 6502 assembly language program to PDP land. If so, see these threads:

There's a  PDP-11 one in this project:

Cheers
Ed

CLASystems

unread,
Jul 12, 2018, 11:28:04 AM7/12/18
to Ed Spittles, AB, PiDP-8
From what I have heard, the TSS8 BASIC is ghastly compared to all of the other PDP-8 BASIC implementations, not that they are all that equal in capability either, but they occupy different corners of the same "universe" at least whereas the TSS8 one is in "uncharted space".

Many of the implementations of PDP-8 BASIC [the rest of them!] are the product of a small number of people, all my long-term friends.and colleges from Brookllyn Poly.  They all bounced ideas off of each other, and thus they have common "roots" in many ways.

There is also an effect of "perfecting" their craft, thus the newer ones in certain ways exceed the previous ones [but not necessarily and of course there are steps backwards]..

There is actually one additional "BASIC" that is definitely worse:  So-called CINET "BASIC".

This is a sham program.  It is nothing more than patched FOCAL so the command names seem to be somewhat more BASIC-like.  That said, FOCAL is not written to flow the same way as BASIC, thus even if you state some code within it somewhat successfully, it won't work the same way!  In fact, FOCAL shares some of the same limitations of later languages such as PASCAL that are incapable of breaking out of loops because there is no proper stack manipulation.  You seem to break out, yet it continues to execute from the top anyway!

[Note: FOCAL is more of a "structured" language because it really doesn't implement unconditional GOTO; in loops it just can make "local" changes and the statements are all performed with a DO statement, etc.

BASIC to be faithful must be able to purge any stack in place so that when you leave an interative loop, you really leave it.  This is taken for granted in languages such as FORTRAN and PL/I where the stacks are either non-existent or carefully defined.

A different project at Brooklyn Poly [some of the same people worked on that as well] was based on a descriptor language, etc. where the following two key elements were implemented:

a) Mark the stack.  This means that if necessary, this is the one you will want to reference.  Each marked position has a unique number.

b) Purrge to mark.  Any and all stack elements are removed all the way back to the proper marked stack element.  Thus, the stack is always properly cleaned up.

When such language elements are allowed to be handled without regard to standards, ineveitably code written in one cannot run in another, etc.

cjl

--
You received this message because you are subscribed to a topic in the Google Groups "PiDP-8" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pidp-8/q4eEMXGPRa0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pidp-8+un...@googlegroups.com.
To post to this group, send email to pid...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-8/CAMPG4Y9uMeACcwhgwYKv2Pxa4EcmNBY8ut9NAL6y%2BVHGRAYncg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
"In the future, OS/2 will be on everyone's desktop"

Bill Gates, 1992

Steve Tockey

unread,
Jul 12, 2018, 1:03:35 PM7/12/18
to PiDP-8

I don't recall where I found this, but if you want obscure you can try this. It's supposed to be a TECO macro for calculating pi:

.R TECO

*i100$$

*GZ0J\UNQN"E 40UN ' BUH BUV HK

QN< J BUQ QN*10/3UI

QI< \+2*10+(QQ*QI)UA B L K QI*2-1UJ QA/QJUQ

QA-(QQ*QJ)-2\ 10@I// -1%I >

QQ/10UT QH+QT+48UW QW-58"E 48UW %V ' QV"N QV^T ' QWUV QQ-(QT*10)UH >

QV^T @^A/

/HKEX$$

3141592653589793238462643383279502884096548392828580051774206964461331476026438773944051683122394366



The $s are <esc>. The last line is TECO output, not user input.


Have fun. . .    :^)


Warren Young

unread,
Jul 12, 2018, 1:17:01 PM7/12/18
to PiDP-8
On Thursday, July 12, 2018 at 11:03:35 AM UTC-6, Steve Tockey wrote:

I don't recall where I found this, but if you want obscure you can try this. It's supposed to be a TECO macro for calculating pi:

.R TECO

*i100$$

*GZ0J\UNQN"E 40UN ' BUH BUV HK


I didn't compare it character-for-character, but it looks like the same macro used within bin/teco-pi-demo, a Python script added in the most recent release of the PiDP-8/I software distribution. The script throttles the Pi down to a "blinkenlights" speed just prior to executing the macro, so it starts up quickly but then runs nice and slow so the lights are not just a blur.

This script also demonstrates how to use the Python "simh" class provided in the same release, so that you can script your own interactions with the simulator and/or OS/8.

CLASystems

unread,
Jul 12, 2018, 3:06:59 PM7/12/18
to steve...@gmail.com, PiDP-8
On Thu, Jul 12, 2018 at 1:03 PM Steve Tockey <steve...@gmail.com> wrote:

I don't recall where I found this, but if you want obscure you can try this. It's supposed to be a TECO macro for calculating pi:

​I'm not all that interested, but I routinely write TECO macros today in support of PDP-8 program development.  One is so complicated, I had to invent a method of documenting it in another file to follow it.  [And it was a good thing I did; that way I discovered a subtle bug in it!

I've heard of Fortran compilers [NOT interpreters!] being written in TECO.

cjl​

.R TECO

*i100$$

*GZ0J\UNQN"E 40UN ' BUH BUV HK

QN< J BUQ QN*10/3UI

QI< \+2*10+(QQ*QI)UA B L K QI*2-1UJ QA/QJUQ

QA-(QQ*QJ)-2\ 10@I// -1%I >

QQ/10UT QH+QT+48UW QW-58"E 48UW %V ' QV"N QV^T ' QWUV QQ-(QT*10)UH >

QV^T @^A/

/HKEX$$

3141592653589793238462643383279502884096548392828580051774206964461331476026438773944051683122394366



The $s are <esc>. The last line is TECO output, not user input.


Have fun. . .    :^)


--
You received this message because you are subscribed to a topic in the Google Groups "PiDP-8" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pidp-8/q4eEMXGPRa0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pidp-8+un...@googlegroups.com.
To post to this group, send email to pid...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Rick Murphy

unread,
Jul 12, 2018, 6:42:02 PM7/12/18
to steve...@gmail.com, PiDP-8
I'm quite sure that this macro is the work of Stanley Rabinowitz. 

Yep - http://www.iwriteiam.nl/HaPi_TECO_macro.html  - post to comp.lang.c.
Love this comment:
    Try this TECO macro. If you use some other editor, you should be able to translate this to your editor's macro support, unless your editor has less functionality than a 30-year old editor for much smaller and slower machines than you are likely to be using.
Stan apparently got a paper written on the algorithm this uses. Pretty impressive. :)
    -Rick

On Thu, Jul 12, 2018 at 1:03 PM Steve Tockey <steve...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "PiDP-8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-8+un...@googlegroups.com.

To post to this group, send email to pid...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-8/9b3db5dd-47c1-42ad-ba27-3b1bb3d03631%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Rick Murphy, CISSP-ISSAP, K1MU/4, Annandale VA USA

CLASystems

unread,
Jul 12, 2018, 10:45:50 PM7/12/18
to Rick Murphy, steve...@gmail.com, PiDP-8
On Thu, Jul 12, 2018 at 6:42 PM Rick Murphy <k1mu....@gmail.com> wrote:
I'm quite sure that this macro is the work of Stanley Rabinowitz. 

​I'll ask him when I see him.

cjl​
You received this message because you are subscribed to a topic in the Google Groups "PiDP-8" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pidp-8/q4eEMXGPRa0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pidp-8+un...@googlegroups.com.

To post to this group, send email to pid...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--

Ed Spittles

unread,
Jul 13, 2018, 1:54:56 AM7/13/18
to Rick Murphy, steve...@gmail.com, PiDP-8
Rabinowitz' 14-line Fortran program is here:
(S. Rabinowitz, Abstract 863-11-482: A spigot algorithm for pi, Abstracts Amer Math. Society 12 (1991) 30.)
and would, presumably, be readily converted to Basic.

There's a short Pascal program by Simeon Simeonov given in the corresponding (and classic) paper here:
(Stanley Rabinowitz and Stan Wagon, `A Spigot Algorithm for the Digits of Pi', American Mathematical Monthly 102 (1995) 195-203.)

Ed

AndyB

unread,
Jul 14, 2018, 11:58:32 AM7/14/18
to PiDP-8
Thank you too all of you for the suggestions.

Will definitely be checking out the Teco route and also investigating Fortran for this.  And the rosetta libraries are also very interesting, surely I can get the PDP11 code to run on my PidP11 :-)

I will also continue to sniff around for a simple BASIC that might work... I did see the Apple basic code before where PEEKs and POKEs are necessary - that's a little outside my skillset :-)

cheers!
Andy

Steve Tockey

unread,
Jul 22, 2018, 3:40:00 PM7/22/18
to PiDP-8

By the way--returning back to the original topic--it turns out that the error codes are already documented in OS/8 HELP.


.HELP BCOMP

is supposed to list out all of the error messages of the BASIC compiler


.HELP BRTS

is supposed to list out all of the error messages of the BASIC run-time system


If that doesn't work, make sure you have files SYS:HELP.SV and SYS:HELP.HL


Cheers,

-- steve
Reply all
Reply to author
Forward
0 new messages