This website requires JavaScript.
Explore
Help
Sign in
imjasonh
/
nescript
Watch
1
Star
0
Fork
You've already forked nescript
0
mirror of
https://github.com/imjasonh/nescript
synced
2026-07-08 00:45:38 +00:00
Code
Activity
033d399565
nescript
/
tests
/
emulator
/
goldens
/
war.audio.hash
2 lines
16 B
Text
Raw
Normal View
History
Unescape
Escape
runtime: gate __multiply / __divide on usage markers Drop __mul_used from IrOp::Mul codegen and __div_used from IrOp::Div / IrOp::Mod codegen (modulo reuses the same routine). The linker skips gen_multiply / gen_divide for programs that never emit the markers, following the same pattern already used by __audio_used / __ppu_update_used / __sprite_cycle_used. The optimizer already rewrites multiplies and divides by constant powers of two into shifts (and modulo by constant powers of two into masks), so the markers only fire for genuinely runtime math. A program like `examples/comparisons.ne` that never multiplies or divides now reclaims ~56 bytes of PRG; programs that use only one of the two reclaim the other's share. Audio goldens flip for every example that uses audio. The .ne sources are unchanged and the pixel goldens are byte-identical — the audio stream differs only because removing the math routines shifts the audio tick's absolute address in PRG by 56 bytes, which changes which of its internal branches cross 6502 page boundaries and therefore the per-frame cycle count of a single NMI by 1-5 clocks. Over 180 frames the accumulated drift shifts APU register write timing enough to render a different digital sample stream at the same logical wave shape. Expected consequence of ROM-layout change under cycle-accurate emulation; documented path per CLAUDE.md "Updating goldens". https://claude.ai/code/session_016kM6P7PukktBDqTZexrrAN
2026-04-16 13:01:19 +00:00
575adcb6 132084
Copy permalink