home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Boot_Images / 2.11_on_rl02 / pdpsim.tz / pdpsim / pdp8_defs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-29  |  3.4 KB  |  94 lines

  1. /* pdp8_defs.h: PDP-8 simulator definitions
  2.  
  3.    Copyright (c) 1993, 1994, Robert M Supnik, Digital Equipment Corporation
  4.    Commercial use prohibited
  5.  
  6.    19-Mar-95    RMS    Added dynamic memory size.
  7.    02-May-94    RMS    Added non-existent memory handling.
  8.  
  9.    The author gratefully acknowledges the help of Max Burnet, Richie Lary,
  10.    and Bill Haygood in resolving questions about the PDP-8
  11. */
  12.  
  13. #include "sim_defs.h"                    /* simulator defns */
  14.  
  15. /* Memory */
  16.  
  17. #define MAXMEMSIZE    32768                /* max memory size */
  18. #define MEMSIZE        (cpu_unit.capac)        /* actual memory size */
  19. #define ADDRMASK    (MAXMEMSIZE - 1)        /* address mask */
  20. #define MEM_ADDR_OK(x)    (x < MEMSIZE)
  21.  
  22. /* Simulator stop codes */
  23.  
  24. #define STOP_RSRV    1                /* must be 1 */
  25. #define STOP_HALT    2                /* HALT */
  26. #define STOP_IBKPT    3                /* breakpoint */
  27.  
  28. /* IOT subroutine return codes */
  29.  
  30. #define IOT_V_SKP    12                /* skip */
  31. #define IOT_V_REASON    13                /* reason */
  32. #define IOT_SKP        (1 << IOT_V_SKP)
  33. #define IOT_REASON    (1 << IOT_V_REASON)
  34. #define IORETURN(f,v)    ((f)? (v): SCPE_OK)        /* stop on error */
  35.  
  36. /* Interrupt flags
  37.  
  38.    The interrupt flags consist of three groups:
  39.  
  40.    1.    Devices with individual interrupt enables.  These record
  41.     their interrupt requests in device_done and their enables
  42.     in device_enable, and must occupy the low bit positions.
  43.  
  44.    2.    Devices without interrupt enables.  These record their
  45.     interrupt requests directly in int_req, and must occupy
  46.     the middle bit positions.
  47.  
  48.    3.    Overhead.  These exist only in int_req and must occupy the
  49.     high bit positions.
  50.  
  51.    Because the PDP-8 does not have priority interrupts, the order
  52.    of devices within groups does not matter.
  53. */
  54.  
  55. #define INT_V_START    0                /* enable start */
  56. #define INT_V_LPT    (INT_V_START+0)            /* line printer */
  57. #define INT_V_PTP    (INT_V_START+1)            /* tape punch */
  58. #define INT_V_PTR    (INT_V_START+2)            /* tape reader */
  59. #define INT_V_TTO    (INT_V_START+3)            /* terminal */
  60. #define INT_V_TTI    (INT_V_START+4)            /* keyboard */
  61. #define INT_V_CLK    (INT_V_START+5)            /* clock */
  62. #define INT_V_DIRECT    (INT_V_START+6)            /* direct start */
  63. #define INT_V_RX    (INT_V_DIRECT+0)        /* RX8E */
  64. #define INT_V_RK    (INT_V_DIRECT+1)        /* RK8E */
  65. #define INT_V_RF    (INT_V_DIRECT+2)        /* RF08 */
  66. #define INT_V_MT    (INT_V_DIRECT+3)        /* TM8E */
  67. #define INT_V_PWR    (INT_V_DIRECT+4)        /* power int */
  68. #define INT_V_UF    (INT_V_DIRECT+5)        /* user int */
  69. #define INT_V_OVHD    (INT_V_DIRECT+6)        /* overhead start */
  70. #define INT_V_NO_ION_PENDING (INT_V_OVHD+0)        /* ion pending */
  71. #define INT_V_NO_CIF_PENDING (INT_V_OVHD+1)        /* cif pending */
  72. #define INT_V_ION    (INT_V_OVHD+2)            /* interrupts on */
  73.  
  74. #define INT_LPT        (1 << INT_V_LPT)
  75. #define INT_PTP        (1 << INT_V_PTP)
  76. #define INT_PTR        (1 << INT_V_PTR)
  77. #define INT_TTO        (1 << INT_V_TTO)
  78. #define INT_TTI        (1 << INT_V_TTI)
  79. #define INT_CLK        (1 << INT_V_CLK)
  80. #define INT_RX        (1 << INT_V_RX)
  81. #define INT_RK        (1 << INT_V_RK)
  82. #define INT_RF        (1 << INT_V_RF)
  83. #define INT_MT        (1 << INT_V_MT)
  84. #define INT_PWR        (1 << INT_V_PWR)
  85. #define INT_UF        (1 << INT_V_UF)
  86. #define INT_NO_ION_PENDING (1 << INT_V_NO_ION_PENDING)
  87. #define INT_NO_CIF_PENDING (1 << INT_V_NO_CIF_PENDING)
  88. #define INT_ION        (1 << INT_V_ION)
  89. #define INT_DEV_ENABLE    ((1 << INT_V_DIRECT) - 1)    /* devices w/enables */
  90. #define INT_ALL        ((1 << INT_V_OVHD) - 1)        /* all interrupts */
  91. #define INT_INIT_ENABLE    (INT_TTI+INT_TTO+INT_PTR+INT_PTP+INT_LPT)
  92. #define INT_PENDING    (INT_ION+INT_NO_CIF_PENDING+INT_NO_ION_PENDING)
  93. #define INT_UPDATE    ((int_req & ~INT_DEV_ENABLE) | (dev_done & dev_enable))
  94.