0x9 exit-script
Opcode 0x9 (9), control. Investigated by OME, with high confidence (from investigation).
() - discard the complete active script stack, zero every global bank, reset scene-owned engine services, and load raw script resource 0 as the new root. Process-owned configuration survives; the initial-root-run flag queried by op 0x130 is cleared so LOGO/OP are not replayed.
Operands
It takes no operands.
In the port
OME’s port implements it. It never waits: a wait parks the engine until input, a sleep, a transition, a dialog or a movie ends. What it can do with control besides waiting:
ends: it ends its frame, the scene or the run, itself or because a frame it ran did
OME derives these facts from the port’s handler (its tools/opcode_flow.py), and they over-approximate: a fact some path can reach is given.
By build
Whether each build’s scripts use it, as OME’s survey of the game’s scripts saw them, and how many evidence items name the build.
| Build | Game | Used by its scripts | Evidence |
|---|---|---|---|
4.24J (SYS4422) | Himegari Dungeon Meister | yes | 1 |
4.33G (SYS4433) | Kamidori Alchemy Meister | yes | — |
4.38D (SYS4438) | Soukoku no Arterial | yes | — |
Evidence
- native-re on SYS4422, high confidence; Himegari AGE.EXE Ghidra /v2 and decoded script corpus (
vm-map/opcodes.toml opcode 0x9): Ghidra /v2: op_0x9_reset_scene_and_reload_root@0x418f50 clears EngineCtx+0x54ff0, disposes all 40 interpreter-frame slots with script_frame_dispose@0x40e610, zeroes every global bank (each integer global becomes ctx->anti_tamper_b, the encoded zero; the float, string, integer-pointer, float-pointer and string-pointer banks are cleared; both bank sets under set:EnableMemFlip), aborts timed/input callback state, calls scene_context_init_reset@0x40b3b0, resets hotspot/input services, releases all 1000 surfaces only when (set:CreateObject & 2) && (set:AutoFreeTex & 1), then calls script_frame_load_resource(...,0). After the hotspot resets it calls save_container_playtime_reset@0x42fa80 (SYS4433 0x430430): the save playtime base and pending value become 0 and the clock restarts, so saves made after a return to title count from there. SYS4433's op_0x9_reset_scene_and_reload_root_sys4433@0x423b50 has the same bank reset, playtime reset and gate; the registered AutoFreeTex default is 0 in both, Kamidori sets 3 and Himegari leaves it unset. The scene reset clears interpreter/ADV/input/retained-gfx state, reinitializes both surface-record tables and deletes the 1000 slots' movie objects (ctx+0x52bd4), but keeps their textures; engine configuration is untouched. A native Kamidori read (2026-11-07) at TITLE after a turn-limit game over found FIELD's G[0x428c] and SC5300's G[0x19c1]/G[0xfd435] back at zero, so INIT2 draws no field objects over the title. A native read (2026-11-07) found SC0000's slots 5 and 14 still textured at TITLE after a Himegari return to title, with record id -1. Corpus sites are terminal scene/control exits rather than ordinary local returns.
Details
OME’s notes on it, as the registry keeps them.
Implemented as a whole-stack root-reload boundary in the persistent VM. A request propagates through every nested call-script frame without resuming caller instructions, clears VM/host scene presentation and input state, keeps every surface unless VmOptions.CreateObject/AutoFreeTex ask for the release (the surface records, reload flags and movies are cleared), cancels deferred SFX starts while preserving active/process-owned audio, zeroes the global banks and restarts the playtime clock from 0 (both 2026-11-07), preserves process-owned host configuration/caches, then resolves raw resource 0 through the script provider and starts it at offset zero. The retained history backlog is deliberately preserved pending a separate proof of its native lifetime; recording suppression is reset.