COREWAR

/
CMP - Compare
🎯Press [STEP] twice to observe CMP skipping the next line when values are equal(0/2)
🟢 EDIT MODE (Click cells to modify)
[Addr][Opcode][A (Left)][B (Right)]
📦 DATA / BOMB (DAT)
+3
0000
◉CMP
#
$
0001
■DAT
#
#
0002
↺JMP
$
0003
■DAT
#
#
◎ B-TARGET
0004
■DAT
$0
$0
++ ADD ROW
0005
■DAT
$0
$0
0006
■DAT
$0
$0
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
📖REDCODE-94 INSTRUCTION REFERENCE(Drag to move)
📚 REDCODE-94 INSTRUCTION REFERENCE (13/19)

CMP - Compare

CMP: Compare (SEQ)

CMP compares operands A and B. If they are equal, the next instruction is skipped. CMP is an alias for SEQ (Skip if Equal).

Syntax

CMP A, B  ; Skip next instruction if A == B

Scanner Usage

Scanners use CMP to detect non-empty cells:

scan: ADD #12, ptr
      CMP @ptr, #0     ; Is the cell empty?
      JMP attack        ; Not empty — attack!
      JMP scan          ; Empty — keep scanning
attack: MOV bomb, @ptr
        JMP scan
ptr:   DAT 0, 0
bomb:  DAT 0, 0

How Skip Works

If the comparison is true (values equal), the Process Counter advances by 2 instead of 1, effectively skipping the next instruction.

Modifiers

  • .I — Compare entire instructions (both opcode and operands)
  • .A — Compare A-fields only
  • .B — Compare B-fields only (default)
  • .AB — Compare source A-field with destination B-field

Strategic Notes

CMP with .I modifier is the most effective scanning technique, as it compares entire instructions rather than just values. This makes it harder for opponents to evade detection.

📚 REDCODE-94 INSTRUCTION REFERENCE (13/19)

CMP - Compare

CMP: Compare (SEQ)

CMP compares operands A and B. If they are equal, the next instruction is skipped. CMP is an alias for SEQ (Skip if Equal).

Syntax

CMP A, B  ; Skip next instruction if A == B

Scanner Usage

Scanners use CMP to detect non-empty cells:

scan: ADD #12, ptr
      CMP @ptr, #0     ; Is the cell empty?
      JMP attack        ; Not empty — attack!
      JMP scan          ; Empty — keep scanning
attack: MOV bomb, @ptr
        JMP scan
ptr:   DAT 0, 0
bomb:  DAT 0, 0

How Skip Works

If the comparison is true (values equal), the Process Counter advances by 2 instead of 1, effectively skipping the next instruction.

Modifiers

  • .I — Compare entire instructions (both opcode and operands)
  • .A — Compare A-fields only
  • .B — Compare B-fields only (default)
  • .AB — Compare source A-field with destination B-field

Strategic Notes

CMP with .I modifier is the most effective scanning technique, as it compares entire instructions rather than just values. This makes it harder for opponents to evade detection.