PDP-11 Fractals in ASCII Art

Now that I have a C compiler for the PDP-11, I decided to do something interesting with it.  Drawing a fractal seemed to fit the bill, so I did a google search to see if anybody had managed to render the Mandelbrot Set in ASCII Art.  I found this Java code.  So I decided that I should port it to K&R C and see if it runs on the PDP-11.  This is the result:

Mandelbrot in ASCII

Very not bad!  And if you're interested, the K&R version came out like this:

#include <stdio.h>

/* CC
   link mandel.obj,c:suport.obj,c:clib.obj

  float b,e,r,n,d;
  int h,c;
  for(e=1.1; e>-1.2; e-=.1)
    for(b=-2; b<1; b+=.04)
      if ((++c % 76)==0) printf("\r\n");
      else printf("%c",h);
      for(r=0; r*r+n*n<4 && --h>32; d=r)
        r = r*r-n*n+b;
        n = 2*d*n+e;

So far this has only been done in SIMH, but when I have made a physical 5.25" boot disk I will try it on the real machine.  I'm interested to know how fast (or slow) it is...

DECUS C combined with RT-11 v5.3

I have now managed to make an RX33 boot disk image from RT-11 v5.3 and Decus C.  However, I did have to remove some extra files from the original boot disk to make more space.  These are the extra files that I removed:


I guessed that since I'm using the "XM" edition of RT-11, then I would not need those files.  Next, I copied over the DECUS C files, like this:

With CCDSK1.DSK in drive DK1:

CREATE sy:cdisk.dsk/allocate:1500
MOUNT ld0: sy:cdisk.dsk
ASSIGN ld0: c:
[LD0:/Initialize; Are you sure?] YES
COPY dk1:*.* c:

...now put disk CCXDSK.DSK in drive DK1:

If you've restarted the emulator to change disks, use the next two lines:
MOUNT ld0: sy:cdisk.dsk
ASSIGN ld0: c:

COPY dk1:*.* c:

Append these lines to your "STARTX.COM" command file (which runs when RT-11 starts):

MOUNT ld0: sy:cdisk.dsk
ASSIGN ld0: c:

Then restart... Finally, to compile a C program, do this:

[CC>] hello.c/A
LINK sy:hello.obj,c:suport.obj,c:clib.obj

Don't forget that this is an old dialect of C, mainly as described by K&R.  So you'll have to stick to the original K&R syntax.  Right, next comes the fun stuff.

Making an RT-11 v5.3 disk image

I realised that if I could get a floppy disk that booted into RT-11 v5.3, then I might be able to add the DECUS C compiler and have a boot disk and C compiler. This is the procedure I used to make my first RT-11 v5.3 boot disk.

Using SIMH, boot into RT-11 v5.3, making sure that you have blank RX33 disk image attached as DK1:. Then use these RT-11 commands to copy the files to the floppy disk image:


Then, shut down SIMH. We'll next use PUTR to make the RX33 disk image bootable (this assumes that you have called the image rx33.dsk and that it is in the same folder as PUTR):

MOUNT a: rx33.dsk /rx33 /rt11

That's it. The RX33 image should now be bootable. Try it out in SIMH to make sure.

RT-11 with Basic-11

I have now managed to get a boot disk with RT-11 and BASIC-11 on it (thanks Mark for making *another* boot disk on your PC).  So now I can boot my PDP and write programs on it.  Progress indeed.  Here is something I captured running on my actual PDP-11/53:

...as you can also see, I have also been busy experimenting with the best colours for my terminal emulator.  Today I am mostly programming with grey text on a blue background.  Getting this to work involved taking two 400k RX50 disk images and creating a single 1.2Mb RX33 image.  So I effectively merged the contents of the RT-11XM boot disk and the "Languages Master" disk into a single boot disk.  Works a treat.  This seems to boot much faster now, so I suppose the RX33 drive is much faster at reading 1.2Mb 5.25" floppy disks.

Simple Test Code Generator

I have been working on a C# console application that will output a test application which can be sent to a PDP-11 and executed. Here is a clip of it in action on a simulated PDP-11:

You must have the flash player to see this movie.

This example shows the RT-11 'DEPOSIT' command in action, it allows memory locations to be set with a specific value from the command line.  I use that to enter the program and then the 'START' command to start running the code.

Das boot

So the next step with my PDP-11 was to try and boot an OS.  A friend of mine (the kind of bloke who keeps old machines with 5.25" floppy drives) was kind enough to volunteer and make a boot disk.  We used the excellent PUTR utility to make the disk on a PC.  The disk image came from here, we used the RT-11 boot disk.  I will post the PUTR instructions another time.  The first disk we made attempted to boot up, there was a lot of disk activity... but after a few minutes I got the message: "?BOOT-U-I/O error".  We wondered if this was just a bad disk.  Fortunately, we made another disk and tried again...  This time it booted straight into RT-11.  This was the result:

RT11 screenshot

How cool is that?  Some sort of celebration must be in order, consumption of beer seems appropriate for that.

PDP-11/53: Hello World

So, I managed to find a proper "Hello World" program for my PDP-11 on the internet. It can be typed into ODT without too much effort. This is what happened when I typed it into my machine:

1000/XXXXXX 042510
1002/XXXXXX 046114
1004/XXXXXX 020117
1006/XXXXXX 047527
1010/XXXXXX 046122
1012/XXXXXX 020504
1014/XXXXXX 005015
1016/XXXXXX 000000
1020/XXXXXX 012701
1022/XXXXXX 001000
1024/XXXXXX 112100
1026/XXXXXX 001406
1030/XXXXXX 105737
1032/XXXXXX 177564
1034/XXXXXX 100375
1036/XXXXXX 110037
1040/XXXXXX 177566
1042/XXXXXX 000770
1044/XXXXXX 000000


As you can see, I'm using this to disable interrupts and start it:


It's a useful little test. I now know that my machine is capable of running programs, which is good.

So my next step is to try an RT11 boot disk so that I can attempt to run an operating system.  The ultimate goal is to run Unix rather than RT11, but you've got to start somewhere...

Do nothing. Do nothing. Do nothing. Stop.

So if I wanted to best describe the first program that ran on my DEC PDP-11/53 ... then it would have to be:

"Do nothing.  Do nothing.  Do nothing.  Stop."

But at least it worked.  I entered those commands as machine instructions in ODT (Octal Debugging Technique) and it ran.  Not much of a "Hello World" program though is it?

Here are the details of the instructions:

001000/240<lf>  ; NOP
001002/240<lf>  ; NOP
001004/240<lf>  ; NOP
R6/1000<cr>  ; set to start code at 1000
R7/1000<cr>  ; set PC to start address so we can use P and not clr PS
RS/340<cr>  ; set PS to disable interrupts
P<cr>  ; start program

That program was a hacked version of something I found here.  Now I need to make it do something better.

DEC PDP-11/53: New CPU Board

The chap who sold me some of the PDP parts was kind enough to let me try another KDJ11-D CPU board that he had, since I thought that the RAM was dead on the first one.  Here it is:

New CPU Board

This one works!  Well, in reality it also has issues ... if I try to use all 1.5 Mb of RAM it also fails the self-test on startup.  So I tried setting the W25 jumper as documented here.  With that jumper in place it seems to work fine, although it means that I'm limited to 512k of memory.  So I imagine that the problem must be in the upper megabyte.  It would seem that these old RAM chips have a tendency to die.  However, it should be good enough for me to continue moving forward.  Although at some point it would be nice to have a fully working KDJ11-D (M7554) in my machine.  I must keep an eye out for that.

PDP-11/53: Floppy Cable

So it appears that I've forgotten how to connect up a floppy drive. In my defence, I have not used a floppy disk in years... Fortunately it seems that the cable in my PDP-11/53 should be the standard type.  My likely mistake was to rummage in my bin of "reclaimed" computer parts and try to use the cable I found in there. It does not have a twist in it :-( Typical.

Seriously. That might be the cause (or one of the causes) of the "Drive Error" message I was getting.  Mind you, if my RAM chips have died (as I suspect) then I might get other error messages. I should expect dodgy memory to manifest itself in all kinds of ways I guess.

So after some reading on the interweb I have been reminded that the standard floppy cable has a twist in it.  It looks hacky; but was the normal technique used to distinguish drive A: from the B: drive. Of course the cable I had in my box of leftovers was flat - a non-standard cable.  I expect that it won't work in my PDP.

On a standard twisted cable the connectors after the twist are usually for drive A: whereas the connectors on the untwisted section are for the B: drive..

The other thing that I remembered is that 5.25" drives normally had a "card edge" connector, rather than a couple of rows of pins like you find on 3.5" drives. I had forgotten that too. So when buying floppy cables, if you want a "standard" one you need both card edge and the 34 pin female connectors, with a twist in the cable.

Maplin's still sell these cables, so I've now got the correct one (I think). Hopefully I will be able to correctly connect my RQDX3 disk controller to my RX33 disk drive now. Watch this space...