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.
| Offset | Type | Field | Meaning |
|---|---|---|---|
| 0 | u8 | opcode | 0xf2 |
| 1 | u16le | target | Offset 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
targetis 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.