mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-03 02:23:49 +00:00
Merge branch 'master' of github.com:AnonymusRaccoon/ComSquare into Debugger
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <iostream>
|
||||
#include "ARectangleMemory.hpp"
|
||||
#include "../Exceptions/InvalidAddress.hpp"
|
||||
#include "../Utility/Utility.hpp"
|
||||
|
||||
namespace ComSquare::Memory
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace ComSquare::Memory
|
||||
{
|
||||
//! @brief Superset of the AMemory to map non continuous rectangle to the memory. (A rectangle that spam across more than one bank but that does not start at 0000 or end at FFFF).
|
||||
class ARectangleMemory : public AMemory {
|
||||
private:
|
||||
protected:
|
||||
//! @brief The first bank to map to.
|
||||
uint8_t _startBank = 0;
|
||||
//! @brief The last bank to map to.
|
||||
|
||||
@@ -22,20 +22,22 @@ namespace ComSquare
|
||||
//! @brief The list of components registered inside the bus. Every components that can read/write to a public address should be in this vector.
|
||||
std::vector<std::shared_ptr<AMemory>> _memoryAccessors;
|
||||
|
||||
//! @brief The last value read via the memory bus.
|
||||
uint8_t _openBus = 0;
|
||||
|
||||
//! @brief WRam, CPU, PPU & APU registers are mirrored to all banks of Q1 & Q3. This function is used for the mirroring.
|
||||
//! @param console All the components.
|
||||
//! @param i Base address for the mirrors.
|
||||
void _mirrorComponents(SNES &console, unsigned i);
|
||||
|
||||
protected:
|
||||
//! @brief The last value read via the memory bus.
|
||||
uint8_t _openBus = 0;
|
||||
public:
|
||||
MemoryBus() = default;
|
||||
MemoryBus(const MemoryBus &) = default;
|
||||
MemoryBus &operator=(const MemoryBus &) = default;
|
||||
~MemoryBus() = default;
|
||||
|
||||
//! @brief Force silencing read to the bus.
|
||||
bool forceSilence = false;
|
||||
|
||||
//! @brief Read data at a global address.
|
||||
//! @param addr The address to read from.
|
||||
//! @param silence Disable login to the memory bus's debugger (if enabled). Should only be used by other debuggers.
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
//
|
||||
|
||||
#include "RectangleShadow.hpp"
|
||||
#include "../Utility/Utility.hpp"
|
||||
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
@@ -17,13 +18,13 @@ namespace ComSquare::Memory
|
||||
|
||||
uint8_t RectangleShadow::read_internal(uint24_t addr)
|
||||
{
|
||||
addr += this->_bankOffset << 16u;
|
||||
addr += this->_bankOffset * (this->_endPage - this->_startPage);
|
||||
return this->_initial->read_internal(addr);
|
||||
}
|
||||
|
||||
void RectangleShadow::write_internal(uint24_t addr, uint8_t data)
|
||||
{
|
||||
addr += this->_bankOffset << 16u;
|
||||
addr += this->_bankOffset * (this->_endPage - this->_startPage);
|
||||
this->_initial->write_internal(addr, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace ComSquare::Memory
|
||||
explicit RectangleShadow(std::shared_ptr<ARectangleMemory> initial, uint8_t startBank, uint8_t endBank, uint16_t startPage, uint16_t endPage);
|
||||
RectangleShadow(const RectangleShadow &) = default;
|
||||
RectangleShadow &operator=(const RectangleShadow &) = default;
|
||||
~RectangleShadow() = default;
|
||||
~RectangleShadow() override = default;
|
||||
|
||||
//! @brief Internal component read. Implement this as you would implement a basic AMemory's read.
|
||||
//! @param addr The local address to read from. 0x0 refer to the first byte of your data and the address is in the component's space. That means that you can consider this address as continuous
|
||||
|
||||
Reference in New Issue
Block a user