Hello,
This is my first time posting on here so not sure if I'm posting to the right place.
I have recently embarked on writing a NES emulator and have found the information on NesDev invaluable but I'm having a few problems emulating Zelda II: The Adventure of Link and I'd like to ask about one of those problems.
I get through the title screen and up to the point of registering a name and seeing it on the menu, however once I attempt to start the actual game my emulator crashes as it appears to be trying to execute an op code of $D2 (one of the KIL codes I believe). I have traced this through and it appears that it crashes right after the MMC1 mapper switches to 32K mode. I'm guessing that I have misunderstood the intended workings of 32k mode and as a result an incorrect byte from the PRGROM is being accessed. Could somebody please explain the details of 32k mode.
The way I have interpreted it is:
If the the PRGBANK register is set to 0 I would expect the 32K to be held like this:
$8000 - $BFFF to be held in PRGBANK[0] and
$C000 - $FFFF to be held in PRGBANK[1]
And if the the PRGBANK register is set to 5 I would expect the 32K to be held like this: (assuming the lowest bit is ignored, we need to drop it giving us a value of 2)
$8000 - $BFFF to be held in PRGBANK[2] and
$C000 - $FFFF to be held in PRGBANK[3]
Also to clarify I have loaded the PRG data from the INES rom file into the PRG banks sequentially (i.e. 16k at a time)
I hope this question makes sense.
This is my first time posting on here so not sure if I'm posting to the right place.
I have recently embarked on writing a NES emulator and have found the information on NesDev invaluable but I'm having a few problems emulating Zelda II: The Adventure of Link and I'd like to ask about one of those problems.
I get through the title screen and up to the point of registering a name and seeing it on the menu, however once I attempt to start the actual game my emulator crashes as it appears to be trying to execute an op code of $D2 (one of the KIL codes I believe). I have traced this through and it appears that it crashes right after the MMC1 mapper switches to 32K mode. I'm guessing that I have misunderstood the intended workings of 32k mode and as a result an incorrect byte from the PRGROM is being accessed. Could somebody please explain the details of 32k mode.
The way I have interpreted it is:
If the the PRGBANK register is set to 0 I would expect the 32K to be held like this:
$8000 - $BFFF to be held in PRGBANK[0] and
$C000 - $FFFF to be held in PRGBANK[1]
And if the the PRGBANK register is set to 5 I would expect the 32K to be held like this: (assuming the lowest bit is ignored, we need to drop it giving us a value of 2)
$8000 - $BFFF to be held in PRGBANK[2] and
$C000 - $FFFF to be held in PRGBANK[3]
Also to clarify I have loaded the PRG data from the INES rom file into the PRG banks sequentially (i.e. 16k at a time)
I hope this question makes sense.