Field ports batch 2 with the porting tools (15-30 routines) #54

Closed
opened 2026-11-04 10:19:06 +00:00 by Gatchan · 1 comment
Owner

First batch made with draftc.py / draft_check.py / liveness / groundtruth / portstyle. Next field routines in docs/coverage.md order that the tools can draft (skip frame-crossing ones, #37). Measure: routines per session and tokens per routine (agent usage / routines).

First batch made with draftc.py / draft_check.py / liveness / groundtruth / portstyle. Next field routines in docs/coverage.md order that the tools can draft (skip frame-crossing ones, #37). Measure: routines per session and tokens per routine (agent usage / routines).
Author
Owner

Merged in PR #55. Field batch 2: 15 field routines ported with the tools (draftc -> draft_check -> port -> generated bridge -> groundtruth + shadow).

Ported: SetTopSpriteMSB, SetBtmSpriteMSB, FixPlayerSpritePriority, UpdateObjLayerPriorityAfter, UpdateMosaic, UpdateFixedColor, UpdatePalAnimPulse, UpdateShake, Rand (field), ShiftPrevLetter, DrawLetter, CopyDlgTextToBuf, ClearTextGfxBuf, CloseMapTitleWindow, CheckTimer.

New tool: tools/portbridge.py generates each bridge and registry row from the routine's drafts (entry guards, live outputs from liveness, don't-care set, hardware writes); the porter states how each live output the routine may change is left (--set/--same), the tool refuses otherwise. Documented in docs/drafts.md.

Validation

  • Drafts proven first (draft_check, 28 drafts, title_to_mines_save + field_menu_tour US/JP): 436 407 calls, 2 mismatches, both SetWindowSelect (PPU BG1 hscroll changed by HDMA during the original, not written by it) -> SetWindowSelect skipped.
  • Shadow, 5 routes, all ports: US 745 371 calls of the 15 ports, JP 668 195, 0 mismatch, 0 fallback (UpdateMosaic guard fixed after 7 fallbacks/version on narshe_to_world_map, rerun 0/0); every movie matches its end hashes.
  • Fuzz (field_menu_tour state, 120 iterations/version + callees alone 60): 0 mismatch, 0 fallback.
  • Original instructions executed (routes + fuzz coverage): 683/683 US, 683/683 JP.
  • groundtruth: 16/30 same; the differences are tool limits (buffer accessors, scratch carried by the bridge, overlapping HDMA element names) and UpdateShake reading the offsets to keep their low byte.
  • portstyle 0 findings; debug and clang builds 0 warnings, ctest -LE slow 27/27 each.

Skipped: SetWindowSelect (PPU compare noise, needs a window video service), TfrBGAnimGfx/TfrBG3AnimGfx/TfrObjGfxSub (VRAM DMA with partial register setups: need a vid VRAM upload service; TfrObjGfxSub keeps everything live), InitBG1/2VScroll, _c0249a, UpdateBG1, UpdateBG3HScroll, UpdateScrollHDMA, InitMaskHDMAData, _c0714a, MoveObjs, DrawOverlaySprites, LoadLetterGfx, UpdateDlgWindow (larger, scratch-heavy: next batch). Frame-crossing routines not attempted (#37).

Merged in PR #55. Field batch 2: 15 field routines ported with the tools (draftc -> draft_check -> port -> generated bridge -> groundtruth + shadow). Ported: SetTopSpriteMSB, SetBtmSpriteMSB, FixPlayerSpritePriority, UpdateObjLayerPriorityAfter, UpdateMosaic, UpdateFixedColor, UpdatePalAnimPulse, UpdateShake, Rand (field), ShiftPrevLetter, DrawLetter, CopyDlgTextToBuf, ClearTextGfxBuf, CloseMapTitleWindow, CheckTimer. New tool: `tools/portbridge.py` generates each bridge and registry row from the routine's drafts (entry guards, live outputs from liveness, don't-care set, hardware writes); the porter states how each live output the routine may change is left (`--set`/`--same`), the tool refuses otherwise. Documented in docs/drafts.md. Validation - Drafts proven first (draft_check, 28 drafts, title_to_mines_save + field_menu_tour US/JP): 436 407 calls, 2 mismatches, both SetWindowSelect (PPU BG1 hscroll changed by HDMA during the original, not written by it) -> SetWindowSelect skipped. - Shadow, 5 routes, all ports: US 745 371 calls of the 15 ports, JP 668 195, 0 mismatch, 0 fallback (UpdateMosaic guard fixed after 7 fallbacks/version on narshe_to_world_map, rerun 0/0); every movie matches its end hashes. - Fuzz (field_menu_tour state, 120 iterations/version + callees alone 60): 0 mismatch, 0 fallback. - Original instructions executed (routes + fuzz coverage): 683/683 US, 683/683 JP. - groundtruth: 16/30 same; the differences are tool limits (buffer accessors, scratch carried by the bridge, overlapping HDMA element names) and UpdateShake reading the offsets to keep their low byte. - portstyle 0 findings; debug and clang builds 0 warnings, `ctest -LE slow` 27/27 each. Skipped: SetWindowSelect (PPU compare noise, needs a window video service), TfrBGAnimGfx/TfrBG3AnimGfx/TfrObjGfxSub (VRAM DMA with partial register setups: need a vid VRAM upload service; TfrObjGfxSub keeps everything live), InitBG1/2VScroll, _c0249a, UpdateBG1, UpdateBG3HScroll, UpdateScrollHDMA, InitMaskHDMAData, _c0714a, MoveObjs, DrawOverlaySprites, LoadLetterGfx, UpdateDlgWindow (larger, scratch-heavy: next batch). Frame-crossing routines not attempted (#37).
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#54
No description provided.