Sensory Organs ("SEQ / CMP") and Conditional Branching: From Blind Bombing to Precision Sniping
How comparing two memory cells and conditionally skipping the next instruction endows digital organisms with vision
While Dwarf throws bombs blindly into empty space, a Scanner possesses eyes (the comparison instruction SEQ / CMP)!
Line 2 (SEQ.I @3, $4) compares: - The remote cell pointed to by @3 against the blank DAT #0, #0 template at $4. - If they are equal (empty memory), it skips line 3 (MOV attack)! - If they differ (enemy detected!), it does NOT skip—it executes line 3 (MOV) to snipe the enemy!
🎯 Your Task The scan step A (Left Value) on row 0000 is currently #0. Change it to #8 and press [PLAY] to scan ahead, spot the enemy at 0400, and snipe it!
1. Blind Bombers (Open-Loop) vs. Ocular Scanners (Closed-Loop)
The Dwarf bomber you mastered in Steps 19–21 is relentless, yet completely blind. It possesses no sensory instructions; whether a target cell contains an enemy warrior or empty space ("DAT #0, #0"), Dwarf spends a full clock cycle firing a MOV bomb into it anyway. In control theory, a system that acts without observing its environment is called an Open-Loop system.
In Step 23, you observed an evolutionary leap: the Scanner, equipped with an optical sensory organ—the comparison instruction "SEQ" (Skip if Equal, historically written as "CMP"). - First, the Scanner peers into a distant memory cell. - If that cell is identical to an empty "DAT #0, #0" box, the Scanner SKIPS the "MOV" attack line entirely—saving precious clock cycles and immediately moving on to check the next address! - Only when the distant cell differs from empty memory (meaning an enemy instruction has been spotted!) does the Scanner execute the "MOV" line to snipe the target! In control engineering and cybernetics, using sensory feedback to conditionally trigger action is the hallmark of a Closed-Loop intelligent system.
[0000] ADD.AB #8, $4 ──► 1. Advance scan pointer by +8
[0001] SEQ.I @3, $4 ──► 2. Compare remote cell (@3) with blank DAT ($4 = [0005])
│
├── If EQUAL (Empty space) ──► SKIP Line 0002! Jump straight to [0003] JMP!
└── If NOT EQUAL (Enemy!) ──► Do NOT skip! Execute [0002] MOV to snipe!
[0002] MOV.I $3, @2 ──► 3. Snipe the detected enemy with a DAT bomb!
[0003] JMP.A $-3, #0 ──► 4. Repeat scan loop2. Hardware Architecture of "Skip-Next" Conditional Branching
How does a processor implement a high-level "if (A == B)" statement at the machine code level? In the ICWS-94 architecture, comparison instructions like "SEQ.I A, B" (Skip if Equal) and "SNE.I A, B" (Skip if Not Equal) operate by controlling the Program Counter increment at the end of the cycle: - The ALU fetches the entire instruction word (.I) pointed to by Operand A and compares it against the instruction word pointed to by Operand B. - If the two cells are EQUAL, instead of incrementing the Program Counter by the normal +1, the CPU increments the Program Counter by +2—leaping clean over the very next line of code! - If the two cells are NOT EQUAL, the Program Counter increments by the normal +1, executing the line immediately below.
This exact "Skip-Next-Instruction" branching mechanism was used in iconic historical computers (such as the PDP-8 and PIC microcontrollers) and inspired predicated execution in ARM processors. With a single instruction, "SEQ.I @3, $4" acts as a gatekeeper right above the "MOV" trigger: when scanning empty space, the gate stays closed (skipping MOV); the instant an enemy cell is seen, the gate opens and fires!
3. Tuning Scan Stride and Target Alignment
In Step 23, changing the scan stride on row 0000 from "#0" to "#8" added 8 to the pointer box at Address 0004 (initially #388, becoming #396). When Line 2 ("SEQ.I @3, $4") dereferenced that pointer at 0004, it inspected Address 0004 + 396 = Address 0400, spotted the enemy's "JMP" instruction, refused to skip Line 3, and sniped Address 0400 with a DAT bomb!
Notice one subtle detail in the Scanner's anatomy: why does "SEQ.I @3, $4" at row 0001 compare the remote cell "@3" against "$4" (which is Row 0005: "DAT.F #0, #0") instead of comparing it against the pointer box at Row 0004? Because untouched empty memory across the Arena is filled with "DAT.F #0, #0"! Row 0005 serves as a pristine "blank memory reference sample". By comparing remote cells against Row 0005 with the ".I" (full instruction) modifier, any cell containing a non-DAT opcode or any non-zero number immediately registers as a mismatch—triggering an instant snipe. Notice the elegance of this sensor design: while a blind Dwarf spends 3 cycles per address (ADD, MOV, JMP) whether an enemy is there or not, a Scanner inspecting empty space skips the MOV and spends only 3 cycles per empty check while saving its destructive ammunition exclusively for verified targets.
🔒 MISSION CLEAR Unlocks the Full Lecture Note
Complete the experiment in the simulator above to automatically unlock the full deep-dive article—or click below to read the full text immediately.