This is the second part of the project to develop the simplest possible program on PDP11. In a previous post I created a program to decrement a register value to zero. This post extends this program to view the current value of the register being decremented on the display panel.
Step 1: Accessing the display panel
The control panel is accessed using a specific memory address, 777 570. This is called the "Control Switches and Display Register". If you read this value, you will obtain the current value of the control switches on the panel. If you write to this value, whatever you write will be displayed on the "Data" lights on the front panel.
Step 2: Adjusting the program to display the current value
Only a very small adjustment to the program developed previously is required to display the result to the panel. Here's the amended program:
set cpu 11/70,4M
;set realcons=localhost
set realcons panel=11/70
set realcons interval=8
set realcons connected
D 1000 MOV #100, R0
D 1004 MOV R0, #177570
D 1010 DEC R0
D 1012 BPL 1004
D 1014 HALT
RESET ALL
SET CPU IDLE
D PSW 000340
D PC 001000
The only new line is the following:
D 1004 MOV R0, #177570
This line deposits in instruction into memory address 1004 to move the value of R0 into the Control Switch and Display Register. The other memory locations in the program need to be updated to accommodate this new instruction but otherwise the program is exactly the same.
Step 3: Running the program
The program is run in exactly the same way as described in the previous post on this topic. As you step through the program you will note two things;
The "Data" display on the panel will contain the current value of R0 and every time you step through the decrement loop, this value will be reduced by one.
The "Address" display on the panel will contain the current value of the Program Counter, in other words the address of the next instruction to be executed.
Conclusion
It was a very simple extension to the previous program to show a data value on the panel.
Comments