flag handling
This commit is contained in:
parent
50e9905415
commit
e5dd0105af
3 changed files with 12 additions and 3 deletions
|
@ -98,6 +98,9 @@ std::string console::read_line(const std::string & prompt)
|
||||||
for(;;) {
|
for(;;) {
|
||||||
char c = wait_char(500);
|
char c = wait_char(500);
|
||||||
|
|
||||||
|
if (*terminate || stop_thread_flag)
|
||||||
|
return "";
|
||||||
|
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -193,7 +196,7 @@ void console::operator()()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (c == 3) // ^c
|
if (c == 3) // ^c
|
||||||
*terminate = true;
|
*interrupt_emulation = *terminate = true;
|
||||||
else if (c == 5) // ^e
|
else if (c == 5) // ^e
|
||||||
*interrupt_emulation = true;
|
*interrupt_emulation = true;
|
||||||
else if (c == 12) // ^l
|
else if (c == 12) // ^l
|
||||||
|
|
|
@ -170,7 +170,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_bool *const interru
|
||||||
|
|
||||||
c->emulation_start();
|
c->emulation_start();
|
||||||
|
|
||||||
while(!event && !terminate && !*interrupt_emulation) {
|
while(!event && !*interrupt_emulation) {
|
||||||
if (tracing || single_step)
|
if (tracing || single_step)
|
||||||
disassemble(c, single_step ? cnsl : nullptr, c->getPC(), false);
|
disassemble(c, single_step ? cnsl : nullptr, c->getPC(), false);
|
||||||
|
|
||||||
|
|
8
main.cpp
8
main.cpp
|
@ -274,8 +274,14 @@ int main(int argc, char *argv[])
|
||||||
else {
|
else {
|
||||||
c->emulation_start(); // for statistics
|
c->emulation_start(); // for statistics
|
||||||
|
|
||||||
while(!event && !terminate)
|
while(!event) {
|
||||||
|
if (interrupt_emulation) {
|
||||||
|
if (terminate)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
c->step();
|
c->step();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*running = false;
|
*running = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue