1 #ifndef HARDWARE_CIA_H
    2 #define HARDWARE_CIA_H
    3 
    4 /*
    5 	cia registers and bits
    6 
    7 	Copyright © 2002 The MorphOS Development Team, All Rights Reserved.
    8 */
    9 
   10 #ifndef EXEC_TYPES_H
   11 # include <exec/types.h>
   12 #endif
   13 
   14 #pragma pack(2)
   15 
   16 
   17 struct CIA
   18 {
   19 	VOLATILE UBYTE ciapra;
   20 	VOLATILE UBYTE            pad0[0xff];
   21 	VOLATILE UBYTE ciaprb;
   22 	VOLATILE UBYTE            pad1[0xff];
   23 	VOLATILE UBYTE ciaddra;
   24 	VOLATILE UBYTE            pad2[0xff];
   25 	VOLATILE UBYTE ciaddrb;
   26 	VOLATILE UBYTE            pad3[0xff];
   27 	VOLATILE UBYTE ciatalo;
   28 	VOLATILE UBYTE            pad4[0xff];
   29 	VOLATILE UBYTE ciatahi;
   30 	VOLATILE UBYTE            pad5[0xff];
   31 	VOLATILE UBYTE ciatblo;
   32 	VOLATILE UBYTE            pad6[0xff];
   33 	VOLATILE UBYTE ciatbhi;
   34 	VOLATILE UBYTE            pad7[0xff];
   35 	VOLATILE UBYTE ciatodlow;
   36 	VOLATILE UBYTE            pad8[0xff];
   37 	VOLATILE UBYTE ciatodmid;
   38 	VOLATILE UBYTE            pad9[0xff];
   39 	VOLATILE UBYTE ciatodhi;
   40 	VOLATILE UBYTE            pad10[0xff];
   41 	VOLATILE UBYTE unusedreg;
   42 	VOLATILE UBYTE            pad11[0xff];
   43 	VOLATILE UBYTE ciasdr;
   44 	VOLATILE UBYTE            pad12[0xff];
   45 	VOLATILE UBYTE ciaicr;
   46 	VOLATILE UBYTE            pad13[0xff];
   47 	VOLATILE UBYTE ciacra;
   48 	VOLATILE UBYTE            pad14[0xff];
   49 	VOLATILE UBYTE ciacrb;
   50 };
   51 
   52 
   53 #define CIAICRB_TA      0
   54 #define CIAICRB_TB      1
   55 #define CIAICRB_ALRM    2
   56 #define CIAICRB_SP      3
   57 #define CIAICRB_FLG     4
   58 #define CIAICRB_IR      7
   59 #define CIAICRB_SETCLR  7
   60 
   61 #define CIAICRF_TA      (1<<CIAICRB_TA)
   62 #define CIAICRF_TB      (1<<CIAICRB_TB)
   63 #define CIAICRF_ALRM    (1<<CIAICRB_ALRM)
   64 #define CIAICRF_SP      (1<<CIAICRB_SP)
   65 #define CIAICRF_FLG     (1<<CIAICRB_FLG)
   66 #define CIAICRF_IR      (1<<CIAICRB_IR)
   67 #define CIAICRF_SETCLR  (1<<CIAICRB_SETCLR)
   68 
   69 
   70 #define CIACRAB_START    0
   71 #define CIACRAB_PBON     1
   72 #define CIACRAB_OUTMODE  2
   73 #define CIACRAB_RUNMODE  3
   74 #define CIACRAB_LOAD     4
   75 #define CIACRAB_INMODE   5
   76 #define CIACRAB_SPMODE   6
   77 #define CIACRAB_TODIN    7
   78 
   79 #define CIACRAF_START    (1<<CIACRAB_START)
   80 #define CIACRAF_PBON     (1<<CIACRAB_PBON)
   81 #define CIACRAF_OUTMODE  (1<<CIACRAB_OUTMODE)
   82 #define CIACRAF_RUNMODE  (1<<CIACRAB_RUNMODE)
   83 #define CIACRAF_LOAD     (1<<CIACRAB_LOAD)
   84 #define CIACRAF_INMODE   (1<<CIACRAB_INMODE)
   85 #define CIACRAF_SPMODE   (1<<CIACRAB_SPMODE)
   86 #define CIACRAF_TODIN    (1<<CIACRAB_TODIN)
   87 
   88 
   89 #define CIACRBB_START    0
   90 #define CIACRBB_PBON     1
   91 #define CIACRBB_OUTMODE  2
   92 #define CIACRBB_RUNMODE  3
   93 #define CIACRBB_LOAD     4
   94 #define CIACRBB_INMODE0  5
   95 #define CIACRBB_INMODE1  6
   96 #define CIACRBB_ALARM    7
   97 
   98 #define CIACRBF_START    (1<<CIACRBB_START)
   99 #define CIACRBF_PBON     (1<<CIACRBB_PBON)
  100 #define CIACRBF_OUTMODE  (1<<CIACRBB_OUTMODE)
  101 #define CIACRBF_RUNMODE  (1<<CIACRBB_RUNMODE)
  102 #define CIACRBF_LOAD     (1<<CIACRBB_LOAD)
  103 #define CIACRBF_INMODE0  (1<<CIACRBB_INMODE0)
  104 #define CIACRBF_INMODE1  (1<<CIACRBB_INMODE1)
  105 #define CIACRBF_ALARM    (1<<CIACRBB_ALARM)
  106 
  107 
  108 #define CIACRBF_IN_PHI2    0
  109 #define CIACRBF_IN_CNT     (CIACRBF_INMODE0)
  110 #define CIACRBF_IN_TA      (CIACRBF_INMODE1)
  111 #define CIACRBF_IN_CNT_TA  (CIACRBF_INMODE0|CIACRBF_INMODE1)
  112 
  113 
  114 #define CIAB_GAMEPORT1  (7)
  115 #define CIAB_GAMEPORT0  (6)
  116 #define CIAB_DSKRDY     (5)
  117 #define CIAB_DSKTRACK0  (4)
  118 #define CIAB_DSKPROT    (3)
  119 #define CIAB_DSKCHANGE  (2)
  120 #define CIAB_LED        (1)
  121 #define CIAB_OVERLAY    (0)
  122 
  123 #define CIAF_GAMEPORT1  (1<<CIAB_GAMEPORT1)
  124 #define CIAF_GAMEPORT0  (1<<CIAB_GAMEPORT0)
  125 #define CIAF_DSKRDY     (1<<CIAB_DSKRDY)
  126 #define CIAF_DSKTRACK0  (1<<CIAB_DSKTRACK0)
  127 #define CIAF_DSKPROT    (1<<CIAB_DSKPROT)
  128 #define CIAF_DSKCHANGE  (1<<CIAB_DSKCHANGE)
  129 #define CIAF_LED        (1<<CIAB_LED)
  130 #define CIAF_OVERLAY    (1<<CIAB_OVERLAY)
  131 
  132 
  133 #define CIAB_COMDTR     (7)
  134 #define CIAB_COMRTS     (6)
  135 #define CIAB_COMCD      (5)
  136 #define CIAB_COMCTS     (4)
  137 #define CIAB_COMDSR     (3)
  138 #define CIAB_PRTRSEL    (2)
  139 #define CIAB_PRTRPOUT   (1)
  140 #define CIAB_PRTRBUSY   (0)
  141 
  142 #define CIAF_COMDTR     (1<<CIAB_COMDTR)
  143 #define CIAF_COMRTS     (1<<CIAB_COMRTS)
  144 #define CIAF_COMCD      (1<<CIAB_COMCD)
  145 #define CIAF_COMCTS     (1<<CIAB_COMCTS)
  146 #define CIAF_COMDSR     (1<<CIAB_COMDSR)
  147 #define CIAF_PRTRSEL    (1<<CIAB_PRTRSEL)
  148 #define CIAF_PRTRPOUT   (1<<CIAB_PRTRPOUT)
  149 #define CIAF_PRTRBUSY   (1<<CIAB_PRTRBUSY)
  150 
  151 
  152 #define CIAB_DSKMOTOR   (7)
  153 #define CIAB_DSKSEL3    (6)
  154 #define CIAB_DSKSEL2    (5)
  155 #define CIAB_DSKSEL1    (4)
  156 #define CIAB_DSKSEL0    (3)
  157 #define CIAB_DSKSIDE    (2)
  158 #define CIAB_DSKDIREC   (1)
  159 #define CIAB_DSKSTEP    (0)
  160 
  161 #define CIAF_DSKMOTOR   (1<<CIAB_DSKMOTOR)
  162 #define CIAF_DSKSEL3    (1<<CIAB_DSKSEL3)
  163 #define CIAF_DSKSEL2    (1<<CIAB_DSKSEL2)
  164 #define CIAF_DSKSEL1    (1<<CIAB_DSKSEL1)
  165 #define CIAF_DSKSEL0    (1<<CIAB_DSKSEL0)
  166 #define CIAF_DSKSIDE    (1<<CIAB_DSKSIDE)
  167 #define CIAF_DSKDIREC   (1<<CIAB_DSKDIREC)
  168 #define CIAF_DSKSTEP    (1<<CIAB_DSKSTEP)
  169 
  170 
  171 #pragma pack()
  172 
  173 #endif /* HARDWARE_CIA_H */