Fixing BCPL

The BCPL compiler to executes successfully and the BCL: ersatz device exists in the monitor but the compiler seems to be producing code which is executing at an illegal memory address. So how do we fix that?

Not being familiar with BCPL or TOPS-10, the best guess that I have for why it is doing this is that the BCPL.EXE and the BCPLIB.REL were last built on a much older system compared to that which I am running and so they may need rebuilding from source and re-linking with up to date libraries. So I am going explore that and in order to do that I have to make sure the system in stable and as I may need to debug code I should make suer that the TOPS-10 printer can be used as an output device.

First lets make sure my amended SYS2.EXE that I built with MONGEN and includes the BCL: ersatz device is made to be the default SYSTEM. To make that happen I use the Operator account to copy SYS2.EXE[10,7,mon] to SYS:SYSTEM.EXE.

.dir sys:system.exe


SYSTEM  EXE  1236  <057>    7-Oct-88    704(33461)      DSKB:   [1,4]

.r pip

*sys:<057>system.exe=sys2.exe[10,7,mon]
*^Z
.dir sys:system.exe


SYSTEM  EXE  1248  <057>   25-Feb-18    704(33461)      DSKB:   [1,4]

Having confirmed that this is now the permanent system, the other thing I want to do is fix the printer output, as when you compile a programme you can output various debugging information to the system printer.

After making some enquiries on the simh email list and alt.sys.pdp10 I discovered two things. One is that in order to make the printer work for a pdp10 on simh it requires you to both attach and enable the device, whereas I have only attached in the past and found it auto enabled. The second is that when you do not have networking enabled with an ANF-10 node number of non-zero you seem to need to specify the actual printer device when you start it.

I have summarised the printer changes in the Tops-10 FAQ page.

Now on to the BCPL compiler problem.

When I execute my test BCPL Hello World program I get the following error:

.execute hello.bcp
BCPL: HELLO 400027/2
LINK: Loading
[LNKXCT BCPL execution]
?
?PC out of bounds at user PC 420504

As I am both unfamiliar with BCPL and also with TOPS-10, I assumed this was because of some issue with the BCPL compiler or libraries that needed rebuilding. Fortunately a comment on my Installing BCPL post from John Forecast pointed out the error before I went very far down a rabbit hole.

The source code for my BCPL Hello World program was as follows:

GET "BCL:BCPLIB"

LET START() BE
$(
WRITES("Hello, world!!!*C*L")
$)

Unfortunately, there is an error in the program that is not picked up by the compiler because the syntax allows it as a statement, but at runtime it yields an invalid pointer. Essentially I need to add a destination for the output stream to go to in the WRITES statement. So, the corrected program should be:

GET "BCL:BCPLIB"

LET START() BE
$(
WRITES(TTY,"Hello, world!!!*C*L")
$)

And this gives the following output using the installed BCPL:

.execute hello.bcp
LINK: Loading
[LNKXCT BCPL execution]
Hello, world!!!

EXIT

Succes at last! So, we have a working BCPL compiler, a working Tops-10 and we are fixed up and ready to go for MUD!

About Quentin

Im just a normal bloke.
This entry was posted in Retro Computing and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *