Add an "UnusedMemory" class to better allow "gaps" in the memory map.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon committed 2018-11-03 23:11:48 +00:00
1 parent 984626a331
commit 9132f2028f
9 files changed
+87 -31

No files matched your search

+11 -10
View File
@@ -7,6 +7,7 @@
#include <Ram.h>
#include <Bus.h>
#include <Register.h>
#include <UnusedMemory.h>
#include "LR35902.h"
#include "IoRegisters.h"
@@ -59,16 +60,16 @@ namespace EightBit {
private:
LR35902 m_cpu;
Rom m_bootRom = 0x100; // 0x0000 - 0x00ff
std::vector<Rom> m_gameRomBanks; // 0x0000 - 0x3fff, 0x4000 - 0x7fff (switchable)
Ram m_videoRam = 0x2000; // 0x8000 - 0x9fff
std::vector<Ram> m_ramBanks; // 0xa000 - 0xbfff (switchable)
Rom m_unmapped2000 = 0x2000; // 0xa000 - 0xbfff
Ram m_lowInternalRam = 0x2000; // 0xc000 - 0xdfff (mirrored at 0xe000)
Ram m_oamRam = 0xa0; // 0xfe00 - 0xfe9f
Rom m_unmapped60 = 0x60; // 0xfea0 - 0xfeff
IoRegisters m_ioPorts; // 0xff00 - 0xff7f
Ram m_highInternalRam = 0x80; // 0xff80 - 0xffff
Rom m_bootRom = 0x100; // 0x0000 - 0x00ff
std::vector<Rom> m_gameRomBanks; // 0x0000 - 0x3fff, 0x4000 - 0x7fff (switchable)
Ram m_videoRam = 0x2000; // 0x8000 - 0x9fff
std::vector<Ram> m_ramBanks; // 0xa000 - 0xbfff (switchable)
UnusedMemory m_unmapped2000 = { 0x2000, 0xff }; // 0xa000 - 0xbfff
Ram m_lowInternalRam = 0x2000; // 0xc000 - 0xdfff (mirrored at 0xe000)
Ram m_oamRam = 0xa0; // 0xfe00 - 0xfe9f
UnusedMemory m_unmapped60 = { 0x60, 0xff }; // 0xfea0 - 0xfeff
IoRegisters m_ioPorts; // 0xff00 - 0xff7f
Ram m_highInternalRam = 0x80; // 0xff80 - 0xffff
bool m_enabledLCD = false;
-12
View File
@@ -6,18 +6,6 @@ EightBit::GameBoy::Bus::Bus() noexcept
: m_cpu(*this),
m_ioPorts(*this) {
WrittenByte.connect(std::bind(&GameBoy::Bus::Bus_WrittenByte, this, std::placeholders::_1));
{
std::vector<uint8_t> content(m_unmapped2000.size());
std::fill(content.begin(), content.end(), 0xff);
m_unmapped2000.load(content);
}
{
std::vector<uint8_t> content(m_unmapped60.size());
std::fill(content.begin(), content.end(), 0xff);
m_unmapped60.load(content);
}
}
void EightBit::GameBoy::Bus::reset() {