/*
* Z80SIM - a Z80-CPU simulator
*
* Copyright (C) 1987-92 by Udo Munk
*
* This module of the Z80-CPU simulator must not be modified by a user,
* see license agreement!
*
* History:
* 28-SEP-87 Development on TARGON/35 with AT&T Unix System V.3
* 11-JAN-89 Release 1.1
* 08-FEB-89 Release 1.2
* 13-MAR-89 Release 1.3
* 09-FEB-90 Release 1.4 Ported to TARGON/31 M10/30
* 20-DEC-90 Release 1.5 Ported to COHERENT
* 10-JUN-92 Release 1.6 long casting problem solved with COHERENT 3.2
* and some optimization
* 25-JUN-92 Release 1.7 comments in english and ported to COHERENT 4.0
*/
/*
* This modul contains all the global variables
*/
#include "sim.h"
/*
* CPU-Register
*/
BYTE A,B,C,D,E,H,L; /* Z80 primary registers */
int F; /* normaly 8-Bit, but int is faster */
WORD IX, IY;
BYTE A_,B_,C_,D_,E_,H_,L_; /* Z80 secoundary registers */
int F_;
BYTE *PC; /* Z80 programm counter */
BYTE *STACK; /* Z80 stackpointer */
BYTE I; /* Z80 interrupt register */
BYTE IFF; /* Z80 interrupt flags */
long R; /* Z80 refresh register */
/* is normaly a 8 bit register */
/* the 32 bits are used to measure the */
/* clock frequency */
/*
* Variables for memory of the emulated CPU
*/
#if defined(COHERENT) && !defined(_I386)
BYTE ram[32767]; /* only 32KB under COHERENT 3.x */
#else
BYTE ram[65536L]; /* 64KB for all other OS's */
#endif
BYTE *wrk_ram; /* workpointer into memory for dump etc. */
/*
* Variables for history memory
*/
#ifdef HISIZE
struct history his[HISIZE]; /* memory to hold trace informations */
int h_next; /* index into trace memory */
int h_flag; /* flag for trace memory overrun */
#endif
/*
* Variables for breakpoint memory
*/
#ifdef SBSIZE
struct softbreak soft[SBSIZE]; /* memory to hold breakpoint informations */
int sb_next; /* index into breakpoint memory */
#endif
/*
* Variables for runtime measurement
*/
#ifdef WANT_TIM
long t_states; /* number of counted T states */
int t_flag; /* flag, 1 = on, 0 = off */
#if !defined(COHERENT) || defined(_I386)
BYTE *t_start = ram + 65535; /* start address for measurement */
BYTE *t_end = ram + 65535; /* end address for measurement */
#else
BYTE *t_start = ram + 32767;
BYTE *t_end = ram + 32767;
#endif
#endif
/*
* Flag to controll operation of simulation
*/
int s_flag; /* flag for -s option */
int l_flag; /* flag for -l option */
int m_flag; /* flag for -m option */
int x_flag; /* flag for -x option */
char xfn[LENCMD]; /* buffer for filename (option -x) */
int break_flag = 1; /* 1 = break at HALT, 0 = execute HALT */
int cpu_state; /* status of CPU emulation */
int cpu_error; /* error status of CPU emulation */
int int_type; /* type of interrupt */
int int_mode; /* CPU interrupt mode (IM 0, IM 1, IM 2) */
int cntl_c; /* flag for cntl-c entered */
int cntl_bs; /* flag for cntl-\ entered */