diff --git a/Intel8080/test/Board.cpp b/Intel8080/test/Board.cpp index e30d2ac..01b3ebf 100644 --- a/Intel8080/test/Board.cpp +++ b/Intel8080/test/Board.cpp @@ -6,21 +6,20 @@ Board::Board(const Configuration& configuration) : m_configuration(configuration), - m_memory(0xffff), - m_cpu(EightBit::Intel8080(m_memory, m_ports)) { + m_ram(0x10000), + m_cpu(EightBit::Intel8080(*this, m_ports)) { } void Board::initialise() { - m_memory.clear(); auto romDirectory = m_configuration.getRomDirectory(); - //m_memory.loadRam(romDirectory + "/TEST.COM", 0x100); // Microcosm - //m_memory.loadRam(romDirectory + "/8080PRE.COM", 0x100); // Bartholomew preliminary - m_memory.loadRam(romDirectory + "/8080EX1.COM", 0x100); // Cringle/Bartholomew - //m_memory.loadRam(romDirectory + "/CPUTEST.COM", 0x100); // SuperSoft diagnostics + //m_ram.load(romDirectory + "/TEST.COM", 0x100); // Microcosm + //m_ram.load(romDirectory + "/8080PRE.COM", 0x100); // Bartholomew preliminary + m_ram.load(romDirectory + "/8080EX1.COM", 0x100); // Cringle/Bartholomew + //m_ram.load(romDirectory + "/CPUTEST.COM", 0x100); // SuperSoft diagnostics - m_memory.poke(5, 0xc9); // ret + poke(5, 0xc9); // ret m_cpu.ExecutingInstruction.connect(std::bind(&Board::Cpu_ExecutingInstruction_Cpm, this, std::placeholders::_1)); if (m_configuration.isProfileMode()) { @@ -61,8 +60,8 @@ void Board::bdos() { break; } case 0x9: - for (uint16_t i = m_cpu.DE().word; m_memory.peek(i) != '$'; ++i) { - std::cout << m_memory.peek(i); + for (uint16_t i = m_cpu.DE().word; peek(i) != '$'; ++i) { + std::cout << peek(i); } break; } @@ -73,7 +72,7 @@ void Board::Cpu_ExecutingInstruction_Profile(const EightBit::Intel8080& cpu) { const auto pc = m_cpu.PC(); m_profiler.addAddress(pc.word); - m_profiler.addInstruction(m_memory.peek(pc.word)); + m_profiler.addInstruction(peek(pc.word)); } void Board::Cpu_ExecutingInstruction_Debug(const EightBit::Intel8080&) { diff --git a/Intel8080/test/Board.h b/Intel8080/test/Board.h index 1d7f7f3..67c0cfd 100644 --- a/Intel8080/test/Board.h +++ b/Intel8080/test/Board.h @@ -1,26 +1,32 @@ #pragma once -#include "Memory.h" -#include "InputOutput.h" -#include "Intel8080.h" -#include "Profiler.h" -#include "EventArgs.h" -#include "Disassembler.h" +#include +#include +#include +#include +#include +#include +#include class Configuration; -class Board { +class Board : public EightBit::Bus { public: Board(const Configuration& configuration); - EightBit::Memory& Memory() { return m_memory; } EightBit::Intel8080& CPU() { return m_cpu; } void initialise(); +protected: + virtual uint8_t& reference(uint16_t address, bool& rom) { + rom = false; + return m_ram.reference(address); + } + private: const Configuration& m_configuration; - EightBit::Memory m_memory; + EightBit::Ram m_ram; EightBit::InputOutput m_ports; EightBit::Intel8080 m_cpu; EightBit::Disassembler m_disassembler; diff --git a/Intel8080/test/Configuration.h b/Intel8080/test/Configuration.h index 0e6cee8..d5d2717 100644 --- a/Intel8080/test/Configuration.h +++ b/Intel8080/test/Configuration.h @@ -2,7 +2,7 @@ #include -#include "Memory.h" +#include class Configuration { public: