Redcode is converted to a load format by a parser before being loaded into the Corewar simulator.

The parser performs the following functions:


All instructions require a modifier and two operands in order to be loaded into the Simulator. Each operand must have an addressing mode and a number.

However, it is not necessary to specify modifiers or addressing modes in order for an instruction to be successfully parsed. If you omit the modifier or addressing modes from an instruction, the parser will insert the default value in the load file output.

For example when parsed mov 0, 1 will become MOV.I $0, $1.

Addressing Modes

The default addressing mode is direct ($) for all opcodes except dat. Instructions with the dat opcode default to the immediate (#) addressing mode.


If an instruction has only a single operand, the B operand is defaulted to zero. Only the dat, jmp, spl and nop opcodes can have a single operand specified. Failure to specify a B operand for other opcodes will result in a syntax error.


Which modifier is inserted as a default is dependant upon the instruction's opcode and A and B addressing modes as follows:

Opcode A-mode B-mode Default Modifier
dat any any .f
mov cmp # any .ab
$@<>{} # .b
$@<>{} $@<>{} .i
add sub mul div mod # any .ab
$@<>{} # .b
$@<>{} $@<>{} .f
slt # any .ab
$@<>{} any .b
jmp jmz jmn djn spl nop any any .b