0x140 coroutine-label-yield
Opcode 0x140 (320), control. Investigated by OME, with med confidence (from investigation).
(out)(name_str)(sub_str)(in) — developer jump picker. Copies the name/sub strings and the int operand, calls AGERC host command 8 (modal dialog resource 8, agerc_label_dialog_proc@0x10002270) and writes its result to operand 1. Name 'LABEL' lists the script's labels filtered by the sub string ('J') and returns the chosen label's PC (Cancel: 0); any other name picks a catalog entry by suffix and '?' pattern (TITLE's 'BIN','SC????.BIN' scene-script picker). ADV scenes use it in their entry loop (SC0000 label_462 'ループ開始': out=G[0x6be]=LABEL('J',G[0x6be]); the loop runs the setup body, calls *out, and exits when out==G[0x6c3], the scene loop head's offset). The loop only runs when the scene-entry gate (Himegari G[0xaba5c], Kamidori G[0x1372d9]) is 1, which only the developer entry sets (Kamidori TITLE developer-menu case 0); retail play skips it. PORT = HOST-MODEL: at gate 1 the VM runs the setup once (first visit returns -1), then returns the scene loop head (the nearest call followed by exit before the yield; the script's terminal immediate must name it, or a run of comments (op 0x1a7) leading into it, or the VM halts with coroutine-yield-terminal; comments anywhere in the pattern are skipped). It does not emulate the dialog. Only a seeded gate reaches it: port direct-scene runs enter as the F4 launcher does (SYSTEM4 hosts the scene, gate -1; 2026-11-05). See engine-re.md §Scene-coroutine framework.
Operands
| # | Role | Types seen | Access |
|---|---|---|---|
| 1 | out: returned label/resume PC (SC0000 G[0x6be]); every ADV scene compares it with an immediate that is its loop head's code offset (144 Himegari, 269 Kamidori), so the decoder relabels that immediate | g-int | write |
| 2 | label name string (e.g. "LABEL") | string | read-string |
| 3 | sub-label string (e.g. "J") | string | read-string |
| 4 | in: current label/resume PC fed back (SC0000 G[0x6be]) | g-int | read |
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 | yes | 1 |
4.33G (SYS4433) | Kamidori Alchemy Meister | yes | — |
4.38D (SYS4438) | Soukoku no Arterial | yes | — |
Evidence
- native-re on SYS4422, med confidence; Himegari AGE.EXE Ghidra /v2 and decoded script corpus (
vm-map/opcodes.toml opcode 0x140): Ghidra: handler 0x4299c0 (dispatch ctx[0x9b74c]=0x4299c0; created+typed EngineCtx*+annotated; Kelebek u0041F9C0 = VA-drift). Records the generic 9-dword instruction length; op2→local_204, op3→local_104, op4→local_208; g_pfnAgercHostCallback(8, ctx[0x54fe8], &local_210) → FUN_00425fb0(1,ret). A read-only probe resolves the callback to AGERC.DLL+0x1050; imported /support/AGERC.DLL identifies agerc_dispatch_host_command@0x100025f0 and its command-8 dialog-resource branch. FUN_00405740 calls the same dispatcher with command 3 and branches on return 1/2 for transition progress. Command 8 is agerc_label_dialog_proc@0x10002270, a modal developer picker: name 'LABEL' lists the script's labels (prefix filter from the second string) and returns the chosen label's PC, Cancel returns 0; any other name lists service entries by 3-character suffix and '?' pattern (TITLE's 'BIN','SC????.BIN' script picker). The loop runs only when the scene-entry gate is set, which Kamidori TITLE does in developer-menu case 0. Confidence stays medium: the IAGEService resolvers (+0x5c, +0x90) are not decoded.