Apply the concept of powered components to the "board"

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2018-11-11 16:48:44 +00:00
parent f29c571226
commit fdbb28828f
22 changed files with 171 additions and 94 deletions
+11 -3
View File
@@ -13,6 +13,16 @@ Board::Board(const Configuration& configuration)
m_disassembler(*this, m_cpu, m_symbols),
m_profiler(m_cpu, m_disassembler, m_symbols) {}
void Board::powerOn() {
EightBit::Bus::powerOn();
CPU().powerOn();
}
void Board::powerOff() {
CPU().powerOff();
EightBit::Bus::powerOff();
}
void Board::initialise() {
auto programFilename = m_configuration.getProgram();
@@ -57,8 +67,6 @@ void Board::initialise() {
m_pollCounter = 0;
m_pollInterval = m_configuration.getPollInterval();
CPU().powerOn();
poke(0x00, 0x4c);
CPU().pokeWord(1, m_configuration.getStartAddress());
}
@@ -77,7 +85,7 @@ void Board::Cpu_ExecutedInstruction_StopLoop(EightBit::MOS6502& cpu) {
if (m_oldPC != pc) {
m_oldPC = pc;
} else {
CPU().powerOff();
powerOff();
auto test = peek(0x0200);
std::cout << std::endl << "** Test=" << std::hex << (int)test;
}
+3 -1
View File
@@ -17,9 +17,11 @@ public:
EightBit::MOS6502& CPU() { return m_cpu; }
void initialise();
virtual void powerOn() final;
virtual void powerOff() final;
protected:
virtual void initialise() final;
virtual EightBit::MemoryMapping mapping(uint16_t address) final {
return { m_ram, 0x0000, 0xffff, EightBit::MemoryMapping::ReadWrite };
}
+1 -2
View File
@@ -16,8 +16,7 @@ int main(int argc, char* argv[]) {
#endif
EightBit::TestHarness<Configuration, Board> harness(configuration);
harness.initialise();
harness.runLoop();
harness.run();
return 0;
}