Skip to main content

Jump

SCRIPT_JUMP · opcode 0xf2 · 3 bytes

Script virtual machine · Opcode list · Control flow

Continues execution at another position of the level's script buffer.

Encoding​

Offsets count from the opcode byte. Words are little-endian.

OffsetTypeFieldMeaning
0u8opcode0xf2
1u16letargetOffset from the start of the runtime script buffer, not from the instruction.

Example (constructed, not from a level): f2 10 01 continues at buffer offset 0x0110.

Behavior​

The handler adds target to the start of the script buffer and moves the interpreter there. The script buffer starts with the script data of the level's INF file.1

The handler reports the jump as the distance from its operand to the destination, so a backward jump appears as a negative 16-bit step; see dispatch.

Edge cases and unknowns​

  • target is not checked: it is added to the buffer's offset in 16 bits, so a target of 7,508 or more runs the bytes of the areas that follow the script buffer, and a sum beyond 65,535 wraps to the start of the buffer's memory segment.

Sources​

Footnotes​

  1. Handler for 0xf2 and the script buffer pointer. Comparative source: oeob_jump in REF-SCUMM-003. ↩