Two-Operand Architecture: The Dual Roles of the A-Field and B-Field
Why assembly instructions carry two operand slots: the universal grammar of Source (A) and Destination (B)
Now let's modify both A (Left Value) and B (Right Value) so you can tell them apart effortlessly! - The left number is A. - The right number is B.
🎯 Your Task At Address 0000, set A (Left Value) to 3 and B (Right Value) to 7, then press [STEP]!
1. The Grammar of Assembly: A (Source) and B (Destination)
In Step 5, you modified both rooms of Address 0000 simultaneously—setting the left-hand A-field to 3 and the right-hand B-field to 7. By doing so, you proved that a single memory cell in CoreWar can hold two independent numerical values at the same time.
Why did the designers of CoreWar equip every memory cell with exactly two operand slots—no more and no less?
In Instruction Set Architecture (ISA) design, the vast majority of fundamental operations are binary operations that act between two entities: "Copy from A to B", "Add A into B", "Subtract A from B", or "Compare A against B". To express these operations cleanly, Redcode (much like x86 assembly in AT&T syntax) adopts a Two-Operand Architecture: - The Left Room (A-Field) represents the SOURCE ("what value" or "where to read from"). - The Right Room (B-Field) represents the DESTINATION ("where to write to" or "which target to modify"). Understanding this left-to-right flow of action (A ➔ B) unlocks the grammar of almost every instruction you will ever write. Even when an instruction only needs one primary input (such as JMP, which jumps to the address in the A-field), the second room (B-field) does not go to waste: clever CoreWar programmers use the unused B-field of a JMP instruction as a free storage pocket to hide a pointer or a decoy value!
[A-Field : Left Room] [B-Field : Right Room]
SOURCE (From / Input) ───► DESTINATION (To / Output)
Example: ADD.AB #3 ───► $7
("Take literal 3" ───► "Add it into cell 7 rows down")2. Storing Dual Variables in DAT and Vector Operations (.F Modifier)
What makes CoreWar's memory architecture especially fascinating is that even passive data cells (DAT) possess both an A-field and a B-field. When you constructed "DAT.F #3, #7" at Address 0000, you effectively packed a two-element tuple—a 2D vector of numbers (3, 7)—into a single memory address.
Notice the ".F" suffix attached to "DAT.F". In the ICWS-94 specification, ".F" stands for Full (or Both Fields). When an arithmetic instruction like "ADD.F" is executed, the virtual CPU performs two additions in parallel during a single clock cycle: it adds the source A-field to the destination A-field, AND simultaneously adds the source B-field to the destination B-field!
In modern microprocessor design, executing a single instruction across multiple data slots at once is known as SIMD (Single Instruction, Multiple Data) vector processing—the technology behind modern GPU shaders and AI accelerators. Because every CoreWar cell has both an A-room and a B-room, advanced warriors can update two separate bombing pointers in a single cycle using ".F" instructions.
3. Memory Inspection and Precision Engineering
Low-level programming demands absolute precision regarding where data lives. Mixing up the A-field and the B-field in assembly is the equivalent of swapping the "amount of money to transfer" with the "bank account number" in a financial transaction—the program will immediately misfire.
By cleanly setting A to 3 and B to 7 in this exercise, you have mastered the spatial layout of a CoreWar memory word. Notice how each room in the structured editor has its own independent controls and can hold any integer from 0 up to the size of the memory core. In real-world assembly programming, keeping track of which register or operand slot holds the source value and which holds the destination address is a core discipline that prevents catastrophic data corruption. Whenever you read a line of Redcode from now on, train your eyes to read from left to right: first the action (Opcode), then the input or source in Room A, and finally the target or destination in Room B. In the next step, the final piece of Chapter 1 awaits: uncovering the profound difference between the "#" symbol and the "
quot; symbol right next to those numbers.🔒 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.