DAT - Data
DAT: Data (Process Termination)
DAT is a non-executable data storage instruction in Redcode-94. When a warrior's execution pointer (Program Counter) attempts to execute a DAT instruction, that process is immediately terminated (killed) and removed from the warrior's process queue. If a warrior has no remaining processes in its queue, it loses the round.
Syntax
DAT.F #A, #B ; Store numerical data in A-field and B-fieldDual Role in Von Neumann Memory
In CoreWar's shared memory (the Core), instructions and data occupy the exact same cells:
- As a Variable / Pointer:
DATcells safely store counters, bomb offsets, and indirect target pointers (@/</>) as long as the Program Counter jumps around them (JMP). - As a Lethal Bomb: Because executing
DATkills a process, warriors copyDATinstructions across the Core (MOV bomb, @ptr) to overwrite enemy code or place landmines in an opponent's execution path.
loop: ADD.AB #4, ptr ; Advance target pointer stored in DAT
MOV.I ptr, @ptr ; Copy the DAT cell itself as a bomb!
JMP.A loop
ptr: DAT.F #0, #0 ; Acts as both pointer variable and DAT bombModifiers & Initialization
- Default Modifier:
.F(always defaults to.Fregardless of addressing modes). - Core Initialization: Every empty cell in the 8,000-cell MARS Core is initialized to
DAT.F $0, $0before battle begins.