endrun fix: z180, tlcs90, upd7810

This commit is contained in:
dinkc64 2019-05-09 23:50:36 -04:00
parent d23f358ea5
commit 1bfa876c36
3 changed files with 26 additions and 13 deletions

View File

@ -1410,6 +1410,8 @@ INT32 tlcs90Run(INT32 nCycles)
}
cpustate->extra_cycles = 0;
cpustate->run_end = 0;
do
{
INT32 prev_cycles = cpustate->icount; // for timers
@ -2049,10 +2051,13 @@ INT32 tlcs90Run(INT32 nCycles)
} while( cpustate->icount > 0 && cpustate->run_end == 0 );
cpustate->run_end = 0;
cpustate->total_cycles += nCycles;
cpustate->total_cycles += cpustate->nCycles - cpustate->icount;
return nCycles;
INT32 ret = cpustate->nCycles - cpustate->icount;
cpustate->nCycles = cpustate->icount = 0;
return ret;
}
INT32 tlcs90Idle(INT32 cycles)
@ -2079,7 +2084,7 @@ void tlcs90RunEnd()
cpustate->run_end = 1;
}
INT32 tlcs90TotalCycles()
{
@ -2087,7 +2092,7 @@ INT32 tlcs90TotalCycles()
// bprintf (0, _T("TotalCycles: %d\n"), cpustate->total_cycles + (cpustate->nCycles - cpustate->icount));
return cpustate->total_cycles;// + (cpustate->nCycles - cpustate->icount);
return cpustate->total_cycles + (cpustate->nCycles - cpustate->icount);
}
void tlcs90Reset()

View File

@ -1889,6 +1889,8 @@ INT32 upd7810Run(INT32 cycles)
upd7810_current_cycles = cycles;
upd7810_icount = cycles;
run_end = 0;
do
{
int cc = 0;
@ -1998,9 +2000,7 @@ void upd7810NewFrame()
void upd7810RunEnd()
{
upd7810_total_cycles += (upd7810_current_cycles - upd7810_icount);
upd7810_current_cycles = 0;
upd7810_icount = 0;
run_end = 1;
}
INT32 upd7810Idle(INT32 cycles)

View File

@ -2064,6 +2064,8 @@ void z180_write_internal_io(UINT32 port, UINT8 data)
}
}
static INT32 end_run;
/****************************************************************************
* Execute 'cycles' T-states. Return number of T-states really executed
****************************************************************************/
@ -2073,6 +2075,8 @@ int z180_execute(int cycles)
z180_icount = cycles;
current_cycles = cycles;
end_run = 0;
/* check for NMIs on the way in; they can only be set externally */
/* via timers, and can't be dynamically enabled, so it is safe */
/* to just check here */
@ -2125,11 +2129,11 @@ again:
/* If DMA is done break out to the faster loop */
if ((IO_DSTAT & Z180_DSTAT_DME) != Z180_DSTAT_DME)
break;
} while( z180_icount > 0 );
} while( z180_icount > 0 && !end_run);
}
}
if (z180_icount > 0)
if (z180_icount > 0 && !end_run)
{
do
{
@ -2146,17 +2150,21 @@ again:
if ((IO_DSTAT & Z180_DSTAT_DME) == Z180_DSTAT_DME)
goto again;
} while( z180_icount > 0 );
} while( z180_icount > 0 && !end_run );
}
total_cycles += cycles - z180_icount;
return cycles - z180_icount;
INT32 ret = cycles - z180_icount;
z180_icount = current_cycles = 0;
return ret;
}
void z180_run_end()
{
z180_icount = 0;
end_run = 1;
}
INT32 z180_total_cycles()