Skip to content

Pass the FDS BIOS through HotSwap so disk images can be hot swapped - #1

Open
UndocumentedWorlds wants to merge 1 commit into
100thCoin:masterfrom
UndocumentedWorlds:fds-hotswap-bios
Open

UndocumentedWorlds wants to merge 1 commit into
100thCoin:masterfrom
UndocumentedWorlds:fds-hotswap-bios

Conversation

@UndocumentedWorlds

@UndocumentedWorlds UndocumentedWorlds commented Sep 3, 2026

Copy link
Copy Markdown

Problem

HotSwap() calls Init(null, rom, null). On the FDS code path, Init()
throws before the board is created:

// NES.cs:382
if (fdsbios == null)
    throw new MissingFirmwareException("Missing FDS Bios");

So hot swapping to any .fds image fails immediately, regardless of
firmware configuration. Cartridge swaps are unaffected because Init()
never reads the third argument on the iNES/UNIF path.

Change

The constructor already resolves the BIOS. This keeps that array and
passes it through on swap.

Using the stored array rather than re-fetching it matters: the
constructor applies the 40976-byte bad-dump correction, and re-fetching
would skip it.

Notes

  • Internal RAM preservation is untouched — the existing hotSwapping
    flag still does that work.
  • The FDS board is recreated by Init(), so the 32 KB PRG-RAM is not
    carried across. It is reloaded from the new disk anyway.
  • The header test mirrors the one inside Init(), so both headered
    .fds files and raw disk images (\x01*NI) are handled. Passing the
    array unconditionally would behave the same; the check is there to
    keep the intent readable.

Testing

  • FDS → FDS swap mid-run: the new disk boots and $0000-$07FF is
    preserved across the swap.
  • Normal loads of FDS and cartridge ROMs still work.

Check if completed:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant