1 /*****************************************************************************/
5 /* Lynx system specific definitions */
9 /* (C) 2003 Shawn Jefferson */
11 /* Adapted with many changes Ullrich von Bassewitz, 2004-10-09 */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
41 /* Check for errors */
42 #if !defined(__LYNX__)
43 # error This module may only be used when compiling for the Lynx game console!
48 /*****************************************************************************/
50 /*****************************************************************************/
55 #define COLOR_BLACK 0x00
56 #define COLOR_RED 0x01
57 #define COLOR_PINK 0x02
58 #define COLOR_LIGHTGREY 0x03
59 #define COLOR_GREY 0x04
60 #define COLOR_DARKGREY 0x05
61 #define COLOR_BROWN 0x06
62 #define COLOR_PEACH 0x07
63 #define COLOR_YELLOW 0x08
64 #define COLOR_LIGHTGREEN 0x09
65 #define COLOR_GREEN 0x0A
66 #define COLOR_DARKBROWN 0x0B
67 #define COLOR_VIOLET 0x0C
68 #define COLOR_BLUE 0x0D
69 #define COLOR_LIGHTBLUE 0x0E
70 #define COLOR_WHITE 0x0F
72 /* TGI color defines (default palette) */
73 #define TGI_COLOR_BLACK COLOR_BLACK
74 #define TGI_COLOR_RED COLOR_RED
75 #define TGI_COLOR_PINK COLOR_PINK
76 #define TGI_COLOR_LIGHTGREY COLOR_LIGHTGREY
77 #define TGI_COLOR_GREY COLOR_GREY
78 #define TGI_COLOR_DARKGREY COLOR_DARKGREY
79 #define TGI_COLOR_BROWN COLOR_BROWN
80 #define TGI_COLOR_PEACH COLOR_PEACH
81 #define TGI_COLOR_YELLOW COLOR_YELLOW
82 #define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
83 #define TGI_COLOR_GREEN COLOR_GREEN
84 #define TGI_COLOR_DARKBROWN COLOR_DARKBROWN
85 #define TGI_COLOR_VIOLET COLOR_VIOLET
86 #define TGI_COLOR_BLUE COLOR_BLUE
87 #define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
88 #define TGI_COLOR_WHITE COLOR_WHITE
90 /* No support for dynamically loadable drivers */
95 /*****************************************************************************/
97 /*****************************************************************************/
101 /* The addresses of the static drivers */
102 extern void lynx_stdjoy[]; /* Referred to by joy_static_stddrv[] */
103 extern void lynx_comlynx[];
104 extern void lynx_160_102_16[]; /* Referred to by tgi_static_stddrv[] */
108 /*****************************************************************************/
110 /*****************************************************************************/
112 void lynx_snd_init ();
113 /* Initialize the sound driver */
115 void lynx_snd_pause ();
118 void lynx_snd_continue ();
119 /* Continue sound after pause */
121 void __fastcall__ lynx_snd_play (unsigned char channel, unsigned char *music);
122 /* Play tune on channel */
124 void lynx_snd_stop ();
125 /* Stop sound on all channels */
127 unsigned char lynx_snd_active();
128 /* Show which channels are active */
130 /*****************************************************************************/
131 /* Accessing the cart */
132 /*****************************************************************************/
136 void __fastcall__ lynx_load (int fileno);
137 /* Load a file into ram. The first entry is fileno=0. */
139 void __fastcall__ lynx_exec (int fileno);
140 /* Load a file into ram and execute it. */
144 /*****************************************************************************/
145 /* Accessing the EEPROM */
146 /*****************************************************************************/
150 unsigned __fastcall__ lynx_eeprom_read (unsigned char cell);
151 /* Read a 16 bit word from the given address */
153 unsigned __fastcall__ lynx_eeprom_write (unsigned char cell, unsigned val);
154 /* Write the word at the given address */
156 void __fastcall__ lynx_eeprom_erase (unsigned char cell);
157 /* Clear the word at the given address */
159 unsigned __fastcall__ lynx_eeread (unsigned cell);
160 /* Read a 16 bit word from the given address 93C46 93C66 or 93C86*/
162 unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val);
163 /* Write the word at the given address 93C46 93C66 or 93C86*/
167 /*****************************************************************************/
169 /*****************************************************************************/
173 #define tgi_sprite(spr) tgi_ioctl(0, spr)
174 #define tgi_flip() tgi_ioctl(1, (void*)0)
175 #define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
176 #define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
177 #define tgi_busy() tgi_ioctl(4, (void*)0)
178 #define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
179 #define tgi_setcollisiondetection(active) tgi_ioctl(5, (void*)(active))
181 /* Define Hardware */
183 #define MIKEY (*(struct __mikey *)0xFD00)
185 #define _MIKEY_TIMERS (*(struct _mikey_all_timers *) 0xFD00) // mikey_timers[8]
186 #define _HBL_TIMER (*(struct _mikey_timer *) 0xFD00) // timer0 (HBL)
187 #define _VBL_TIMER (*(struct _mikey_timer *) 0xFD08) // timer2 (VBL)
188 #define _UART_TIMER (*(struct _mikey_timer *) 0xFD14) // timer4 (UART)
189 #define _VIDDMA (*(unsigned int *) 0xFD92) // dispctl/viddma
192 #define SUZY (*(struct __suzy*)0xFC00)