main.cpp - Add try-catch for CpuException
This commit is contained in:
parent
243553acba
commit
c38f0de994
1 changed files with 28 additions and 22 deletions
8
main.cpp
8
main.cpp
|
@ -64,8 +64,9 @@ int main(int argc, char** argv)
|
|||
cpu.state.SP = 0xFFFE;
|
||||
cpu.state.PC = 0x100;
|
||||
|
||||
const std::chrono::milliseconds delay(1);
|
||||
const std::chrono::milliseconds delay(10);
|
||||
|
||||
try {
|
||||
while(!cpu.state.stopped)
|
||||
{
|
||||
std::cout
|
||||
|
@ -87,7 +88,12 @@ int main(int argc, char** argv)
|
|||
|
||||
cpu.step();
|
||||
|
||||
|
||||
if(cpu.state.halted)
|
||||
std::this_thread::sleep_for(delay);
|
||||
}
|
||||
} catch(CpuException& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue