home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Includes / hardware / cia.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-12  |  5.4 KB  |  190 lines

  1. #ifndef HARDWARE_CIA_H
  2. #define HARDWARE_CIA_H
  3. /*
  4. **    $Filename: hardware/cia.h $
  5. **    $Release: 1.3 $
  6. **
  7. **    registers and bits in the Complex Interface Adapter (CIA) chip 
  8. **
  9. **    (C) Copyright 1985,1986,1987,1988 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. /*
  14.  * ciaa is on an ODD address (e.g. the low byte) -- $bfe001
  15.  * ciab is on an EVEN address (e.g. the high byte) -- $bfd000
  16.  *
  17.  * do this to get the definitions:
  18.  *    extern struct CIA ciaa, ciab;
  19.  */
  20.  
  21.  
  22. struct CIA {
  23.     UBYTE   ciapra;
  24.     UBYTE   pad0[0xff];
  25.     UBYTE   ciaprb;
  26.     UBYTE   pad1[0xff];
  27.     UBYTE   ciaddra;
  28.     UBYTE   pad2[0xff];
  29.     UBYTE   ciaddrb;
  30.     UBYTE   pad3[0xff];
  31.     UBYTE   ciatalo;
  32.     UBYTE   pad4[0xff];
  33.     UBYTE   ciatahi;
  34.     UBYTE   pad5[0xff];
  35.     UBYTE   ciatblo;
  36.     UBYTE   pad6[0xff];
  37.     UBYTE   ciatbhi;
  38.     UBYTE   pad7[0xff];
  39.     UBYTE   ciatodlow;
  40.     UBYTE   pad8[0xff];
  41.     UBYTE   ciatodmid;
  42.     UBYTE   pad9[0xff];
  43.     UBYTE   ciatodhi;
  44.     UBYTE   pad10[0xff];
  45.     UBYTE   unusedreg;
  46.     UBYTE   pad11[0xff];
  47.     UBYTE   ciasdr;
  48.     UBYTE   pad12[0xff];
  49.     UBYTE   ciaicr;
  50.     UBYTE   pad13[0xff];
  51.     UBYTE   ciacra;
  52.     UBYTE   pad14[0xff];
  53.     UBYTE   ciacrb;
  54. };
  55.  
  56.  
  57. /* interrupt control register bit numbers */
  58. #define CIAICRB_TA    0
  59. #define CIAICRB_TB    1
  60. #define CIAICRB_ALRM    2
  61. #define CIAICRB_SP    3
  62. #define CIAICRB_FLG    4
  63. #define CIAICRB_IR    7
  64. #define CIAICRB_SETCLR    7
  65.  
  66. /* control register A bit numbers */
  67. #define CIACRAB_START    0
  68. #define CIACRAB_PBON    1
  69. #define CIACRAB_OUTMODE 2
  70. #define CIACRAB_RUNMODE 3
  71. #define CIACRAB_LOAD    4
  72. #define CIACRAB_INMODE    5
  73. #define CIACRAB_SPMODE    6
  74. #define CIACRAB_TODIN    7
  75.  
  76. /* control register B bit numbers */
  77. #define CIACRBB_START    0
  78. #define CIACRBB_PBON    1
  79. #define CIACRBB_OUTMODE 2
  80. #define CIACRBB_RUNMODE 3
  81. #define CIACRBB_LOAD    4
  82. #define CIACRBB_INMODE0 5
  83. #define CIACRBB_INMODE1 6
  84. #define CIACRBB_ALARM    7
  85.  
  86. /* interrupt control register masks */
  87. #define CIAICRF_TA    (1<<CIAICRB_TA)
  88. #define CIAICRF_TB    (1<<CIAICRB_TB)
  89. #define CIAICRF_ALRM    (1<<CIAICRB_ALRM)
  90. #define CIAICRF_SP    (1<<CIAICRB_SP)
  91. #define CIAICRF_FLG    (1<<CIAICRB_FLG)
  92. #define CIAICRF_IR    (1<<CIAICRB_IR)
  93. #define CIAICRF_SETCLR    (1<<CIAICRB_SETCLR)
  94.  
  95. /* control register A register masks */
  96. #define CIACRAF_START    (1<<CIACRAB_START)
  97. #define CIACRAF_PBON    (1<<CIACRAB_PBON)
  98. #define CIACRAF_OUTMODE (1<<CIACRAB_OUTMODE)
  99. #define CIACRAF_RUNMODE (1<<CIACRAB_RUNMODE)
  100. #define CIACRAF_LOAD    (1<<CIACRAB_LOAD)
  101. #define CIACRAF_INMODE    (1<<CIACRAB_INMODE)
  102. #define CIACRAF_SPMODE    (1<<CIACRAB_SPMODE)
  103. #define CIACRAF_TODIN    (1<<CIACRAB_TODIN)
  104.  
  105. /* control register B register masks */
  106. #define CIACRBF_START    (1<<CIACRBB_START)
  107. #define CIACRBF_PBON    (1<<CIACRBB_PBON)
  108. #define CIACRBF_OUTMODE (1<<CIACRBB_OUTMODE)
  109. #define CIACRBF_RUNMODE (1<<CIACRBB_RUNMODE)
  110. #define CIACRBF_LOAD    (1<<CIACRBB_LOAD)
  111. #define CIACRBF_INMODE0 (1<<CIACRBB_INMODE0)
  112. #define CIACRBF_INMODE1 (1<<CIACRBB_INMODE1)
  113. #define CIACRBF_ALARM    (1<<CIACRBB_ALARM)
  114.  
  115. /* control register B INMODE masks */
  116. #define CIACRBF_IN_PHI2 0
  117. #define CIACRBF_IN_CNT    (CIACRBF_INMODE0)
  118. #define CIACRBF_IN_TA    (CIACRBF_INMODE1)
  119. #define CIACRBF_IN_CNT_TA  (CIACRBF_INMODE0|CIACRBF_INMODE1)
  120.  
  121. /*
  122.  * Port definitions -- what each bit in a cia peripheral register is tied to
  123.  */
  124.  
  125. /* ciaa port A (0xbfe001) */
  126. #define CIAB_GAMEPORT1    (7)   /* gameport 1, pin 6 (fire button*) */
  127. #define CIAB_GAMEPORT0    (6)   /* gameport 0, pin 6 (fire button*) */
  128. #define CIAB_DSKRDY    (5)   /* disk ready* */
  129. #define CIAB_DSKTRACK0    (4)   /* disk on track 00* */
  130. #define CIAB_DSKPROT    (3)   /* disk write protect* */
  131. #define CIAB_DSKCHANGE    (2)   /* disk change* */
  132. #define CIAB_LED    (1)   /* led light control (0==>bright) */
  133. #define CIAB_OVERLAY    (0)   /* memory overlay bit */
  134.  
  135. /* ciaa port B (0xbfe101) -- parallel port */
  136.  
  137. /* ciab port A (0xbfd000) -- serial and printer control */
  138. #define CIAB_COMDTR    (7)   /* serial Data Terminal Ready* */
  139. #define CIAB_COMRTS    (6)   /* serial Request to Send* */
  140. #define CIAB_COMCD    (5)   /* serial Carrier Detect* */
  141. #define CIAB_COMCTS    (4)   /* serial Clear to Send* */
  142. #define CIAB_COMDSR    (3)   /* serial Data Set Ready* */
  143. #define CIAB_PRTRSEL    (2)   /* printer SELECT */
  144. #define CIAB_PRTRPOUT    (1)   /* printer paper out */
  145. #define CIAB_PRTRBUSY    (0)   /* printer busy */
  146.  
  147. /* ciab port B (0xbfd100) -- disk control */
  148. #define CIAB_DSKMOTOR    (7)   /* disk motorr* */
  149. #define CIAB_DSKSEL3    (6)   /* disk select unit 3* */
  150. #define CIAB_DSKSEL2    (5)   /* disk select unit 2* */
  151. #define CIAB_DSKSEL1    (4)   /* disk select unit 1* */
  152. #define CIAB_DSKSEL0    (3)   /* disk select unit 0* */
  153. #define CIAB_DSKSIDE    (2)   /* disk side select* */
  154. #define CIAB_DSKDIREC    (1)   /* disk direction of seek* */
  155. #define CIAB_DSKSTEP    (0)   /* disk step heads* */
  156.  
  157. /* ciaa port A (0xbfe001) */
  158. #define CIAF_GAMEPORT1    (1<<7)
  159. #define CIAF_GAMEPORT0    (1<<6)
  160. #define CIAF_DSKRDY    (1<<5)
  161. #define CIAF_DSKTRACK0    (1<<4)
  162. #define CIAF_DSKPROT    (1<<3)
  163. #define CIAF_DSKCHANGE    (1<<2)
  164. #define CIAF_LED    (1<<1)
  165. #define CIAF_OVERLAY    (1<<0)
  166.  
  167. /* ciaa port B (0xbfe101) -- parallel port */
  168.  
  169. /* ciab port A (0xbfd000) -- serial and printer control */
  170. #define CIAF_COMDTR    (1<<7)
  171. #define CIAF_COMRTS    (1<<6)
  172. #define CIAF_COMCD    (1<<5)
  173. #define CIAF_COMCTS    (1<<4)
  174. #define CIAF_COMDSR    (1<<3)
  175. #define CIAF_PRTRSEL    (1<<2)
  176. #define CIAF_PRTRPOUT    (1<<1)
  177. #define CIAF_PRTRBUSY    (1<<0)
  178.  
  179. /* ciab port B (0xbfd100) -- disk control */
  180. #define CIAF_DSKMOTOR    (1<<7)
  181. #define CIAF_DSKSEL3    (1<<6)
  182. #define CIAF_DSKSEL2    (1<<5)
  183. #define CIAF_DSKSEL1    (1<<4)
  184. #define CIAF_DSKSEL0    (1<<3)
  185. #define CIAF_DSKSIDE    (1<<2)
  186. #define CIAF_DSKDIREC    (1<<1)
  187. #define CIAF_DSKSTEP    (1<<0)
  188.  
  189. #endif    /* HARDWARE_CIA_H */
  190.