Programming the PDP-15

Parent Category: Projects Category: BlinkenBone panel simulations Written by Administrator

The PDP-15 distributions at GitHub comes with two software packages:

If you want to write own programs, you need a MACRO-15 assembler or a PDP-15 FORTRAN. There are no cross-assemblers running on modern hardware, so XVM/DOS is used to development a small assembler program.

Paper tape FOCAL

FOCAL is a BASIC-like interpretative arithmetic language. It can be run from a paper tape strip without need for any additional software. In this it resembles the BASIC ROM interpreters of early micro computers (PET, Apple II): here the ROM is made from paper holes instead of transistor cells.

To boot the PDP-15 from papertape just execute the "pdp15_focal" batch file. Normally pressing the READ IN key is necessary, but we're cheating here, for your convenience.

The manual is "Focal Programming Manual PDP-15 Systems (Oct 1970, DEC-15-KJZB-D).pdf".

http://www.ibm.com/developerworks/library/os-emulatehistory/ has a simple demo. They enter and run this program:

*01.10 ASK "WHAT YEAR WERE YOU BORN?", BORN 
*01.20 ASK "WHAT YEAR IS IT?", YEAR
*01.30 SET AGE=YEAR-BORN
*01.40 TYPE "YOU ARE ", AGE-1, " OR ", AGE, " YEARS OLD.", !
*GO
WHAT YEAR WERE YOU BORN?:1964
WHAT YEAR IS IT?:2010
YOU ARE 45.0000 OR 46.0000 YEARS OLD.
*

Not too impressive, but at least the math is correct. See here a walk-through:

 pdp 15 focal small

 

XVM/DOS - editing and assembling

This software package is the one distributed with SimH itself. Primary focus for them is booting XVM/RSX, with RSX/DOS only acting as boot step. But since I still panic when I see the "MCR>" prompt, I choose XVM/DOS as development environment.

The XVM/DOS is quite mystic too, but not too complex. Docs are all at bitsavers. Here we need:

So now follow me stumbling through the pits of a completly unkown user shell (PDP-15 old-timers, please don't laugh!)

A login is possible, but not necessary.

File handling: DIR, DELETE, RENAME

There's no "DIR" command. To list files, PIP must be used:

$PIP
PIP XVM V1A000
>L TT_SY
     01-JAN-79
 DIRECTORY LISTING  (SCR)
 110710 FREE BLKS
     10 USER FILES
    320 USER BLKS
 BUILD  XCT       1  13-JAN-99
 BUILD  XCU      33  13-JAN-99
 CODE   SRC     105  13-JAN-99
 RSXPAT XCT       1  13-JAN-99
 RSXPAT XCU       1  13-JAN-99
 RSX    BAT     153  13-JAN-99
 HALT   SRC       1  01-JAN-88
 CLOSE  HAL       1  01-JAN-88

>^C
XVM/DOS V1A000
$

There is also no RENAME nor a DELETE under XVM/DOS. These can be called from within the editor!

Editing texts

The text editor is line oriented, of course. There is an EDIT mode to issue commands, and an INSERT mode to write text. Features like BLOCK mode, INPUT file and OUTPUT file are there to deal with devices like tape, and with limited memory usage.

Call:

$EDIT

EDITOR XVM V1A000
>

Most commands in EDIT mode have a single-letter form:

Command 
 Short
Description
DELETE   CALL DELETE INPUT <filename> <ext>
Note the space between <filename> and <ext>A file is deleted from disk. Works only before any editing command!
RENAME  

CALL RENAME INPUT <filename1> <ext1> <filename2> <ext2>
Rename a file from <filename1> to <filename2>

OPEN  

OPEN <filename> <ext>
Loads a file from disk

CLOSE   CLOSE [<filename> <ext>]
Saves a file to disk. The name can be changed.
QUIT ^C Exit editor.
INSERT <CR> In EDIT mode, the ENTER key switches to INSERT mode. Then text can be typed
EDIT <CR>
^P
Ctrl-P leaves the INSERT mode, back to EDIT mode. Also does a single <CR>: you can not simply enter empty lines.
TOP T Make the top most line current (goto the virtual line before the first one)
NEXT <n> N <n> Go down n lines.
To goto an absolute line number, use
T
N <line#>
PPRINT P Display current line
PRINT <n> P <n> List (print) the <n> next lines, new current lin is last printed.
INSERT I <text> Insert a new line <text> after the current line. Notice the <space> after "I".
REPLACE R <text> Replace the current line with <text>. Notice the <space> after "R".
DELETE D Delete the current line

 

 Running the MACRO-15 assembler

Call:
$MACRO
 MACRO XVM V1A000
>

After the ">" prompt, a "command string" must be entered. It is of the form
<OPTION> <OPTION>←<filename>

Options are single letters separated by spaces. Interesting ones:
L   create listing
N   number lines decimal
A   print symbols

And yes, the ASR-33 teletype had an "←" symbol on its keyboard, don't you have one?
No problem: the "←" is today displayed as the underline "_".

So an assembler call may look like this (the program  "HALT SRC" contains only a single HALT opcode):

$MACRO
 MACRO XVM V1A000 >A L N_HALT  END OF PASS 1
PAGE   1     HALT   SRC
   1                                    / DEMO PROGRAM: JUST A HALT
   2        00100 A                     .LOC    100
   3        00100 A 740040 A            HLT
   4                000000 A            .END
SIZE=00101     NO ERROR LINES
PAGE   2     HALT   SRC
.CLEAR  MACRO      .CLOSE  MACRO      .DLETE  MACRO      .ENTER  MACRO
.EXIT   MACRO      .FSTAT  MACRO      .GET    MACRO      .GTBUF  MACRO
.GVBUF  MACRO      .INIT   MACRO      .MTAPE  MACRO      .MTRAN  MACRO
.OVRLA  MACRO      .PUT    MACRO      .RAND   MACRO      .READ   MACRO
.RENAM  MACRO      .RTRAN  MACRO      .SEEK   MACRO      .SETUP  MACRO
.SYSID  MACRO      .TIMER  MACRO      .TRAN   MACRO      .USER   MACRO
.WAIT   MACRO      .WAITR  MACRO      .WRITE  MACRO      .XVMOF  MACRO
.XVMON  MACRO
 MACRO XVM V1A000
>

The "running light program"

Now that we can assemble, the "Hello world" of BlinkenLight panels is next. It loads the pattern of the DATA switches into the accumulator AC, then shifts it right and HALTS. On CONT another shift is done, and so on.

        / "RUNNING LIGHT" PROGRAM
        / ROTATES THE PATTERN OF THE DATA SWITCHES RIGHT ON EACH CONT
        / SET REGISTER SELECT TO "AC" TO SEE PATTERN.
        / TRY "CONT" WITH AUTO REPEAT!
        
        .LOC    100 / SET POSITION IN MEMORY

START   LAS             / LOAD DATA SWITCHES INTO AC
LOOP    RAR             / ROTATE AC AND LINK RIGHT
        HLT             / WAIT FOR CONT
        JMP     LOOP    / AGAIN
        
        .END

Assembling - a complete walk-through

1. Boot

PDP-15 simulator V4.0-0 Beta  REALCONS        git commit id: $Format:
Listening on port 2311
Searching realcons controller "PDP15" ...
Connecting to host localhost ...
REALCONS PDP15, host="localhost", host panel="PDP15", interval = 1 msec, connected, boot image filename not set, nodebug,
panel BlinkenBoards driver hardware state = ACTIVE,
server info=
Server info................: PanelsimPDP15_app v1.00
Server program name........: blinkenbone.panelsim.panelsimPDP15.PanelsimPDP15_app
Server command line options: --width 1000 --repeat_rate 8 --register_select 10

To boot XVM/RSX, type "RSX" and press enter at the XVM/DOS "$" prompt.
To return to XVM/DOS, type "DOS" and press enter at the RSX MCR prompt.
To access the extra terminals, telnet to 127.0.0.1 on port 2311 and press Ctrl-T
to bring up the login prompt.
To log off MULTIACCESS, use the TDV command "OFF".
XVM/DOS V1A000
 ENTER DATE (MM/DD/YY) - 01/01/79

PAGE MODE  128K  API ON  XVM ON  SCR
$

 

2. Edit

$EDIT
EDITOR XVM V1A000
>CALL DELETE INPUT LIGHT SRC
>
INPUT
                / "RUNNING" LIGHT PROGRAM
                / ROTATES THE PATTERN OF THE DATA SWITCHES RIGHT ON EACH CONT
                .LOC        100
                LAS                 / LOAD DATA SWITCHES INTO ACCUMULATOR AC
LOOP            RAR                 / ROTATE AC AND LINK RIGHT
                HLT                 / WAIT FOR CONT
                JMP         LOOP   / AGAIN
                .END
EDIT
>CLOSE LIGHT
EDITOR XVM V1A000
>EXIT
XVM/DOS V1A000
$

We saved the new file as "LIGHT SRC".

3. Is the new source file there?

$PIP
PIP XVM V1A000
>L TT_SY
     01-JAN-79
 DIRECTORY LISTING  (SCR)
 110707 FREE BLKS
     11 USER FILES
    321 USER BLKS
 BUILD  XCT       1  13-JAN-99
 BUILD  XCU      33  13-JAN-99
 CODE   SRC     105  13-JAN-99
 RSXPAT XCT       1  13-JAN-99
 RSXPAT XCU       1  13-JAN-99
 RSX    BAT     153  13-JAN-99
 HALT   SRC       1  01-JAN-88
 LIGHT  SRC       1  01-JAN-79
 CLOSE  HAL       1  01-JAN-88

>^C
XVM/DOS V1A000
$

Yes, LIGHT SRC is there!

4. Assemble

$MACRO
 MACRO XVM V1A000
>L_LIGHT
 END OF PASS 1
PAGE   1     LIGHT  SRC
                                / "RUNNING" LIGHT PROGRAM
                                / ROTATES THE PATTERN OF THE DATA SWITCHES RIGHT ON EACH CONT
        / SET REGISTER SELECT TO "AC" TO SEE PATTERN.
        / TRY "CONT" WITH AUTO REPEAT!
    00100 A                     .LOC    100
    00100 A 750004 A            LAS             / LOAD DATA SWITCHES INTO ACCUMULATOR AC
    00101 A 740020 A    LOOP    RAR             / ROTATE AC AND LINK RIGHT
    00102 A 740040 A            HLT             / WAIT FOR CONT
    00103 A 600101 A            JMP     LOOP    / AGAIN
            000000 A            .END
SIZE=00104     NO ERROR LINES
 MACRO XVM V1A000
>^C
XVM/DOS V1A000 $

 

Entering and starting the LIGHT program

Now that we have the binary code of LIGHT, we must enter it into memory. This will destroy the XVM/DOS memory image, but never mind.
From the listing we can see that the SimH commands would be:

sim> deposit 100 750004
sim> deposit 101 740020
sim> deposit 102 740040
sim> deposit 103 600101

But we use the panel now!

 Step  Switches  Cmd switch  Description
 1.   Preparation
 1.1.    STOP  Stop program execution, if running
 1.2.    REG GROUP inactive
 REGISTER SELECT = "OA"
 Display memory address ("operand address") on REGISTER lamps
 2.   Enter data into memory
 2.1.  ADDRESS = 000100
 DATA = 750004
 DEPOSIT THIS  Set memory word at 100 to 750004
 See image below
 2.2.  DATA = 740020  DEPOSIT NEXT  Set memory word at 101 to 740020
 2.3.  DATA = 740040  DEPOSIT NEXT   Set memory word at 102 to 740040
 2.4.  DATA = 600101  DEPOSIT NEXT  Set memory word at 103 to 600101
 3.   Verify data in memory
 3.1.  ADDRESS = 000100  EXAMINE THIS  Verify  word at 100 on MEMORY BUFFER lamps: 750004
 3.2.    EXAMINE NEXT  Verify  word at 101
 3.3.    EXAMINE NEXT  Verify  word at 102
 3.4.    EXAMINE NEXT  Verify  word at 103
 4.   Run 
 4.1.    REG GROUP inactive
 REGISTER SELECT="AC"
 Display accumulator "AC" on LINK and REGISTER lamps
 4.2.  DATA = pattern    Select a data pattern to shift
 4.3.  ADDRESS = 000100  START  Start program at address 100.
 It HALTs at PC=103 and shows the shifted pattern.
 (Set REGISTER SELECT = "PC" to verifyOA
 4.4.    CONT  Next shift, and HALT again, and so on.

 

deposit100=750004 small

Deposit 750004 into address 100

Debugging with Single Step

You can set SING INST and single step through the program with CONT. You have to set the REGISTER SELECT knob to "PC" to see the program counter changing. It should go 101, 102, 103, 101, 102, 103, .... on each CONT.

More fun: REPEAT

You can use the REPEAT feature to automatically fireing CONT events with varying frequency. This works in normal mode and with SING INST!

Just set REPT active and keep CONT pressed !

Excercises to the reader

Attachments:
Download this file (pdp15_hello.lst)pdp15_hello.lst[PDP-15 assembler listing for a "Hello World" program.]2 kB