Atomic Pre-Decrement ("<") and Defensive Engineering: The Imp-Gate
How the "<" addressing mode combines pointer subtraction and memory writing into a single atomic cycle to crush advancing Imps
An enemy Imp (MOV $0, $1) is marching toward you 1 cell at a time! A regular Dwarf that bombs every 4 cells will let the tiny 1-cell Imp slip right through the gaps.
To crush an Imp, use the < (Pre-Decrement Indirect) addressing mode, which automatically subtracts 1 from the pointer's B-value before every access! By changing the B-mode of MOV.I $2, $2 on row 0000 from $ to < (MOV.I $2, <2), your warrior sweeps backward from 415 without leaving any gaps, slamming a wall of DAT bombs directly into the advancing Imp!
🎯 Your Task Change the highlighted B-Mode ($) on row 0000 to <, then press [PLAY] to crush the enemy Imp!
1. The Bomber's Nightmare: Why Standard Dwarf Struggles Against an Imp
Concluding Chapter 4, Step 24 pitted you against an advancing enemy Imp ("MOV.I $0, $1") marching steadily forward from Address 0400. By changing the B-field addressing mode on row 0000 from "
quot; to "<" (Pre-Decrement Indirect), you erected an impenetrable wall of DAT bombs that crushed the Imp in its tracks.Why is the humble 1-line Imp such a frustrating opponent for standard bombers like Dwarf? First, an Imp's active body is only 1 cell wide, and it moves forward every single turn. A Dwarf firing every 4 cells has a high probability of jumping right over the Imp's head. Second, even if Dwarf's bombs hit the trail of old "MOV.I $0, $1" copies behind the Imp, destroying those old copies does nothing—because the Imp's execution pointer has already moved ahead!
To kill an Imp, a defender must land a DAT bomb directly onto the exact cell where the Imp's execution pointer currently stands—or lay down a continuous, gap-free barrage moving backward into the oncoming Imp.
Advancing Imp : [0400] ──► [0401] ──► [0402] ──► [0403] (Moves +1 per turn)
"<" Imp-Gate : [0415] ◄── [0416] ◄── [0417] ◄── [0418] (Sweeps -1 per loop with zero gaps!)
💥 Head-on Collision Guaranteed!2. Two Actions in One Clock Cycle: How "<" (Pre-Decrement) Works
Normally, moving a pointer and firing a bomb requires two separate instructions: an "ADD/SUB" line to update the pointer, and a "MOV @" line to fire the bomb (taking 3 cycles per shot including the JMP). The "<" addressing mode—known in computer architecture as Pre-Decrement Indirect Addressing—combines pointer subtraction and indirect memory access into a single atomic clock cycle!
Let's trace what happens inside the MARS processor during the single cycle when "MOV.I $2, <2" executes at Address 0000: 1. LOOKUP: The CPU locates the pointer cell 2 rows down at Address 0002 ("DAT.F #0, #415"). 2. PRE-DECREMENT: Before computing the target address, the hardware automatically subtracts 1 from Cell 0002's B-field in place, mutating it from 415 to 414! 3. DEREFERENCE & WRITE: Immediately within the same clock cycle, the CPU uses the newly decremented pointer value (0002 + 414 = Address 0416) as the destination address and drops the DAT bomb there!
Because "<" updates the pointer for free inside the MOV instruction itself, your loop shrinks to just 2 lines (MOV and JMP), firing a continuous wall of DAT bombs backward (0416 ➔ 0415 ➔ 0414 ➔ 0413...) every 2 cycles without a single gap!
3. The Physics of Head-On Collision and the "Imp-Gate"
Why is sweeping the pointer backward ("-1" via "<") so devastatingly effective against an Imp? Think of the physics of relative velocity. The enemy Imp starts at 0400 and marches forward (+1 address per turn: 0400 ➔ 0401 ➔ 0402...). Meanwhile, your "<" bomber starts just ahead of the Imp at 0416 and sweeps backward (-1 address every 2 turns: 0416 ➔ 0415 ➔ 0414...).
Because the Imp is moving in the positive direction (+1) while your gap-free wall of DAT bombs is moving in the negative direction (-1), the two trajectories are on an inescapable head-on collision course! Neither can slip past the other without occupying the exact same integer coordinate, guaranteeing the Imp's destruction.
In advanced CoreWar engineering, a tight loop that continuously decrements a memory cell using "<" is called an Imp-Gate: an automated defensive turnstile that shreds any Imp attempting to crawl through that sector of memory. Moreover, as you will see in Chapter 5, this exact "<" mode (equivalent to "*(--ptr)" in C) is also the secret engine behind high-speed self-replication!
🔒 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.