AltairZ80: M68K: Fix hang with 'expect'

This commit is contained in:
Peter Schorn 2022-10-08 00:25:15 -07:00 committed by Howard M. Harte
parent 1110802bb1
commit 3a7ec4788f
2 changed files with 9 additions and 8 deletions

View file

@ -210,9 +210,9 @@ static int32 markTimeSP = 0; /* stack pointer for timer stack
/* default time in milliseconds to sleep for SIMHSleepCmd */
#if defined (__MWERKS__) && defined (macintosh)
static uint32 SIMHSleep = 0; /* no sleep on Macintosh OS9 */
uint32 SIMHSleep = 0; /* no sleep on Macintosh OS9 */
#else
static uint32 SIMHSleep = 1; /* default value is one millisecond */
uint32 SIMHSleep = 1; /* default value is one millisecond */
#endif
static uint32 sleepAllowedCounter = 0; /* only sleep on no character available when == 0 */
static uint32 sleepAllowedStart = SLEEP_ALLOWED_START_DEFAULT; /* default start for above counter */

View file

@ -121,6 +121,7 @@
#define IRQ_MC6850 5
extern uint32 PCX;
extern uint32 SIMHSleep;
/* Prototypes */
static void MC6850_reset(void);
@ -268,7 +269,6 @@ static void MC6850_reset(void) {
}
#define INITIAL_IDLE 100
#define IDLE_SLEEP 20
static uint32 idleCount = INITIAL_IDLE;
static void m68k_input_device_update(void) {
@ -281,8 +281,8 @@ static void m68k_input_device_update(void) {
} else if (--idleCount == 0) {
const t_stat ch = sim_poll_kbd();
idleCount = INITIAL_IDLE;
if (IDLE_SLEEP)
sim_os_ms_sleep(IDLE_SLEEP);
if (SIMHSleep)
sim_os_ms_sleep(SIMHSleep);
if (ch) {
characterAvailable = TRUE;
keyboardCharacter = ch;
@ -301,8 +301,9 @@ static uint32 MC6850_data_read(void) {
} else
ch = sim_poll_kbd();
while ((ch <= 0) && (!stop_cpu)) {
if (IDLE_SLEEP)
sim_os_ms_sleep(IDLE_SLEEP);
sim_interval -= KBD_POLL_WAIT; // ensure progress
if (SIMHSleep)
sim_os_ms_sleep(SIMHSleep);
ch = sim_poll_kbd();
}
if (ch == SCPE_STOP)