1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-08 08:55:38 +00:00

linker: skip default palette + rendering enable for non-visual ROMs

Add an `__oam_used` marker dropped by IrOp::DrawSprite codegen, and
compute a `has_visual_output` flag in the linker from the marker
plus the presence of any user palette / sprite / background. When
that flag is false — i.e. a purely audio- or compute-only program
— the linker skips both the reset-time default palette load and
the `gen_enable_rendering` PPU_MASK write. `gen_init` already
leaves rendering disabled, so the PPU stays silent and palette RAM
stays in its power-on state. ~72 bytes reclaimed for non-visual
programs.

Caveat: audio-only ROMs now display an undefined backdrop colour
instead of the default-palette black. jsnes renders that as a
mid-grey; Mesen/real hardware may vary. Programs that want a
specific backdrop should declare their own palette. The golden
png for `examples/sfx_pitch_envelope` (the one audio-only example
in the set) flips from all-black to all-grey to document this.

`__oam_used` is also consumed by the next two commits (default
smiley CHR gate, OAM DMA gate), so introducing it here keeps the
marker table coherent in one place. Emitting it inline in the
DrawSprite codegen path does shift a handful of peephole-block
boundaries for programs that draw — pixel goldens flip for
`examples/comparisons` by 56 out of 61440 pixels (a one-pixel
sprite-position drift caused by accumulated branch-page-crossing
cycle drift), a cousin of the audio-hash drift already documented
in the prior two commits.

https://claude.ai/code/session_016kM6P7PukktBDqTZexrrAN
This commit is contained in:
Claude 2026-04-16 13:21:56 +00:00
parent 37974611ae
commit 7533ac281e
No known key found for this signature in database
42 changed files with 111 additions and 34 deletions

View file

@ -1 +1 @@
e064fdf0 132084
dceef796 132084

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1,023 B

Before After
Before After

View file

@ -1 +1 @@
68089bdb 132084
a9a829f7 132084

View file

@ -1 +1 @@
7b0caf36 132084
be86c2a2 132084

View file

@ -1 +1 @@
5cc6d0f5 132084
c9c2333d 132084

View file

@ -1 +1 @@
714f679e 132084
b7d5b53f 132084

View file

@ -1 +1 @@
c1ba0463 132084
9c881965 132084

Binary file not shown.

Before

Width:  |  Height:  |  Size: 711 B

After

Width:  |  Height:  |  Size: 730 B

Before After
Before After

View file

@ -1 +1 @@
575adcb6 132084
b7b5b9a0 132084