PPU: Fixed V/H read toggle
This commit is contained in:
parent
66aa5034a0
commit
93b730b390
1 changed files with 15 additions and 9 deletions
22
Core/Ppu.cpp
22
Core/Ppu.cpp
|
@ -578,25 +578,31 @@ uint8_t Ppu::Read(uint16_t addr)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x213C:
|
case 0x213C: {
|
||||||
//OPHCT - Horizontal Scanline Location
|
//OPHCT - Horizontal Scanline Location
|
||||||
|
uint8_t value;
|
||||||
if(_horizontalLocToggle) {
|
if(_horizontalLocToggle) {
|
||||||
//"Note that the value read is only 9 bits: bits 1-7 of the high byte are PPU2 Open Bus."
|
//"Note that the value read is only 9 bits: bits 1-7 of the high byte are PPU2 Open Bus."
|
||||||
return ((_horizontalLocation & 0x100) >> 8) | ((addr >> 8) & 0xFE);
|
value = ((_horizontalLocation & 0x100) >> 8) | ((addr >> 8) & 0xFE);
|
||||||
} else {
|
} else {
|
||||||
return _horizontalLocation & 0xFF;
|
value = _horizontalLocation & 0xFF;
|
||||||
|
}
|
||||||
|
_horizontalLocToggle = !_horizontalLocToggle;
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x213D:
|
case 0x213D: {
|
||||||
//OPVCT - Vertical Scanline Location
|
//OPVCT - Vertical Scanline Location
|
||||||
|
uint8_t value;
|
||||||
if(_verticalLocationToggle) {
|
if(_verticalLocationToggle) {
|
||||||
//"Note that the value read is only 9 bits: bits 1-7 of the high byte are PPU2 Open Bus."
|
//"Note that the value read is only 9 bits: bits 1-7 of the high byte are PPU2 Open Bus."
|
||||||
return ((_verticalLocation & 0x100) >> 8) | ((addr >> 8) & 0xFE);
|
value = ((_verticalLocation & 0x100) >> 8) | ((addr >> 8) & 0xFE);
|
||||||
} else {
|
} else {
|
||||||
return _verticalLocation & 0xFF;
|
value = _verticalLocation & 0xFF;
|
||||||
|
}
|
||||||
|
_verticalLocationToggle = !_verticalLocationToggle;
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case 0x213E:
|
case 0x213E:
|
||||||
|
|
Loading…
Add table
Reference in a new issue