Cannot boot TOPS‑20 from the panel switches

Open Beginner friendly
#32 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
awk, shell

Research direction

Start in pdpcontrol.sh at the awk lookup that matches the scansw10 result against systems/selections. Reproduce with the 0200 entry and pdpcontrol start, then verify that the lookup selects tops20 rather than hills-blinky. Done means the panel value matches the selection entry as text without breaking the fallback.

Written by the indexing model from the issue text.

Description

Overview

In pdpcontrol.sh of PiDP‑10, the logic that matches the panel switch value (the return code of scansw10) against systems/selections fails to detect the correct entry.
As a result, even when the panel switch is set to 0200 (TOPS‑20), the system always falls back to hills-blinky instead of booting TOPS‑20.

Cause

The comparison in awk is performed as a numeric comparison, not a string comparison.

In awk, a number with a leading zero (e.g., 0200) is interpreted as octal:

0200 (octal) = 128 (decimal)

$1 in systems/selections is the string "0200"
→ when coerced to a number, it becomes 200 (decimal)

Therefore:

128 ≠ 200
The comparison fails, and the fallback value (hills-blinky) is selected.

Problematic Code (pdpcontrol.sh)

sel=`awk '$1 == '$sys' { sys = $2; exit } END { if(sys) print sys; else print "hills-blinky" }' < /opt/pidp10/systems/selections`

Here:

$1 == 0200
is treated by awk as a numeric (octal) comparison, not a string comparison.

Steps to Reproduce

Ensure systems/selections contains the entry:

コード
0200 tops20
Set the panel switch to 0200.

Run:

pdpcontrol start
The system incorrectly selects hills-blinky instead of tops20.

Proposed Fix (use string comparison)

Pass the shell variable to awk as a string, ensuring $1 is compared as text:

sel=`awk '$1 == "'$sys'" { sys = $2; exit } END { if(sys) print sys; else print "hills-blinky" }' < /opt/pidp10/systems/selections`

This forces:

$1 == "0200"
which correctly matches the entry in systems/selections.

Dominant language
C
Stars
47
Forks
11
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from obsolescence/pidp10

All issues in obsolescence/pidp10

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.