main.cpp - Add try-catch for CpuException

This commit is contained in:
madmaurice 2023-09-01 23:44:06 +02:00
parent 243553acba
commit c38f0de994

View file

@ -64,8 +64,9 @@ int main(int argc, char** argv)
cpu.state.SP = 0xFFFE; cpu.state.SP = 0xFFFE;
cpu.state.PC = 0x100; cpu.state.PC = 0x100;
const std::chrono::milliseconds delay(1); const std::chrono::milliseconds delay(10);
try {
while(!cpu.state.stopped) while(!cpu.state.stopped)
{ {
std::cout std::cout
@ -87,7 +88,12 @@ int main(int argc, char** argv)
cpu.step(); cpu.step();
if(cpu.state.halted)
std::this_thread::sleep_for(delay); std::this_thread::sleep_for(delay);
} }
} catch(CpuException& e) {
std::cerr << e.what() << std::endl;
}
} }