I added a register at $4027 for choosing the disk side. Reading and writing was a little tricky. PowerPak's FPGA does not control A0-A12 of its PRG RAM, so it's not possible to map any arbitrary byte to the disk read port ($4031). A proper address needs to be requested by the NES. I handle this by patching a load instruction in the BIOS, replacing the address with the current disk pointer. Thus,Fx3 wrote:I would be interested about the "logic" emulating the $4xxx registers. What about the BIOS?
$F4EF: LDA $4031 ;read byte from disk
PowerPak changes this to LDA $XXXX (E000-FFFF), maps part of the disk to the BIOS area on the next read, and increments the disk pointer. Writing works similarly. Of course, this isn't the only way to do it, maybe I made it too complex
The BIOS was not modified much. I added the disk switching, and removed disk interrupts and some delay code, which aren't needed anymore. Real saving to CF will need to be done as BMF54123 wrote above.