home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / emulator / unix / z80pack / cpmsim / srcsim / sim.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-12  |  2.9 KB  |  95 lines

  1. /*
  2.  * Z80SIM  -  a Z80-CPU simulator
  3.  *
  4.  * Copyright (C) 1987-92 by Udo Munk
  5.  *
  6.  * History:
  7.  * 28-SEP-87 Develoment on TARGON/35 with AT&T Unix System V.3
  8.  * 11-JAN-89 Release 1.1
  9.  * 08-FEB-89 Release 1.2
  10.  * 13-MAR-89 Release 1.3
  11.  * 09-FEB-90 Release 1.4 Ported to TARGON/31 M10/30
  12.  * 23-DEC-90 Release 1.5 Ported to COHERENT 3.0
  13.  * 10-JUN-92 Release 1.6 long casting problem solved with COHERENT 3.2
  14.  *             and some optimization
  15.  * 25-JUN-92 Release 1.7 comments in english
  16.  */
  17.  
  18. /*
  19.  *    The following defines may be activated, commented or modified
  20.  *    by user for her/his own purpose.
  21.  */
  22. /*#define WANT_INT*/    /* no interrupts */
  23. /*#define WANT_SPC*/    /* CP/M doesn't work with SP over-/underrun */
  24. /*#define WANT_PCC*/    /* CP/M doesn't work with PC overrun */
  25. /*#define CNTL_C*/    /* don't abort simulation with cntl-c */
  26. #define CNTL_BS        /* emergency exit with cntl-\ :-) */
  27. /*#define WANT_TIM*/    /* no run length measurement */
  28. /*#define HISIZE  1000*//* no history */
  29. /*#define SBSIZE  10*/    /* no breakpoints */
  30.  
  31. /*
  32.  *    The following lines of this file must not be modified by user,
  33.  *    see license agreemant!
  34.  */
  35. #define COPYR   "Copyright (C) 1987-92 by Udo Munk"
  36. #define RELEASE "1.7"
  37.  
  38. #define LENCMD          80              /* length of command buffers etc */
  39.  
  40. #define    S_FLAG        128        /* bit definitions of CPU flags */
  41. #define Z_FLAG          64
  42. #define N2_FLAG         32
  43. #define H_FLAG          16
  44. #define N1_FLAG         8
  45. #define P_FLAG          4
  46. #define N_FLAG          2
  47. #define C_FLAG          1
  48.  
  49.                     /* operation of simulated CPU */
  50. #define    SINGLE_STEP    0        /* single step */
  51. #define    CONTIN_RUN    1        /* continual run */
  52. #define    STOPPED        0        /* stop CPU because of error */
  53.  
  54.                     /* causes of error */
  55. #define    NONE        0        /* no error */
  56. #define    OPHALT        1        /* HALT    op-code    trap */
  57. #define    IOTRAP        2        /* IN/OUT trap */
  58. #define    OPTRAP1        3        /* illegal 1 byte op-code trap */
  59. #define    OPTRAP2        4        /* illegal 2 byte op-code trap */
  60. #define    OPTRAP4        5        /* illegal 4 byte op-code trap */
  61. #define    USERINT        6        /* user    interrupt */
  62.  
  63.                     /* type of CPU interrupt */
  64. #define    INT_NMI        1        /* non maskable interrupt */
  65. #define    INT_INT        2        /* maskable interrupt */
  66.  
  67. typedef    unsigned short WORD;        /* 16 bit unsigned */
  68. typedef    unsigned char  BYTE;        /* 8 bit unsigned */
  69.  
  70. #ifdef HISIZE
  71. struct history {            /* structure of a history entry */
  72.     WORD    h_adr;            /* address of execution */
  73.     WORD    h_af;            /* register AF */
  74.     WORD    h_bc;            /* register BC */
  75.     WORD    h_de;            /* register DE */
  76.     WORD    h_hl;            /* register HL */
  77.     WORD    h_ix;            /* register IX */
  78.     WORD    h_iy;            /* register IY */
  79.     WORD    h_sp;            /* register SP */
  80. };
  81. #endif
  82.  
  83. #ifdef SBSIZE
  84. struct softbreak {            /* structure of a breakpoint */
  85.     WORD    sb_adr;            /* address of breakpoint */
  86.     BYTE    sb_oldopc;        /* op-code at address of breakpoint */
  87.     int    sb_passcount;        /* pass counter of breakpoint */
  88.     int    sb_pass;        /* no. of pass to break */
  89. };
  90. #endif
  91.  
  92. #ifndef isxdigit
  93. #define    isxdigit(c) ((c<='f'&&c>='a')||(c<='F'&&c>='A')||(c<='9'&&c>='0'))
  94. #endif
  95.