0x139 try-pop-int-stack
Opcode 0x139 (313), compute. Investigated by OME, with high confidence (from investigation).
(stack_id, out_success, out_value) - pop the most recently pushed integer and write success=1, or write success=0 when empty.
Operands
| # | Role | Types seen | Access |
|---|---|---|---|
| 1 | stack_id (an index into stack, 10 entries, not bounds-checked) | — | |
| 2 | out_success | — | |
| 3 | out_value | — |
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:
falls: it returns to the next instruction
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 | no | 1 |
4.33G (SYS4433) | Kamidori Alchemy Meister | no | — |
4.38D (SYS4438) | Soukoku no Arterial | no | — |
Evidence
- native-re on SYS4422, high confidence; Himegari AGE.EXE Ghidra /v2 and decoded script corpus (
vm-map/opcodes.toml opcode 0x139): Ghidra /v2: op_0x139_try_pop_int_stack@0x4297a0 reads top at stack+0x10; when top>=0 it reads data[top] and decrements top, then writes success and value. When top<0, the local holding the value was never replaced from the incoming EngineCtx pointer, yet operand 3 is still written. No Himegari script calls this opcode.
Details
OME’s notes on it, as the registry keeps them.
On success native writes the removed value. On empty, the release handler still writes its reused `this`/EngineCtx local into out_value, so that cell is implementation garbage and must not be consumed unless out_success is nonzero. Port status (2026-07-29): implemented as LIFO TryPop; success writes 1 and the signed dword, while empty writes 0 and deliberately preserves out_value rather than exposing a host pointer. The ten-slot/id-10 alias caveat is documented on op 0x137.