1 /*****************************************************************************/
5 /* Atari Lynx, Suzy chip register hardware structures */
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. */
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: */
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 */
25 /*****************************************************************************/
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
42 #define BUTTON_PAUSE 0x01
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
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
64 /* Sprite control block (SCB) defines */
73 #define TYPE_SHADOW 0x07
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
95 typedef struct SCB_REHVST_PAL { // SCB with all attributes
96 unsigned char sprctl0;
97 unsigned char sprctl1;
98 unsigned char sprcoll;
105 unsigned int stretch;
107 unsigned char penpal[8];
110 typedef struct SCB_REHVST { // SCB without pallette
111 unsigned char sprctl0;
112 unsigned char sprctl1;
113 unsigned char sprcoll;
120 unsigned int stretch;
124 typedef struct SCB_REHV { // SCB without stretch/tilt
125 unsigned char sprctl0;
126 unsigned char sprctl1;
127 unsigned char sprcoll;
136 typedef struct SCB_REHV_PAL { // SCB without str/tilt, w/ penpal
137 unsigned char sprctl0;
138 unsigned char sprctl1;
139 unsigned char sprcoll;
146 unsigned char penpal[8];
149 typedef struct SCB_REHVS { // SCB w/o tilt & penpal
150 unsigned char sprctl0;
151 unsigned char sprctl1;
152 unsigned char sprcoll;
159 unsigned int stretch;
162 typedef struct SCB_REHVS_PAL { // SCB w/o tilt w/penpal
163 unsigned char sprctl0;
164 unsigned char sprctl1;
165 unsigned char sprcoll;
172 unsigned int stretch;
173 unsigned char penpal[8];
176 typedef struct SCB_RENONE { // SCB w/o size/stretch/tilt/pal
177 unsigned char sprctl0;
178 unsigned char sprctl1;
179 unsigned char sprcoll;
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;
194 unsigned char penpal[8];
197 typedef struct PENPAL_4 {
198 unsigned char penpal[8];
201 typedef struct PENPAL_3 {
202 unsigned char penpal[4];
205 typedef struct PENPAL_2 {
206 unsigned char penpal[2];
209 typedef struct PENPAL_1 {
210 unsigned char penpal[1];
213 /* Misc system defines */
217 #define SPRITE_GO 0x01
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
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
239 #define HIGHSPEED 0x80
240 #define VECTORSPACE 0x08
241 #define ROMSPACE 0x04
242 #define MIKEYSPACE 0x02
243 #define SUZYSPACE 0x01
246 /* Suzy Hardware Registers */
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