Skip to content

Commit be8f2da

Browse files
fhoedemakersclaude
andauthored
Several updates (#210)
* Update pico_shared submodule for pico-extras I2S driver Bumps the pico_shared pointer to the new audio driver work: TLV320 codec control extracted to its own module, optional pico-extras based I2S driver added behind USE_PICO_EXTRAS_I2S (default OFF), bld.sh gains a -e flag. Also tweak .gitignore to ignore all build*/ directories (matching how local test builds are named) rather than only **/build. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Update pico_shared submodule to latest commit * Update pico_shared submodule to latest commit * Update pico_shared submodule to latest commit * Enhance audio processing with DC blocking filter in InfoNES_SoundOutput * Update pico_shared submodule to latest commit * Update pico_shared submodule to latest commit * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update README.md * Update CHANGELOG.md * Reduce audio output scaling factor from 4 to 2 in InfoNES_SoundOutput function * Update subproject commit reference in pico_shared * Update subproject commit reference in pico_shared * Update subproject commit reference in pico_shared * Update subproject commit reference in pico_shared * Update subproject commit reference in pico_shared * Fix HUD bottom-line flicker in Ganbare Goemon! Karakuri Douchuu (mapper 75) VRC1 has no scanline IRQ, so the game uses CPU-cycle timing to swap CHR banks between the HUD and the playfield. The line-based renderer applied those writes to the current scanline, causing the boundary line to flicker. Defer CHR/mirroring writes by one scanline via a two-stage commit in a new Map75_HSync so they take effect on the next rendered line, matching real-HW HBlank-timed swaps. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * Update subproject commit reference in pico_shared * Update subproject commit reference in pico_shared * Add headless Linux host harness for the InfoNES core The harness at hosttest/ compiles the unmodified infones/ core against RP2350 + framebuffer + FDS configuration on a Linux PC, dumping per-frame PPMs and accepting env-var driven input. Mirrors the existing pcePlus harness and lets PPU/CPU/mapper regressions be reproduced under ASan in seconds instead of one-UF2-per-iteration. Verified end-to-end with SMB (Mapper 0) and Metroid (FDS, multi-side auto-swap working through title -> file-select -> KILL MODE -> name entry). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * Update CHANGELOG.md for audio enhancements and fixes * Update HISTORY.md for v0.41: Add Famicom Disk System save support, NSF playback, and various fixes * Update NES settings conform pico_shared * Update CHANGELOG * Update subproject commit reference in pico_shared * Update CHANGELOG with detailed audio enhancements and fixes --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 46759e6 commit be8f2da

17 files changed

Lines changed: 1082 additions & 151 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ CMakePresets.json
3939
*.out
4040
*.app
4141

42-
**/build
42+
build*/
4343
.vscode
4444

4545
# Apple filesystem cruft

CHANGELOG.md

Lines changed: 30 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CHANGELOG
22

3-
Famicom Disk System games no longer require PSRAM. 8:7 pixel aspect ratio display mode and configurable scanline types added for HSTX based boards. Two player USB support.
3+
Audio mixing improvements, HDMI stability fixes, a scrollable settings menu, and a Ganbare Goemon HUD flicker fix.
44

55

66
# General Info
@@ -11,6 +11,35 @@ Famicom Disk System games no longer require PSRAM. 8:7 pixel aspect ratio displa
1111

1212
[See setup section in readme how to install and wire up](https://github.com/fhoedemakers/pico-infonesPlus#pico-setup)
1313

14+
# v0.43
15+
16+
## Audio
17+
18+
- Better audio mixing for NES games.
19+
- Fixed a DC offset on the I2S audio.
20+
- Added an alternative I2S audio driver based on the official pico-extras driver. This is an opt-in build option; the default driver is unchanged.
21+
22+
Special thanks go to [szuping](https://github.com/szuping) for his contribution to the audio fixes.
23+
24+
## Game fixes
25+
26+
- Fixed flickering on the bottom line of the top HUD in *Ganbare Goemon! - Karakuri Douchuu (Japan)*.
27+
28+
## HDMI
29+
30+
- More stable HDMI/DVI output on HSTX-based boards. Some monitors previously lost the picture intermittently and recovered with a visible glitch; the updated signal shape keeps the picture stable.
31+
32+
## Settings menu
33+
34+
- The options list is now scrollable, with up/down arrows when items extend beyond the visible window. SAVE/CANCEL/DEFAULT, the palette, and the help text stay anchored at fixed rows.
35+
- Note: the settings file format was bumped; existing `settings_nes.dat` files will be reset to defaults on first boot.
36+
37+
## Developer
38+
39+
- Added a headless Linux host harness for the InfoNES core, so PPU/CPU/mapper bugs can be reproduced on a PC without flashing a board.
40+
41+
42+
1443
# v0.42
1544

1645
## Features
@@ -65,81 +94,6 @@ Other configurations may also work when using a USB hub, but these have not yet
6594
- Fixed settings menu always showing unsaved changes after the new scanline setting was added.
6695
- Updated the build configuration to be compatible with the latest TinyUSB version. [#202](https://github.com/fhoedemakers/pico-infonesPlus/issues/202) [#203](https://github.com/fhoedemakers/pico-infonesPlus/issues/203)
6796

68-
# v0.41
69-
70-
## Features
71-
72-
**Famicom Disk System**
73-
74-
Note that FDS support requires an RP2350 board with PSRAM and a BIOS file at `/bios/fds-bios.rom`.
75-
76-
- Implement save games for games that support write save data back to disk, like Metroid and Zelda. Saves are stored as `/SAVES/gametitle_fds.sav` [#193](https://github.com/fhoedemakers/pico-infonesPlus/issues/193)
77-
- Added an option to the settings menu to automatically swap disk sides. This setting is disabled by default. When it’s off, you can manually swap disks in-game using SELECT + START.
78-
79-
Audio is not perfect but acceptable.
80-
81-
**NSF sound playback**
82-
83-
- Added NSF playback. Emulator can load and play `.nsf` (Nintendo Sound Format) roms.
84-
- Controls:
85-
- LEFT/RIGHT change track
86-
- Button2 Stop
87-
- Button1 Resume
88-
89-
**Settings menu**
90-
91-
- Better use of screen real estate:
92-
- SAVE / DEFAULT / CANCEL are on the same row.
93-
- FG/BG color codes now placed to the left to the color grid.
94-
95-
## Fixes
96-
97-
**Famicom Disk System**
98-
99-
- Fix disk error 24 in Metroid and possible in other games too. [#192](https://github.com/fhoedemakers/pico-infonesPlus/issues/192)
100-
- Fix for game lock-up in Zelda when moving to the next screen during gameplay.
101-
102-
## Use of AI
103-
104-
FDS, NSF, additional mappers developed with the help of [Anthropic Claude Opus 4.6](https://www.anthropic.com/claude/opus)
105-
106-
# v0.40 (This is a re-release of v0.39 with some fixes and improvements)
107-
108-
- Fix incorrect parsing of region in NES 2.0 header. [#197](https://github.com/fhoedemakers/pico-infonesPlus/issues/197) Thanks to [@Lome-one](https://github.com/Lome-one) for reporting.
109-
- The emulatortype is now correctly set to "NES" for Famicom Disk System games.
110-
111-
# v0.39
112-
113-
**Features:**
114-
- Famicom Disk System (.fds) support on RP2350 boards with PSRAM (with limitations—see [#192](https://github.com/fhoedemakers/pico-infonesPlus/issues/192), [#193](https://github.com/fhoedemakers/pico-infonesPlus/issues/193), [#194](https://github.com/fhoedemakers/pico-infonesPlus/issues/194), [#195](https://github.com/fhoedemakers/pico-infonesPlus/issues/195)). Requires a BIOS file at `/bios/fds-bios.rom`. Disk swapping is done via the settings menu (SELECT+START).
115-
- Added "reset game" option to the in-game settings menu.
116-
- Removed unused 360 folder from metadata.
117-
118-
## Fixes
119-
120-
**Regional Support:**
121-
- PAL/Dendy games now run at the correct frame rate on RP2350 boards (50Hz instead of 60Hz). RP2040 boards still run PAL/Dendy at 60Hz due to hardware constraints.
122-
123-
**Mapper & Game-Specific Fixes:**
124-
- Mapper 85 now supported (tested with Tiny Toon Adventures 2 JP, Lagrange Point JP). Note: expansion audio for Mapper 85 is not yet emulated.
125-
- Akumajou Special: Boku Dracula-kun (Mapper 23) - fixed black screen issue.
126-
- Gimmick! (JP) - fixed black playfield after pressing Start.
127-
- Robocop 3 (USA) - fixed black screen on startup (Mapper 1 fix).
128-
- Castlevania III US (Mapper 5) and Castlevania III JP (Mapper 24) - fixed sound effects cutting out mid-level.
129-
- Akumajou Densetsu (Castlevania III JP) - fixed graphical glitches in intro screen.
130-
- Galaxian (JP) - fixed handling of incorrect ROM header info.
131-
- Battletoads - Double Dragon - fixed missing sound effects.
132-
- Double Dragon - partial fix for sound glitch.
133-
- Added Sunsoft 5B expansion audio emulation for Mapper 69 (Gimmick!, Hebereke).
134-
135-
**Performance & Stability:**
136-
- Fixed stack overflow when sorting large directory contents.
137-
- Removed 40K fixed buffer used for Mapper 235 from heap memory.
138-
- DVI mode: added watchdog function on core 1 to recover from occasional signal drops
139-
140-
**Adafruit Fruit Jam:**
141-
- Headphone detection now works correctly; plugging in headphones automatically mutes the speaker.
142-
- External audio setting now enables the Fruit Jam's built-in speaker.
14397

14498

14599
# previous changes

HISTORY.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,81 @@
11
# History of changes
22

3+
# v0.41
4+
5+
## Features
6+
7+
**Famicom Disk System**
8+
9+
Note that FDS support requires an RP2350 board with PSRAM and a BIOS file at `/bios/fds-bios.rom`.
10+
11+
- Implement save games for games that support write save data back to disk, like Metroid and Zelda. Saves are stored as `/SAVES/gametitle_fds.sav` [#193](https://github.com/fhoedemakers/pico-infonesPlus/issues/193)
12+
- Added an option to the settings menu to automatically swap disk sides. This setting is disabled by default. When it’s off, you can manually swap disks in-game using SELECT + START.
13+
14+
Audio is not perfect but acceptable.
15+
16+
**NSF sound playback**
17+
18+
- Added NSF playback. Emulator can load and play `.nsf` (Nintendo Sound Format) roms.
19+
- Controls:
20+
- LEFT/RIGHT change track
21+
- Button2 Stop
22+
- Button1 Resume
23+
24+
**Settings menu**
25+
26+
- Better use of screen real estate:
27+
- SAVE / DEFAULT / CANCEL are on the same row.
28+
- FG/BG color codes now placed to the left to the color grid.
29+
30+
## Fixes
31+
32+
**Famicom Disk System**
33+
34+
- Fix disk error 24 in Metroid and possible in other games too. [#192](https://github.com/fhoedemakers/pico-infonesPlus/issues/192)
35+
- Fix for game lock-up in Zelda when moving to the next screen during gameplay.
36+
37+
## Use of AI
38+
39+
FDS, NSF, additional mappers developed with the help of [Anthropic Claude Opus 4.6](https://www.anthropic.com/claude/opus)
40+
41+
# v0.40 (This is a re-release of v0.39 with some fixes and improvements)
42+
43+
- Fix incorrect parsing of region in NES 2.0 header. [#197](https://github.com/fhoedemakers/pico-infonesPlus/issues/197) Thanks to [@Lome-one](https://github.com/Lome-one) for reporting.
44+
- The emulatortype is now correctly set to "NES" for Famicom Disk System games.
45+
46+
# v0.39
47+
48+
**Features:**
49+
- Famicom Disk System (.fds) support on RP2350 boards with PSRAM (with limitations—see [#192](https://github.com/fhoedemakers/pico-infonesPlus/issues/192), [#193](https://github.com/fhoedemakers/pico-infonesPlus/issues/193), [#194](https://github.com/fhoedemakers/pico-infonesPlus/issues/194), [#195](https://github.com/fhoedemakers/pico-infonesPlus/issues/195)). Requires a BIOS file at `/bios/fds-bios.rom`. Disk swapping is done via the settings menu (SELECT+START).
50+
- Added "reset game" option to the in-game settings menu.
51+
- Removed unused 360 folder from metadata.
52+
53+
## Fixes
54+
55+
**Regional Support:**
56+
- PAL/Dendy games now run at the correct frame rate on RP2350 boards (50Hz instead of 60Hz). RP2040 boards still run PAL/Dendy at 60Hz due to hardware constraints.
57+
58+
**Mapper & Game-Specific Fixes:**
59+
- Mapper 85 now supported (tested with Tiny Toon Adventures 2 JP, Lagrange Point JP). Note: expansion audio for Mapper 85 is not yet emulated.
60+
- Akumajou Special: Boku Dracula-kun (Mapper 23) - fixed black screen issue.
61+
- Gimmick! (JP) - fixed black playfield after pressing Start.
62+
- Robocop 3 (USA) - fixed black screen on startup (Mapper 1 fix).
63+
- Castlevania III US (Mapper 5) and Castlevania III JP (Mapper 24) - fixed sound effects cutting out mid-level.
64+
- Akumajou Densetsu (Castlevania III JP) - fixed graphical glitches in intro screen.
65+
- Galaxian (JP) - fixed handling of incorrect ROM header info.
66+
- Battletoads - Double Dragon - fixed missing sound effects.
67+
- Double Dragon - partial fix for sound glitch.
68+
- Added Sunsoft 5B expansion audio emulation for Mapper 69 (Gimmick!, Hebereke).
69+
70+
**Performance & Stability:**
71+
- Fixed stack overflow when sorting large directory contents.
72+
- Removed 40K fixed buffer used for Mapper 235 from heap memory.
73+
- DVI mode: added watchdog function on core 1 to recover from occasional signal drops
74+
75+
**Adafruit Fruit Jam:**
76+
- Headphone detection now works correctly; plugging in headphones automatically mutes the speaker.
77+
- External audio setting now enables the Fruit Jam's built-in speaker.
78+
379
# v0.38
480

581
## New and improved Mapper support

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,17 +1278,19 @@ XInput driver: https://github.com/Ryzee119/tusb_XInput by [Ryzee119](https://git
12781278

12791279
FatFS driver: https://github.com/elehobica/pico_fatfs by [elehobica](https://github.com/elehobica)
12801280

1281-
PSRAM: https://github.com/AndrewCapon/PicoPlusPsram
1281+
PSRAM: [AndrewCapon](https://github.com/AndrewCapon/PicoPlusPsram)
12821282

1283-
lwmem: https://github.com/MaJerle/lwmem
1283+
lwmem: [MaJerle](https://github.com/MaJerle/lwmem)
1284+
1285+
Audio feedback and fixes: [szuping](https://github.com/szuping)
12841286

12851287
Mesen: https://github.com/SourMesen/Mesen2 used as basis for:
12861288

12871289
- NES rom database
12881290
- FDS implementation
1289-
- NSF playback.
1291+
- NSF playback
12901292

1291-
[Anthropic Claude Opus 4.6](https://www.anthropic.com/claude/opus) assisted with:
1293+
[Anthropic Claude Opus 4.6 and 4.7](https://www.anthropic.com/claude/opus) assisted with:
12921294

12931295
- Famicom Disk System (FDS) support
12941296
- mapper 5 (MMC5)

hosttest/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ROMs and BIOS images
2+
*.fds
3+
*.nes
4+
*.rom
5+
6+
# Per-run output (frame dumps, VRAM/SPRRAM blobs, etc.)
7+
out*/
8+
9+
# Compiled harness binary
10+
nes_host

hosttest/README.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# hosttest — Linux host harness for the InfoNES core
2+
3+
Runs the unmodified `infones/` emulator core headless on a Linux PC, dumping
4+
frames as images. Useful for debugging core behavior (PPU rendering, CPU
5+
timing, mapper state) with fast iteration and full instrumentation — no Pico
6+
flashing, no serial console. Only hardware-specific issues (HSTX/DVI output,
7+
SD card, PSRAM latency, audio sinks) still need the real device.
8+
9+
The harness builds against the **RP2350 + framebuffer** configuration:
10+
`PICO_RP2350=1`, `FRAMEBUFFERISPOSSIBLE=1`, `isPsramEnabled()=true`. That
11+
unlocks MMC5, VRC7 CHR-RAM, the Famicom Disk System (FDS), and the
12+
320×240 full-frame rendering path the device uses on RP2350.
13+
14+
## Layout
15+
16+
| File | Purpose |
17+
|---|---|
18+
| `host_main.cpp` | main loop, InfoNES_* callbacks, 256×240 PPM dumper, env-var input injection, minimal iNES parser, inline CRC32, NES palette |
19+
| `stubs.cpp` | Frens helper subset (f_malloc/f_free/isPsramEnabled/...) the core links against, audio callback no-ops, host-stdio-backed FatFs (so FDS BIOS loads), `settings` instance |
20+
| `shim/pico.h` | empty `__not_in_flash_func` / `__not_in_flash` placement macros |
21+
| `shim/pico/time.h` | host `time_us_32` from `clock_gettime` |
22+
| `shim/ff.h` | minimal FatFs surface — backed by stdio in `stubs.cpp` |
23+
| `shim/FrensHelpers.h` | minimal `Frens::*` declarations the core needs; replaces the real (heavy) `pico_shared/FrensHelpers.h` |
24+
| `shim/settings.h` | minimal `settings` struct used by `FDS_AutoInsertEnabled` |
25+
| `ppm2png.py` | PPM → PNG converter, Python stdlib only (no PIL/ImageMagick needed) |
26+
27+
## Build
28+
29+
From the repo root:
30+
31+
```sh
32+
g++ -O1 -g -fsanitize=address -std=gnu++17 \
33+
-DPICO_RP2350=1 -DNDEBUG -DPICO_NO_HARDWARE=1 \
34+
-I hosttest/shim -I infones -I pico_lib -I pico_shared \
35+
-o hosttest/nes_host \
36+
hosttest/host_main.cpp hosttest/stubs.cpp \
37+
infones/InfoNES.cpp infones/K6502.cpp infones/InfoNES_Mapper.cpp \
38+
infones/InfoNES_pAPU.cpp infones/InfoNES_Region.cpp \
39+
infones/InfoNES_NSF.cpp infones/InfoNES_FDS.cpp
40+
```
41+
42+
- AddressSanitizer is intentional: it doubles as a memory-bug detector for
43+
the core. Drop `-fsanitize=address` for faster runs.
44+
- `-DPICO_RP2350=1` enables the MMC5 / VRC7 CHR-RAM / FDS code paths.
45+
- `-DNDEBUG` collapses `util/work_meter.h` to empty inlines.
46+
47+
## Run
48+
49+
```sh
50+
./hosttest/nes_host <rom.nes|rom.fds> <total-frames> <dump-every-N> [outdir]
51+
52+
# examples
53+
./hosttest/nes_host "Super Mario Bros.nes" 600 60 hosttest/out
54+
./hosttest/nes_host "Akumajou Densetsu (J).nes" 800 100 hosttest/out # MMC5
55+
./hosttest/nes_host "Zelda no Densetsu (J).fds" 600 60 hosttest/out # FDS
56+
python3 hosttest/ppm2png.py hosttest/out/frame_00200.ppm # -> .png next to it
57+
```
58+
59+
A `.fds` extension auto-routes to `fdsParse()` instead of the iNES path.
60+
Frames are written as `outdir/frame_NNNNN.ppm`, 256×240, RGB.
61+
62+
## FDS BIOS
63+
64+
FDS games need an 8 KB Famicom Disk System BIOS. Put it at:
65+
66+
```
67+
$NES_FAT_ROOT/bios/fds-bios.rom (default $NES_FAT_ROOT = ".")
68+
```
69+
70+
i.e. `./bios/fds-bios.rom` if you run the harness from the repo root. Sidecar
71+
save files (`*.SAV`) are written under `$NES_FAT_ROOT/saves/`.
72+
73+
## Environment variables
74+
75+
| Variable | Effect |
76+
|---|---|
77+
| `NES_PRESS_START=<frame>` | hold START for 10 frames starting there (gets past title screens) |
78+
| `NES_PRESS_KEYS=<f>:<hex>[,<f>:<hex>...]` | hold the given button mask 10 frames at each frame |
79+
| `NES_HOLD_A=<frame>` | autofire button A (4 frames on / 4 off) from that frame on |
80+
| `NES_REGION=ntsc\|pal\|dendy` | override `InfoNES_DetectRegion` (CRC lookup still runs, but result is overridden) |
81+
| `NES_DUMP_REGS=1` | print PPU R0..R7, scanline, PAD1 latch, mapper every 100 frames |
82+
| `NES_DUMP_VRAM=1` | write `ppuram.bin` (16 KB) and `sprram.bin` (256 B) to outdir at exit |
83+
| `NES_FDS_DISK_SIDE=<N>` | (FDS only) call `fdsRequestSwap(N)` once at startup |
84+
| `NES_FAT_ROOT=<dir>` | root directory for FatFs paths; default `.` |
85+
86+
Button mask (per joypad, hex):
87+
88+
| Bit | Value | Button |
89+
|---|---|---|
90+
| 0 | 0x01 | A |
91+
| 1 | 0x02 | B |
92+
| 2 | 0x04 | SELECT |
93+
| 3 | 0x08 | START |
94+
| 4 | 0x10 | UP |
95+
| 5 | 0x20 | DOWN |
96+
| 6 | 0x40 | LEFT |
97+
| 7 | 0x80 | RIGHT |
98+
99+
Example: `NES_PRESS_KEYS=120:08,200:11` taps START at frame 120, then holds
100+
UP+A at frame 200 for 10 frames each.
101+
102+
## Caveats
103+
104+
- Host runs are fully deterministic: no PSRAM latency, no input-timing
105+
variation. A bug that is *intermittent* on the device usually shows up
106+
here as its always-broken variant.
107+
- Audio is stubbed entirely (`InfoNES_SoundOutput` is a sink).
108+
- NSF files aren't auto-detected (no `.nsf` dispatch in the harness).
109+
- The harness does NOT load NVRAM; cartridge save RAM starts empty every run.
110+
- `isPsramEnabled()` always returns true, so FDS multi-side games keep all
111+
sides in host RAM (matches the device's PSRAM build behavior).
112+
- Region detection runs the real MesenDB CRC lookup, so games with PAL/Dendy
113+
entries pick the right timing automatically; `NES_REGION=…` forces it.

0 commit comments

Comments
 (0)