mirror of
https://github.com/imjasonh/nescript
synced 2026-07-08 17:06:04 +00:00
State machine dispatch: - IrProgram now stores states (Vec<String>) and start_state - Lowering captures state metadata before walking the AST - IR codegen generates a main loop with vblank wait and CMP+BNE+JMP dispatch table, matching the AST codegen's layout - Each frame handler ends with JMP __ir_main_loop - current_state initialized to the start state's index at boot Multi-OAM support: - next_oam_slot counter, reset at the start of each _frame function - Sequential allocation of 4-byte OAM entries at $0200 + slot*4 - Silently drops draws beyond slot 63 (OAM full) Transition codegen: - IrOp::Transition now looks up the target state's index from state_indices, writes it to ZP $03, and JMPs back to main loop - Previously this was a no-op placeholder Shared constants: - ZP_FRAME_FLAG ($00) and ZP_CURRENT_STATE ($03) match AST codegen Tests: 271 total (5 new IR codegen tests + 2 new integration tests) All 7 examples compile through --use-ir, including multi-state games and programs with transitions and functions. https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3 |
||
|---|---|---|
| .. | ||
| integration | ||
| integration_test.rs | ||