--- generator/main/cpuz80-mz80.c 2020/03/04 04:46:53 1.1.1.2 +++ generator/main/cpuz80-mz80.c 2020/03/04 04:47:22 1.1.1.4 @@ -18,13 +18,14 @@ void cpuz80_iowrite_actual(UINT16 addr, uint8 *cpuz80_ram = NULL; uint32 cpuz80_bank = 0; -unsigned int cpuz80_active = 0; +uint8 cpuz80_resetting = 0; +uint8 cpuz80_active = 0; +unsigned int cpuz80_on = 1; /* z80 turned on? */ CONTEXTMZ80 cpuz80_z80; /*** global variables ***/ static unsigned int cpuz80_lastsync = 0; -static unsigned int cpuz80_resetting = 0; static struct MemoryReadByte cpuz80_read[] = { {0x0000, 0xFFFF, cpuz80_read_actual, NULL}, @@ -162,14 +163,14 @@ void cpuz80_sync(void) { int cpu68k_wanted = cpu68k_clocks - cpuz80_lastsync; int wanted = (cpu68k_wanted < 0 ? 0 : cpu68k_wanted) * 7 / 15; - int acheived; + int achieved; - if (cpuz80_active && !cpuz80_resetting) { + if (cpuz80_on && cpuz80_active && !cpuz80_resetting) { /* ui_log(LOG_USER, "executing %d z80 clocks @ %X", wanted, cpuz80_z80.z80pc); */ mz80exec(wanted); - acheived = mz80GetElapsedTicks(1); - cpuz80_lastsync = cpuz80_lastsync + acheived * 15 / 7; + achieved = mz80GetElapsedTicks(1); + cpuz80_lastsync = cpuz80_lastsync + achieved * 15 / 7; } else { cpuz80_lastsync = cpu68k_clocks; }