Sending small text files to your PDP-11

These days I'm always experimenting with little bits of code, mostly stuff that I've tried in SIMH and then want to run on the real machine.  Kermit works great for multiple file transfers, but sometimes it's just nice to send a simple source file over the console without having to run special software on each side.

So ... I've written this Paste program in C.

You just type 'paste' on the PDP-11, and when prompted for an argument type in the destination filename.  Then you send your text over the console (in Tera Term Pro you can easily send a text file over the console).  To close the file, just send two blank lines, you can press enter twice if the file doesn't finish with blank lines.

For me, this works a treat, so nowadays I'm using it in both SIMH and on real hardware...

PDP-11 wireless internet

To get my PDP-11 on the internet without buying more stuff, I decided to connect my WiFly board to it.  This will allow me to send commands out of the second serial line, which will be dealt with by the WiFly and then sent over the internet.  It means that my PDP will have wireless internet access.  I have knocked up a simple breadboard experiment:

WiFly breadboard for the PDP-11

I realised that I can test this without writing any code, through the magic of the PDP-11's diagnostic commands.  I can use the 'wrap' command, which will send anything I type on the keyboard to the WiFly and then echo any responses from the WiFly back to the console.  It means that I can test without worrying over buggy code or problems in the OS.  It works great; here is an example:

Screenshot of a PDP-11 on the web

Now that I have proved the hardware works together, I can write some C code to do the same and I should have some sort of internet access.  Umm, I wonder how many text-only websites still exist...

Information is beautiful

My wife gave me this book for our anniversary this year.  It's brilliant.  At the moment my favourite page is the periodic table of the condiments:

Periodic table of the condiments

Make a disk bootable in RT-11

In the end it was very easy to get my winchester drive to be bootable.  I just had to read the manual really...  This was what I used:

copy/boot dk0:rt11xm.sys dk0:

The trick is to already have a copy of the boot-file (RT11XM.SYS in my case) on the disk.  The "copy/boot" command then just moves the file from one part of the disk, to the boot section.  Easy.

I used that to make my Winchester Drive bootable, so now I'm booting straight from the fixed disk.

Kermit on the PDP-11

After a bit of a struggle I have gotten Kermit to happily transfer files between Windows 7 and my PDP-11.  On Windows, I'm using Kermit-95.  Currently, I use the Console version rather than the GUI one, it seems more in keeping with my PDP.

On the PDP-11, I've installed the latest version of Kermit-11, which I got from here. There are several flavours of Kermit-11, I'm using KRTTSX.SAV (Kermit-11 3.63 for RT-11XB/XM/ZB/ZM and TSX+).

I think that one of my problems was the Line Time Clock.  I thought that I had the LTC switched on, but I may have gotten the DIP switch the wrong way round.  Since I flipped the LTC DIP switch the other way round things have started to work.

This is what I'm entering on the PC to make it work:

set port com2
set line com2
set speed 9600
set flow xon/xoff
set carrier-watch off
set attributes off

...and here are the Kermit commands I'm entering on the PDP, once Kermit-11 is running:

set file bin
set line tt:
set attributes off

After that, I can use the GET and SEND commands on the PC to transfer files.

XXDP booting via ODT

So I needed to format the Winchester Disk in my PDP, and since RT-11 cannot format these types of fixed disk I needed to use the disk formatting program in XXDP.  XXDP is a small operating system made by DEC for diagnostics.

There is a good tutorial on how to make an RX50 XXDP boot disk here.  That is what I've used anyway.  However, I found that the resulting disk image was bootable in the SIMH emulator, but a real disk would not boot in my uPDP-11/53.  I don't know why yet, the disk starts the boot process, but then the machine halts.

An alternative is to boot the machine from a tape image and use the vtsever program on another machine to pretend it is a tape over a serial line.  Unfortunately, I have not managed to get vtserver to work at all.  Maybe it doesn't like Windows 7.  I'll come back to vtserver another time...

Still, this page got me to thinking there may be another way.  Maybe I could boot my working disk image of XXDP in SIMH and then dump the memory to disk.  Perhaps, this memory dump could be restored to a real PDP and then I could use XXDP from there...

Indeed you can... if you want the file I created, it's here.  But here are some notes about how to do it yourself:

- Boot an XXDP disk image in SIMH
- When the OS is running, type "R ZRQCH0" at the command prompt
- You should now see something like this:

RQDX3 Disk Formatter Utility
UNIT IS Formattable Winchester (RDnn) or Floppy (RX33) Drives
RSTRT ADR 145702

- We'll need the RSTRT ADR (restart address).  Make a note of it, for me it was 145702
- Press <CTRL>+E, to halt the simulator, you should then get a "sim>" prompt
- Enter this command: "ex @dump.txt 0-157777"
- That will save the first 56k of memory to the file called dump.txt (in the folder where SIMH was running from)
- Close SIMH, we've got what we needed
- The memory dump now needs to be converted, so that it can be loaded via ODT
- Here is a quick and dirty C# program that will convert the file to ODT format:

static void Main(string[] args)
    StreamReader sr = new StreamReader("dump.txt");
    StreamWriter sw = new StreamWriter("odt.txt");

    string line;
    char[] sep = { ':' };
    for (; ; )
        line = sr.ReadLine();
        string[] split = line.Split(sep);
        sw.Write(split[1].TrimStart() + (char)10);
        if (sr.EndOfStream) break;


- Use the above program, after that you should now have a converted file called "odt.txt"
- Boot the real PDP and go into ODT.  Send "odt.txt" over the console serial line
  NOTE: to be safe, I used Tera Term Pro to send the file and set some delays:
     100ms delay after each line
     25ms delay after each character
- Be patient.  It took me about 1.5 hours to send this file via ODT!
- When the whole file has been sent, enter the Restart Address followed by 'G', eg:
- You should now be in XXDP, with the disk formatter loaded.  You should see a DR> prompt.
- Now just use the ZRQCH0 program.  I followed the formatting procedure here.

There are many improvements that I could make to this, but it worked first time; so I'm leaving it alone.

Winchester Drive

A colleague at work gave me a Seagate ST-225 "winchester" MFM hard disk.  This disk is the same as the RD31 used in PDP-11's (a 20meg drive). It has been sitting inside my PDP for a while, but I could not format it.  I tried to make an XXDP boot disk, which has the formatting program, but it halted the machine when I tried to use it.  RT-11 cannot format fixed disks.  However, I managed to find other means to get XXDP onto my machine.  Here is the disk format program in action:

ST-225 MFM formatting

Nice!  What I did was boot XXDP in the SIMH emulator, start the ZRQCH0 formatting program and then dump the first 56k of memory to disk.  I then used a little C# utility I wrote to turn this dump into machine instrictions that could be entered into memory via ODT.  It took about 2 hours to send the data over a 9,600 baud serial line.  Still, it worked a treat!  I have a formatted hard disk in my machine!  I haven't managed to make it bootable yet, but I have copied some files to the new disk.  I need to upload some photos...

BA23 Enclosure Cables

Cabling up the insides of my uPDP-11/53 would have been easier if I had found this:

BA23 Cables

…which was taken from page 20 here.  So I’m keeping a copy, for possible future reference.

Fractals on the real thing

My RT-11 boot disk with DECUS C worked a treat on the real machine.  It took 16 seconds for it to draw the mandelbrot set in ASCII art on the actual uPDP-11/53.  Here is a picture of the real thing in action:

ASCII fractal on a real PDP-11

I would say that's a result.  My next project is to use memory-mapped I/O in C to communicate over the second serial line.  This may allow me to hook the PDP to my serial-to-wifi board.