Friday, January 18, 2019

PiDP11 display register and RSX11


  Recently, a fellow in Switzerland, Oscar Vermuelen,  has been producing some scale models of the PDP-11/70 front panel.  Driven by SIMH running on a Raspberry Pi, and using software from Jorg H )

  It comes in kit form, but only takes a few hours to assemble. The build quality on the components of this kit is really great. I've really enjoyed having mine - it's been a long time since I've had access to the lights and switches of a PDP-11 console. 

  Here's a really terrible phone camera picture of it. It looks much better in person.





   PDP-11 consoles (both real and PiDP11 emulated) came with a switches and display register. A read to this register would read the values set in the console toggle switches. A write to it would cause the value written to be displayed in the DATA lights, if the console display select switch was set to DISPLAY REGISTER.

  RSX comes with a utility for reading the console switches (the SWR utility), but doesn't include any facility for setting the display register lights from a program.

 I wanted a demo program to show how to read  the switches and write to the display from an RSX program. The display register's address is 17777570. But, on RSX, it's not a simple as just writing a program to store a value at that address. The PDP-11/70 (and the PiDP11 simulator) has a 22 bit address memory  space. Programs running on a 70 under RSX  have a 16 bit address space. They access real memory in 8KB chunks, that are mapped to  8KB chunks in the 22 bit memory space.

  The top of that 22 bit space is called the IO page. It's where the CPU and device registers are (IO is mostly memory mapped on the PDP11, mostly). In order for a program to access the IO page, it has to be task-built as a privileged task. Among other things, this causes  the  top 8KB chunk of the task to be mapped to the IO page. When this is done, the 16 bit addresses in the task that are in that top 8KB chunk correspond to the addresses in the IO page. Thus, 17777570 in the IO page, in 22 bit space,  can now be accessed as 177570 in the program. And this is the sketchiest bare bones explanation of PDP-11/70 memory management you'll ever find - don't get me started about I&D space, or user, supervisor and kernel mode mapping registers. 

  Here's a trivial example of how to do that. It reads the switch settings, and writes them into the display register. To use, switch the PiDP display to "DISPLAY REGISTER" from "DATAPATHS", set a value in the switches, and then run the program. The value in the switches will then be shown in the console data lights.

File readwrite.mac


******************************
        .mcall  exit$s

        .psect  cod,ro,i,gbl,rel,con

readwrite:
        mov     @#177570,r0     ;read the switches
        mov     r0,@#177570     ;write the display

        exit$s                             ;donesville

        .end    readwrite

[EOB]



********************************

  To build it, save the above as readwrite.mac, then assemble and link it:


>tkb readwrite/pr=readwrite,[1,1]exelib/lb,[1,54]rsx11m.stb

  Substitute the directory that readwrite.mac is located in for the [200,200] on the first mac line above.

  The above MAC and TKB command lines work fine, but Hugh Sparks pointed out that they are overkill for this project. The commands above are the boilerplate command lines I use when doing more complicated privileged programs that make use of symbols in the exec. For this project, since we don't do anything with symbols, actually all you need to do is...

>tkb readwrite/pr=readwrite
>


 Anyway, it's privileged, and mapped to the IO page, so be careful when you modify it...mistakes here will give you an excellent opportunity  to learn how to use XDT to analyze a crash dump.


No comments:

Post a Comment

Comments?