DARKER Research archive

Setup callbacks and geometry-triggered context entry

Native setup callback inventory

callbacks.json now exports object +66 after native setup, including embedded native blocks, for all 107 world records and 1,857 object placements. Each entry retains resource, record, object index, definition slot and group. These are stored placements, including reserves/free lists, not simultaneously active actors.

Callback Placements Established role
8823 1,439 Calls 8AA1, which runs the main mission interpreter BF97, then continues target/movement logic
8609 158 Calls the same 8AA1 gateway, then follows underground navigation logic
8DDD 1 Initial transitional movement callback installed by embedded setup; changes to 8823 when its deadline is reached
8F3B 172 Separate compact-route interpreter; does not use BF97 at entry
0000 87 No movement callback installed during this setup fixture; do not invoke address zero as an object update

The inventory uses the established setup harness: synthetic zero-height geometry, and underground initializer BEE7 substituted with its callback result 8609. Thus the 158 underground entries confirm setup/export consistency, not independent verification of all BEE7 effects. Runtime callback changes are not included.

This refines the update-order experiment: real air/navigation callbacks call the main interpreter, whereas ground vehicles consume their compact routes. The two systems share object fields but are not interchangeable virtual machines.

Alternate context entry C776

C776 is reached by fallthrough from the geometry gate beginning C6FB, through the player post-update handler C582. It is not a normal CALL target. Before entry the gate checks:

On success, it stores target coordinates in shared code/data operands, sets player flag 10h, installs callback 7D9A and disables weapon bits through C8DD. Callback 7D9A moves toward stored horizontal coordinates and height 0148h (328), with additional heading/movement completion logic beyond this check. This supports describing the path as a geometry-triggered transition; a precise player-facing name still needs identification of mode-1 cell type 3 and its use in the actual scenario.

C776 loads its message pointer from the immediate C777, which the supplementary-record loader initializes separately from the exchange slot C77F. It explicitly obtains SI from player +58 before joining the exchange at C781. Therefore it preserves the current player's script continuation, regardless of whatever SI the caller happened to leave in the register.

What this resolves about SI—and what it does not

The explicit script opcode enters C77E with SI already pointing after the opcode. The geometry path enters C776 with SI loaded from player +58. Both have meaningful continuation contracts.

The late main-loop gate calls C77E with SI inherited from earlier work. The final preceding call at 3E80 is audio processing 33D3; there is no reload of the player's saved script pointer between it and the context exchange. This path restores the incoming saved script/message pointers, but stores its incoming SI into the alternate slot. The test confirms this behaviour rather than replacing it with a guessed continuation.

A controlled geometry-entry/late-return test restores the original player script and message cursor when return-gate preconditions are supplied. It does not establish how a real supplementary script reaches those preconditions, or that the late gate's newly saved SI is subsequently used. A later C776 entry saves the proper current object continuation again, but it also needs the correct incoming supplementary pointer; the supply re-entry analysis now identifies that pointer as a saved relative jump back to the sequence entry.

Verification

PYTHONPATH=/tmp/darker-python python3 tools/verify_missions.py
PYTHONPATH=/tmp/darker-python python3 tools/verify_mission_context_entry.py

Context-entry results cover 12 native gate cases, including exact height boundaries, map type and projected cell-edge rejection, plus a controlled restoration of script and text pointers. Native trigonometric table bytes are used with a synthetic map. Existing parser checks still pass for all placements and 963 category-list checks.

The supply restart mechanism and the distinction between craft configuration and mode are now resolved in the supplementary-script follow-up. The late-frame SI producer remains unresolved, but the blackout script does not consume that saved pointer.

Follow-up: supplementary-script analysis finds that all five owner registrations select the non-returning blackout script. Its native terminal loop does not consume the saved late-frame continuation. Supply records 5/6 use different return paths; repeated entry is now verified through their saved restart jumps.