2016-08-17 12:31:22 +00:00
|
|
|
#include <ms/ms.hpp>
|
|
|
|
|
|
|
|
namespace MasterSystem {
|
|
|
|
|
|
|
|
CPU cpu;
|
|
|
|
|
|
|
|
auto CPU::Enter() -> void {
|
|
|
|
while(true) scheduler.synchronize(), cpu.main();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto CPU::main() -> void {
|
2016-08-19 14:11:26 +00:00
|
|
|
instruction();
|
2016-08-17 12:31:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto CPU::step(uint clocks) -> void {
|
|
|
|
Thread::step(clocks);
|
2016-08-19 14:11:26 +00:00
|
|
|
synchronize(vdp);
|
|
|
|
synchronize(psg);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto CPU::power() -> void {
|
2016-09-04 13:51:27 +00:00
|
|
|
Z80::bus = &MasterSystem::bus;
|
|
|
|
Z80::power();
|
2016-08-19 14:11:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto CPU::reset() -> void {
|
2016-09-04 13:51:27 +00:00
|
|
|
Z80::reset();
|
2016-08-19 14:11:26 +00:00
|
|
|
create(CPU::Enter, system.colorburst());
|
2016-08-17 12:31:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|