diff --git a/bsnes/snes/alt/ppu-compatibility/debugger/debugger.cpp b/bsnes/snes/alt/ppu-compatibility/debugger/debugger.cpp index 96c8d60..a4b67d4 100644 --- a/bsnes/snes/alt/ppu-compatibility/debugger/debugger.cpp +++ b/bsnes/snes/alt/ppu-compatibility/debugger/debugger.cpp @@ -379,6 +379,18 @@ bool PPUDebugger::property(unsigned id, string &name, string &value) { item("OAM Interlace", regs.oam_interlace); item("Interlace", regs.interlace); + //$2134 + item("$2134", ""); + item("Multiplication Result Low", string("0x", hex<2>(regs.mpyl))); + + //$2135 + item("$2135", ""); + item("Multiplication Result Mid", string("0x", hex<2>(regs.mpym))); + + //$2136 + item("$2136", ""); + item("Multiplication Result High", string("0x", hex<2>(regs.mpyh))); + //$213c item("$213c", ""); item("H-counter", (unsigned)regs.hcounter); diff --git a/bsnes/snes/alt/ppu-compatibility/mmio/mmio.cpp b/bsnes/snes/alt/ppu-compatibility/mmio/mmio.cpp index 89e2aea..368ad5e 100644 --- a/bsnes/snes/alt/ppu-compatibility/mmio/mmio.cpp +++ b/bsnes/snes/alt/ppu-compatibility/mmio/mmio.cpp @@ -434,8 +434,10 @@ void PPU::mmio_w2133(uint8 value) { uint8 PPU::mmio_r2134() { uint32 r; r = ((int16)regs.m7a * (int8)(regs.m7b >> 8)); - if(!Memory::debugger_access()) + if(!Memory::debugger_access()) { regs.ppu1_mdr = r; + regs.mpyl = regs.ppu1_mdr; + } return r; } @@ -443,8 +445,10 @@ uint32 r; uint8 PPU::mmio_r2135() { uint32 r; r = ((int16)regs.m7a * (int8)(regs.m7b >> 8)); - if(!Memory::debugger_access()) + if(!Memory::debugger_access()) { regs.ppu1_mdr = r >> 8; + regs.mpym = regs.ppu1_mdr; + } return r >> 8; } @@ -452,8 +456,10 @@ uint32 r; uint8 PPU::mmio_r2136() { uint32 r; r = ((int16)regs.m7a * (int8)(regs.m7b >> 8)); - if(!Memory::debugger_access()) + if(!Memory::debugger_access()) { regs.ppu1_mdr = r >> 16; + regs.mpyh = regs.ppu1_mdr; + } return r >> 16; } diff --git a/bsnes/snes/alt/ppu-compatibility/mmio/mmio.hpp b/bsnes/snes/alt/ppu-compatibility/mmio/mmio.hpp index aeb1c3a..df5181a 100644 --- a/bsnes/snes/alt/ppu-compatibility/mmio/mmio.hpp +++ b/bsnes/snes/alt/ppu-compatibility/mmio/mmio.hpp @@ -117,6 +117,11 @@ struct { bool oam_interlace; bool interlace; + //$2134-$2136 + uint8 mpyl; + uint8 mpym; + uint8 mpyh; + //$2137 uint16 hcounter, vcounter; bool latch_hcounter, latch_vcounter; diff --git a/bsnes/snes/alt/ppu-compatibility/ppu.cpp b/bsnes/snes/alt/ppu-compatibility/ppu.cpp index 768ca4c..8bc2d1d 100644 --- a/bsnes/snes/alt/ppu-compatibility/ppu.cpp +++ b/bsnes/snes/alt/ppu-compatibility/ppu.cpp @@ -323,6 +323,11 @@ void PPU::power() { regs.oam_interlace = false; regs.interlace = false; + //$2134-$2136 + regs.mpyl = 0; + regs.mpym = 0; + regs.mpyh = 0; + //$2137 regs.hcounter = 0; regs.vcounter = 0; diff --git a/bsnes/snes/alt/ppu-compatibility/serialization.cpp b/bsnes/snes/alt/ppu-compatibility/serialization.cpp index 078ad48..038a1f3 100644 --- a/bsnes/snes/alt/ppu-compatibility/serialization.cpp +++ b/bsnes/snes/alt/ppu-compatibility/serialization.cpp @@ -118,6 +118,10 @@ void PPU::serialize(serializer &s) { s.integer(regs.oam_interlace); s.integer(regs.interlace); + s.integer(regs.mpyl); + s.integer(regs.mpym); + s.integer(regs.mpyh); + s.integer(regs.hcounter); s.integer(regs.vcounter); s.integer(regs.latch_hcounter); diff --git a/bsnes/snes/alt/ppu-performance/debugger/debugger.cpp b/bsnes/snes/alt/ppu-performance/debugger/debugger.cpp index 2e7186a..a072797 100644 --- a/bsnes/snes/alt/ppu-performance/debugger/debugger.cpp +++ b/bsnes/snes/alt/ppu-performance/debugger/debugger.cpp @@ -378,6 +378,18 @@ bool PPUDebugger::property(unsigned id, string &name, string &value) { item("OAM Interlace", oam.regs.interlace); item("Interlace", regs.interlace); + //$2134 + item("$2134", ""); + item("Multiplication Result Low", string("0x", hex<2>(regs.mpyl))); + + //$2135 + item("$2135", ""); + item("Multiplication Result Mid", string("0x", hex<2>(regs.mpym))); + + //$2136 + item("$2136", ""); + item("Multiplication Result High", string("0x", hex<2>(regs.mpyh))); + //$213c item("$213c", ""); item("H-counter", (unsigned)regs.hcounter); diff --git a/bsnes/snes/alt/ppu-performance/mmio/mmio.cpp b/bsnes/snes/alt/ppu-performance/mmio/mmio.cpp index b004e6c..d198829 100644 --- a/bsnes/snes/alt/ppu-performance/mmio/mmio.cpp +++ b/bsnes/snes/alt/ppu-performance/mmio/mmio.cpp @@ -175,6 +175,7 @@ uint8 PPU::mmio_read(unsigned addr) { return result; regs.ppu1_mdr = result >> 0; + regs.mpyl = regs.ppu1_mdr; return regs.ppu1_mdr; } @@ -185,6 +186,7 @@ uint8 PPU::mmio_read(unsigned addr) { return result >> 8; regs.ppu1_mdr = result >> 8; + regs.mpym = regs.ppu1_mdr; return regs.ppu1_mdr; } @@ -195,6 +197,7 @@ uint8 PPU::mmio_read(unsigned addr) { return result >> 16; regs.ppu1_mdr = result >> 16; + regs.mpyh = regs.ppu1_mdr; return regs.ppu1_mdr; } @@ -941,6 +944,11 @@ void PPU::mmio_reset() { oam.regs.interlace = 0; regs.interlace = 0; + //$2134-$2136 + regs.mpyl = 0; + regs.mpym = 0; + regs.mpyh = 0; + //$213e oam.regs.time_over = 0; oam.regs.range_over = 0; diff --git a/bsnes/snes/alt/ppu-performance/mmio/mmio.hpp b/bsnes/snes/alt/ppu-performance/mmio/mmio.hpp index 3fcbfe8..02cea7e 100644 --- a/bsnes/snes/alt/ppu-performance/mmio/mmio.hpp +++ b/bsnes/snes/alt/ppu-performance/mmio/mmio.hpp @@ -68,6 +68,11 @@ struct Regs { bool overscan; bool interlace; + //$2134-$2136 + uint8 mpyl; + uint8 mpym; + uint8 mpyh; + //$213c uint16 hcounter; diff --git a/bsnes/snes/alt/ppu-performance/serialization.cpp b/bsnes/snes/alt/ppu-performance/serialization.cpp index 7d6e2dd..76e24d6 100644 --- a/bsnes/snes/alt/ppu-performance/serialization.cpp +++ b/bsnes/snes/alt/ppu-performance/serialization.cpp @@ -75,6 +75,10 @@ void PPU::serialize(serializer &s) { s.integer(regs.overscan); s.integer(regs.interlace); + s.integer(regs.mpyl); + s.integer(regs.mpym); + s.integer(regs.mpyh); + s.integer(regs.hcounter); s.integer(regs.vcounter); diff --git a/bsnes/snes/ppu/debugger/debugger.cpp b/bsnes/snes/ppu/debugger/debugger.cpp index b9c5bfe..95814d6 100644 --- a/bsnes/snes/ppu/debugger/debugger.cpp +++ b/bsnes/snes/ppu/debugger/debugger.cpp @@ -378,6 +378,18 @@ bool PPUDebugger::property(unsigned id, string &name, string &value) { item("OAM Interlace", oam.regs.interlace); item("Interlace", regs.interlace); + //$2134 + item("$2134", ""); + item("Multiplication Result Low", string("0x", hex<2>(regs.mpyl))); + + //$2135 + item("$2135", ""); + item("Multiplication Result Mid", string("0x", hex<2>(regs.mpym))); + + //$2136 + item("$2136", ""); + item("Multiplication Result High", string("0x", hex<2>(regs.mpyh))); + //$213c item("$213c", ""); item("H-counter", (unsigned)regs.hcounter); diff --git a/bsnes/snes/ppu/mmio/mmio.cpp b/bsnes/snes/ppu/mmio/mmio.cpp index b8eb3fe..933a432 100644 --- a/bsnes/snes/ppu/mmio/mmio.cpp +++ b/bsnes/snes/ppu/mmio/mmio.cpp @@ -577,6 +577,7 @@ uint8 PPU::mmio_r2134() { return result >> 0; regs.ppu1_mdr = (result >> 0); + regs.mpyl = regs.ppu1_mdr; return regs.ppu1_mdr; } @@ -587,6 +588,7 @@ uint8 PPU::mmio_r2135() { return result >> 8; regs.ppu1_mdr = (result >> 8); + regs.mpym = regs.ppu1_mdr; return regs.ppu1_mdr; } @@ -597,6 +599,7 @@ uint8 PPU::mmio_r2136() { return result >> 16; regs.ppu1_mdr = (result >> 16); + regs.mpyh = regs.ppu1_mdr; return regs.ppu1_mdr; } @@ -840,6 +843,13 @@ void PPU::mmio_reset() { regs.overscan = false; regs.interlace = false; + //$2134 MPYL + //$2135 MPYM + //$2136 MPYH + regs.mpyl = random(0x00); + regs.mpym = random(0x00); + regs.mpyh = random(0x00); + //$213c OPHCT regs.hcounter = 0; diff --git a/bsnes/snes/ppu/mmio/mmio.hpp b/bsnes/snes/ppu/mmio/mmio.hpp index 1a8c4e3..2b38774 100644 --- a/bsnes/snes/ppu/mmio/mmio.hpp +++ b/bsnes/snes/ppu/mmio/mmio.hpp @@ -75,6 +75,13 @@ struct { bool overscan; bool interlace; + //$2134 MPYL + //$2135 MPYM + //$2136 MPYH + uint8 mpyl; + uint8 mpym; + uint8 mpyh; + //$213c OPHCT uint16 hcounter; diff --git a/bsnes/snes/ppu/serialization.cpp b/bsnes/snes/ppu/serialization.cpp index f4472f0..8dd8a15 100644 --- a/bsnes/snes/ppu/serialization.cpp +++ b/bsnes/snes/ppu/serialization.cpp @@ -64,6 +64,10 @@ void PPU::serialize(serializer &s) { s.integer(regs.overscan); s.integer(regs.interlace); + s.integer(regs.mpyl); + s.integer(regs.mpym); + s.integer(regs.mpyh); + s.integer(regs.hcounter); s.integer(regs.vcounter);