home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / inc&ad2.0 / includes / hardware / cia.h < prev    next >
C/C++ Source or Header  |  1992-09-01  |  6KB  |  199 lines

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