mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-07 11:45:07 +00:00
Finishing the common bus for all modes
This commit is contained in:
@@ -48,12 +48,14 @@ namespace ComSquare
|
|||||||
void MemoryBus::_mirrorComponents(SNES &console, int i)
|
void MemoryBus::_mirrorComponents(SNES &console, int i)
|
||||||
{
|
{
|
||||||
this->_memoryAccessors.push_back(Memory::MemoryShadow::createShadow(console.wram, i, i + 0x2000));
|
this->_memoryAccessors.push_back(Memory::MemoryShadow::createShadow(console.wram, i, i + 0x2000));
|
||||||
|
this->_memoryAccessors.push_back(Memory::MemoryShadow::createShadow(console.ppu, i + 0x2100, i + 0x2140));
|
||||||
|
this->_memoryAccessors.push_back(Memory::MemoryShadow::createShadow(console.apu, i + 0x2140, i + 0x2144));
|
||||||
this->_memoryAccessors.push_back(Memory::MemoryShadow::createShadow(console.cpu, i + 0x4200, i + 0x4220));
|
this->_memoryAccessors.push_back(Memory::MemoryShadow::createShadow(console.cpu, i + 0x4200, i + 0x4220));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryBus::mapComponents(SNES &console)
|
void MemoryBus::mapComponents(SNES &console)
|
||||||
{
|
{
|
||||||
// The WRam is always mapped in the bank 7E and 7F, no matter the memory mapping mode.
|
// The WRam and PU registers are always mapped at the same address no matter the mapping mode.
|
||||||
console.wram->setMemoryRegion(0x7E0000, 0x7FFFFF);
|
console.wram->setMemoryRegion(0x7E0000, 0x7FFFFF);
|
||||||
this->_memoryAccessors.push_back(console.wram);
|
this->_memoryAccessors.push_back(console.wram);
|
||||||
|
|
||||||
@@ -67,14 +69,15 @@ namespace ComSquare
|
|||||||
this->_memoryAccessors.push_back(console.cpu);
|
this->_memoryAccessors.push_back(console.cpu);
|
||||||
|
|
||||||
// TODO implement DMA & HDMA (4220 to 4300)
|
// TODO implement DMA & HDMA (4220 to 4300)
|
||||||
|
// TODO implement Joys.
|
||||||
|
|
||||||
//Mirror the first $2000 bits of the WRam to all banks of the Q1 & Q3.
|
// Map to the quarter 1.
|
||||||
for (uint24_t i = 0; i < 0x400000; i += 0x10000) {
|
for (uint24_t i = 0; i < 0x400000; i += 0x10000)
|
||||||
this->_mirrorComponents(console, i);
|
this->_mirrorComponents(console, i);
|
||||||
}
|
// Map to the quarter 3.
|
||||||
for (uint24_t i = 0x800000; i < 0xC00000; i += 0x10000) {
|
for (uint24_t i = 0x800000; i < 0xC00000; i += 0x10000)
|
||||||
this->_memoryAccessors.push_back(Memory::MemoryShadow::createShadow(console.wram, i, i + 0x2000));
|
this->_mirrorComponents(console, i);
|
||||||
this->_memoryAccessors.push_back(Memory::MemoryShadow::createShadow(console.cpu, i + 0x4200, i + 0x4220));
|
|
||||||
}
|
// TODO should map sram, cartridge etc via the mapping mode of the cartridge.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ namespace ComSquare
|
|||||||
std::shared_ptr<IMemory> getAccessor(uint24_t addr);
|
std::shared_ptr<IMemory> getAccessor(uint24_t addr);
|
||||||
//! @brief The last value read via the memory bus.
|
//! @brief The last value read via the memory bus.
|
||||||
uint8_t _openbus = 0;
|
uint8_t _openbus = 0;
|
||||||
//! @brief Mirror components to other banks. (Used by the mapComponents method).
|
//! @brief WRam, CPU, PPU & ALU registers are mirrored to all banks of Q1 & Q3. This function is used for the mirroring.
|
||||||
//! @param console All the components.
|
//! @param console All the components.
|
||||||
//! @param i Base address for the mirrors.
|
//! @param i Base address for the mirrors.
|
||||||
inline void _mirrorComponents(struct SNES &console, int i);
|
inline void _mirrorComponents(struct SNES &console, int i);
|
||||||
|
|||||||
Reference in New Issue
Block a user