mirror of
https://github.com/zoriya/ComSquare.git
synced 2025-12-19 21:55:11 +00:00
the CGRam debugger is fixed display correctly the cgram and cgram value getter supports all 512 entries of the ram
This commit is contained in:
@@ -5,7 +5,9 @@
|
|||||||
#include "CGramDebug.hpp"
|
#include "CGramDebug.hpp"
|
||||||
#include "../SNES.hpp"
|
#include "../SNES.hpp"
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <bitset>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
#include "../Utility/Utility.hpp"
|
#include "../Utility/Utility.hpp"
|
||||||
|
|
||||||
namespace ComSquare::Debugger
|
namespace ComSquare::Debugger
|
||||||
@@ -50,6 +52,7 @@ namespace ComSquare::Debugger
|
|||||||
void CGramDebug::updateInfoTile(uint8_t addr)
|
void CGramDebug::updateInfoTile(uint8_t addr)
|
||||||
{
|
{
|
||||||
uint16_t cgramValue = this->_ppu.cgramRead(addr);
|
uint16_t cgramValue = this->_ppu.cgramRead(addr);
|
||||||
|
cgramValue += this->_ppu.cgramRead(addr + 1) << 8;
|
||||||
uint8_t blue = (cgramValue & 0x7D00U) >> 10U;
|
uint8_t blue = (cgramValue & 0x7D00U) >> 10U;
|
||||||
uint8_t green = (cgramValue & 0x03E0U) >> 5U;
|
uint8_t green = (cgramValue & 0x03E0U) >> 5U;
|
||||||
uint8_t red = (cgramValue & 0x001FU);
|
uint8_t red = (cgramValue & 0x001FU);
|
||||||
@@ -90,7 +93,10 @@ QVariant CGramModel::data(const QModelIndex &index, int role) const
|
|||||||
return Qt::AlignCenter;
|
return Qt::AlignCenter;
|
||||||
if (role != Qt::BackgroundRole)
|
if (role != Qt::BackgroundRole)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
addressValue = this->_ppu.cgramRead(index.column() * 16 + index.row());
|
int idDisplayTile = index.row() * 16 + index.column();
|
||||||
|
uint16_t cgramAddress = idDisplayTile / 8 * 16 + (idDisplayTile % 8 * 2);
|
||||||
|
addressValue = this->_ppu.cgramRead(cgramAddress);
|
||||||
|
addressValue += this->_ppu.cgramRead(cgramAddress + 1) << 8U;
|
||||||
|
|
||||||
blue = (addressValue & 0x7D00U) >> 10U;
|
blue = (addressValue & 0x7D00U) >> 10U;
|
||||||
green = (addressValue & 0x03E0U) >> 5U;
|
green = (addressValue & 0x03E0U) >> 5U;
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ namespace ComSquare::PPU
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t PPU::cgramRead(uint8_t addr)
|
uint16_t PPU::cgramRead(uint16_t addr)
|
||||||
{
|
{
|
||||||
return this->cgram->read_internal(addr);
|
return this->cgram->read_internal(addr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ namespace ComSquare::PPU
|
|||||||
//! @brief Return true if the CPU is overloaded with debugging features.
|
//! @brief Return true if the CPU is overloaded with debugging features.
|
||||||
virtual bool isDebugger();
|
virtual bool isDebugger();
|
||||||
//! @brief Allow others components to read the CGRAM (Debuggers)
|
//! @brief Allow others components to read the CGRAM (Debuggers)
|
||||||
uint16_t cgramRead(uint8_t addr);
|
uint16_t cgramRead(uint16_t addr);
|
||||||
//! @brief Render a background on the screen
|
//! @brief Render a background on the screen
|
||||||
void renderBackground(int bgNumber, std::vector<int> characterSize, int bpp, bool priority);
|
void renderBackground(int bgNumber, std::vector<int> characterSize, int bpp, bool priority);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace ComSquare::Ram
|
|||||||
protected:
|
protected:
|
||||||
//! @brief The ram. (Can be used for WRam, SRam, VRam etc)
|
//! @brief The ram. (Can be used for WRam, SRam, VRam etc)
|
||||||
uint8_t *_data;
|
uint8_t *_data;
|
||||||
//! @brief The size of the ram (iny bytes).
|
//! @brief The size of the ram (in bytes).
|
||||||
size_t _size;
|
size_t _size;
|
||||||
//! @brief An id identifying the type of memory this is (for the debugger)
|
//! @brief An id identifying the type of memory this is (for the debugger)
|
||||||
Component _ramType;
|
Component _ramType;
|
||||||
|
|||||||
Reference in New Issue
Block a user