home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / ace_basic / ace / include / hardware / cia.h < prev    next >
C/C++ Source or Header  |  1977-12-31  |  6KB  |  211 lines

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