]> git.sur5r.net Git - cc65/blob - include/_suzy.h
Fixed _textcolor definition.
[cc65] / include / _suzy.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                _suzy.h                                    */
4 /*                                                                           */
5 /* Atari Lynx, Suzy chip register hardware structures                        */
6 /*                                                                           */
7 /*                                                                           */
8 /* This software is provided 'as-is', without any expressed or implied       */
9 /* warranty.  In no event will the authors be held liable for any damages    */
10 /* arising from the use of this software.                                    */
11 /*                                                                           */
12 /* Permission is granted to anyone to use this software for any purpose,     */
13 /* including commercial applications, and to alter it and redistribute it    */
14 /* freely, subject to the following restrictions:                            */
15 /*                                                                           */
16 /* 1. The origin of this software must not be misrepresented; you must not   */
17 /*    claim that you wrote the original software. If you use this software   */
18 /*    in a product, an acknowledgment in the product documentation would be  */
19 /*    appreciated but is not required.                                       */
20 /* 2. Altered source versions must be plainly marked as such, and must not   */
21 /*    be misrepresented as being the original software.                      */
22 /* 3. This notice may not be removed or altered from any source              */
23 /*    distribution.                                                          */
24 /*                                                                           */
25 /*****************************************************************************/
26
27
28 #ifndef __SUZY_H
29 #define __SUZY_H
30
31 /* Joypad $FCB0 */
32 #define JOYPAD_RIGHT    0x10
33 #define JOYPAD_LEFT     0x20
34 #define JOYPAD_DOWN     0x40
35 #define JOYPAD_UP       0x80
36 #define BUTTON_OPTION1  0x08
37 #define BUTTON_OPTION2  0x04
38 #define BUTTON_INNER    0x02
39 #define BUTTON_OUTER    0x01
40
41 /* Switches $FCB1 */
42 #define BUTTON_PAUSE    0x01
43
44
45 /* Hardware Math */
46 #define FACTOR_A *(unsigned int *) 0xFC54
47 #define FACTOR_B *(unsigned int *) 0xFC52
48 #define PRODUCT0 *(unsigned int *) 0xFC60
49 #define PRODUCT1 *(unsigned int *) 0xFC62
50 #define PRODUCT *(long *) 0xFC60
51
52 #define DIVIDEND0 *(unsigned int *) 0xFC60
53 #define DIVIDEND1 *(unsigned int *) 0xFC62
54 #define DIVIDEND *(long *) 0xFC60
55 #define DIVISOR *(unsigned int *) 0xFC56
56 #define QUOTIENT0 *(unsigned int *) 0xFC52
57 #define QUOTIENT1 *(unsigned int *) 0xFC54
58 #define QUOTIENT *(long *) 0xFC52
59 #define REMAINDER0 *(unsigned int *) 0xFC6C
60 #define REMAINDER1 *(unsigned int *) 0xFC6E
61 #define REMAINDER *(long *) 0xFC6C
62
63
64 /* Sprite control block (SCB) defines */
65
66 /* SPRCTL0 $FC80 */
67 #define BPP_4            0xC0
68 #define BPP_3            0x80
69 #define BPP_2            0x40
70 #define BPP_1            0x00
71 #define HFLIP            0x20
72 #define VFLIP            0x10
73 #define TYPE_SHADOW      0x07
74 #define TYPE_XOR         0x06
75 #define TYPE_NONCOLL     0x05
76 #define TYPE_NORMAL      0x04
77 #define TYPE_BOUNDARY    0x03
78 #define TYPE_BSHADOW     0x02
79 #define TYPE_BACKNONCOLL 0x01
80 #define TYPE_BACKGROUND  0x00
81
82 /* SPRCTL1 $FC81 */
83 #define LITERAL          0x80
84 #define PACKED           0x00
85 #define ALGO3            0x40
86 #define RENONE           0x00
87 #define REHV             0x10
88 #define REHVS            0x20
89 #define REHVST           0x30
90 #define REUSEPAL         0x08
91 #define SKIP             0x04
92 #define DRAWUP           0x02
93 #define DRAWLEFT         0x01
94
95 typedef struct SCB_REHVST_PAL {             // SCB with all attributes
96   unsigned char sprctl0;
97   unsigned char sprctl1;
98   unsigned char sprcoll;
99   char *next;
100   unsigned char *data;
101   signed int hpos;
102   signed int vpos;
103   unsigned int hsize;
104   unsigned int vsize;
105   unsigned int stretch;
106   unsigned int tilt;
107   unsigned char penpal[8];
108 } SCB_REHVST_PAL;
109
110 typedef struct SCB_REHVST {                  // SCB without pallette
111   unsigned char sprctl0;
112   unsigned char sprctl1;
113   unsigned char sprcoll;
114   char *next;
115   unsigned char *data;
116   signed int hpos;
117   signed int vpos;
118   unsigned int hsize;
119   unsigned int vsize;
120   unsigned int stretch;
121   unsigned int tilt;
122 } SCB_REHVST;
123
124 typedef struct SCB_REHV {                 // SCB without stretch/tilt
125   unsigned char sprctl0;
126   unsigned char sprctl1;
127   unsigned char sprcoll;
128   char *next;
129   unsigned char *data;
130   signed int hpos;
131   signed int vpos;
132   unsigned int hsize;
133   unsigned int vsize;
134 } SCB_REHV;
135
136 typedef struct SCB_REHV_PAL {             // SCB without str/tilt, w/ penpal
137   unsigned char sprctl0;
138   unsigned char sprctl1;
139   unsigned char sprcoll;
140   char *next;
141   unsigned char *data;
142   signed int hpos;
143   signed int vpos;
144   unsigned int hsize;
145   unsigned int vsize;
146   unsigned char penpal[8];
147 } SCB_REHV_PAL;
148
149 typedef struct SCB_REHVS {                // SCB w/o tilt & penpal
150   unsigned char sprctl0;
151   unsigned char sprctl1;
152   unsigned char sprcoll;
153   char *next;
154   unsigned char *data;
155   signed int hpos;
156   signed int vpos;
157   unsigned int hsize;
158   unsigned int vsize;
159   unsigned int stretch;
160 } SCB_REHVS;
161
162 typedef struct SCB_REHVS_PAL {            // SCB w/o tilt w/penpal
163   unsigned char sprctl0;
164   unsigned char sprctl1;
165   unsigned char sprcoll;
166   char *next;
167   unsigned char *data;
168   signed int hpos;
169   signed int vpos;
170   unsigned int hsize;
171   unsigned int vsize;
172   unsigned int stretch;
173   unsigned char penpal[8];
174 } SCB_REHVS_PAL;
175
176 typedef struct SCB_RENONE {                 // SCB w/o size/stretch/tilt/pal
177   unsigned char sprctl0;
178   unsigned char sprctl1;
179   unsigned char sprcoll;
180   char *next;
181   unsigned char *data;
182   signed int hpos;
183   signed int vpos;
184 } SCB_RENONE;
185
186 typedef struct SCB_RENONE_PAL {             // SCB w/o size/str/tilt w/penpal
187   unsigned char sprctl0;
188   unsigned char sprctl1;
189   unsigned char sprcoll;
190   char *next;
191   unsigned char *data;
192   signed int hpos;
193   signed int vpos;
194   unsigned char penpal[8];
195 } SCB_RENONE_PAL;
196
197 typedef struct PENPAL_4 {
198   unsigned char penpal[8];
199 } PENPAL_4;
200
201 typedef struct PENPAL_3 {
202   unsigned char penpal[4];
203 } PENPAL_3;
204
205 typedef struct PENPAL_2 {
206   unsigned char penpal[2];
207 } PENPAL_2;
208
209 typedef struct PENPAL_1 {
210   unsigned char penpal[1];
211 } PENPAL_1;
212
213 /* Misc system defines */
214
215 /* SPRGO $FC91 */
216 #define EVER_ON         0x04
217 #define SPRITE_GO       0x01
218
219 /* SPRSYS (write) $FC92 */
220 #define SIGNMATH        0x80
221 #define ACCUMULATE      0x40
222 #define NO_COLLIDE      0x20
223 #define VSTRETCH        0x10
224 #define LEFTHAND        0x08
225 #define CLR_UNSAFE      0x04
226 #define SPRITESTOP      0x02
227
228 /* SPRSYS (read) $FC92 */
229 #define MATHWORKING     0x80
230 #define MATHWARNING     0x40
231 #define MATHCARRY       0x20
232 #define VSTRETCHING     0x10
233 #define LEFTHANDED      0x08
234 #define UNSAFE_ACCESS   0x04
235 #define SPRITETOSTOP    0x02
236 #define SPRITEWORKING   0x01
237
238 /* MAPCTL $FFF9 */
239 #define HIGHSPEED       0x80
240 #define VECTORSPACE     0x08
241 #define ROMSPACE        0x04
242 #define MIKEYSPACE      0x02
243 #define SUZYSPACE       0x01
244
245
246 /* Suzy Hardware Registers */
247 struct __suzy {
248   unsigned int  tmpadr;         // 0xFC00  Temporary address
249   unsigned int  tiltacc;        // 0xFC02  Tilt accumulator
250   unsigned int  hoff;           // 0xFC04  Offset to H edge of screen
251   unsigned int  voff;           // 0xFC06  Offset to V edge of screen
252   unsigned char *sprbase;       // 0xFC08  Base address of sprite
253   unsigned char *colbase;       // 0xFC0A  Base address of collision buffer
254   unsigned char *vidadr;        // 0xFC0C  Current vid buffer address
255   unsigned char *coladr;        // 0xFC0E  Current col buffer address
256   unsigned char *scbnext;       // 0xFC10  Address of next SCB
257   unsigned char *sprdline;      // 0xFC12  start of sprite data line address
258   unsigned char *hposstrt;      // 0xFC14  start hpos
259   unsigned char *vposstrt;      // 0xFC16  start vpos
260   unsigned char *sprhsize;      // 0xFC18  sprite h size
261   unsigned char *sprvsize;      // 0xFC1A  sprite v size
262   unsigned int  stretchl;       // 0xFC1C  H size adder
263   unsigned int  tilt;           // 0xFC1E  H pos adder
264   unsigned int  sprdoff;        // 0xFC20  offset to next sprite data line
265   unsigned int  sprvpos;        // 0xFC22  current vpos
266   unsigned int  colloff;        // 0xFC24  offset to collision depository
267   unsigned int  vsizeacc;       // 0xFC26  vertical size accumulator
268   unsigned int  hsizeoff;       // 0xFC28  horizontal size offset
269   unsigned int  vsizeoff;       // 0xFC2A  vertical size offset
270   unsigned char *scbaddr;       // 0xFC2C  address of current SCB
271   unsigned char *procaddr;      // 0xFC2E  address of current spr data proc
272   unsigned char unused0[32];    // 0xFC30 - 0xFC4F  reserved/unused
273   unsigned char unused1[2];     // 0xFC50 - 0xFC51  do not use
274   unsigned char mathd;          // 0xFC52
275   unsigned char mathc;          // 0xFC53
276   unsigned char mathb;          // 0xFC54
277   unsigned char matha;          // 0xFC55
278   unsigned char mathp;          // 0xFC56
279   unsigned char mathn;          // 0xFC57
280   unsigned char unused2[8];     // 0xFC58 - 0xFC5F  do not use
281   unsigned char mathh;          // 0xFC60
282   unsigned char mathg;          // 0xFC61
283   unsigned char mathf;          // 0xFC62
284   unsigned char mathe;          // 0xFC63
285   unsigned char unused3[8];     // 0xFC64 - 0xFC6B  do not use
286   unsigned char mathm;          // 0xFC6C
287   unsigned char mathl;          // 0xFC6D
288   unsigned char mathk;          // 0xFC6E
289   unsigned char mathj;          // 0xFC6F
290   unsigned char unused4[16];    // 0xFC70 - 0xFC7F  do not use
291   unsigned char sprctl0;        // 0xFC80  sprite control bits 0
292   unsigned char sprctl1;        // 0xFC81  sprite control bits 1
293   unsigned char sprcoll;        // 0xFC82  sprite collision number
294   unsigned char sprinit;        // 0xFC83  sprite initialization bits
295   unsigned char unused5[4];     // 0xFC84 - 0xFC87  unused
296   unsigned char suzyhrev;       // 0xFC88  suzy hardware rev
297   unsigned char suzysrev;       // 0xFC89  suzy software rev
298   unsigned char unused6[6];     // 0xFC8A - 0xFC8F  unused
299   unsigned char suzybusen;      // 0xFC90  suzy bus enable
300   unsigned char sprgo;          // 0xFC91  sprite process start bit
301   unsigned char sprsys;         // 0xFC92  sprite system control bits
302   unsigned char unused7[29];    // 0xFC93 - 0xFCAF  unused
303   unsigned char joystick;       // 0xFCB0  joystick and buttons
304   unsigned char switches;       // 0xFCB1  other switches
305   unsigned char cart0;          // 0xFCB2  cart0 r/w
306   unsigned char cart1;          // 0xFCB3  cart1 r/w
307   unsigned char unused8[8];     // 0xFCB4 - 0xFCBF  unused
308   unsigned char leds;           // 0xFCC0  leds
309   unsigned char unused9;        // 0xFCC1  unused
310   unsigned char parstat;        // 0xFCC2  parallel port status
311   unsigned char pardata;        // 0xFCC3  parallel port data
312   unsigned char howie;          // 0xFCC4  howie (?)
313                                 // 0xFCC5 - 0xFCFF  unused
314 };
315
316
317 #endif
318