mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-21 01:16:50 +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:
@@ -10,6 +10,17 @@ Board::Board(const Configuration& configuration)
|
||||
m_disassembler(*this) {
|
||||
}
|
||||
|
||||
void Board::powerOn() {
|
||||
EightBit::Bus::powerOn();
|
||||
CPU().powerOn();
|
||||
CPU().reset();
|
||||
}
|
||||
|
||||
void Board::powerOff() {
|
||||
CPU().powerOff();
|
||||
EightBit::Bus::powerOff();
|
||||
}
|
||||
|
||||
void Board::initialise() {
|
||||
|
||||
auto romDirectory = m_configuration.getRomDirectory();
|
||||
@@ -29,9 +40,6 @@ void Board::initialise() {
|
||||
m_cpu.ExecutingInstruction.connect(std::bind(&Board::Cpu_ExecutingInstruction_Debug, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
CPU().powerOn();
|
||||
CPU().reset();
|
||||
|
||||
poke(0, 0xc3); // JMP
|
||||
CPU().pokeWord(1, m_configuration.getStartAddress());
|
||||
|
||||
@@ -42,7 +50,7 @@ void Board::Cpu_ExecutingInstruction_Cpm(EightBit::Intel8080& cpu) {
|
||||
switch (cpu.PC().word) {
|
||||
case 0x0: // CP/M warm start
|
||||
if (++m_warmstartCount == 3) {
|
||||
CPU().powerOff();
|
||||
powerOff();
|
||||
if (m_configuration.isProfileMode()) {
|
||||
m_profiler.dump();
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@ public:
|
||||
EightBit::Intel8080& CPU() { return m_cpu; }
|
||||
const EightBit::Intel8080& CPU() const { 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 };
|
||||
}
|
||||
|
||||
@@ -8,14 +8,12 @@ int main(int, char*[]) {
|
||||
Configuration configuration;
|
||||
|
||||
#ifdef _DEBUG
|
||||
//configuration.setDebugMode(true);
|
||||
configuration.setDebugMode(true);
|
||||
configuration.setProfileMode(true);
|
||||
#endif
|
||||
//configuration.setDebugMode(true);
|
||||
|
||||
EightBit::TestHarness<Configuration, Board> harness(configuration);
|
||||
harness.initialise();
|
||||
harness.runLoop();
|
||||
harness.run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user