PiDP-8/I SoftwareView Ticket
Not logged in
Ticket UUID: 6c1f29ab596fd916a330289f3b702e1f982206aa
Title: Merge scanswitch and pidp8i-test
Status: Verified Type: Feature Request
Severity: Minor Priority: Medium
Subsystem: scanswitch Resolution: Open
Last Modified: 2017-02-03 15:00:58
Version Found In:
User Comments:
tangent added on 2016-11-30 20:03:54:
These two programs do much the same sort of thing, only with different outputs. One returns the value of a particular switch as an exit code, while the other displays the switch outputs on the console.

Since there are plans afoot to add operating modes to pidp8i-test to make it skip certain tests, why not also add one that makes it check the switches that scanswitch does and exit the same way? That way a single core can be used both interactively and in scripts.

tangent added on 2017-01-21 08:11:20:
exec() this test from the simulator when SING_STEP + SING_INST + EXAM is given, mnemonic "examine," as in "test".

Accept SING_STEP + SING_INST + CONT to re-exec pidp8i-sim from pidp8i-test, mnemonic "continue with simulation." It needs to be a different combo anyway, because the Pi can probably launch and start pidp8i-test before the user releases the EXAM switch.

tangent added on 2017-01-21 08:49:54:
Proposed command line switch additions:

    -s N   Read the state of switch N, which can either be an index from the left edge of the panel or a switch name (e.g. -s SR3)
    -S     Enter a loop displaying the current switch states on stdout
    -c N   Turn on all LEDs in column N, numbered from 0 at left edge of panel
    -r N   Ditto, but for rows from the top
    -l X,Y Turn on LED at column X, row Y
    -a     Turn on all LEDs
    -q     Run silently. Given with -s, indicates switch state as an exit status.
    -p N   Display pattern #N (see next comment)
    -P     Select pattern from DF switches

The -c, -r and -l options can be given multiple times, and they add together. So, you could draw a box with a dot in the middle with "-c 6 -c 19 -r 0 -r 4 -l 8,2". (Columns 0 thru 5 are for STEP, IF, DF, and LINK, 6-19 are for the bulk of the registers, and 20-22 are for the instruction decoding and processor mode lights.)

Given all of this, we can replace the current timed test with a shell script, perhaps called `pidp8i-autotest`:


    echo Lighting up all LEDs...
    $tprg -a
    sleep 5

    for r in seq 0 4 ; do
       echo Lighting up row $r LEDs...
       $tprg -r $r
       sleep 5

    for c in seq 0 22 ; do
       echo Lighting up column $c LEDs...
       $tprg -c $c
       sleep 5

    echo "Reading the switches.  Toggle any pattern desired.  CTRL-C to quit."
    $tprg -S

tangent added on 2017-01-21 09:28:43:
-P mode above makes the program work something like Deeper Thought, but with our own demo modes, not taken from the existing code.


DF switches select first 8 -p patterns, which are set with PDP-8/I sense, 0 = up, not down:

    000 = semi-random display, with system time selecting interactive, batch, and idle mix
    001 = bouncing ball (mnemonic: 1 LED on: the ball)
    010 = text scroller (no mnemonic)
    011 = snake (mnemonic: 3 LEDs on, default snake length)
    100 = binary clock (mnemonic: 1 o'clock)
    101 = like pidp8i-autotest, but controlled with IF and SR (mnemonic: 101 is "basics")
    110 = Larson scanner (mnemonic: Cylon Number 6)
    111 = all LEDs on (mnemonic: all DF bits on)

Other patterns can be added with -p N where N > 7, run from the command line instead of via -P and set with DF.

Speed is set with IF switches, not SR. IF=0 is "very fast," IF=7 is "very slow." Delays are set per DF mode, since the definition of "fast" may differ for different displays.

SR controls per-demo modes:

    000 = randomness mix
    001 = bounce angle
    010 = select message from a 4096=line catalog, like fortune(1)
    011 = length of snake
    100 = bottom 5 bits of SR add hours to TZ, so 00111 would push MST to UTC
               upper 7 bits do...TBD
    101 = SR != 0 stops iteration and lights columns corresponding to SR settings
    110 = first 2 SR switches control height of LED blob (1, 3 or 5 rows)
              next 4 control width (SR2 selects multiply or divide, next 3 give 1-8x factor)
              remaining 6 control TBD; inverse mode?
    111 = seed for turning off a random subset of the LEDs; "some LEDs on"

Obey the same shutdown and reboot SING_STEP commands as the simulator.

tangent added on 2017-02-03 15:00:58:
Maybe rename the combined program to something like `pidp8i-fp`, with special-case modes selected when argv[0] == "pidp8i-test", which can be installed as a hard link. Don't bother for "scanswitch", since that's an internal program.