mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-21 17:16:35 +00:00
Apply the concept of powered components to the "board"
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
+11
-3
@@ -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
@@ -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
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user