AltairZ80: Reduced polling for CPU stop on non UNIX platforms
This commit is contained in:
parent
ff908f4f59
commit
a9e5913d0c
4 changed files with 38 additions and 8 deletions
|
@ -2047,6 +2047,24 @@ void setClockFrequency(const uint32 Value) {
|
|||
clockHasChanged = TRUE;
|
||||
}
|
||||
|
||||
|
||||
#if !UNIX_PLATFORM
|
||||
|
||||
/* Poll for CPU stop when user presses sim_int_char. Must be followed by sim_process_event */
|
||||
|
||||
#define INITIAL_POLL_COUNTER 1000
|
||||
|
||||
void pollForCPUStop(void) {
|
||||
static uint32 pollCounter = INITIAL_POLL_COUNTER;
|
||||
if (--pollCounter <= 0) {
|
||||
pollCounter = INITIAL_POLL_COUNTER;
|
||||
sim_poll_kbd(); /* the following sim_process_event will check for stop */
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static t_stat sim_instr_mmu (void) {
|
||||
extern int32 timerInterrupt;
|
||||
extern int32 timerInterruptHandler;
|
||||
|
@ -2099,8 +2117,8 @@ static t_stat sim_instr_mmu (void) {
|
|||
while (switch_cpu_now == TRUE) { /* loop until halted */
|
||||
if (sim_interval <= 0) { /* check clock queue */
|
||||
#if !UNIX_PLATFORM
|
||||
/* poll on platforms without reliable signalling */
|
||||
sim_poll_kbd(); /* following sim_process_event will check for stop */
|
||||
/* poll on platforms without reliable signalling but not too often */
|
||||
pollForCPUStop(); /* following sim_process_event will check for stop */
|
||||
#endif
|
||||
if ((reason = sim_process_event()))
|
||||
break;
|
||||
|
|
|
@ -124,6 +124,10 @@ extern int32 IFF_S; /* Interrupt Flip Flop */
|
|||
extern int32 IR_S; /* Interrupt (upper) / Refresh (lower) register */
|
||||
extern int32 chiptype;
|
||||
|
||||
#if !UNIX_PLATFORM
|
||||
extern void pollForCPUStop(void);
|
||||
#endif
|
||||
|
||||
/* the following tables precompute some common subexpressions
|
||||
parityTable[i] 0..255 (number of 1's in i is odd) ? 0 : 4
|
||||
incTable[i] 0..256! (i & 0xa8) | (((i & 0xff) == 0) << 6) | (((i & 0xf) == 0) << 4)
|
||||
|
@ -1016,8 +1020,8 @@ t_stat sim_instr_nommu(void) {
|
|||
while (TRUE) { /* loop until halted */
|
||||
if (sim_interval <= 0) { /* check clock queue */
|
||||
#if !UNIX_PLATFORM
|
||||
/* poll on platforms without reliable signalling */
|
||||
sim_poll_kbd(); /* following sim_process_event will check for stop */
|
||||
/* poll on platforms without reliable signalling but not too often */
|
||||
pollForCPUStop(); /* following sim_process_event will check for stop */
|
||||
#endif
|
||||
if ((reason = sim_process_event()))
|
||||
break;
|
||||
|
|
|
@ -44,6 +44,10 @@ extern int32 PCX_S; /* PC register (8086), 20 bit */
|
|||
extern uint32 PCX; /* external view of PC */
|
||||
extern UNIT cpu_unit;
|
||||
|
||||
#if !UNIX_PLATFORM
|
||||
extern void pollForCPUStop(void);
|
||||
#endif
|
||||
|
||||
void i86_intr_raise(PC_ENV *m,uint8 intrnum);
|
||||
void cpu8086reset(void);
|
||||
t_stat sim_instr_8086(void);
|
||||
|
@ -209,8 +213,8 @@ t_stat sim_instr_8086(void) {
|
|||
while (switch_cpu_now == TRUE) { /* loop until halted */
|
||||
if (sim_interval <= 0) { /* check clock queue */
|
||||
#if !UNIX_PLATFORM
|
||||
/* poll on platforms without reliable signalling */
|
||||
sim_poll_kbd(); /* following sim_process_event will check for stop */
|
||||
/* poll on platforms without reliable signalling but not too often */
|
||||
pollForCPUStop(); /* following sim_process_event will check for stop */
|
||||
#endif
|
||||
if ( (reason = sim_process_event()) )
|
||||
break;
|
||||
|
|
|
@ -158,6 +158,10 @@ static uint32 m68k_fc; /* Current function code fro
|
|||
extern uint32 m68k_registers[M68K_REG_CPU_TYPE + 1];
|
||||
extern UNIT cpu_unit;
|
||||
|
||||
#if !UNIX_PLATFORM
|
||||
extern void pollForCPUStop(void);
|
||||
#endif
|
||||
|
||||
#define M68K_BOOT_LENGTH (32 * 1024) /* size of bootstrap */
|
||||
#define M68K_BOOT_PC 0x000400 /* initial PC for boot */
|
||||
#define M68K_BOOT_SP 0xfe0000 /* initial SP for boot */
|
||||
|
@ -215,8 +219,8 @@ t_stat sim_instr_m68k(void) {
|
|||
while (TRUE) {
|
||||
if (sim_interval <= 0) { /* check clock queue */
|
||||
#if !UNIX_PLATFORM
|
||||
/* poll on platforms without reliable signalling */
|
||||
sim_poll_kbd(); /* following sim_process_event will check for stop */
|
||||
/* poll on platforms without reliable signalling but not too often */
|
||||
pollForCPUStop(); /* following sim_process_event will check for stop */
|
||||
#endif
|
||||
if ((reason = sim_process_event()))
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue