1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-08 08:55:38 +00:00
nescript/tests/emulator/goldens
Claude 0de1d60c33
runtime: gate controller-2 reads in NMI on __p2_input_used
Drop the three-instruction JOY2 shift block (`LDA $4017 / LSR A /
ROL ZP_INPUT_P2`) from inside the NMI's 8-iteration input loop
when user code never reads controller 2. IR codegen emits the
`__p2_input_used` marker from `IrOp::ReadInput(_, 1)`; the linker
threads the flag through a new `NmiOptions::has_p2_input` bool,
and `gen_nmi` writes the shift block only when the flag is set.

Savings for single-player programs:
 - ~6 bytes of NMI code.
 - ~30 cycles per frame (3 instructions × 8 loop iterations, each
   6-8 cycles depending on addressing — LDA abs is 4, LSR A is 2,
   ROL zp is 5, so ~11 cycles × 8 = ~88 cycles; rounded down for
   the page-crossing penalty landing differently in the new layout).

This commit also fixes the IR codegen to drop the matching
`__p1_input_used` marker from `IrOp::ReadInput(_, 0)`, even though
the next commit is the one that actually consumes it. Landing the
two markers together keeps the IR codegen's per-op bookkeeping
coherent.

Six audio goldens flip (every program that reads input + plays
audio) with the expected NMI-layout-shift cycle drift.

https://claude.ai/code/session_016kM6P7PukktBDqTZexrrAN
2026-04-16 21:15:09 +00:00
..
arrays_and_functions.audio.hash
arrays_and_functions.png compiler: fix three scoping bugs; war: revert all local/param workarounds 2026-04-15 20:33:41 +00:00
audio_demo.audio.hash runtime: gate controller-2 reads in NMI on __p2_input_used 2026-04-16 21:15:09 +00:00
audio_demo.png
auto_chr_background.audio.hash assets: auto-generate CHR data from @nametable() PNG sources 2026-04-15 03:29:58 +00:00
auto_chr_background.png assets: auto-generate CHR data from @nametable() PNG sources 2026-04-15 03:29:58 +00:00
bitwise_ops.audio.hash
bitwise_ops.png
bouncing_ball.audio.hash
bouncing_ball.png
coin_cavern.audio.hash
coin_cavern.png
comparisons.audio.hash
comparisons.png linker: skip default palette + rendering enable for non-visual ROMs 2026-04-16 21:15:08 +00:00
friendly_assets.audio.hash runtime: gate controller-2 reads in NMI on __p2_input_used 2026-04-16 21:15:09 +00:00
friendly_assets.png
function_chain.audio.hash
function_chain.png
hello_sprite.audio.hash
hello_sprite.png
inline_asm_demo.audio.hash
inline_asm_demo.png codegen: reuse analyzer's local allocations so inline asm {param} works 2026-04-16 16:03:10 +00:00
logic_ops.audio.hash
logic_ops.png
loop_break_continue.audio.hash
loop_break_continue.png
match_demo.audio.hash
match_demo.png
metasprite_demo.audio.hash parser/lowering: declarative metasprites for multi-tile sprite groups 2026-04-15 03:13:30 +00:00
metasprite_demo.png parser/lowering: declarative metasprites for multi-tile sprite groups 2026-04-15 03:13:30 +00:00
mmc1_banked.audio.hash
mmc1_banked.png
mmc3_per_state_split.audio.hash
mmc3_per_state_split.png
nested_structs.audio.hash
nested_structs.png
noise_triangle_sfx.audio.hash runtime: gate controller-2 reads in NMI on __p2_input_used 2026-04-16 21:15:09 +00:00
noise_triangle_sfx.png
palette_and_background.audio.hash
palette_and_background.png
platformer.audio.hash runtime: gate controller-2 reads in NMI on __p2_input_used 2026-04-16 21:15:09 +00:00
platformer.png
pong.audio.hash linker: skip default palette + rendering enable for non-visual ROMs 2026-04-16 21:15:08 +00:00
pong.png codegen: fuse compare-then-branch to drop boolean materialization 2026-04-16 17:10:02 +00:00
scanline_split.audio.hash
scanline_split.png
sfx_pitch_envelope.audio.hash runtime: gate controller-2 reads in NMI on __p2_input_used 2026-04-16 21:15:09 +00:00
sfx_pitch_envelope.png linker: skip default palette + rendering enable for non-visual ROMs 2026-04-16 21:15:08 +00:00
sha256.audio.hash examples/sha256: interactive SHA-256 hasher with on-screen keyboard 2026-04-16 14:02:58 +00:00
sha256.png examples/sha256: interactive SHA-256 hasher with on-screen keyboard 2026-04-16 14:02:58 +00:00
sprite_flicker_demo.audio.hash sprite-per-scanline: add cycle_sprites runtime flicker + debug telemetry 2026-04-15 22:07:19 +00:00
sprite_flicker_demo.png sprite-per-scanline: add cycle_sprites runtime flicker + debug telemetry 2026-04-15 22:07:19 +00:00
sprites_and_palettes.audio.hash
sprites_and_palettes.png
state_machine.audio.hash
state_machine.png
structs_enums_for.audio.hash
structs_enums_for.png
two_player.audio.hash
two_player.png
uxrom_banked.audio.hash
uxrom_banked.png
uxrom_banked_to_banked.audio.hash
uxrom_banked_to_banked.png
uxrom_user_banked.audio.hash
uxrom_user_banked.png
war.audio.hash runtime: gate controller-2 reads in NMI on __p2_input_used 2026-04-16 21:15:09 +00:00
war.png examples: regenerate ROMs, gifs, and goldens after codegen local fix 2026-04-16 16:12:46 +00:00