0x4C: sixteen dispatchers in one opcode0x4C is the field script's grab-bag opcode. It carries the name MENU_CTRL and is not a menu: the byte after it picks one of sixteen small sub-dispatchers, and between them they paint walls into the walkability grid, steer the camera, tint and clone actors, wobble the floor, take items from the bag, spend casino coins, start movies and schedule escape timers. This is the reference for all sixteen; the rest of the VM is on the field / event VM page.
[4C, op0, operands…]; the high nibble of op0 selects the dispatcher0x801CEE60, inside the field VM FUN_801DE840 (field overlay, PROT 0897)legaia_scene_formats::field_disasm carries the widths for all sixteen nibblesThree exits recur across the arms:
0x400, then advances the caller; if the target is already held, the caller halts at PC instead.4C 30 and 4C 31 raise and clear one word, _DAT_8007B854. It is the ambient-particle master gate, not an input lock. Its six references disc-wide are two clears in the executable, the field render pass that stages the particle table, the ambient particle emitter, and these two stores - none of them is pad state. A field script decides, per scene, whether ambience emits at all.
Four arms are the script's only grip on the field camera's parameter block:
| Op | What it does |
|---|---|
4C 38 | camera-zone query and load at the player's tile |
4C 39 | the same query, a floor-height sample, then falls into the snap below |
4C 3A | the player's heading takes the arrival facing a door set; every scene's entry script issues it once |
4C 3D | walk-region attribute refresh at the player's tile - not a camera load |
4C 3E | camera snap and focus clamp; its table entry points inside 4C 39's arm |
A neighbour in the same nibble is not a camera arm: 4C 37 (issued as CC <id> 37) copies the player’s position and facing onto another actor - the “materialise a parked companion at the player” step before a walk-out. A target held at a scripted height rather than on the floor also has that height set to the player’s, so it appears level with him.
[4C, 0x7s, col0, row0, col1, row1 (, mask)] edits the walkability grid the locomotion collision check reads - one byte per 128-unit tile, whose high nibble is four sub-cell wall bits.
| Sub | Effect | Width |
|---|---|---|
0 | clear walls (&= 0x0F) | 6 |
1 | block all (|= 0xF0) | 6 |
2 | clear the mask's wall bits | 7 |
3 | set the mask's wall bits | 7 |
The row bounds carry an extra +1 the column bounds do not. The painted rectangle is columns [col0, col1 + 1) and rows [row0 + 1, row1 + 2). These edits layer over the disc-streamed base grid and are commonly gated behind story-flag tests: story-conditional terrain, such as a gate that opens after a boss.
| Op | What it does |
|---|---|
4C 80 | child-actor allocator |
4C 81 | actor draw tint, with a blend target and a tick count. An object can name its own id from its bind-time prologue - the actor already exists by then - which is how Octam’s sunken set pieces stand black after the collapse |
4C 82 slot | full HP / MP restore of one party slot |
4C 83 | rectangular tile fill |
4C 84 | screen-shake amplitude |
4C 85 / 8E / 8F | halt-acquire on a target, which turns it to face someone |
4C 86 / 87 | install / retire the reflection controller |
4C 89 | the dialog pager's automatic press |
4C 8B / 8D | jumps on an actor search |
There is no inn opcode. 4C 82 takes a literal slot, not “every active member”, and it is the primitive every inn, rest and infirmary script is built on; the charge is a separate gold gate and debit, so the price is per-scene script data.
The halt-acquire is not a freeze. The bytes it hands the target are a face-target leg of the walk kernel: the target turns toward a named actor over a frame budget, and the leg's last frame releases it. Cutscene records issue over a thousand of these - “one character turns to another” is exactly this op. Aimed at the player, the arm also holds the caller, so a cutscene waits on the player's turn. A placement's own spawn section can aim it at itself through the cross-context form - two of Sol Broadway's townspeople turn to the neighbour beside them this way as the scene loads.
The scene keeps a 16-entry ladder of floor elevations: the one ground height is interpolated from, and the one added to every placed object's height. Nibble 9 writes it.
4C 9E installs all sixteen rungs, and also the copy the follow camera samples - so an installed ladder moves the camera.4C 90 sets one rung oscillating (live rungs only, so the camera does not follow).4C 9F retires every oscillator.The organic Seru interior's undulating floor is the clean example: its entry script installs a linear ramp, then issues 4C 90 over consecutive rungs with a rising phase - a travelling wave across the ladder. Two of the three oscillator sub-ops are dead code: 4C 91 and 4C 92 land on phases whose loop never terminates, and no shipped scene uses them.
Three readers see the live rungs, and placed objects are not among them:
A placed object’s Y is written once, when it is spawned (at scene init or by the window sweep’s re-plan), as its rung plus its own offset; its actor template sets neither height-arm bit that would make the per-frame driver re-sample the floor. When a scene’s system script lifts rungs after spawn, the objects on those rungs stay where they were placed.
The exception is an object whose bind script raises the floor-follow class bit (31 11): the actor tick re-samples the floor under it every frame it is in view, through the live rungs, so it rides a new ladder like the ground does. Mt. Rikuroa’s summit is the case: the system script installs a ladder that lifts the cave mouth out of rikuroa2 664 units above the header’s floor, and the cliff carrying it, the player and the two chests beside it all stand on that raised floor.
Nibble 4 is one pattern, [4C, 4s, value:u16, ticks:u16]: with ticks zero the slot s is written at once; otherwise a scheduled actor ramps it from its current value over ticks frames and the script never waits on it. The slots cover the actor’s speed and draw scale, its held height, its position halves, its drawn heading, the floor ladder, three globals and an audio duck (a fraction of the configured level, which the port runs as its BGM duck). Sub 5 is the one 11-byte form. A ramp runs on whichever actor the op names, the player or any NPC or object: a cutscene can hide a character at scale 0 and grow it back in, the way Gi Delilas steps into the Shadow Gate confrontation.
Held height. Sub 2 writes the actor’s height slot +0x8E. An actor with flag bit 0x20000000 takes Y = -(+0x8E) every frame in the per-actor tick’s height arm instead of the ground sample, and the arm sits ahead of both floor arms, so the held height follows the actor wherever it moves. A placed object is drawn at its actor, and the height is absolute rather than an offset from its map seat - this is how a script lifts or drops scenery (a collapsing dungeon’s boulders tween down to the stairs) and how a walking boss can stay at a fixed altitude while its motion stream walks it. The tween lands on whichever actor the op names - a placement as readily as an object: Octam’s underground bridge collapses this way, its planks parked level with the ledges and then tweened down into the chasm while a look turn tips each one over. The port runs the arm for its placement NPCs (World::tick_field_npc_heights) and steps their height tweens (World::npcs.slot_ramps), and both play hosts draw from it. The same arm holds the player’s height while its script raises the law, and subs 3 and 4 tween an actor’s X and Z angles the same way, tipping objects, townsfolk and the player as the scene asks - in Rugi’s portal beat the player tips nearly flat and is set upright again.
A scripted arc jump writes the held height as it flies: on every frame and on the landing it stores the arc’s height into +0x8E of any actor but the player, so a held actor stays where it landed when it walks on. In the Nivora ravine the Delilas siblings leap down from their ledges and line up for their pose; the port had drawn them back up at their ledge heights once they stepped off the landing spot, and now writes the slot as the arc does.
[4C, 51, x, z, depth, move_id] is a seat, not a walk: no walk kernel is armed. On the actor the op resolves (the executing context, or a cross-context target), the arm writes four things in order:
0x8_, so its clip id resolves through the party locomotion bank; any other depth plays a scene-bank clip. The first three writes land on the player as well - the arm only splits the player off at the clip - so a cutscene can seat the hero on a scene clip of his own.Two shipped consequences: a monster seated beside its tree on its pre-fight arm loops its tree-eating clip instead of its header clip, and party members seated at a bridge get their walk clips before the compass legs walk them up it. The port writes the bit, the mask and the clip slot on every NPC arm (FieldHostImpl::run_to_tile) and binds the clip at the op itself, so a script line that waits for the seated clip to finish waits for the right one, and raises the clip cue on the cross-context arm; one difference remains - the port’s cue skips a re-request of the clip already playing, where retail’s restarts it.
The player takes the bit too. Rugi’s portal beat flies the party into Rogue’s Tower with three seats at depth 04: Vahn on scene clip 7, Noa on 33, Gala on 16, each a flight pose from the tower’s own clip bank, and the record raises the hero’s bit again before it lands him on idle. Left on, the bit would stride clip 7 into his locomotion bank and fly him in on a landing pose. The port writes the bit on the player arm, which some two dozen other cutscenes of the same shape also rely on, and treats a player whose height a script holds as carried rather than walked, so the landing drift plays the idle the script names instead of a walk.
| Op | What it does |
|---|---|
4C C0 | seats the actor's clip at a random frame - not a cancel. The festival crowd in town0d issues it for every dancer, so each starts its loop at its own phase rather than in lockstep |
4C C1 | fog-region enable reset |
4C C3 | script-table teleport and spawn-section re-run |
4C C4 x z | camera-zone query at an explicit tile: frames a shot from a region the player is not standing in |
4C C5 / C6 | wait until a system flag is set / cleared. The flag is flipped by a move-VM part the record itself just spawned (ext sub-op 0x1C / 0x1D in the scene's stager record), so the wait lasts as long as that part takes to reach it. Those parts tick in the frame tail, not in the scene tick, so a headless driver that skips the tail leaves the wait to the cutscene timeline’s anti-hang cap, and the record’s tail never runs |
4C C7 char art | teach a Hyper Art: inserts art into roster slot char's learned list - the masters' lessons |
4C CA / CB / CC | script counter set / add / subtract |
4C CD | wait for the camera glide |
4C CE | player clip override: re-points walk, idle and run at other scene-bank records |
4C CF x z | script camera-focus override |
4C D0 x y | press-a-button prompt: a blinking cursor at (x, y) holds the script until confirm or cancel is pressed (Tetsu's lessons) |
4C D3 | timed-flag scheduler (14 bytes) |
4C D4 / D5 | set / clear the VRAM semi-transparency bit over a rectangle |
4C D6 mode | make an actor's whole draw semi-transparent in blend mode (4 turns it off): the top byte of its colour word, which the primitive dispatcher ORs into every packet. Only Underground Octam (chitei2) uses it, fading the pillars between the camera and a corridor while the party walks it |
4C D8 | synchronous morph-actor spawn (9 bytes) |
The timed-flag scheduler 4C D3 expiry:u16 below:u16 duration:u32 threshold:u32 arms a countdown that lives in the save block. A per-tick consumer sets the expiry flag at zero and the below flag while under the threshold. Retail uses it for the two escape sequences: a collapsing dungeon and the Floating Castle. Stopping the clock does not clear the below flag, which is the root of a traced missing-encounters oddity.
4C D2, D6 and D7 all advance in retail. A VM that halts on them holds a cross-context record forever.
LAB_801E360C adds the halfword less two), not an absolute target. 4C DC / 4C DE skip the same way when the party holds or wears an item, and so do 4C 8B..8D (spell known, a context word zero, art learned), 4C D1 (a camera glide running) and 4C EB (an actor missing). Aimed at another actor the skip reads that actor’s words and stays relative - it is not a wait: town01’s Genesis Tree beat closes Mei’s door behind her this way, on the door’s open bit and then its clip cursor (4C 8C).4C E0 formats the reading box: a row capacity, a latch that loads the next page whole (the help pages use twelve-row boxes loaded at once), or - for operands of 100 and up - the option-cursor preset picker[+0xE] = b1 - 100, which the next line load copies into the cursor (MES: the option cursor).4C FF passes through. The disc-wide opcode census finds no coherent use of either in any scene.Any 4C op can carry a target id (CC <id> ..). The dispatcher looks the id up before the sub-op runs and swaps that actor in as the one the arm works on, so the sub-ops that touch an actor’s own words land on the named actor: its scale, speed, height, tilt and head turn, heading, model, seat, tint, clip words, the copy of the player’s spot, and the box test of where it stands. Sub-ops that work on the camera, the screen, the bag or the script’s own flow ignore the target.
Door and switch records use this to stage the NPCs around them. At the Shadow Gate the gate’s records hide Gi Delilas and grow him back in, tint him, and set Noa and Gala down on Vahn’s spot; the inn counter in the Ancient Wind Cave turns its keeper’s head. Talks do it too, in Rim Elm, the Fire Path and the Usha Research Center. The port’s cutscene runner always ran such ops on the named actor; the door and talk runners ran them on their own record, so the NPC never hid, moved, tilted or looked anywhere. Both now hand them to the NPC.
The dispatcher lives in legaia_engine_vm::field (step/menu_ctrl/), with one FieldHost hook per sub-cluster implemented over the world by FieldHostImpl. Feature homes include the reflection controller, the actor clone, the morph-weight apply, the casino coin bank, the escape timer, the step-counter reroll and the camera-zone requests.
Every arm address and width on this page comes from the disassembly of the field VM, not the decompiled C - which rendered several arms wrongly: absolute jumps that are relative skips, halts that advance from a branch delay slot, and TAKE_ITEM as a menu poll. Disc usage comes from the field-op census, taken at decoded instruction boundaries. Live captures confirm the reflection controllers and the clear colour.
Every sub-op's body, arm address and width is in docs/subsystems/script-vm-menuctrl.md.