JMarlin / nesii

0 stars 0 forks source link

[NES II] Implement BIOS update module system #22

Closed JMarlin closed 2 months ago

JMarlin commented 2 months ago

Description

In order to waste as little space as possible in our limited memory, I would like to harness the flexible memory mapping in the NES II cartridge to allow me to effectively add more system code to the BIOS area after boot in the form of binary overlays

Acceptance criteria

JMarlin commented 2 months ago

Important note: For some reason, it didn't occur to me that we still need to access the slot and switches when we're running the BIOS out of RAM. Figured out a hack wherein the high/low SRAM mapping is backwards from what it currently is between modes 0 and 2 and SRAM is selected in the ROM position in mode 2, but is otherwise the same. That way, when we start up in mode 0 we can copy the BIOS right into high physical SRAM and then switch into mode 2 running out of SRAM without really caring what physical portion of SRAM is mapped into the low cart area.

This is going to require some changes to both the PLD equations and the NES game loader code to work properly, which hasn't been implemented yet.

JMarlin commented 2 months ago

Fixed up and tested the PLD to match the aforementioned scheme

JMarlin commented 2 months ago

Note to myself about RAM availability: ostensibly, once we're in NOS, we can switch to one of the all-RAM modes and switch in and out of mode 2 when we need to do disk access. That should give us gobs of room for things like BASIC if we're going to end up wanting it.