COREWAR

/
MOD - Modulo
🎯Press [STEP] twice to observe modulo calculation (27 % 10 = 7)(0/2)
🟢 EDIT MODE (Click cells to modify)
[Addr][Opcode][A (Left)][B (Right)]
📦 DATA / BOMB (DAT)
+2
0000
+MOD
#
$
0001
↺JMP
$
0002
■DAT
#
#
◎ B-TARGET
0003
■DAT
$0
$0
++ ADD ROW
0004
■DAT
$0
$0
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 (7/19)

MOD - Modulo

MOD: Modulo (Remainder)

MOD calculates the remainder of B / A and stores it in B. Like DIV, division by zero terminates the process.

Syntax

MOD A, B   ; B = B % A

Use Cases

Wrapping Values

Keep pointer values within a specific range:

MOD #100, ptr  ; Ensure ptr stays within 0-99

Pattern Generation

Create repeating bombing patterns:

loop: ADD #7, ptr
      MOD #100, ptr  ; Wrap within 100-cell range
      MOV bomb, @ptr
      JMP loop
ptr:  DAT 0, 0
bomb: DAT 0, 0

Modifiers

  • .A — Modulo A-fields
  • .B — Modulo B-fields (default)
  • .F — Modulo both fields independently

Strategic Notes

MOD is useful for creating warriors that bomb in specific patterns within bounded regions. Combined with prime numbers, it can create efficient core-coverage strategies.

📚 REDCODE-94 INSTRUCTION REFERENCE (7/19)

MOD - Modulo

MOD: Modulo (Remainder)

MOD calculates the remainder of B / A and stores it in B. Like DIV, division by zero terminates the process.

Syntax

MOD A, B   ; B = B % A

Use Cases

Wrapping Values

Keep pointer values within a specific range:

MOD #100, ptr  ; Ensure ptr stays within 0-99

Pattern Generation

Create repeating bombing patterns:

loop: ADD #7, ptr
      MOD #100, ptr  ; Wrap within 100-cell range
      MOV bomb, @ptr
      JMP loop
ptr:  DAT 0, 0
bomb: DAT 0, 0

Modifiers

  • .A — Modulo A-fields
  • .B — Modulo B-fields (default)
  • .F — Modulo both fields independently

Strategic Notes

MOD is useful for creating warriors that bomb in specific patterns within bounded regions. Combined with prime numbers, it can create efficient core-coverage strategies.