PPU: Implemented multiply register

This commit is contained in:
Sour 2019-02-21 08:15:00 -05:00
parent 5952fcd3f5
commit d73ca5bf82
2 changed files with 20 additions and 0 deletions

View file

@ -529,6 +529,10 @@ void Ppu::LatchLocationValues()
uint8_t Ppu::Read(uint16_t addr)
{
switch(addr) {
case 0x2134: return ((int16_t)_mode7MatrixA * ((int16_t)_mode7MatrixB >> 8)) & 0xFF;
case 0x2135: return (((int16_t)_mode7MatrixA * ((int16_t)_mode7MatrixB >> 8)) >> 8) & 0xFF;
case 0x2136: return (((int16_t)_mode7MatrixA * ((int16_t)_mode7MatrixB >> 8)) >> 16) & 0xFF;
case 0x2137:
//SLHV - Software Latch for H/V Counter
//Latch values on read, and return open bus
@ -753,6 +757,18 @@ void Ppu::Write(uint32_t addr, uint8_t value)
}
break;
case 0x211B:
//M7A - Mode 7 Matrix A (also used with $2134/6)
_mode7MatrixA = (value << 8) | _mode7Latch;
_mode7Latch = value;
break;
case 0x211C:
//M7B - Mode 7 Matrix B (also used with $2134/6)
_mode7MatrixB = (value << 8) | _mode7Latch;
_mode7Latch = value;
break;
case 0x2121:
//CGRAM Address(CGADD)
_cgramAddress = value * 2;

View file

@ -117,6 +117,10 @@ private:
uint16_t _verticalLocation = 0;
bool _verticalLocationToggle = false;
uint16_t _mode7MatrixA = 0;
uint16_t _mode7MatrixB = 0;
uint8_t _mode7Latch = 0;
template<bool forMainScreen>
void RenderBgColor();