FDS: Improved open bus behavior for register reads (fixes Super Lode Runner)
This commit is contained in:
parent
3da14db83d
commit
3a55cfeea9
2 changed files with 18 additions and 9 deletions
10
Core/FDS.cpp
10
Core/FDS.cpp
|
@ -375,12 +375,15 @@ bool FDS::IsDiskInserted()
|
|||
|
||||
uint8_t FDS::ReadRegister(uint16_t addr)
|
||||
{
|
||||
uint8_t value = 0;
|
||||
uint8_t value = MemoryManager::GetOpenBus();
|
||||
if(_soundRegEnabled && addr >= 0x4040) {
|
||||
return _audio->ReadRegister(addr);
|
||||
} else if(_diskRegEnabled && addr <= 0x4033) {
|
||||
switch(addr) {
|
||||
case 0x4030:
|
||||
//These 3 pins are open bus
|
||||
value &= 0x2C;
|
||||
|
||||
value |= CPU::HasIRQSource(IRQSource::External) ? 0x01 : 0x00;
|
||||
value |= _transferComplete ? 0x02 : 0x00;
|
||||
value |= _badCrc ? 0x10 : 0x00;
|
||||
|
@ -398,6 +401,9 @@ uint8_t FDS::ReadRegister(uint16_t addr)
|
|||
return _readDataReg;
|
||||
|
||||
case 0x4032:
|
||||
//These 5 pins are open bus
|
||||
value &= 0xF8;
|
||||
|
||||
value |= !IsDiskInserted() ? 0x01 : 0x00; //Disk not in drive
|
||||
value |= (!IsDiskInserted() || !_scanningDisk) ? 0x02 : 0x00; //Disk not ready
|
||||
value |= !IsDiskInserted() ? 0x04 : 0x00; //Disk not writable
|
||||
|
@ -413,7 +419,7 @@ uint8_t FDS::ReadRegister(uint16_t addr)
|
|||
|
||||
case 0x4033:
|
||||
//Always return good battery
|
||||
return 0x80 & _extConWriteReg;
|
||||
return _extConWriteReg;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,16 +90,19 @@ protected:
|
|||
public:
|
||||
uint8_t ReadRegister(uint16_t addr)
|
||||
{
|
||||
uint8_t value = MemoryManager::GetOpenBus();
|
||||
if(addr <= 0x407F) {
|
||||
return 0x40 | _waveTable[addr & 0x3F];
|
||||
} else {
|
||||
switch(addr) {
|
||||
case 0x4090: return 0x40 | _volume.GetGain();
|
||||
case 0x4092: return 0x40 | _mod.GetGain();
|
||||
}
|
||||
value &= 0xC0;
|
||||
value |= _waveTable[addr & 0x3F];
|
||||
} else if(addr == 0x4090) {
|
||||
value &= 0xC0;
|
||||
value |= _volume.GetGain();
|
||||
} else if(addr == 0x4092) {
|
||||
value &= 0xC0;
|
||||
value |= _mod.GetGain();
|
||||
}
|
||||
|
||||
return MemoryManager::GetOpenBus();
|
||||
return value;
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
|
|
Loading…
Add table
Reference in a new issue