Skip to content

Commit 3b4db83

Browse files
authored
Merge pull request #196 from fhoedemakers/fds
Limited Famicom Disk System support
2 parents 40c01c9 + 4d9ec45 commit 3b4db83

15 files changed

Lines changed: 1603 additions & 53 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ bld/
7575
[Ll]og/
7676
[Ll]ogs/
7777
*.nes
78+
*.fds
7879
# Visual Studio 2015/2017 cache/options directory
7980
.vs/
8081
# Uncomment if you have tasks that create the project's static files in wwwroot

CHANGELOG.md

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

3-
More mapper fixes and PAL/Dendy games now run at the correct speed on RP2350 boards.
3+
Famicom Disk System support with limitations, additional mapper improvements, and native PAL/Dendy frame rates on RP2350 boards.
44

55
# General Info
66

@@ -12,26 +12,36 @@ More mapper fixes and PAL/Dendy games now run at the correct speed on RP2350 boa
1212

1313
# v0.39
1414

15-
- Added "reset game" to the in-game settings menu.
16-
- Removed the 360 folder from the metdata since it's not being used.
15+
**Features:**
16+
- 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).
17+
- Added "reset game" option to the in-game settings menu.
18+
- Removed unused 360 folder from metadata.
1719

1820
## Fixes
19-
- PAL/Dendy games now run at the correct speed on RP2350 boards. Previously, they ran at 60Hz instead of 50Hz, causing them to run too fast. Due to the way the RP2040 has no framebuffer and renders directly to the display, it was not possible to implement a 50Hz mode on RP2040 boards. PAL/Dendy games on RP2040 boards will continue to run at 60Hz. Not that only PAL games are tested. Dendy games are not tested yet, but they should also run at the correct speed now.
20-
- Mapper 85 games now working. Tested with Tiny Toon Adventures 2 (JP), Lagrange Point (JP). Note that the expansion audio for Mapper 85 is yet emulated, so Lagrange Point will be missing music and sound effects. Tiny Toon Adventures 2 (JP) does not use the expansion audio and is playable with music and sound effects.
21-
- Partial fix for a sound glitch in Double Dragon. [#188](https://github.com/fhoedemakers/pico-infonesPlus/issues/188)
22-
- Fix for black screen in Akumajou Special: Boku Dracula-kun - Mapper 23 [#186](https://github.com/fhoedemakers/pico-infonesPlus/issues/186)
23-
- Fix for Gimmick! (JP) showing only the HUD with a black playfield after pressing Start. [#187](https://github.com/fhoedemakers/pico-infonesPlus/issues/187)
24-
- Added Sunsoft 5B expansion audio emulation for Mapper 69 (Gimmick!, Hebereke).
25-
- Fix for roms with incorrect header info, like Galaxian (JP)
26-
- Fix for Robocop 3 (USA) not starting and only showing a black screen instead. (Mapper 1 fix, see [#185](https://github.com/fhoedemakers/pico-infonesPlus/issues/185))
27-
- Fixed a bug where sorting large directory contents could cause a stack overflow; now uses a safer sorting method to prevent this issue.
28-
- Fix graphical issue in intro screen of Akumajou Densetsu (Castlevania III JP)
29-
- Fix sound effects (e.g. whip) disappearing after a few screens in Castlevania III US (mapper 5) and Castlevania III JP (mapper 24). The APU `$4015` status register now correctly reflects actual channel/DPCM state rather than the last-written value.
30-
- Fix for missing sound effects in Battletoads - Double Dragon [#111](https://github.com/fhoedemakers/pico-infonesPlus/issues/111)
31-
- **Adafruit Fruit Jam:**
32-
- Headphone detection now works correctly. Plugging in headphones automatically mutes the speaker (Internal or monitor); unplugging them re-enables it.
33-
- The external audio setting, when enabled, enables the Fruit Jam built-in speaker. Audio is muted from the monitor.
34-
- In DVI video mode, a watchdog function was added on core 1 to recover from occasional signal drops. This issue is not present in HDMI mode.
21+
22+
**Regional Support:**
23+
- 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.
24+
25+
**Mapper & Game-Specific Fixes:**
26+
- Mapper 85 now supported (tested with Tiny Toon Adventures 2 JP, Lagrange Point JP). Note: expansion audio for Mapper 85 is not yet emulated.
27+
- Akumajou Special: Boku Dracula-kun (Mapper 23) - fixed black screen issue.
28+
- Gimmick! (JP) - fixed black playfield after pressing Start.
29+
- Robocop 3 (USA) - fixed black screen on startup (Mapper 1 fix).
30+
- Castlevania III US (Mapper 5) and Castlevania III JP (Mapper 24) - fixed sound effects cutting out mid-level.
31+
- Akumajou Densetsu (Castlevania III JP) - fixed graphical glitches in intro screen.
32+
- Galaxian (JP) - fixed handling of incorrect ROM header info.
33+
- Battletoads - Double Dragon - fixed missing sound effects.
34+
- Double Dragon - partial fix for sound glitch.
35+
- Added Sunsoft 5B expansion audio emulation for Mapper 69 (Gimmick!, Hebereke).
36+
37+
**Performance & Stability:**
38+
- Fixed stack overflow when sorting large directory contents.
39+
- Removed 40K fixed buffer used for Mapper 235 from heap memory.
40+
- DVI mode: added watchdog function on core 1 to recover from occasional signal drops
41+
42+
**Adafruit Fruit Jam:**
43+
- Headphone detection now works correctly; plugging in headphones automatically mutes the speaker.
44+
- External audio setting now enables the Fruit Jam's built-in speaker.
3545

3646

3747
# previous changes

README.md

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,52 @@
11
# pico-infonesPlus.
22

3-
## Introduction.
3+
## Introduction
44

5-
A NES (Nintendo Entertainment System) emulator with SD card and menu support for the Raspberry Pi Pico, Raspberry Pi Pico 2 and other RP2040/RP2350 based microcontrollers. Uses HDMI for display.
5+
**pico-infonesPlus** is a NES (Nintendo Entertainment System) emulator for Raspberry Pi Pico, Pico 2, and other RP2040/RP2350-based microcontrollers. It provides NES emulation with SD card support, an integrated menu system, and HDMI video output, enabling users to build compact, affordable retro gaming systems.
66

7-
Supported regions are NTSC, PAL and Dendy. Note that PAL/Dendy games run at the correct speed on RP2350 boards, but run at 60Hz instead of 50Hz on RP2040 boards due to technical limitations. Dendy games are not tested yet, but they should also run at the correct speed on RP2350 boards.
7+
### Features
88

9-
Supports two controllers for two player games. [See "about two player games" below for specifics and limitations](#about-two-player-games)
9+
- **NES Emulation** – Execute NES ROM files directly from an SD card
10+
- **SD Card Menu System** – Browse and launch games from an on-screen menu interface
11+
- **Dual Controller Support** – Two simultaneous controllers for multiplayer gameplay ([details](#about-two-player-games))
12+
- **Save State Management** – Automatic battery-backed SRAM persistence and manual save states
13+
- **Audio Playback** – WAV format audio playback in the menu (RP2350 only)
14+
- **Famicom Disk System** – Support for FDS game images with user-supplied BIOS
15+
- **Multi-Region Support** – NTSC, PAL, and Dendy region compatibility
16+
- **Flexible Hardware** – Compatible with standard DVI/HDMI breakout boards, with optional [custom PCB](#pcb-with-raspberry-pi-pico-or-pico-2) and [3D-printed case](https://github.com/fhoedemakers/pico-infonesPlus#3d-printed-case)
1017

11-
The emulator used is [Infones by Jay Kumogata](https://github.com/jay-kumogata/InfoNES) which was ported to the [Raspberry Pi Pico by Shuichi Takano](https://github.com/shuichitakano/pico-infones) with changes done by me to accomodate the SD card menu.
18+
### Regional Support
1219

13-
Create a FAT32 (recommended) or exFAT formatted SD card and copy your NES roms and optional [metadata](#using-metadata) on to it. It is possible to organize your roms into different folders. Then insert the SD Card into the card slot. Needless to say you must own all the roms you put on the card.
20+
| Platform | NTSC | PAL | Dendy |
21+
|----------|------|-----|-------|
22+
| **RP2350** || ✓ (native speed) | ✓ (native speed, untested) |
23+
| **RP2040** || ✓ (60Hz) | ✓ (60Hz, untested) |
1424

15-
A menu is added to the emulator, which reads the roms from the SD card and shows them on screen for the user to select, flash and play. The menu can also [play back music files in WAV format](#music-playback-in-menu-rp2350-only) (RP2350 boards only).
25+
*Note: RP2040 boards operate PAL/Dendy games at 60Hz instead of 50Hz due to hardware constraints.*
1626

17-
For games that use battery-backed SRAM, the SRAM data is automatically saved to the SD card when you exit to the menu. The emulator also supports save states.
27+
### Setup Overview
1828

19-
See below for [possible configurations](#possible-configurations), [supported game controllers](#gamecontroller-support) and how to [setup](#setup). There is even a custom [PCB (printed circuit board)](#pcb-with-raspberry-pi-pico-or-pico-2) available and a [3D-printable case design](https://github.com/fhoedemakers/pico-infonesPlus#3d-printed-case) which fits the PCB.
29+
1. Prepare an SD card formatted as FAT32 or exFAT
30+
2. Transfer NES ROM files to the card (subdirectory organization is supported)
31+
3. Optionally include [metadata files](#using-metadata) for game information
32+
4. Insert the SD card into the device
33+
5. Use the menu to browse, select, and play games. Save data is automatically persisted to the SD card.
2034

21-
[See also the Adafruit guide](https://learn.adafruit.com/nes-emulator-for-rp2040-dvi-boards).
35+
### Famicom Disk System (FDS) Games
36+
37+
To enable FDS game support, provide your own BIOS file:
38+
1. Copy the FDS BIOS file to the `/bios` directory on your SD card
39+
2. Name the file: `fds-bios.rom`
40+
41+
FDS ROM images will then be available alongside NES ROMs in the menu.
42+
43+
For more info on FDS Game see the [FDS](#famicom-disk-system-fds-games-1) section in this README.
44+
45+
### Project Information
46+
47+
This project is based on [Infones](https://github.com/jay-kumogata/InfoNES) by Jay Kumogata, ported to Raspberry Pi Pico by [Shuichi Takano](https://github.com/shuichitakano/pico-infones). This implementation extends the core emulator with comprehensive SD card integration, menu functionality, and additional enhancements.
48+
49+
For detailed setup instructions, refer to the [Setup](#setup) section. For hardware configurations and controller options, consult [Possible Configurations](#possible-configurations) and [Gamecontroller Support](#gamecontroller-support). Additional guidance is available in the [Adafruit tutorial](https://learn.adafruit.com/nes-emulator-for-rp2040-dvi-boards).
2250

2351
There is also an emulator port for the Sega Master System/Sega Game Gear, Nintendo DMG Game Boy/Game Boy Color and Sega Mega Drive/Genesis. You can find them here:
2452

@@ -58,26 +86,26 @@ You can use it with these RP2040/RP2350 boards and configurations:
5886

5987
You can 3d print your own NES-like case for for this board. This does require some soldering.
6088

61-
- [Waveshare RP2350-PiZero Development Board](https://www.waveshare.com/rp2350-pizero.htm) Supports the optional PSRAM chip. When installed, the emulator loads ROMs from PSRAM instead of flash memory for significantly faster performance. Fully functional even without PSRAM.
89+
- [Waveshare RP2350-PiZero Development Board](https://www.waveshare.com/rp2350-pizero.htm) Supports the optional PSRAM chip. When installed, the emulator loads ROMs from PSRAM instead of flash memory for significantly faster performance. When PSRAM is installed, the board must have a Winbond flash chip installed. See [#191](https://github.com/fhoedemakers/pico-infonesPlus/issues/191) Fully functional even without PSRAM.
6290

6391
- [Adafruit Metro RP2350](https://www.adafruit.com/product/6003) Supports the optional PSRAM chip. When installed, the emulator loads ROMs from PSRAM instead of flash memory for significantly faster performance. Fully functional even without PSRAM.
6492

6593
- [Pimoroni Pico Plus 2](https://shop.pimoroni.com/products/pimoroni-pico-plus-2?variant=42092668289107)
6694

67-
Use the breadboard config as mentioned above. Works also on the Pimoroni Pico DV Demo base. This board does not fit the PCB because of the SP/CE connector on back of the board.
95+
Use the breadboard config as mentioned above. Works also on the discontinued Pimoroni Pico DV Demo base. This board does not fit the PCB because of the SP/CE connector on back of the board.
6896
The PSRAM on the board is used in stead of flash to load the roms from SD.
6997

7098
- [Adafruit Fruit Jam](https://www.adafruit.com/product/6200)
71-
No additional hardware is required apart from a USB gamepad. Audio is output through the included speaker, with the option to connect external speakers or a Wii Classic controller via Stemma QT. The PSRAM on the board is used in stead of flash to load the roms from SD.
99+
No additional hardware is required apart from a USB gamepad. Audio is output through the monitor or the included speaker, with the option to connect external speakers and a Wii Classic controller via Stemma QT. The PSRAM on the board is used in stead of flash to load the roms from SD.
72100

73101
- [SpotPear HDMI](https://spotpear.com/index/product/detail/id/1207.html)
74102
See downloads in the releases page for the correct binary to use with this board.
75103

76104
- [Murmulator M1 and M2 boards](https://murmulator.ru).
77105
See downloads in the releases page for the correct binary to use with these boards.
78106

79-
- (Discontinued) [Pimoroni Pico Plus 2](https://shop.pimoroni.com/products/pimoroni-pico-plus-2?variant=42092668289107) and a Raspberry Pi Pico, Pico 2. Requires one of these addons:
80-
- [Pimoroni Pico DV Demo Base](https://shop.pimoroni.com/products/pimoroni-pico-dv-demo-base?variant=39494203998291) hdmi add-on board. For use with a USB gamecontroller or up to two a legacy NES controllers. (NES controller ports require soldering)
107+
- [Pimoroni Pico Plus 2](https://shop.pimoroni.com/products/pimoroni-pico-plus-2?variant=42092668289107) Requires one of these addons:
108+
- (Discontinued) [Pimoroni Pico DV Demo Base](https://shop.pimoroni.com/products/pimoroni-pico-dv-demo-base?variant=39494203998291) hdmi add-on board. For use with a USB gamecontroller or up to two a legacy NES controllers. (NES controller ports require soldering)
81109
- Breadboard and
82110
- [Adafruit DVI Breakout For HDMI Source Devices](https://www.adafruit.com/product/4984)
83111
- [Adafruit Micro-SD breakout board+](https://www.adafruit.com/product/254).
@@ -86,9 +114,6 @@ See downloads in the releases page for the correct binary to use with these boar
86114

87115
[See below to see how to setup your specific configuration.](#Setup)
88116

89-
> [!NOTE]
90-
> It seems that sellers on AliExpress have copied the PCB design and are selling pre-populated PCB's. I do not condone this in any way.
91-
> For questions about those boards, please contact the seller on AliExpress.
92117

93118
***
94119

@@ -910,6 +935,25 @@ Download the metadata pack from the [releases page](https://github.com/fhoedemak
910935

911936
<img width="1920" height="1080" alt="Screenshot 2025-08-25 15-43-24" src="https://github.com/user-attachments/assets/7aa98825-e3b1-4c7a-ba13-80e04929a27d" />
912937

938+
# Famicom Disk System (FDS) Games
939+
940+
FDS games are supported with the following limitations:
941+
942+
- A BIOS file is required. Place it at `/bios/fds-bios.rom` on the SD card.
943+
- An RP2350 board with PSRAM is required.
944+
- Games that save data to disk may not work correctly or at all. (Zelda, Metroid)
945+
- Expansion audio is not supported.
946+
947+
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) for issues regarding to FDS.
948+
949+
### Swapping Disks
950+
951+
When prompted to swap disks, use the in-game settings menu:
952+
953+
1. Press **SELECT + START** to open the settings menu.
954+
2. Select the first option to change the disk.
955+
3. Press **LEFT/RIGHT** to choose the disk side.
956+
4. Press **Button2** to confirm and return.
913957

914958
# Gamepad and keyboard usage
915959

infones/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ INTERFACE
66
InfoNES_pAPU.cpp
77
InfoNES.cpp
88
InfoNES_Region.cpp
9+
InfoNES_FDS.cpp
910
K6502.cpp
1011
)
1112

infones/InfoNES.cpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ BYTE ROM_Trainer;
308308
/* Four screen VRAM */
309309
BYTE ROM_FourScr;
310310

311+
/* True when the loaded image is a Famicom Disk System disk (no iNES header). */
312+
bool IsFDS = false;
313+
311314
/*===================================================================*/
312315
/* */
313316
/* InfoNES_Init() : Initialize InfoNES */
@@ -379,6 +382,7 @@ void InfoNES_Fin()
379382
Map5_Gfx_Mode = 0;
380383
#endif
381384
if (Map85_Chr_Ram) { Frens::f_free(Map85_Chr_Ram); Map85_Chr_Ram = nullptr; }
385+
if (DRAM) { Frens::f_free(DRAM); DRAM = nullptr; }
382386
}
383387

384388
/*===================================================================*/
@@ -457,14 +461,26 @@ int InfoNES_Reset()
457461
// MapperNo |= (NesHeader.byInfo2 & 0xf0);
458462
// }
459463

460-
// Mapper Number is 8bits. Always use lower 4bits of byInfo2 for compatibility with old ROMs.
461-
MapperNo = (NesHeader.byInfo1 >> 4) | (NesHeader.byInfo2 & 0xf0);
462-
463-
// Get information on the ROM
464-
ROM_Mirroring = NesHeader.byInfo1 & 1;
465-
ROM_SRAM = NesHeader.byInfo1 & 2;
466-
ROM_Trainer = NesHeader.byInfo1 & 4;
467-
ROM_FourScr = NesHeader.byInfo1 & 8;
464+
if (IsFDS)
465+
{
466+
// Famicom Disk System: no iNES header, dispatch through synthetic mapper 20.
467+
MapperNo = 20;
468+
ROM_Mirroring = 0;
469+
ROM_SRAM = 0;
470+
ROM_Trainer = 0;
471+
ROM_FourScr = 0;
472+
}
473+
else
474+
{
475+
// Mapper Number is 8bits. Always use lower 4bits of byInfo2 for compatibility with old ROMs.
476+
MapperNo = (NesHeader.byInfo1 >> 4) | (NesHeader.byInfo2 & 0xf0);
477+
478+
// Get information on the ROM
479+
ROM_Mirroring = NesHeader.byInfo1 & 1;
480+
ROM_SRAM = NesHeader.byInfo1 & 2;
481+
ROM_Trainer = NesHeader.byInfo1 & 4;
482+
ROM_FourScr = NesHeader.byInfo1 & 8;
483+
}
468484

469485
/*-------------------------------------------------------------------*/
470486
/* Initialize resources */

infones/InfoNES.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ extern BYTE ROM_SRAM;
305305
extern BYTE ROM_Trainer;
306306
extern BYTE ROM_FourScr;
307307

308+
/* True when the loaded image is a Famicom Disk System disk (no iNES header).
309+
Set by parseROM in main before InfoNES_Reset. RP2350 + PSRAM only. */
310+
extern bool IsFDS;
311+
308312
/*-------------------------------------------------------------------*/
309313
/* Function prototypes */
310314
/*-------------------------------------------------------------------*/

0 commit comments

Comments
 (0)