diff --git a/sources/PPU/Background.cpp b/sources/PPU/Background.cpp index 7015c0e..f21406c 100644 --- a/sources/PPU/Background.cpp +++ b/sources/PPU/Background.cpp @@ -56,6 +56,7 @@ namespace ComSquare::PPU tileData.raw = data; palette = getPalette(tileData.palette); + // TODO explain X and Y and rethink the formula graphicAddress = this->_tileSetAddress + (tileData.posX * 16 * this->_bpp * 8) + (tileData.posY * this->_bpp * 8); for (int i = 0; i < this->_characterSize.y; i++) { for (int j = 0; j < this->_characterSize.x; j++) { @@ -127,7 +128,7 @@ namespace ComSquare::PPU Vector2 pos(0,0); uint16_t vramAddress = baseAddress; - while (vramAddress < 0x800 + baseAddress) { + while (vramAddress < baseAddress + 0x800) { tileMapValue = this->_vram->read_internal(vramAddress); tileMapValue += this->_vram->read_internal(vramAddress + 1) << 8U; drawBgTile(tileMapValue, {(pos.x * this->_characterSize.x) + offset.x, (pos.y * this->_characterSize.y) + offset.y}); diff --git a/sources/PPU/PPU.cpp b/sources/PPU/PPU.cpp index b0092a8..6ecd720 100644 --- a/sources/PPU/PPU.cpp +++ b/sources/PPU/PPU.cpp @@ -595,8 +595,10 @@ namespace ComSquare::PPU for (auto & _background : this->_backgrounds) _background.renderBackground(); + // TODO make a function getDefaultBgColor colorPalette = this->cgram->read_internal(0); colorPalette += this->cgram->read_internal(1) << 8U; + for (unsigned long i = 0; i < this->_subScreen.size(); i++) for (unsigned long j = 0; j < this->_subScreen[i].size(); j++) this->_subScreen[i][j] = getRealColor(colorPalette); @@ -679,6 +681,7 @@ namespace ComSquare::PPU //sprites priority 2 this->addToMainSubScreen(this->_backgrounds[bgName::bg1Priority]); //sprites priority 3 + break; case 7: // Not implemented default: diff --git a/ui/ui_cpu.h b/ui/ui_cpu.h index f26b484..533450f 100644 --- a/ui/ui_cpu.h +++ b/ui/ui_cpu.h @@ -25,7 +25,7 @@ #include #include #include -//efef + QT_BEGIN_NAMESPACE class Ui_CPUView