This commit is contained in:
Clément Le Bihan
2020-02-13 19:03:29 +01:00
parent 00b0d140ea
commit 5619c634d6
2 changed files with 13 additions and 5 deletions
+9 -4
View File
@@ -106,11 +106,11 @@ namespace ComSquare::PPU
case ppuRegisters::cgdata:
if (this->_isLowByte) {
this->_cgdata.cgdatal = data;
this->_bus->write(this->_cgadd, this->_cgdata.cgdatal);
this->_cgram.write(this->_cgadd, this->_cgdata.raw);
}
else {
this->_cgdata.cgdatah = data;
this->_bus->write(this->_cgadd, this->_cgdata.cgdatah);
this->_cgram.write(this->_cgadd, this->_cgdata.raw);
}
this->_isLowByte = !this->_isLowByte;
this->_cgadd++;
@@ -183,14 +183,14 @@ namespace ComSquare::PPU
void PPU::update(unsigned cycles)
{
(void)cycles;
int inc = getVramAddress();
int inc = 0;
//uint32_t pixelTmp = 0xFFFFFFFF;
//pixelTmp |= this->_inidisp.brightness;
if (!this->_inidisp.fblank) {
for (int x = 0; x < 448; x++) {
for (int y = 0; y < 512; y++) {
//this->_renderer.putPixel(x, y, ((uint32_t)_vram[inc++] << 8U) + 0xFFU);
this->_renderer.putPixel(x, y, (uint32_t)this->_bus->read(inc++));
this->_renderer.putPixel(x, y, (uint32_t)this->_vram.read(inc++));
}
}
}
@@ -198,6 +198,11 @@ namespace ComSquare::PPU
}
PPU::PPU(const std::shared_ptr<Memory::MemoryBus> &bus, Renderer::IRenderer &renderer):
_renderer(renderer),
_bus(std::move(bus)),
_vram(64000),
_oamram(544),
_cgram(512)
_renderer(renderer),
_bus(std::move(bus))
{
+4 -1
View File
@@ -9,6 +9,7 @@
#include "../Memory/IMemory.hpp"
#include "../Memory/MemoryBus.hpp"
#include "../Renderer/IRenderer.hpp"
#include "../Ram/ExtendedRam.hpp"
//#define max2BitTiles 4096
//#define max4BitTiles 2048
@@ -518,7 +519,9 @@ namespace ComSquare::PPU
} mpy;
Renderer::IRenderer &_renderer;
std::shared_ptr<Memory::MemoryBus> _bus;
uint16_t *_vram;
Ram::ExtendedRam _vram;
Ram::ExtendedRam _oamram;
Ram::ExtendedRam _cgram;
public:
PPU(const std::shared_ptr<Memory::MemoryBus> &bus, Renderer::IRenderer &renderer);
PPU(const PPU &) = default;