-
Notifications
You must be signed in to change notification settings - Fork 24
Wire up transpiler recognition for oam_begin / OamFrame.Dispose #430
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
This is Phase 3 of the using var pattern support (#427). Depends on #428 (try/finally) and #429 (OamFrame struct).
Proposed transpiler changes
The transpiler needs to recognize two method calls and emit the corresponding 6502 code:
oam_begin()
When the transpiler sees a call to NESLib.oam_begin(), emit:
LDA #0
STA oam_off ; reset OAM buffer offset
JSR oam_clear ; clear all sprite entriesThe return value (OamFrame struct) is a zero-size sentinel -- no actual data needs to be stored.
OamFrame.Dispose()
When the transpiler sees a call to OamFrame.Dispose() (which appears in the finally block), emit:
LDA oam_off
JSR oam_hide_rest ; hide all unused OAM entries from current offsetDetection approach
The transpiler already recognizes method names for built-in subroutine dispatch. This follows the same pattern:
- In
Transpiler.cs: detectoam_beginin the used methods set, addOamClearto required subroutines - In
IL2NESWriter.cs: add cases foroam_beginandDisposecalls on theOamFrametype - Ensure
oam_hide_restis included in the subroutine list whenOamFrameis used
Part of #427
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request