Frame model: per-port coroutine for routines that wait for frames #37

Closed
opened 2026-11-02 17:38:40 +00:00 by Gatchan · 1 comment
Owner

Every heavy field/battle/menu routine waits for NMI or spans frames (docs/coverage.md, timing-census.md). Brief §5.1 and workdocs/execution-model.md describe the model (libco coroutines, wait_frame() as a scheduling point) but core/ has no co_create yet.

Scope: design and implement the frame model for ported code (a ported routine that waits for a frame yields to the host; the interpreter and the port interleave correctly), with one real port that waits for a frame as the proof, validated in shadow US+JP. Needed before FieldMain/FieldNMI and any multi-frame loader.

From the 2026-11-02 plan review.

Every heavy field/battle/menu routine waits for NMI or spans frames (docs/coverage.md, timing-census.md). Brief §5.1 and workdocs/execution-model.md describe the model (libco coroutines, `wait_frame()` as a scheduling point) but `core/` has no `co_create` yet. Scope: design and implement the frame model for ported code (a ported routine that waits for a frame yields to the host; the interpreter and the port interleave correctly), with one real port that waits for a frame as the proof, validated in shadow US+JP. Needed before `FieldMain`/`FieldNMI` and any multi-frame loader. From the 2026-11-02 plan review.
Author
Owner

Merged in PR #65 (355a2d9). Frame model: tm_wait_frame + per-port libco coroutines; shadow compares a waiting call at its return (clone follows the original cycle by cycle). Ports: field/WaitVblank, btlgfx/WaitVblank. Shadow, chapter 1 routes US+JP once each: btlgfx 39108/39108 US, 37025/37025 JP; field 46586/46589 US, 42888/42891 JP (last call per route pending at movie end), 0 mismatch, 0 fallback. portcheck all PASS (136). debug ctest -LE slow 27/27. Side bug #64 (LakeSnes FastROM table after state load) fixed in core/hw.

Merged in PR #65 (355a2d9). Frame model: tm_wait_frame + per-port libco coroutines; shadow compares a waiting call at its return (clone follows the original cycle by cycle). Ports: field/WaitVblank, btlgfx/WaitVblank. Shadow, chapter 1 routes US+JP once each: btlgfx 39108/39108 US, 37025/37025 JP; field 46586/46589 US, 42888/42891 JP (last call per route pending at movie end), 0 mismatch, 0 fallback. portcheck all PASS (136). debug ctest -LE slow 27/27. Side bug #64 (LakeSnes FastROM table after state load) fixed in core/hw.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Gatchan/FF6Portage#37
No description provided.