Playing with the PDP-11/40
After starting the script "pdp1140.bat|sh", two application windows appear on your desktop:
- The SimH command window, which is also the serial console of the simulated PDP-11.
After start, it shows the boot prompt of a RT-11 operating system.
- The graphical panelsim window.
Initially it shows heavy blinking, as the simulated machine is executing a code loop while it waits for your input.
Arrange these two windows, so you can see both. (And you don't need to know much about PDP-11's, the RT-11 operating system or Blinkenlight panels.)
You now surely want to "Fingergrabbing and pressing the cnoeppkes from the computer" (see the jargon file). Well, try this:
- At first you must activate HALT to stop code execution. On a running PDP-11, all other console switches are ignored.
- Execute single steps through the input code loop, by flipping CONT several times.
- Continue code execution by de-activating HALT and press CONT again.
- Halt the machine again.
- Examine the memory: Enter a address with the data switches, then press LOAD ADRS. After that you may toggle EXAM multiple times. See data appear in the DATA LEDs, and see the address incrementing (always by 2) in the ADDRESS LEDs.
- Deposit (write) something into memory: Enter an address, then do LOAD ADRS. Enter some data, then flip the DEP switch. The data is written into memory. Change the data, and press DEP again to change more memory cells. After that, you want to EXAM than, as described above.
(It very likely that this will ruin the operating system code :-)
Hint: Watch the SimH command window: it will reflect all operations made on the panel !
After destructing RT-11, it's time for some more constructive work.
Let's enter and run the "Hello world" program for Blinkenlight front panels: a running console light!
The corresponding PDP-11 assembler program was compiled with the MACRO-11 cross assembler.
See here spurce code, binary code, and how to enter it over the Blinkenlight panel:
PDP-11 assembler program:
operation on switches
Check this program again with EXAM operations! While converting octal digits to switch positions, you will make much more errors than you expect (we'll, at least I did ...).
After cross-checking, start the program. You should see a single light running in DATA from right to left.
The trick is using opcode "reset": "Reset" initializes all devices, it needs 70 milliseconds = 1/14 second to do this. In this time, the content of cpu register R0 is visible on the DATA LEDs.
To get a binary counter instead of a running light, replace this line
001004 006100 rol r0 ; data switches=006100, DEP
001004 005200 inc r0 ; data switches=005200, DEP
Here comes another demo you can play: a little MACRO-11 assembler program, which adds the first <n> natural numbers:
sum = 1 + 2 + 3 + ... + n.
See the attachement for a complete listings and instructions how to toggle it in and let it run. Follow these basic steps:
- Toggle in the program starting at address 1000 (octal). It is just 11 opcodes long.
- verify it by EXAMing all opcodes.
- Enter a value for <n> over the SR data switches. Try at first n=100, which is octal 144.
- Start the program from address 1000. It will calculate the sum and HALT then. The resulting sum is show on the DATA LEDs. For n=100, the sum 1 + 2 + 3 .. 100 = 5050, (octal 11672)
- Enter another value for <n> as in step 3, then CONTinue program execution.
(You can tell your audience the story behind: The sum 1 + 2 + 3 + .. + n can quickly be calculated as sum = n*(n+1)/2. This formula was discovered by the 8-year old Carl Friedrich Gauss. He was forced in school to add the numbers 1+2+3+..+100, because a lazy teacher wanted to keep the kids occupied for an hour. Gauss quickly reordered the numbers to
(1+100) + (2+99) + (3+98) ... (50+51) = 101 * 50 = 5050.
and had the result after a few seconds. Hence this formula is named "Little Gauss".