1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-18 06:36:57 +00:00

IR codegen: scroll, debug.log, debug.assert

Adds Scroll / DebugLog / DebugAssert variants to IrOp, wires them into
the IR lowering, optimizer liveness tracking, and IR codegen. Scroll
emits two PPU $2005 writes; debug statements emit writes to $4800 when
IrCodeGen::with_debug(true) is set, stripped otherwise. These were the
last feature gaps versus the AST codegen path, so IR codegen is now a
full replacement.

https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
Claude 2026-04-12 10:43:53 +00:00
parent 8a6441071e
commit d609b77cd7
No known key found for this signature in database
5 changed files with 162 additions and 6 deletions

View file

@ -129,6 +129,14 @@ pub enum IrOp {
ReadInput(IrTemp, u8),
WaitFrame,
Transition(String),
/// Write PPU scroll registers (two writes to $2005: X then Y).
Scroll(IrTemp, IrTemp),
/// Debug: write a list of temps to the emulator debug port ($4800).
/// Stripped in release mode by the codegen.
DebugLog(Vec<IrTemp>),
/// Debug: runtime assertion — if `cond` is zero, halt with debug marker.
/// Stripped in release mode by the codegen.
DebugAssert(IrTemp),
// Source mapping
SourceLoc(Span),