moving ppu ctor debug into separate file

This commit is contained in:
Clément Le Bihan
2021-07-03 12:42:10 +02:00
parent deebddc574
commit f3abfe823f
7 changed files with 3940 additions and 3750 deletions
+10 -60
View File
@@ -10,6 +10,10 @@
#include "Ram/Ram.hpp"
#include "Models/Vector2.hpp"
namespace ComSquare::PPU::Utils::Debug {
void populateEnvironment(PPU &ppu, int dumpNumber);
}
namespace ComSquare::PPU
{
PPU::PPU(Renderer::IRenderer &renderer):
@@ -32,75 +36,20 @@ namespace ComSquare::PPU
{
this->_registers._isLowByte = true;
//colors for the cgram
this->cgram->write(2, 0xE0);
this->cgram->write(3, 0x7F);
this->cgram->write(4, 0x1F); // 0x1F
this->cgram->write(6, 0xFF);
this->cgram->write(7, 0x03);
this->cgram->write(66, 0xE0);
this->cgram->write(67, 0x7F);
//tiles
int vram_test[] = {
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0xff,0xff,0xff,0xff,
0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xff,0xff,0xff,0xff,
00,0xc0,0x00,0xe0,0x00,0x70,0x00,0x38,0x00,0x1c,0x00,0x0e,0x00,0x07,0x00,0x03,
00,0x03,0x00,0x07,0x00,0x0e,0x00,0x1c,0x00,0x38,0x00,0x70,0x00,0xe0,0x00,0xc0,
00,0x07,0x00,0x0f,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0xc0,0x00,0xc0,0x00,0xc0,
00,0xe0,0x00,0xf0,0x00,0x18,0x00,0x0c,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x03,
0xfc,0x00,0xf8,0x00,0xf0,0x00,0xe0,0x00,0xc0,0x00,0x80,0x00,0x00,0x00,0x00,0x00,
0x3f,0x00,0x1f,0x00,0x0f,0x00,0x07,0x00,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,
0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xff,0xff,0xff,0xff,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,
00,0x03,0x00,0x07,0x00,0x0e,0x00,0x1c,0x00,0x38,0x00,0x70,0x00,0xe0,0x00,0xc0,
00,0xc0,0x00,0xe0,0x00,0x70,0x00,0x38,0x00,0x1c,0x00,0x0e,0x00,0x07,0x00,0x03,
00,0xc0,0x00,0xc0,0x00,0xc0,0x00,0x60,0x00,0x30,0x00,0x18,0x00,0x0f,0x00,0x07,
00,0x03,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0c,0x00,0x18,0x00,0xf0,0x00,0xe0,
00,0x00,0x00,0x00,0x80,0x00,0xc0,0x00,0xe0,0x00,0xf0,0x00,0xf8,0x00,0xfc,0x00,
00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x07,0x00,0x0f,00,0x1f,00,0x3f,00, -1
};
/* int *cgram_test = Utils::get_dump_cgram();
for (int i = 0; cgram_test[i] != -1; i++) {
this->cgram->write(i, cgram_test[i]);
} */
//int *vram_test = Utils::get_dump_vram();
for (int i = 0; vram_test[i] != -1; i++) {
/* for (int i = 0; vram_test[i] != -1; i++) {
this->vram->write(i, vram_test[i]);
}
int vram_test_2[] = {8, 00, 02, 00, 0x0A, 00, 02, 00, 0x0A, 00, 00, 00, 00, 00, 00, -1};
for (int i = 0; vram_test_2[i] != -1; i++) {
this->vram->write(i + 0x8000, vram_test_2[i]);
}
int vram_test_3[] = {8, 00, 02, 00, 0x8, 00, 02, 00, 0x8, 00, 00, 00, 00, 00, 00, -1};
for (int i = 0; vram_test_3[i] != -1; i++) {
this->vram->write(i + 0x8080, vram_test_3[i]);
}
int vram_test_4[] = {8, 00, 02, 00, 0x0A, 00, 02, 00, 0x0A, 00, 00, 00, 00, 00, 00, -1};
for (int i = 0; vram_test_4[i] != -1; i++) {
this->vram->write(i + 0x8100, vram_test_4[i]);
}
this->vram->write(0x8040, 04);
this->vram->write(0x8042, 06);
this->vram->write(0x8044, 04);
this->vram->write(0x8046, 06);
this->vram->write(0x8048, 04);
*/
/*
this->vram->write(0x80C0, 04);
this->vram->write(0x80C2, 06);
this->vram->write(0x80C4, 04);
@@ -142,7 +91,7 @@ namespace ComSquare::PPU
//this->_registers._bgofs[3].raw = 0x03DF;
this->_registers._t[0].enableWindowDisplayBg1 = true;
this->_registers._t[0].enableWindowDisplayBg2 = true;
/*
//registers aladin
@@ -199,6 +148,7 @@ namespace ComSquare::PPU
this->_registers._t[0].enableWindowDisplayBg3 = true;
*/
Utils::Debug::populateEnvironment(*this, 0);
}
uint8_t PPU::read(uint24_t addr)