running scripts?

163 views
Skip to first unread message

Kaladin Light

unread,
May 7, 2024, 5:50:35 PMMay 7
to PiDP-8
So I feel bad for not being able to figure this out... I'm younger than the PDP and not familiar with it.  I've built successfully and ran a few programs via the front panel.  
Now I see some on here where people post stuff like this...
0200      *200

00200  7201  START,  CLA IAC         // Get 1 into the AC
00201  7421          MQL             // Store it in the MQ
00202  7313          CLA CLL IAC RTR // Get 1 into the AC
00203  3231  LOOP,   DCA ACCUM       // Save that value
00204  7404          OSR             // Read the outer loop count from the switch register
00205  7041          CIA             // Negate it because we count up not down in our outer loop
00206  3227          DCA OUTSID      // Save it
00207  1231          TAD ACCUM       // Get the AC back for display purposes
00210  2230  LOOP1,  ISZ INSIDE      // Inner delay loop
00211  5210          JMP LOOP1
00212  2227          ISZ OUTSID      // Outer delay loop
00213  5210          JMP LOOP1
00214  7100          CLL
00215  7701          CLA MQA         // Clear AC and Link and transfer the MQ to the AC
00216  7004          RAL             // Rotate the bit left
00217  7430          SZL             // if we did not rotate into the link skip
00220  7004          RAL             // Rotate again to get the bit back into the AC
00221  7421          MQL             // Store it back into the MQ
00222  1231          TAD ACCUM       // Get the saved AC display value
00223  7010          RAR             // Rotate it right
00224  7430          SZL             // If we did not rotate into the link skip
00225  7010          RAR             // Rotate it again to get it back into the AC
00226  5203          JMP LOOP        // And do it all again
00227  0000  OUTSIDE, 0
00230  0000  INSIDE,  0
00231  0000  ACCUM,   0
             $


ACCUM  0231
INSIDE 0230
LOOP   0203
LOOP1  0210
OUTSID 0227
START  0200

For the life of me I can't figure out how to run this in simh.  I've saved it in /opt/pidp8i/share/save/lights.script but can't seem to reference it at all in simh.  All I see is stuff in docs that say to execute things run DO <file> or EXE <file> but i'm obviously missing something.  I'm sure it's simple so any quick guidance much appreciated.

Vincent Slyngstad

unread,
May 7, 2024, 7:37:22 PMMay 7
to PiDP-8
What you've got there is a source listing.  Someone took source code (roughly what you've got with the first two columns removed), and ran it through an assembler.  The assembler filled in the two columns, which are typically address and value, and created a listing (.LS or .lst) file.  It also created a .BI or .bin file with the binary in it.

You can use the "load" command of SIMH or of OS/8 to load the binary file, or you can use the first two columns to toggle in the program with the front panel.

Hope this helps,

Vince

Steve Tockey

unread,
May 7, 2024, 8:47:02 PMMay 7
to PiDP-8

One place to start is the OS/8 Language Reference Manual available from BitSavers.org


Chapter 3 is on the PDP-8 assembler, PAL-8. There are examples of how to use the assembler and examples of assembly code.

You might also need to learn the OS/8 operating system (which could largely be seen as a precursor to MS-DOS):



I hope this helps,

-- steve

Kaladin Light

unread,
May 7, 2024, 9:38:21 PMMay 7
to PiDP-8
Ok so i can strip the first two columns and save it as a .BI file.  I guess my problem is even simpler.  I don't know how to use the load command to load it.  I mean I can get into simh and type load light.bi but it has no idea light.bi exists on the raspberry pi file system.  do i have to add light.bi to the disk that simh is loading as its virtual disk?  I've booted it up normal which means it was running 0.script in boot.  and i know I can toggle IF switches to load 1.script, 2.script etc.  However that leads to another question.  There is a hello.script in boot.  How would I run that?  
I am reading more about OS/8 and how it works but just hoping someone can spell out the basic step here i'm missing so I can play around while continuing to read.  

Kaladin Light

unread,
May 7, 2024, 9:42:19 PMMay 7
to PiDP-8
for instance this doc section 3.1 http://simh.trailing-edge.com/hp/docs/simh_doc.pdf tells me what you said.  to load a program run LOAD <prog>.  However it too doesn't say how i get the program into SIMH to even see it.  It lives on my raspberry pi filesystem.  do i just put in a certain directory that simh can see?  If I type DIR simh see's a bunch of stuff.  how did all that get on its "Disk"?  I want to add my binary file there so I can LOAD it.

Vincent Slyngstad

unread,
May 7, 2024, 9:48:18 PMMay 7
to PiDP-8
Well, source files have generally .PA or .pal extensions and are text files, not binary files. So, no, you can't just type it in and then LOAD it. You'd need an assembler as an intermediate step.  Palbart, PAL8, something like that.

Vincent Slyngstad

unread,
May 7, 2024, 9:53:35 PMMay 7
to PiDP-8
Getting stuff in and out of PDP-8 file systems is covered somewhere in the PiDP docs. I don't do it that way, so I don't remember offhand. (os8copy or something like that.)

SIMH has a LOAD command that loads from the RasPi file system; for that you'd use PALBART or similar.  The PAL8 assembler in OS/8 needs the file in an OS/8 file system. That's a bit more involved, and I'm sure there are folks here who can help.

Kaladin Light

unread,
May 9, 2024, 4:21:11 PMMay 9
to PiDP-8
well when i made the above script just assembly I figured out how to paste it into simh following these steps.
.CREATE TEST.PA
*I
<paste>
^L
*E

.
.PAL TEST.PA
.LOAD/G TEST

and it worked.

next i'm going to try to get these 3 files from tockey at the end of this post https://groups.google.com/g/pidp-8/c/BZjTAxHp7ec/m/_amAsexHAQAJ and ideally just set the bi to run with front panel switches like a 5.script or something.  

Vincent Slyngstad

unread,
May 9, 2024, 5:26:25 PMMay 9
to PiDP-8
Excellent!

I should correct myself; .bin is usually shortened as .BN.  The .BI extension is for batch scripts, IIRC.

Mike Katz

unread,
May 10, 2024, 9:28:28 AMMay 10
to Kaladin Light, PiDP-8
Line 202 does not put 1 into the AC

CLA    Clears the ACi
CLL    Clears the link
IAC    Increments the AC to 1
RTR   rotates 1 bit two places to the right going through the link register.

This effectively puts 40008 into the AC.

Here is a program I wrote to do something similar.  It rotates a through the AC back and forth (like a Cylon from Battle Star Galactica) with the speed set by the switch register.
It assumes the AC is clear on start (pressing clear/cont would do that).

    1        0100          *100
    2 00100  7001  START,  IAC             // Start with 1 in the AC
    3 00101  4113  LOOP,   JMS DELAY       // Wait for a bit
    4 00102  7004  SKIP1,  RAL             // Shift that bit left
    5 00103  7420          SNL             // Did we shifted the bit into the link?
    6 00104  5101          JMP LOOP        // No:  Keep looping
    7 00105  5107          JMP SKIP        // Yes:  Skip the delay and rotate the bit back
    8                                      //       This instruction is here because the 8/E
    9                                      //       Does not have the link register light
   10                                      //       on the same row with the accumulator lights
   11 00106  4113  LOOP2,  JMS DELAY       // Delay
   12 00107  7010  SKIP,   RAR             // Shift the bit right
   13 00110  7420          SNL             // Did it rotate into the link?
   14 00111  5106          JMP LOOP2       // No:  Rinse and repeat
   15 00112  5102          JMP SKIP1       // See the PDP-8/E Command above
   16              //
   17              //  Start of Delay Subroutine
   18              //
   19 00113  0000  DELAY,  0               // Entry Point
   20 00114  7421          MQL             // Save the bit position in AC in the MQ
   21 00115  7404          OSR             // Read the Switch Register
   22 00116  7040          CMA             // Compliment the AC because we are counting up not down
   23 00117  3127          DCA TEMP1       // Save the outer loop counter
   24 00120  7521          SWP             // Restore the bit into the AC from the MQ (MQ destroyed)
   25 00121  2126  LOOP1,  ISZ TEMP        // Increment the inner loop counter
   26 00122  5121          JMP LOOP1       // Loop until it is zero
   27 00123  2127          ISZ TEMP1       // Increment the outer loop
   28 00124  5121          JMP LOOP1       // Loop both inner and outer loop until the outer loop is zero
   29 00125  5513          JMP I DELAY     // Return from subroutine
   30
   31 00126  0000  TEMP,   0               // Counter for outer loop
   32 00127  0000  TEMP1,  0               // Counter for inner loop
   33                                                        $
--
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/3602b44a-223d-49a7-8178-f8a9899d3d17n%40googlegroups.com.

Kaladin Light

unread,
May 13, 2024, 2:26:21 PMMay 13
to PiDP-8
oh cool, i'll paste this in and see how it looks.  Do you happen to know how to get it running in one of the startup scripts?

Steve Tockey

unread,
May 14, 2024, 3:32:00 PMMay 14
to PiDP-8

There seems to be a fundamental misunderstanding about the different, and relevant, file systems at play. I'm not at all intending to insult, I'm just pointing out that a lot of the confusion seems to be rooted here. So:


1) The Raspberry Pi has its own Linux-based file system. You seem to already be reasonably familiar with that. Great.


2) OS/8 has its own file system as well. There is essentially no relationship between the OS/8 file system in the PiDP-8/I and the Raspberry Pi's file system other than that simulated storage media (e.g., hard disks, floppy disks, DecTapes, etc.) in OS/8 appear as themselves separate,  unique files in the Raspberry Pi file system.  As one specific example, the default OS/8 system disk (RKA0: and RKB0:) appears as  /opt/pidp8i/share/media/os8/v3d.rk05 in the Raspberry Pi file system. As another specific example, an OS/8 DecTape (e.g., DTA0:) could appear as /opt/pidp8i/share/media/os8/cc8.tu56 in the Raspberry Pi file system.


3) If you look at any of the boot script files in, I believe, /opt/pidp8i/share/boot you will see how the SIMH attach command (often abbreviated "att") connects a simulated media file in the Raspberry Pi file system to a "storage device" in OS/8. For example:

att rk0 /opt/pidp8i/share/media/os8/v3d.rk05

tells SIMH to treat the data in the Raspberry Pi file named /opt/pidp8i/share/media/os8/v3d.rk05 as devices RKA0: and RKB0: in OS/8, while the command:

att dt0 /opt/pidp8i/share/media/os8/cc8.tu56

tells SIMH to treat the data in the Raspberry Pi file system named /opt/pidp8i/share/media/os8/cc8.tu56  as device DTA0: in OS/8


4) There are a number of ways to move files files back and forth between the Raspberry Pi file system and the OS/8 file system:

4a) Maybe one of the most straightforward could be discussed here: https://tangentsoft.com/pidp8i/file?name=doc/os8-cp.md&ci=tip

4b) My personal favorite way is to use the simulated paper tape reader (PTR) in OS/8. First, make a .txt file in the Raspberry Pi file system that contains the text (e.g., the source code for some program) that you want to import into the PiDP-8/I, Call that file /opt/mycode/myfile.txt for sake of illustration. Then, from inside of SIMH while running OS/8:

.           (note: this is the OS/8 prompt)
.
^e      (note: you type control/e on the SIMH console keyboard, this drops you from OS/8 into SIMH itself
simh> attach ptr /opt/mycode/myfile.txt      (note: this connects your Rasping text file to the OS/8 PTR: device)
simh> go    (note: this returns you from SIMH back to running OS/8)

.R PIP        (note: this runs the OS/8 system program PIP, aka Peripheral Interchange Program)
*MYFILE.PA<PTR:/A    (note: * is the PIP prompt, MYFILE.PA is the file name you want to use in OS/8, PTR: is where you are going from, the /A tells PIP it is ASCII data)
^             (note: OS/8 is prompting you to load the tape into the reader, but you did that with the SIMH attach, command earlier, so now just hit any normal key on the keyboard)
*^C         (note: when the simulated paper tape read is done, PIP prompts you for another file to interchange, you type control/c to tell PIP there are no more)

.             (note, you are now back at the OS/8 prompt with the file DSK:MYFILE.PA that you can deal with as an OS/8 file)

The difficulty here is that the end-of-line delimiter in Raspberry Pi (a LINEFEED character, ASCII 212) is different than in OS/8 (a RETURN character, ASCII 215) so you will need to further massage the file using either the OS/8 editor program TECO or a separate, custom utility program like LF2CR.SV that I can supply to you if you want. I won't provide the details here unless you really want to go this route.

After fixing the end-of-line delimiter, the content of your original Raspberry Pi file /opt/mycode/myfile.txt is also in an OS/8 file named DSK:MYFILE.PA. You have complete freedom to specify other OS/8 disks and DecTapes like RKA1:, RKB1:, DTA0:, DTA1:, etc. You can also use other file extensions, like .BA for BASIC source code, .FT for FORTRAN code, and so on. You have the full capabilities of your OS/8 system, as described in the earlier-referenced OS/8 Handbook to use the programming languages described in the earlier-referenced OS/8 Language Reference Manual.

Either option 4a or 4b would be the most realistic recreation of how code development and execution was done in a real PDP-8 once the data is in the OS/8 file.


5) If you have the assembly listing of a program like in your first message, you can manually toggle it into the PiDP-8/I using the front panel. You will need to learn Octal notation if you don't already know it, but it's quite easy in reality. Just understand that the left-most column is the Memory Address and the column immediately to the right of that is the memory contents to load at that address. See the 1970 edition of the Small Computer Handbook (https://bitsavers.org/pdf/dec/pdp8/handbooks/SmallComputerHandbook_1970.pdf), Chapter 2 for descriptions of all of the front panel switches and lights. The down sides here are that this only works for assembler code (no other languages), it is inconvenient for larger programs, and it's non-trivial to save what you did to be able to re-run it again later without re-entering the whole program through the switches again.


6) you can also enter assembled octal code using the SIMH "deposit" (often abbreviated as just d) command. Simply, when SIMH is running the PiDP-8/i, use control/e to drop into SIMH mode and, for example, for your first program above:

^E
simh> d 00200  7201
simh> d 00201  7421
simh> d 00202  7313

...        (note: here you would be entering all. of the other memory contents between addresses 00202 and 00227)
simh> d 00227  0000
simh> d 00230  0000
simh> d 00231  0000
simh> go 00200

Again, the issues here are that it only works on assembler code and that it's a bit inconvenient to have to re-type all of this to load the program when you want to re-run it later. On the other hand, the SIMH dump command appears to be able to save what you entered for later use using the SIMH load command. The key here is to understand that the save-ed and load-ed files are in the Raspberry Pi's file system, and not at all in the OS/8 file system.


7) You can take all of the SIMH commands from option 6 and enter them into a text file in the Raspberry Pi file system, for example, /opt/mycode/myscript.script, as in:

d 00200  7201
d 00201  7421
d 00202  7313

...        (note: here you would be entering all. of the other memory contents between addresses 00202 and 00227)
d 00227  0000
d 00230  0000
d 00231  0000
go 00200

Then, with the PiDP-8/I in SIMH command mode (e.g., after typing control/e), you can use the SIMH "do" command to execute your script:

^e
simh> do /opt/mycode/myscript.script

If you have the final go 00200 command in the script the do command will immediately load your program and execute it. If you don't put the go 00200 command into the script then you can manually type the go 00200 to the SIMH prompt, as in:

^e
simh> do /opt/mycode/myscript.script
simh> go 00200

Finally, if you first put the front panel Sing Inst switch (farthest right) on, then you can:

^e
simh> do /opt/mycode/myscript.script
simh> go

then put the Sing Inst switch back off, then put 000200 into the front panel switch register, then hit Load Add, then Start. An advantage of doing things this way is that these scripts are easily re-loadable using the SIMH do command.

8) Finally, of course, is the use of the SIMH Load command as Vincent Slyngstand mentioned above but that does mean you have to first prepare the binary image file inside of OS/8 and then export it (e.g., via PIP and the simulated PTR: device or use PALBART) and seems to me to be pretty unnatural if you are wanting the "real PDP-8" experience..


I hope all of this helps,

-- steve

 

Kaladin Light

unread,
May 16, 2024, 1:05:33 PMMay 16
to PiDP-8
thank you for taking the time to write all that out.  I did understand 1, 2, 3 but 4 gives me more to read.  I do know how to toggle things into the front panel and yes familiar with octal quite well so no issues with 6 or even 7 now.  I guess what i'm trying to do is take one of the cool blinken lights type programs I have ( I have a few now ), and have a linux script kick off starting simh and the pdp8 switches are such that it will load a specific file which will just run that program.  maybe some way i can create that based on 4a and maybe that's the idea of number 8.  
but yes you are correct, in this case i'm not looking for the real pdp 8 experience.  My plan is to learn enough about front panel so show people a simple program using just the front panel ( this is done ).  Show a more complicated program running to those people (which I'll use #7 for). and finally, having a linux script run every hour that blinks the lights for 10 min or so by starting simh with some blinking lights code to run then after X time just doing a pidp8 stop.  I think 8 might be best for that part.

Steve Tockey

unread,
May 16, 2024, 3:36:42 PMMay 16
to PiDP-8
If your end goal is to have the PiDP-8/I just run some interesting blinkenlights simulations kicked off by a Linux script then Option 7 should be your best bet. Your Linux script could fire up SIMH where the command line argument is a PiDP-8/I script file to execute as it starts up. You could point this argument at any one of several Option 7 style scripts to get different blinkenlights patterns. You shouldn't actually need the front panel switches set in any particular way if you are firing off your own scripts. Firing off SIMH Oscar's "normal" way does pay attention to the front panel switches but that's not required. You should be able to set up your own separate start up pathways using the SIMH command line argument directly.

This should be a workable experiment for you to try:

1) Set up a RasPi directory of one or more of your own Option 7 style SIMH scripts, say for example /opt/myscripts, where each of those scripts do end with the go 00200 command.

2) I'm not 100% sure where the pidp8i.exe file is, but from the RasPi OS prompt cd into that directory then say

./pidp8i /opt/myscripts/nameofascript.script

then you should be able to directly fire up the PiDP-8/I running your own Option 7 style SIMH script--bypassing the front panel switches.

This experiment should work but I'm not at my PiDP-8/I(s) to test it for now. if it doesn't work, let me know if you can't figure out on your won what I did wrong.


-- steve
Reply all
Reply to author
Forward
0 new messages