Mapper 37: Fixed reset & added WRAM write protect behavior for block register
This commit is contained in:
parent
642faea14a
commit
65edf01c28
3 changed files with 16 additions and 3 deletions
|
@ -147,10 +147,10 @@ void Console::ResetComponents(bool softReset)
|
|||
_debugger->Step(1);
|
||||
}
|
||||
|
||||
_memoryManager->Reset(softReset);
|
||||
_ppu->Reset();
|
||||
_apu->Reset(softReset);
|
||||
_cpu->Reset(softReset);
|
||||
_memoryManager->Reset(softReset);
|
||||
|
||||
SoundMixer::StopAudio(true);
|
||||
|
||||
|
|
|
@ -98,6 +98,11 @@ class MMC3 : public BaseMapper
|
|||
}
|
||||
}
|
||||
|
||||
bool CanWriteToWorkRam()
|
||||
{
|
||||
return _wramEnabled && !_wramWriteProtected;
|
||||
}
|
||||
|
||||
virtual void UpdateState()
|
||||
{
|
||||
_currentRegister = _state.Reg8000 & 0x07;
|
||||
|
|
|
@ -17,6 +17,12 @@ protected:
|
|||
MMC3::StreamState(saving);
|
||||
}
|
||||
|
||||
virtual void Reset(bool softReset)
|
||||
{
|
||||
_selectedBlock = 0;
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
virtual void SelectCHRPage(uint16_t slot, uint16_t page, ChrMemoryType memoryType = ChrMemoryType::Default)
|
||||
{
|
||||
if(_selectedBlock >= 4) {
|
||||
|
@ -47,8 +53,10 @@ protected:
|
|||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
{
|
||||
if(addr < 0x8000) {
|
||||
_selectedBlock = value & 0x07;
|
||||
UpdateState();
|
||||
if(CanWriteToWorkRam()) {
|
||||
_selectedBlock = value & 0x07;
|
||||
UpdateState();
|
||||
}
|
||||
} else {
|
||||
MMC3::WriteRegister(addr, value);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue