PPU: Implemented second PPU status flag ($213F)
This commit is contained in:
parent
93b730b390
commit
bcf41aca83
2 changed files with 21 additions and 2 deletions
21
Core/Ppu.cpp
21
Core/Ppu.cpp
|
@ -524,6 +524,7 @@ void Ppu::LatchLocationValues()
|
|||
{
|
||||
_horizontalLocation = _cycle;
|
||||
_verticalLocation = _scanline;
|
||||
_locationLatched = true;
|
||||
}
|
||||
|
||||
uint8_t Ppu::Read(uint16_t addr)
|
||||
|
@ -606,6 +607,7 @@ uint8_t Ppu::Read(uint16_t addr)
|
|||
|
||||
|
||||
case 0x213E:
|
||||
//STAT77 - PPU Status Flag and Version
|
||||
//TODO open bus on bit 4
|
||||
|
||||
//"The high/low selector is reset to <20>elow<6F>f when $213f is read"
|
||||
|
@ -615,9 +617,26 @@ uint8_t Ppu::Read(uint16_t addr)
|
|||
return (
|
||||
(_timeOver ? 0x80 : 0) |
|
||||
(_rangeOver ? 0x40 : 0) |
|
||||
0x01 //PPU chip version
|
||||
0x01 //PPU (5c77) chip version
|
||||
);
|
||||
|
||||
case 0x213F: {
|
||||
//STAT78 - PPU Status Flag and Version
|
||||
//TODO open bus on bit 5
|
||||
uint8_t value = (
|
||||
((_frameCount & 0x01) ? 0x80 : 0) |
|
||||
(_locationLatched ? 0x40 : 0) |
|
||||
//TODO (_isPal ? 0x10 : 0)
|
||||
0x02 //PPU (5c78) chip version
|
||||
);
|
||||
|
||||
if(_regs->GetIoPortOutput() & 0x80) {
|
||||
_locationLatched = false;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
default:
|
||||
MessageManager::DisplayMessage("Debug", "Unimplemented register read: " + HexUtilities::ToHex(addr));
|
||||
break;
|
||||
|
|
|
@ -113,9 +113,9 @@ private:
|
|||
|
||||
uint16_t _horizontalLocation = 0;
|
||||
bool _horizontalLocToggle = false;
|
||||
|
||||
uint16_t _verticalLocation = 0;
|
||||
bool _verticalLocationToggle = false;
|
||||
bool _locationLatched = false;
|
||||
|
||||
uint16_t _mode7MatrixA = 0;
|
||||
uint16_t _mode7MatrixB = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue