Use pidp8 to control a virtual device

190 views
Skip to first unread message

Jay Stainbrook

unread,
Jun 1, 2023, 12:56:25 AM6/1/23
to PiDP-8
Hi, I have a pidp8 up and running and have been playing around with assembly and would like to try and use it to control another device.  I was hoping to set up a simple virtual "device" just to get it interacting with the PiDP8 and the IOT commands.  Can somebody point me in the right direction on where to start?  I'm just looking for some rough guidelines on what would be involved.  Thanks!

Steve Tockey

unread,
Jun 1, 2023, 12:59:09 PM6/1/23
to PiDP-8

The problem is that you gave a very broad request. There are many, many different directions you could go with this. Aside from just doing machine level I/O with the default TTY: (device codes 03, 04), you could access PTR: and PTP: (device codes 01, 02). Alternatively you could use SIMH to attach additional terminals ( typically 40, 41 - 42, 43 - etc.) and access them on the Pi using PuTTY's Telnet. If you wanted more of a challenge, you could read and write data blocks on simulated magnetic media like an RK05 hard disk, RX01/RX02 floppy, or DECTape although at this level it is well outside of the OS/8 file system.

As probably the simplest example, you should be able to access a second terminal as follows:


1) Either in the SIMH boot script or by using CTRL/E to drop into SIMH, give the command:

attach ttix 1234

This tells SIMH that you want to add a secondary terminal that will use device codes 40 (input) and 41 (output) in the same way that 03 is keyboard and 04 is printer on the default TTY:  Note that the 1234 can be many different numbers, it's just a port number for Telnet (next).


2) If not already installed, install PuTTY on your Pi and configure a Telnet session for localhost on the same port number you used in the "attach ttix n" in SIMH, above. It probably makes sense to save this as a named PuTTY configuration so you can re-open it at any time later.


3) With the PiDP-8/I running and the Telnet session open on the Pi, PDP-8 machine code that outputs to device code 41 should appear in the Telnet session window. The following program merely cycles through all of the ASCII character codes, printing them in the Telnet session window:

addr contents
0200  7001     / increment the AC
0201  6416     / output to the second terminal
0202  6411     / did the terminal respond yet?
0203  5202     / no, ask again
0204  5200     / yes, go to the next character


4) Machine code that inputs from device code 40 should read characters typed in the Telnet session window. The following code will read keys typed in the Telnet window and echo them in the output as was done in 3):

addr contents
0400  6401     / did anything get typed on the second terminal?
0401  5200     / no, ask again
0402  7200     / clear the AC
0403  6406     / yes, read it into the AC
0404  6416     / yes, now output it to the second terminal
0405  6411     / did the terminal respond yet?
0406  5205     / no, ask again
0407  5200     / yes, go wait for the next character


I hope this helps,

-- steve


Clem Cole

unread,
Jun 1, 2023, 4:32:08 PM6/1/23
to Jay Stainbrook, PiDP-8
Jay,

As Steve said - this is a pretty broad request.  I had started to reply and had some of the same info, that Steve did so I pulled that all out.  But I wanted to take this back a level to help explain why its so opened ended and maybe offer you something to think about as you plan your project.

There are really two parts to your question ... a) what peripherals and how they are emulated on the PDP-8 and b) how the RPi will present external data such that simh can read/write it and thus offer it to the emulated peripherals.

As for part one, to see what devices are emulated, you do a show device command to simh. You will see something like this:
sim> show device
PDP-8 simulator configuration

CPU     idle disabled
TSC     disabled
FPP     disabled
CLK     60Hz, devno=13
PTR     devno=01
PTP     devno=02
TTI     KSR (UC, MARK parity), devno=03
TTO     KSR (UC, MARK parity), devno=04
TTIX    lines=4, devno=40,42,44,46
TTOX    devno=41,43,45,47, 4 units
LPT     devno=66
RK      devno=74, 4 units
RL      disabled
RX      RX8E, devno=75, 2 units
DF      devno=60-62
RF      disabled
DT      devno=76-77, 8 units
TD      disabled
MT      devno=70-72, 8 units
CT      disabled


Note that not all the devices listed/found in Table 9-2 on Page 9-33 of the 1973 Small Computer Handbook are there.
In particular, there is no BB08/DR8/AM8/AD8, described earlier in the book, which, besides sync/async serial, were the traditional ways external "things" might have been interfaced to the PDP-8 in say a laboratory setting.

As you can seem, you have an emulated LE8  line printer simh LPT device (which is write-only) and DP8 serial port muxes simh TTIx/TTOx devices (read-only on TTIx and write-only TTOx).   More details can be found at: https://github.com/open-simh/simh/tree/master/doc in the Word documents (start with the faq and the PDP8 documents).   There is also a help command on simh which can be useful, although it is sometimes a tad light and, unless you already grok what it's saying, can be less than it probably should/needs to be [the OpenSIMH SC folks (which I am one) know this and updating/adding tutorials is on the ToDo list behind some other things].

On the Host RPi, you have USB and Ethernet (and some small amount of built-in serial - which I will ignore).

simh offers a command: attach which allows you to splice between a Unix file and an emulated device.
For instance, to get output from your session:  attach lpt /tmp/outfile.txt
will create a traditional UNIX text file (/tmp/outfile.txt) of everything that is written to the LPT: device during the session.

Steve explained how to associate a telnet port to one of the serial ports on the DP8, and how to program the PDP-8 to see the data presented to it. But besides using Ethernet/TCP from the Unix side you can use directly attached HW also.

There is another simh command to: show serial, which will list the serial ports that SIMH sees in /dev on the RPi and are available to be opened by simh.  On the RPi, if you add a USB to serial port cable such as one based on the Prolific PL23xx chips or the FTCI FT2232 chips; they are likely to show up in Raspian as /dev/ttyUSBx.  Thus they should be seen with show serial and can be associated with the PDP-8 simulated devices with the attach command. [I'll not explain why in this email - but I recommend staying away from cables made with some of the other chipsets if you want the path of least resistance].

So ... you want to try some real-world style PDP-8 programming -- you can take something like an Arduino, interface it to something tangible (like an LED or switches), and have the Arduino send the information from/to the USB to serial port cable on the RPi.  You can pick the LE8 or the DP8 emulation.

That said, other than running out of GPIO's that Oscar has already used for the blinkenlights, there is nothing stopping you from modifying SIMH to add support for another device. I believe that a number of people, such as I have done this - in my case with with a crude DR-11/C PDP-11 emulation that was specific to some very old project I had in school. But, that is going to take surgery to the simh after you ensure the RPi can talk correctly to your external device with its GPIOs.

 


On Thu, Jun 1, 2023 at 12:56 AM Jay Stainbrook <jaysta...@gmail.com> wrote:
Hi, I have a pidp8 up and running and have been playing around with assembly and would like to try and use it to control another device.  I was hoping to set up a simple virtual "device" just to get it interacting with the PiDP8 and the IOT commands.  Can somebody point me in the right direction on where to start?  I'm just looking for some rough guidelines on what would be involved.  Thanks!

--
You received this message because you are subscribed to the Google Groups "PiDP-8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-8+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-8/358a66cd-e25f-4f64-8d46-e146bf6c7640n%40googlegroups.com.

Jay Stainbrook

unread,
Jun 1, 2023, 10:41:37 PM6/1/23
to PiDP-8
That's great, thank you both, that answers my question.  I wasn't very specific but I ultimately want to control a serial device, so attaching the serial to the ttix in simH solves the problem.  I was totally overthinking it.  

Jay Stainbrook

unread,
Jun 9, 2023, 11:10:02 PM6/9/23
to PiDP-8

I can now control most serial devices with the pidp-8 and a usb-serial converter.  However, the specific device I want to control needs a positive voltage on the DTR line.  I believe it uses it for power.  When connected to a PC I measure a continuous positive voltage of 7 volts on DTR and can control the device via the USB to serial cable.  Connected to the pi I measure  a negative ~ 11 volts on DTR.  I think that is what is preventing communication (technically preventing the device from powering itself).  Is there a way to configure the ttyUSBx device to output a positive voltage on DTR or am I looking at a hardware solution, tying the DTR to a power source?
Reply all
Reply to author
Forward
0 new messages