--- /dev/null
+/*****************************************************************************/\r
+/* */\r
+/* _mikey.h */\r
+/* */\r
+/* Atari Lynx, Mikey chip register hardware structures */\r
+/* */\r
+/* */\r
+/* This software is provided 'as-is', without any expressed or implied */\r
+/* warranty. In no event will the authors be held liable for any damages */\r
+/* arising from the use of this software. */\r
+/* */\r
+/* Permission is granted to anyone to use this software for any purpose, */\r
+/* including commercial applications, and to alter it and redistribute it */\r
+/* freely, subject to the following restrictions: */\r
+/* */\r
+/* 1. The origin of this software must not be misrepresented; you must not */\r
+/* claim that you wrote the original software. If you use this software */\r
+/* in a product, an acknowledgment in the product documentation would be */\r
+/* appreciated but is not required. */\r
+/* 2. Altered source versions must be plainly marked as such, and must not */\r
+/* be misrepresented as being the original software. */\r
+/* 3. This notice may not be removed or altered from any source */\r
+/* distribution. */\r
+/* */\r
+/*****************************************************************************/\r
+\r
+#ifndef __MIKEY_H\r
+#define __MIKEY_H\r
+\r
+/* timer structure */\r
+typedef struct _mikey_timer {\r
+ unsigned char reload;\r
+ unsigned char control;\r
+ unsigned char count;\r
+ unsigned char control2;\r
+} _mikey_timer;\r
+\r
+typedef struct _mikey_all_timers {\r
+ struct _mikey_timer timer[8];\r
+} _mikey_all_timers;\r
+\r
+/* audio channel structure */\r
+typedef struct _mikey_audio {\r
+ unsigned char volume;\r
+ unsigned char feedback;\r
+ unsigned char dac;\r
+ unsigned char shiftlo;\r
+ unsigned char reload;\r
+ unsigned char control;\r
+ unsigned char count;\r
+ unsigned char other;\r
+} _mikey_audio;\r
+\r
+/* Define a structure with the mikey register offsets */\r
+struct __mikey {\r
+ struct _mikey_timer timer0; // 0xFD00\r
+ struct _mikey_timer timer1; // 0xFD04\r
+ struct _mikey_timer timer2; // 0xFD08\r
+ struct _mikey_timer timer3; // 0xFD0C\r
+ struct _mikey_timer timer4; // 0xFD10\r
+ struct _mikey_timer timer5; // 0xFD14\r
+ struct _mikey_timer timer6; // 0xFD18\r
+ struct _mikey_timer timer7; // 0xFD1C\r
+ struct _mikey_audio channel_a; // 0xFD20\r
+ struct _mikey_audio channel_b; // 0xFD28\r
+ struct _mikey_audio channel_c; // 0xFD30\r
+ struct _mikey_audio channel_d; // 0xFD38\r
+ unsigned char attena; // 0xFD40 ?? not yet allocated?\r
+ unsigned char attenb; // 0xFD41 |\r
+ unsigned char attenc; // 0xFD42 |\r
+ unsigned char attend; // 0xFD43 |\r
+ unsigned char panning; // 0xFD44 |\r
+ unsigned char unused0[11]; // 0xFD45 - 0xFD4F not used\r
+ unsigned char mstereo; // 0xFD50 stereo control bits\r
+ unsigned char unused1[47]; // 0xFD51 - 0xFD7F not used\r
+ unsigned char intrst; // 0xFD80 interrupt poll 0\r
+ unsigned char intset; // 0xFD81 interrupt poll 1\r
+ unsigned char unused2[2]; // 0xFD82 - 0xFD83 not used\r
+ unsigned char magrdy0; // 0xFD84 mag tape channel0 ready bit\r
+ unsigned char magrdy1; // 0xFD85 mag tape channel1 ready bit\r
+ unsigned char audin; // 0xFD86 audio in\r
+ unsigned char sysctl1; // 0xFD87 control bits\r
+ unsigned char mikeyrev; // 0xFD88 mikey hardware rev\r
+ unsigned char mikeysrev; // 0xFD89 mikey software rev\r
+ unsigned char iodir; // 0xFD8A parallel i/o data dir\r
+ unsigned char iodat; // 0xFD8B parallel data\r
+ unsigned char serctl; // 0xFD8C serial control register\r
+ unsigned char serdat; // 0xFD8D serial data\r
+ unsigned char unused3[2]; // 0xFD8E - 0xFD8F not used\r
+ unsigned char sdoneack; // 0xFD90 suzy done acknowledge\r
+ unsigned char cpusleep; // 0xFD91 cpu bus request disable\r
+ unsigned char dispctl; // 0xFD92 video bus request enable, viddma\r
+ unsigned char pkbkup; // 0xFD93 magic 'P' count\r
+ unsigned char *scrbase; // 0xFD94 start address of video display\r
+ unsigned char unused4[6]; // 0xFD96 - 0xFD9B not used\r
+ unsigned char mtest0; // 0xFD9C\r
+ unsigned char mtest1; // 0xFD9D\r
+ unsigned char mtest2; // 0xFD9E\r
+ unsigned char unused5; // 0xFD9F not used\r
+ unsigned char palette[32]; // 0xFDA0 - 0xFDBF palette 32 bytes\r
+ // 0xFDC0 - 0xFDFF not used\r
+};\r
+\r
+\r
+#endif
\ No newline at end of file
--- /dev/null
+/*****************************************************************************/\r
+/* */\r
+/* _suzy.h */\r
+/* */\r
+/* Atari Lynx, Suzy chip register hardware structures */\r
+/* */\r
+/* */\r
+/* This software is provided 'as-is', without any expressed or implied */\r
+/* warranty. In no event will the authors be held liable for any damages */\r
+/* arising from the use of this software. */\r
+/* */\r
+/* Permission is granted to anyone to use this software for any purpose, */\r
+/* including commercial applications, and to alter it and redistribute it */\r
+/* freely, subject to the following restrictions: */\r
+/* */\r
+/* 1. The origin of this software must not be misrepresented; you must not */\r
+/* claim that you wrote the original software. If you use this software */\r
+/* in a product, an acknowledgment in the product documentation would be */\r
+/* appreciated but is not required. */\r
+/* 2. Altered source versions must be plainly marked as such, and must not */\r
+/* be misrepresented as being the original software. */\r
+/* 3. This notice may not be removed or altered from any source */\r
+/* distribution. */\r
+/* */\r
+/*****************************************************************************/\r
+\r
+\r
+#ifndef __SUZY_H\r
+#define __SUZY_H\r
+\r
+/* Joypad $FCB0 */\r
+#define JOY_RIGHT 0x10\r
+#define JOY_LEFT 0x20\r
+#define JOY_DOWN 0x40\r
+#define JOY_UP 0x80\r
+#define BUTTON_OPTION1 0x08\r
+#define BUTTON_OPTION2 0x04\r
+#define BUTTON_INNER 0x02\r
+#define BUTTON_OUTER 0x01\r
+\r
+/* Switches $FCB1 */\r
+#define BUTTON_PAUSE 0x01\r
+\r
+\r
+/* Hardware Math */\r
+#define FACTOR_A *(unsigned int *) 0xFC54\r
+#define FACTOR_B *(unsigned int *) 0xFC52\r
+#define PRODUCT0 *(unsigned int *) 0xFC60\r
+#define PRODUCT1 *(unsigned int *) 0xFC62\r
+#define PRODUCT *(long *) 0xFC60\r
+\r
+#define DIVIDEND0 *(unsigned int *) 0xFC60\r
+#define DIVIDEND1 *(unsigned int *) 0xFC62\r
+#define DIVIDEND *(long *) 0xFC60\r
+#define DIVISOR *(unsigned int *) 0xFC56\r
+#define QUOTIENT0 *(unsigned int *) 0xFC52\r
+#define QUOTIENT1 *(unsigned int *) 0xFC54\r
+#define QUOTIENT *(long *) 0xFC52\r
+#define REMAINDER0 *(unsigned int *) 0xFC6C\r
+#define REMAINDER1 *(unsigned int *) 0xFC6E\r
+#define REMAINDER *(long *) 0xFC6C\r
+\r
+\r
+/* Sprite control block (SCB) defines */\r
+\r
+/* SPRCTL0 $FC80 */\r
+#define BPP_4 0xC0\r
+#define BPP_3 0x80\r
+#define BPP_2 0x40\r
+#define BPP_1 0x00\r
+#define HFLIP 0x20\r
+#define VFLIP 0x10\r
+#define TYPE_SHADOW 0x07\r
+#define TYPE_XOR 0x06\r
+#define TYPE_NONCOLL 0x05\r
+#define TYPE_NORMAL 0x04\r
+#define TYPE_BOUNDARY 0x03\r
+#define TYPE_BSHADOW 0x02\r
+#define TYPE_BACKNONCOLL 0x01\r
+#define TYPE_BACKGROUND 0x00\r
+\r
+/* SPRCTL1 $FC81 */\r
+#define LITERAL 0x80\r
+#define PACKED 0x00\r
+#define ALGO3 0x40\r
+#define RENONE 0x00\r
+#define REHV 0x10\r
+#define REHVS 0x20\r
+#define REHVST 0x30\r
+#define REUSEPAL 0x08\r
+#define SKIP 0x04\r
+#define DRAWUP 0x02\r
+#define DRAWLEFT 0x01\r
+\r
+typedef struct SCB_REHVST_PAL { // SCB with all attributes\r
+ unsigned char sprctl0;\r
+ unsigned char sprctl1;\r
+ unsigned char sprcoll;\r
+ char *next;\r
+ char *data;\r
+ unsigned int hpos;\r
+ unsigned int vpos;\r
+ unsigned int hsize;\r
+ unsigned int vsize;\r
+ unsigned int stretch;\r
+ unsigned int tilt;\r
+ unsigned char penpal[8];\r
+} SCB_REHVST_PAL;\r
+\r
+typedef struct SCB_REHVST { // SCB without pallette\r
+ unsigned char sprctl0;\r
+ unsigned char sprctl1;\r
+ unsigned char sprcoll;\r
+ char *next;\r
+ char *data;\r
+ unsigned int hpos;\r
+ unsigned int vpos;\r
+ unsigned int hsize;\r
+ unsigned int vsize;\r
+ unsigned int stretch;\r
+ unsigned int tilt;\r
+} SCB_REHVST;\r
+\r
+typedef struct SCB_REHV { // SCB without stretch/tilt\r
+ unsigned char sprctl0;\r
+ unsigned char sprctl1;\r
+ unsigned char sprcoll;\r
+ char *next;\r
+ char *data;\r
+ unsigned int hpos;\r
+ unsigned int vpos;\r
+ unsigned int hsize;\r
+ unsigned int vsize;\r
+} SCB_REHV;\r
+\r
+typedef struct SCB_REHV_PAL { // SCB without str/tilt, w/ penpal\r
+ unsigned char sprctl0;\r
+ unsigned char sprctl1;\r
+ unsigned char sprcoll;\r
+ char *next;\r
+ char *data;\r
+ unsigned int hpos;\r
+ unsigned int vpos;\r
+ unsigned int hsize;\r
+ unsigned int vsize;\r
+ unsigned char penpal[8];\r
+} SCB_REHV_PAL;\r
+\r
+typedef struct SCB_REHVS { // SCB w/o tilt & penpal\r
+ unsigned char sprctl0;\r
+ unsigned char sprctl1;\r
+ unsigned char sprcoll;\r
+ char *next;\r
+ char *data;\r
+ unsigned int hpos;\r
+ unsigned int vpos;\r
+ unsigned int hsize;\r
+ unsigned int vsize;\r
+ unsigned int stretch;\r
+} SCB_REHVS;\r
+\r
+typedef struct SCB_REHVS_PAL { // SCB w/o tilt w/penpal\r
+ unsigned char sprctl0;\r
+ unsigned char sprctl1;\r
+ unsigned char sprcoll;\r
+ char *next;\r
+ char *data;\r
+ unsigned int hpos;\r
+ unsigned int vpos;\r
+ unsigned int hsize;\r
+ unsigned int vsize;\r
+ unsigned int stretch;\r
+ unsigned char penpal[8];\r
+} SCB_REHVS_PAL;\r
+\r
+typedef struct SCB_RENONE { // SCB w/o size/stretch/tilt/pal\r
+ unsigned char sprctl0;\r
+ unsigned char sprctl1;\r
+ unsigned char sprcoll;\r
+ char *next;\r
+ char *data;\r
+ unsigned int hpos;\r
+ unsigned int vpos;\r
+} SCB_RENONE;\r
+\r
+typedef struct SCB_RENONE_PAL { // SCB w/o size/str/tilt w/penpal\r
+ unsigned char sprctl0;\r
+ unsigned char sprctl1;\r
+ unsigned char sprcoll;\r
+ char *next;\r
+ char *data;\r
+ unsigned int hpos;\r
+ unsigned int vpos;\r
+ unsigned char penpal[8];\r
+} SCB_RENONE_PAL;\r
+\r
+\r
+/* Misc system defines */\r
+\r
+/* SPRGO $FC91 */\r
+#define EVER_ON 0x04\r
+#define SPRITE_GO 0x01\r
+\r
+/* SPRSYS (write) $FC92 */\r
+#define SIGNMATH 0x80\r
+#define ACCUMULATE 0x40\r
+#define NO_COLLIDE 0x20\r
+#define VSTRETCH 0x10\r
+#define LEFTHAND 0x08\r
+#define CLR_UNSAFE 0x04\r
+#define SPRITESTOP 0x02\r
+\r
+/* SPRSYS (read) $FC92 */\r
+#define MATHWORKING 0x80\r
+#define MATHWARNING 0x40\r
+#define MATHCARRY 0x20\r
+#define VSTRETCHING 0x10\r
+#define LEFTHANDED 0x08\r
+#define UNSAFE_ACCESS 0x04\r
+#define SPRITETOSTOP 0x02\r
+#define SPRITEWORKING 0x01\r
+\r
+/* MAPCTL $FFF9 */\r
+#define HIGHSPEED 0x80\r
+#define VECTORSPACE 0x08\r
+#define ROMSPACE 0x04\r
+#define MIKEYSPACE 0x02\r
+#define SUZYSPACE 0x01\r
+\r
+\r
+/* Suzy Hardware Registers */\r
+struct __suzy {\r
+ unsigned int tmpadr; // 0xFC00 Temporary address\r
+ unsigned int tiltacc; // 0xFC02 Tilt accumulator\r
+ unsigned int hoff; // 0xFC04 Offset to H edge of screen\r
+ unsigned int voff; // 0xFC06 Offset to V edge of screen\r
+ unsigned char *sprbase; // 0xFC08 Base address of sprite\r
+ unsigned char *colbase; // 0xFC0A Base address of collision buffer\r
+ unsigned char *vidadr; // 0xFC0C Current vid buffer address\r
+ unsigned char *coladr; // 0xFC0E Current col buffer address\r
+ unsigned char *scbnext; // 0xFC10 Address of next SCB\r
+ unsigned char *sprdline; // 0xFC12 start of sprite data line address\r
+ unsigned char *hposstrt; // 0xFC14 start hpos\r
+ unsigned char *vposstrt; // 0xFC16 start vpos\r
+ unsigned char *sprhsize; // 0xFC18 sprite h size\r
+ unsigned char *sprvsize; // 0xFC1A sprite v size\r
+ unsigned int stretchl; // 0xFC1C H size adder\r
+ unsigned int tilt; // 0xFC1E H pos adder\r
+ unsigned int sprdoff; // 0xFC20 offset to next sprite data line\r
+ unsigned int sprvpos; // 0xFC22 current vpos\r
+ unsigned int colloff; // 0xFC24 offset to collision depository\r
+ unsigned int vsizeacc; // 0xFC26 vertical size accumulator\r
+ unsigned int hsizeoff; // 0xFC28 horizontal size offset\r
+ unsigned int vsizeoff; // 0xFC2A vertical size offset\r
+ unsigned char *scbaddr; // 0xFC2C address of current SCB\r
+ unsigned char *procaddr; // 0xFC2E address of current spr data proc\r
+ unsigned char unused0[32]; // 0xFC30 - 0xFC4F reserved/unused\r
+ unsigned char unused1[2]; // 0xFC50 - 0xFC51 do not use\r
+ unsigned char mathd; // 0xFC52\r
+ unsigned char mathc; // 0xFC53\r
+ unsigned char mathb; // 0xFC54\r
+ unsigned char matha; // 0xFC55\r
+ unsigned char mathp; // 0xFC56\r
+ unsigned char mathn; // 0xFC57\r
+ unsigned char unused2[8]; // 0xFC58 - 0xFC5F do not use\r
+ unsigned char mathh; // 0xFC60\r
+ unsigned char mathg; // 0xFC61\r
+ unsigned char mathf; // 0xFC62\r
+ unsigned char mathe; // 0xFC63\r
+ unsigned char unused3[8]; // 0xFC64 - 0xFC6B do not use\r
+ unsigned char mathm; // 0xFC6C\r
+ unsigned char mathl; // 0xFC6D\r
+ unsigned char mathk; // 0xFC6E\r
+ unsigned char mathj; // 0xFC6F\r
+ unsigned char unused4[16]; // 0xFC70 - 0xFC7F do not use\r
+ unsigned char sprctl0; // 0xFC80 sprite control bits 0\r
+ unsigned char sprctl1; // 0xFC81 sprite control bits 1\r
+ unsigned char sprcoll; // 0xFC82 sprite collision number\r
+ unsigned char sprinit; // 0xFC83 sprite initialization bits\r
+ unsigned char unused5[4]; // 0xFC84 - 0xFC87 unused\r
+ unsigned char suzyhrev; // 0xFC88 suzy hardware rev\r
+ unsigned char suzysrev; // 0xFC89 suzy software rev\r
+ unsigned char unused6[6]; // 0xFC8A - 0xFC8F unused\r
+ unsigned char suzybusen; // 0xFC90 suzy bus enable\r
+ unsigned char sprgo; // 0xFC91 sprite process start bit\r
+ unsigned char sprsys; // 0xFC92 sprite system control bits\r
+ unsigned char unused7[29]; // 0xFC93 - 0xFCAF unused\r
+ unsigned char joystick; // 0xFCB0 joystick and buttons\r
+ unsigned char switches; // 0xFCB1 other switches\r
+ unsigned char cart0; // 0xFCB2 cart0 r/w\r
+ unsigned char cart1; // 0xFCB3 cart1 r/w\r
+ unsigned char unused8[8]; // 0xFCB4 - 0xFCBF unused\r
+ unsigned char leds; // 0xFCC0 leds\r
+ unsigned char unused9; // 0xFCC1 unused\r
+ unsigned char parstat; // 0xFCC2 parallel port status\r
+ unsigned char pardata; // 0xFCC3 parallel port data\r
+ unsigned char howie; // 0xFCC4 howie (?)\r
+ // 0xFCC5 - 0xFCFF unused\r
+};\r
+\r
+\r
+#endif\r
#define COLOR_WHITE 0x0F
/* TGI color defines (default palette) */
-#define TGI_COLOR_BLACK COLOR_BLACK
-#define TGI_COLOR_RED COLOR_RED
-#define TGI_COLOR_BLUE COLOR_BLUE
-#define TGI_COLOR_GREEN COLOR_GREEN
-#define TGI_COLOR_VIOLET COLOR_VIOLET
-#define TGI_COLOR_PURPLE COLOR_PURPLE
-#define TGI_COLOR_CYAN COLOR_CYAN
-#define TGI_COLOR_PEAGREEN COLOR_PEAGREEN
-#define TGI_COLOR_GREY COLOR_GREY
-#define TGI_COLOR_NAVYBLUE COLOR_NAVYBLUE
-#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED
-#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
-#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
+#define TGI_COLOR_BLACK COLOR_BLACK
+#define TGI_COLOR_RED COLOR_RED
+#define TGI_COLOR_BLUE COLOR_BLUE
+#define TGI_COLOR_GREEN COLOR_GREEN
+#define TGI_COLOR_VIOLET COLOR_VIOLET
+#define TGI_COLOR_PURPLE COLOR_PURPLE
+#define TGI_COLOR_CYAN COLOR_CYAN
+#define TGI_COLOR_PEAGREEN COLOR_PEAGREEN
+#define TGI_COLOR_GREY COLOR_GREY
+#define TGI_COLOR_NAVYBLUE COLOR_NAVYBLUE
+#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED
+#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
+#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
#define TGI_COLOR_LIGHTPURPLE COLOR_LIGHTPURPLE
-#define TGI_COLOR_LIGHTCYAN COLOR_LIGHTCYAN
-#define TGI_COLOR_YELLOW COLOR_YELLOW
-#define TGI_COLOR_WHITE COLOR_WHITE
+#define TGI_COLOR_LIGHTCYAN COLOR_LIGHTCYAN
+#define TGI_COLOR_YELLOW COLOR_YELLOW
+#define TGI_COLOR_WHITE COLOR_WHITE
+
+
#define SPRCOLL_dont_collide 0x20
#define SPRCOLL_number_0_3 0x00
+
+/* Define Hardware */
+#include <_mikey.h>
+#define MIKEY (*(struct __mikey *)0xFD00)
+
+#define _MIKEY_TIMERS (*(struct _mikey_all_timers *) 0xFD00) // mikey_timers[8]
+#define _HBL_TIMER (*(struct _mikey_timer *) 0xFD00) // timer0 (HBL)
+#define _VBL_TIMER (*(struct _mikey_timer *) 0xFD08) // timer2 (VBL)
+#define _UART_TIMER (*(struct _mikey_timer *) 0xFD14) // timer4 (UART)
+#define _VIDDMA (*(unsigned int *) 0xFD92) // dispctl/viddma
+
+#include <_suzy.h>
+#define SUZY (*(struct __suzy*)0xFC00)
+
+
/* End of lynx.h */
#endif