christopherpow / nesicide

Integrated Development Environment for the 8-bit Nintendo Entertainment System
316 stars 38 forks source link

Erratum in code in MMC3 emulator #66

Closed aa-dav closed 4 years ago

aa-dav commented 4 years ago

https://github.com/christopherpow/nesicide/blob/master/libs/nes/emulator/cnesrommapper004.cpp Here we have (from line 213):

if ( m_reg[0]&0x40 ) { m_PRGROMmemory.REMAP(0,m_numPrgBanks-2); m_PRGROMmemory.REMAP(1,m_prg[1]); m_PRGROMmemory.REMAP(2,m_prg[0]); m_PRGROMmemory.REMAP(3,m_numPrgBanks-1); } else { m_PRGROMmemory.REMAP(0,m_prg[0]); m_PRGROMmemory.REMAP(1,m_prg[0]); // !!!!!!!!! must be m_prg[1] !!!!!!!!!! m_PRGROMmemory.REMAP(2,m_numPrgBanks-2); m_PRGROMmemory.REMAP(3,m_numPrgBanks-1); }

This is error - second bank in /else/ must be attached to slot '1' (m_prg[1]). Ufff, I thought there is problem with debugger, but it's erratum in emulator. This error leads to impossibility of switching second 8Kb bank to anything except slot first bank is attached to (compare to specs and first 'twisted' mode in 'if'').

christopherpow commented 4 years ago

Nice catch! Will be fixed in next build.

aa-dav commented 4 years ago

Works well now!