From: just nine Date: Wed, 14 Apr 2021 21:33:13 +0000 (+0100) Subject: support emulation quit (see long msg for more) X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=d3e59a0c0fdfcb61af85b2e302d2f0efd82cd086;hp=3b91ccdbc93d5b503f2f958dd00439e25f00958b;p=pistorm support emulation quit (see long msg for more) please note that if loopcycles = 0 then the emulation thread may never notice the quit request. needs replacing with some form of thread signal eventually, but that will require a signal handler. --- diff --git a/emulator.c b/emulator.c index acf6a1f..320c080 100644 --- a/emulator.c +++ b/emulator.c @@ -61,6 +61,8 @@ uint8_t realtime_disassembly, int2_enabled = 0; uint32_t do_disasm = 0, old_level; uint32_t last_irq = 8, last_last_irq = 8; +uint8_t end_signal = 0; + char disasm_buf[4096]; #define KICKBASE 0xF80000 @@ -255,6 +257,10 @@ cpu_loop: // dampen the scroll wheel until next while loop iteration mouse_extra = 0x00; } + + if (end_signal) + goto stop_cpu_emulation; + goto cpu_loop; //stop_cpu_emulation: @@ -342,11 +348,10 @@ key_loop: //m68k_pulse_reset(); printf("CPU emulation reset.\n"); } - // @todo work out how to signal the main process that we want to quit - // if (c == 'q') { - // printf("Quitting and exiting emulator.\n"); - // goto stop_cpu_emulation; - // } + if (c == 'q') { + printf("Quitting and exiting emulator.\n"); + end_signal = 1; + } if (c == 'd') { realtime_disassembly ^= 1; do_disasm = 1;