📚 REDCODE-94 INSTRUCTION REFERENCE (9/19)
JMZ - Jump if Zero
JMZ: Jump if Zero
JMZ jumps to address A if the value tested at address B is zero. This is the primary conditional instruction for scanning.
Syntax
JMZ target, test ; Jump to target if test's B-field is 0Scanner Pattern
The classic scanning loop uses JMZ to skip empty cells:
scan: ADD #10, ptr ; Move scan pointer forward
JMZ scan, @ptr ; If cell is empty (0), keep scanning
MOV bomb, @ptr ; Found non-zero! Attack!
JMP scan
ptr: DAT 0, 0
bomb: DAT 0, 0How It Works
- Test the B-field of the instruction at address B
- If the value is zero, jump to address A
- If non-zero, continue to the next instruction
Modifiers
.B— Test B-field (default).A— Test A-field.F— Jump if both fields are zero
Strategic Notes
JMZ is essential for scanners that detect the presence of enemy code. Empty core cells are initialized to DAT 0, 0, so any non-zero value indicates an opponent.