What Unix is suitable for BBC Basic for the PDP-11?

bbc/electron apps, languages, utils, educational progs, demos + more
Post Reply
litwr
Posts: 245
Joined: Sun Jun 12, 2016 9:44 am
Contact:

What Unix is suitable for BBC Basic for the PDP-11?

Post by litwr »

I am curious to run BBC Basic for the PDP-11 on real hardware. Online real systems usually use RSX-11 or Unix. There are two major Unix variants for the PDP-11: BSD 2.11 and Unix V7. What one may be used for BBC Basic?
Last edited by litwr on Tue Sep 21, 2021 7:21 am, edited 1 time in total.
User avatar
Bobbi
Posts: 684
Joined: Thu Sep 24, 2020 12:32 am
Contact:

Re: What Unix is suitable for BBC Basic?

Post by Bobbi »

Both probably. BSD2.11 is derived from v7 and mostly adds extra stuff.
User avatar
jgharston
Posts: 4545
Joined: Thu Sep 24, 2009 12:22 pm
Location: Whitby/Sheffield
Contact:

Re: What Unix is suitable for BBC Basic?

Post by jgharston »

litwr wrote:
Mon Sep 20, 2021 2:56 pm
I am curious to run BBC Basic for the PDP-11 on real hardware. Online real systems usually use RSX-11 or Unix. There are two major Unix variants for the PDP-11: BSD 2.11 and Unix V7. What one may be used for BBC Basic?
PDP11 BBC BASIC here will run on PDP11 Unix v5, v6 and v7. I've been working on the interface code for BSD PDP11 Unix, it uses a slightly different API method.

If you want to try BBC BASIC on Unix v6 straight away, try here. :)

To bring back that Saturday teatime experience, try typing results at the Unix prompt. ;)

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.36
(C) Copyright J.G.Harston 1989,2005-2020
>_
litwr
Posts: 245
Joined: Sun Jun 12, 2016 9:44 am
Contact:

Re: What Unix is suitable for BBC Basic?

Post by litwr »

I tried to use LCM but due to the quarantine the situation is rather bad there. Real computers have been replaced by emulators and some emulators just don't work. I could not connect to Misspiggy, the 11/70 under Unix v7. :(
Bobbi wrote:
Mon Sep 20, 2021 3:31 pm
BSD2.11 is derived from v7 and mostly adds extra stuff.
I doubt it. 2.11BSD derived from the BSD line of Unixes.
jgharston wrote:
Mon Sep 20, 2021 10:33 pm
If you want to try BBC BASIC on Unix v6 straight away, try here. :)
Thank you very much. What a nice thing! However IMHO it would be better if BBC Basic for the PDP-11 allows us to use small letters too.
User avatar
BigEd
Posts: 4435
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by BigEd »

Thanks JGH, that was good fun with the teletype! I should have read your documentation first, of course - no SQR, log or trig. But that's fine.

One possible small trap for the unwary: it seems BBC Basic and other programs are as case-sensitive as ever, but the teletype is upper-case only, so judicious use of CAPS LOCK helped out once I'd realised that. PRINT PI looks very much like PRINT PI.
User avatar
BigEd
Posts: 4435
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by BigEd »

(JGH, for a square root routine you might like to see here and here.)
User avatar
Bobbi
Posts: 684
Joined: Thu Sep 24, 2020 12:32 am
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by Bobbi »

2BSD started as a set of add on packages for v7, then became its own 'distribution'. The early BSD stuff is quite similar to v7.

I used to own a PDP-11/34 (with RK05 2.5MB removable pack drive) and a Teletype (this was back in the 90s, wish I still had it.)

I managed to get UNIX v5 and v6 running on it but v7 was a stretch with so little storage. I do have some experience with PDP UNIX :)
Coeus
Posts: 2357
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by Coeus »

BigEd wrote:
Tue Sep 21, 2021 11:36 am
(JGH, for a square root routine you might like to see here and here.)
For the first of those, I believe the algorithm can be speeded up slightly, i.e. we can save a multiply operation, by changing:

Code: Select all

Repeat
  Y = X*X;
  X = X * (Y + 3*N) / (3*Y + N)
Until Abs(X*X-N) <= toler
into

Code: Select all

Y = X*X;
Repeat
  X = X * (Y + 3*N) / (3*Y + N)
  Y = X*X;
Until Abs(Y-N) <= toler
dominicbeesley
Posts: 1689
Joined: Tue Apr 30, 2013 12:16 pm
Contact:

Re: What Unix is suitable for BBC Basic?

Post by dominicbeesley »

jgharston wrote:
Mon Sep 20, 2021 10:33 pm

If you want to try BBC BASIC on Unix v6 straight away, try here. :)
That really is excellent!
User avatar
hoglet
Posts: 10593
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: What Unix is suitable for BBC Basic?

Post by hoglet »

dominicbeesley wrote:
Wed Sep 22, 2021 11:27 am
That really is excellent!
So what am I doing wrong?
pdpteletype.png
Edit: Doh! Invisible lower case!
User avatar
BigEd
Posts: 4435
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by BigEd »

This is the one time that CAPS LOCK comes in very handy!
dominicbeesley
Posts: 1689
Joined: Tue Apr 30, 2013 12:16 pm
Contact:

Re: What Unix is suitable for BBC Basic?

Post by dominicbeesley »

hoglet wrote:
Wed Sep 22, 2021 12:01 pm
dominicbeesley wrote:
Wed Sep 22, 2021 11:27 am
That really is excellent!
So what am I doing wrong?
pdpteletype.png
Edit: Doh! Invisible lower case!
That got me at first. I used to use an application at work in the 80's that did that...sweariness guaranteed every time!
User avatar
sweh
Posts: 2563
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by sweh »

HPUX 10.x (at least) persisted this through the console.

If you logged in as ROOT then it switched to "everything in caps" mode and prefixed real capital letters with a \, so "Hello" would be rendered as "\HELLO". The fix was "stty -lcase" (or "STTY -LCASE" :-)). If you logged in as root then it worked properly.
Rgds
Stephen
User avatar
BigEd
Posts: 4435
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by BigEd »

I even found and fixed a bug in some typed-in Basic!
PDP11-Basic-pi-spigot.png
PDP11-bc-pi.png
litwr
Posts: 245
Joined: Sun Jun 12, 2016 9:44 am
Contact:

Re: What Unix is suitable for BBC Basic?

Post by litwr »

I has been able to get CLOCKSP 2.01 results from a real PDP-11/93 J11@18MHz from Switzerland! It works under RSX-11 so it used RTEM to run Basic. It is also possible to get results for Unix variant of BBC Basic from this machine but it uses 2.11BSD.
PDP11 BBC BASIC IV Version 0.36 (RT11)
(C) Copyright J.G.Harston 1989-2020
>*ESC OFF
>LOAD "clock.bas"
>RUN
BBC BASIC CPU Timing Program
Real REPEAT loop 5.00MHz
Integer REPEAT loop 3.73MHz
Real FOR loop 7.52MHz
Integer FOR loop 2.47MHz
Trig/Log test <none>
String manipulation 5.19MHz
Procedure call 5.75MHz
GOSUB call 3.04MHz
Combined Average 4.67MHz

Compared to a 2.00MHz BBC B
Is it the first time when BBC Basic has run on authentic DEC hardware?

However I had to use a patched Basic because v0.36 has a bug in its timing routine. This bug corrupts time values on the J11 and some other processors.

I used the next routine.

Code: Select all

.IO_ReadTime
mov  #RT_STACK,r0
mov  sp,(r0)		; Save SP
mov  r0,sp		; Use internal stack
cmp  -(sp),-(sp)	; Make room on stack
mov  sp,r0
mov  r0,-(sp)		; Stack address of space on stack
mov  #&o21*256+0,-(sp)	; GETTIM - Get Time
mov  sp,r0
emt  &o375
cmp  (sp)+,(sp)+	; Drop command and address
mov  (sp)+,r1		; Get 50Hz/60Hz tick to r1:r0
mov  (sp)+,r0
mov  (sp),sp		; Restore SP
rts  pc
However a man has suggested to use much better code.
User avatar
Bobbi
Posts: 684
Joined: Thu Sep 24, 2020 12:32 am
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by Bobbi »

@sweh That HPUX behaviour you describe is standard UNIX behaviour, certainly was on SysV R2 which I started on, and I know UNIX v5/v6/v7 do the same thing.

Log in in upper case and it will set the terminal to upper case only and use backslash to show real upper case characters. Of course it was very handy if you had an ASR33 Teletype (uppercase only.)

\VERY ANNOYING WHEN YOU DO IT BY ACCIDENT. \I HAVE MANAGED TO A FEW TIMES.

I don't know when getty stopped doing this.

All the best,
Bobbi
Coeus
Posts: 2357
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by Coeus »

Bobbi wrote:
Fri Sep 24, 2021 6:41 pm
@sweh That HPUX behaviour you describe is standard UNIX behaviour, certainly was on SysV R2 which I started on, and I know UNIX v5/v6/v7 do the same thing.

Log in in upper case and it will set the terminal to upper case only and use backslash to show real upper case characters. Of course it was very handy if you had an ASR33 Teletype (uppercase only.)

\VERY ANNOYING WHEN YOU DO IT BY ACCIDENT. \I HAVE MANAGED TO A FEW TIMES.

I don't know when getty stopped doing this.

All the best,
Bobbi
Interestingly, POSIX decided not to standardise it - presumably by the days of POSIX, UC-only terminals were considered obsolete. The Linux terminal driver still has the IUCLC flag and the OLCUC in the terminal driver, which will be what getty was setting, as probably do most other Unux-like systems.
User avatar
sweh
Posts: 2563
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by sweh »

Bobbi wrote:
Fri Sep 24, 2021 6:41 pm
@sweh That HPUX behaviour you describe is standard UNIX behaviour, certainly was on SysV R2 which I started on, and I know UNIX v5/v6/v7 do the same thing.
Yeah but HPUX was a BSD derived system and 10.20 was a mid/late 90s version.

HPUX had a number of other old throwbacks on the console login screen; for example # was the erase character and @ was the line kill character... which made it very hard to login with that password! That's also a throwback to early Unixes and due to teletypes not having a real delete character :-)
I don't know when getty stopped doing this.
SunOS 4 getty (BSD) used gettytab and there are entries "lc" (terminal has lower case) and "uc" (terminal is upper case only) so the behaviour can be tuned. Modern FreeBSD gettytab doesn't support this any more. I don't think Linux agetty ever did support this. But there were so many Linux getty variations in the early 90s that who knows what system supported what!
Rgds
Stephen
Coeus
Posts: 2357
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by Coeus »

sweh wrote:
Fri Sep 24, 2021 7:09 pm
Yeah but HPUX was a BSD derived system and 10.20 was a mid/late 90s version.
That isn't what I remember and Wikipedia agrees with me:
HP-UX (from "Hewlett Packard Unix") is Hewlett Packard Enterprise's proprietary implementation of the Unix operating system, based on Unix System V (initially System III) and first released in 1984.
It did, like many other Unixes, include some BSD functionality, for example it implemented IP-based networking using the BSD sockets interface, through SYSV streams was added when that became available. It included termcap as well as terminfo to enable BSD applications to be ported easily and implemented many BSD system calls.

In the particular case of this lower/upper case business, I believe the stty command had some shortcuts for setting a few of the termios flags at the same time.
sweh wrote:
Fri Sep 24, 2021 7:09 pm
HPUX had a number of other old throwbacks on the console login screen; for example # was the erase character and @ was the line kill character... which made it very hard to login with that password! That's also a throwback to early Unixes and due to teletypes not having a real delete character :-)
Yes, I remember that too. We ended up writing a little program that ran from the login profile to do some more intelligent setting up of the terminal. There was, I think, a program already included that could do some of this, including looking up the device name to find the type of the attached terminal (for lines that always had the same terminal, which would be true of the console). What we ended up with something that worked in two parts:

1. Determine the type of terminal. If this wasn't known from the device name then the user would be given the option to enter it. If the user just pressed return some escape sequences would be sent to initiate an answerback from the types of terminals we commonly had and the response processed to get a terminal type.

2. Once the terminal type was known we would set the erase and kill characters accordingly - for erase, some terminals used backspace and some used ASCII DEL.
User avatar
hoglet
Posts: 10593
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: What Unix is suitable for BBC Basic for the PDP-11?

Post by hoglet »

Slightly off topic, but I still have a HPUX 10.20 based system in my Lab:
viewtopic.php?p=136868#p136868

Here's a photo of the CPU board:
16700B-CPU-TOP.jpg
The big chip is a 150MHz PA RISC processor (a PA-7300LC).

I used a HP-UX workstation as my main development system (at work) continuously from 1988 to about 2003 (ish), and I don't remember this caps issue. Not the same one of course: the first one was a 68020 based HP 9000 series 350 Bobcat; the last one was that I can recall was a PA-8000 baased HP 9000 series C180. Fun days!

Dave
Post Reply

Return to “8-bit acorn software: other”