From f863c4cfa06aea4e78dd0e45b52bc77743945043 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 5 Mar 2019 21:53:28 -0500 Subject: [PATCH] quit if the HALT_WANTOQUIT is set (ie, win32 closing the window) --- src/debug_shell.re2c | 5 +++++ src/sim65816.c | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/debug_shell.re2c b/src/debug_shell.re2c index 647ccea..f1969f8 100644 --- a/src/debug_shell.re2c +++ b/src/debug_shell.re2c @@ -1186,6 +1186,9 @@ int debug_shell(int code) { char *cp; int control_d_count = 0; + fflush(stderr); + fflush(stdout); + if (!g_templates_loaded) { char *path; g_templates_loaded = 1; @@ -1286,6 +1289,8 @@ void do_go() { for(;;) { ret = run_prog(); + if (halt_sim & HALT_WANTTOQUIT) return; + if (ret || g_stepping) { g_config_control_panel = 1; ok = debug_shell(ret); diff --git a/src/sim65816.c b/src/sim65816.c index db211dc..92347ff 100644 --- a/src/sim65816.c +++ b/src/sim65816.c @@ -1613,9 +1613,12 @@ int run_prog() { ret = 0; break; } - if(halt_sim & 0x07) { - halt_sim &= ~0x07; - ret = RET_HALT; + if (halt_sim & ~HALT_EVENT) { + if(halt_sim & 0x07) { + /* halt_printf() */ + halt_sim &= ~0x07; + ret = RET_HALT; + } break; }