COREWAR

/
Step 18: Understanding Indirect Addressing (@ Pointers)
🎯Change Cell 0002 B-value and write data to a distant cell via @ pointer(0/4)

MISSIONS (30 STEPS)

CH.1: UI & MEMORY BASICS (1-6)
BASIC★☆☆
Step 1: The "STEP" Button That Advances Time
🔒
BASIC★☆☆
Step 2: Process Termination and Restoring with "RESET"
🔒
BASIC★☆☆
Step 3: "Edit Mode" vs. "Running Mode"EDIT
🔒
BASIC★☆☆
Step 4: The Three Rooms of a Memory Box (Changing B)EDIT
🔒
BASIC★☆☆
Step 5: Modifying Both the Left Room (A) and Right Room (B)EDIT
🔒
BASIC★☆☆
Step 6: Literal Numbers (#) vs. Relative Addresses ($)EDIT
CH.2: CORE INSTRUCTIONS (7-13)
🔒
ARITHMETIC★☆☆
Step 7: Observing the "ADD" Instruction
🔒
ARITHMETIC★☆☆
Step 8: Changing the Number to Add (A-Field)EDIT
🔒
ARITHMETIC★☆☆
Step 9: Changing the Target Address (B-Field)EDIT
🔒
ARITHMETIC★☆☆
Step 10: Using the Subtraction Instruction "SUB"EDIT
🔒
BASIC★☆☆
Step 11: Copying an Entire Box with "MOV"EDIT
🔒
CONTROL★☆☆
Step 12: Looping Back in Time with "JMP"EDIT
🔒
CONTROL★☆☆
Step 13: Build Your First Program (Automatic Counter)EDIT
CH.3: VON NEUMANN & DIGITAL LIFE (14-18)
🔒
BASIC★☆☆
Step 14: Why Does "DAT" Become a Bomb?EDIT
🔒
BASIC★☆☆
Step 15: Copying Your Own Instruction (Code = Data)EDIT
🔒
BASIC★☆☆
Step 16: Observation: Stepping Through "Imp", the Oldest Digital Organism
🔒
BASIC★☆☆
Step 17: Modifying the Imp (Copy Destination Experiment)EDIT
🔒
ARITHMETIC★★☆
Step 18: Understanding Indirect Addressing (@ Pointers)EDIT
CH.4: CLASSIC ARCHETYPES (19-24)
🔒
STRATEGY★★☆
Step 19: Observation: Dissecting the "Dwarf" Bomber Step-by-Step
🔒
STRATEGY★★☆
Step 20: Modifying Dwarf (Changing the Bombing Interval)EDIT
🔒
STRATEGY★★☆
Step 21: First Combat: Tune Your Bomb Interval to Destroy the TargetEDIT
🔒
CONTROL★★☆
Step 22: Observation: The "SPL" Split Instruction and Mitosis
🔒
CONTROL★★☆
Step 23: Finding Enemies with Conditional Skip "SEQ / CMP"EDIT
🔒
STRATEGY★★☆
Step 24: Stopping an Imp with a Pre-Decrement "Imp-Gate"EDIT
CH.5: BATTLE EVOLUTION (25-30)
🔒
STRATEGY★★☆
Step 25: [Stone] High-Speed Bomber and Step Size TuningEDIT
🔒
STRATEGY★★☆
Step 26: [Paper] Observing the Self-Replicating Swarm "Mice"
🔒
STRATEGY★★★
Step 27: [Modifying Paper] Tune Clone Dispersal Distance to Overwhelm StoneEDIT
🔒
STRATEGY★★☆
Step 28: [Scissors] Tuning Scanner Stride to Shred PaperEDIT
🔒
STRATEGY★★★
Step 29: [Trap] Abducting Enemy Processes with "Vampire"EDIT
🔒
STRATEGY★★★
Step 30: Graduation Exam: Tune Your Warrior and Win the Final BattleEDIT
🟢 EDIT MODE (Click cells to modify)
[Addr][Opcode][A (Left)][B (Right)]
📦 DATA / BOMB (DAT)
0000
▼MOV
#
$
0001
▼MOV
<
<
0002
↺JMN
$
$
👈 EDIT
0003
❖SPL
@
#
0004
+ADD
#
$
0005
↺JMP
$
$
0006
■DAT
$0
$0
++ ADD ROW
0007
■DAT
$0
$0
0008
■DAT
$0
$0
0009
■DAT
$0
$0
0010
■DAT
$0
$0
0011
■DAT
$0
$0
0012
■DAT
$0
$0
0013
■DAT
$0
$0
0014
■DAT
$0
$0
0015
■DAT
$0
$0
0016
■DAT
$0
$0
0017
■DAT
$0
$0
0018
■DAT
$0
$0
0019
■DAT
$0
$0
0020
■DAT
$0
$0
0021
■DAT
$0
$0
0022
■DAT
$0
$0
0023
■DAT
$0
$0
0024
■DAT
$0
$0
0025
■DAT
$0
$0
0026
■DAT
$0
$0
0027
■DAT
$0
$0
🏟️ARENA (20 ROWS)SCOPE: 0000 - 0019
[CORE MEMORY 800 CELLS (20 ROWS × 40 COLS)]1:1 Row Synced with Editor
TASKS: 0
CYC: 0
📖 LECTURE NOTE // STEP 18 OF 30Chapter 3: Von Neumann Awakening & Digital Life⏱ 6 min read
📖 Lecture Note: Computer Science & Artificial Life Principles Behind This Experiment

The Science of Indirect Addressing (@ Pointers): How Static Code Gains Dynamic Reach

Two-stage address dereferencing: how treating a data cell's number as a destination address unlocks the entire memory space

#Indirect Addressing (@)#Pointers & Dereferencing#Two-Stage Lookup#Dynamic Targeting#Effective Address
🔬Step 18: Understanding Indirect Addressing (@ Pointers)

To finish Chapter 3, let's learn the secret weapon behind bombers: @ (B-Field Indirect Addressing / Pointers)! - $ goes directly to the relative address written in the instruction. - @ is a two-step lookup: "Go to the specified data box first, read its B-value as a destination memo, and launch the data there!"

Right now, 0000 says MOV.I $2, @2, using Cell 0002 as its pointer box (watch the dashed purple arrow!).

🎯 Your Task Change the highlighted B (Right Value) of the pointer box at Address 0002 from 0 to 3 (which points 3 cells ahead of 0002 to 0005) or 5, watch the purple arrow extend, and press [STEP]!

1. The Limitation of Direct Addressing ($): Why Fixed Offsets Aren't Enough

Capping off Chapter 3, Step 18 demystifies one of the most powerful concepts in all of computer science—a concept infamous for challenging students in C and assembly courses, yet crystal clear when seen visually in CoreWar: Pointers (Indirect Addressing via the "@" symbol).

First, consider why Direct Addressing ("

quot;) alone is not enough to build a real warrior. In Step 17, "MOV.I $0, $4" always wrote to Address 0004. Even if you loop that instruction a thousand times, it will hammer Address 0004 a thousand times while leaving the other 799 cells of the Arena completely untouched! If you only had "
quot;, sweeping an 800-cell arena would require writing 800 separate MOV instructions.

How can a compact 3-line or 4-line program fire at Address 0005 on loop 1, Address 0009 on loop 2, and Address 0013 on loop 3 using the exact same MOV line? The answer is Indirect Addressing ("@").

Direct ($2)   : [0000] MOV $2, $2 ──► Writes directly into Cell [0002] (Fixed target)

Indirect (@2) : [0000] MOV $2, @2 ──(Step 1: Look at pointer box [0002])──┐
                [0001] JMP $-1, #0                                        │
                [0002] DAT #0, #3 ◄───────────────────────────────────────┘
                                │
                                └────(Step 2: Read B-value "+3", jump 3 rows from [0002])
                                ▼
                [0005] DAT #0, #3 ◄──💥 Final Landing Address = 0002 + 3 = 0005!

2. The Two-Stage Rocket: How "@" (B-Indirect Dereferencing) Works

Let's compare "$2" and "@2" using the analogy of delivering a package: - Direct Addressing ("$2"): "Deliver this package to the house 2 doors down (Address 0002)." The courier drops the package at 0002 and is done. - Indirect Addressing ("@2"): "Go to the house 2 doors down (Address 0002) and read the forwarding number written on its B-field signboard. Then carry the package that many doors further down from Address 0002!"

Let's trace your exact experiment when Row 0000 is "MOV.I $2, @2" and Row 0002 is "DAT.F #0, #3": 1. STAGE 1 (Pointer Lookup): To resolve "@2", the CPU first travels 2 rows down from 0000 to inspect the pointer box at Address 0002. 2. STAGE 2 (Dereferencing): The CPU reads the B-value stored inside Address 0002, which you set to 3. Using the pointer box itself (Address 0002) as the base, the CPU adds +3 to compute the final Effective Address: 0002 + 3 = Address 0005!

Notice the magic here: without touching the MOV instruction at Address 0000 at all, simply changing the data number inside Address 0002 from 0 to 3 (or 5) redirected the purple target beam across space to strike Address 0005 (or 0007)!

3. Connecting C Pointers (*ptr) to the Birth of the Bomber

In computer science and languages like C, C++, and Rust, a memory cell (like Address 0002) that holds the address offset of another cell is called a Pointer Variable, and following that pointer to its final target via "@" is called Dereferencing (written as "*ptr" in C). When a C compiler translates "*ptr = val;" into machine code, it emits the exact indirect addressing instruction you just executed in Step 18.

Now, put the two halves of your knowledge together! - In Step 13 (end of Chapter 2), you built an Automatic Counter that used "ADD" inside a "JMP" loop to automatically increase a DAT cell's B-value every cycle. - In Step 18 (end of Chapter 3), you learned that "@2" launches a bomb to whatever address is written inside that DAT cell's B-value.

What happens when you combine the Automatic Counter with the "@" Pointer? On every turn of the loop, the pointer number increases automatically—and the "@" instruction fires a DAT bomb to a brand-new address across the Arena! Turn to Chapter 4 (Step 19) to see this exact synthesis come alive as the legendary "Dwarf" bomber.

🔒

🔒 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.