Core: Open bus improvements
This commit is contained in:
parent
b8624003f0
commit
348da3879b
3 changed files with 13 additions and 4 deletions
|
@ -15,6 +15,7 @@
|
|||
void MemoryManager::Initialize(shared_ptr<Console> console)
|
||||
{
|
||||
_masterClock = 0;
|
||||
_openBus = 0;
|
||||
_console = console;
|
||||
_regs = console->GetInternalRegisters().get();
|
||||
_ppu = console->GetPpu();
|
||||
|
@ -160,10 +161,10 @@ uint8_t MemoryManager::Read(uint32_t addr, MemoryOperationType type)
|
|||
uint8_t value;
|
||||
if(_handlers[addr >> 12]) {
|
||||
value = _handlers[addr >> 12]->Read(addr);
|
||||
_openBus = value;
|
||||
} else {
|
||||
//open bus
|
||||
value = (addr >> 12);
|
||||
|
||||
value = _openBus;
|
||||
MessageManager::DisplayMessage("Debug", "Read - missing handler: $" + HexUtilities::ToHex(addr));
|
||||
}
|
||||
_console->ProcessCpuRead(addr, value, type);
|
||||
|
@ -176,9 +177,10 @@ uint8_t MemoryManager::ReadDma(uint32_t addr)
|
|||
uint8_t value;
|
||||
if(_handlers[addr >> 12]) {
|
||||
value = _handlers[addr >> 12]->Read(addr);
|
||||
_openBus = value;
|
||||
} else {
|
||||
//open bus
|
||||
value = (addr >> 12);
|
||||
value = _openBus;
|
||||
MessageManager::DisplayMessage("Debug", "Read - missing handler: $" + HexUtilities::ToHex(addr));
|
||||
}
|
||||
_console->ProcessCpuRead(addr, value, MemoryOperationType::DmaRead);
|
||||
|
@ -226,6 +228,11 @@ void MemoryManager::WriteDma(uint32_t addr, uint8_t value)
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t MemoryManager::GetOpenBus()
|
||||
{
|
||||
return _openBus;
|
||||
}
|
||||
|
||||
uint64_t MemoryManager::GetMasterClock()
|
||||
{
|
||||
return _masterClock;
|
||||
|
|
|
@ -30,6 +30,7 @@ private:
|
|||
vector<unique_ptr<RamHandler>> _workRamHandlers;
|
||||
|
||||
uint8_t *_workRam;
|
||||
uint8_t _openBus;
|
||||
|
||||
uint64_t _masterClock;
|
||||
uint8_t _masterClockTable[2][0x10000];
|
||||
|
@ -56,6 +57,7 @@ public:
|
|||
void Write(uint32_t addr, uint8_t value, MemoryOperationType type);
|
||||
void WriteDma(uint32_t addr, uint8_t value);
|
||||
|
||||
uint8_t GetOpenBus();
|
||||
uint64_t GetMasterClock();
|
||||
uint8_t* DebugGetWorkRam();
|
||||
|
||||
|
|
|
@ -1255,7 +1255,7 @@ uint8_t Ppu::Read(uint16_t addr)
|
|||
break;
|
||||
}
|
||||
|
||||
return addr >> 8;
|
||||
return _console->GetMemoryManager()->GetOpenBus();
|
||||
}
|
||||
|
||||
void Ppu::Write(uint32_t addr, uint8_t value)
|
||||
|
|
Loading…
Add table
Reference in a new issue