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 /*****************************************************************************/
109 /* Accessing the cart */
110 /*****************************************************************************/
114 void __fastcall__ lynx_load (int fileno);
115 /* Load a file into ram. The first entry is fileno=0. */
117 void __fastcall__ lynx_exec (int fileno);
118 /* Load a file into ram and execute it. */
122 /*****************************************************************************/
123 /* Accessing the EEPROM */
124 /*****************************************************************************/
128 unsigned __fastcall__ lynx_eeprom_read (unsigned char cell);
129 /* Read a 16 bit word from the given address */
131 unsigned __fastcall__ lynx_eeprom_write (unsigned char cell, unsigned val);
132 /* Write the word at the given address */
134 void __fastcall__ lynx_eeprom_erase (unsigned char cell);
135 /* Clear the word at the given address */
137 unsigned __fastcall__ lynx_eeread (unsigned cell);
138 /* Read a 16 bit word from the given address 93C46 93C66 or 93C86*/
140 unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val);
141 /* Write the word at the given address 93C46 93C66 or 93C86*/
145 /*****************************************************************************/
147 /*****************************************************************************/
151 #define tgi_sprite(spr) tgi_ioctl(0, spr)
152 #define tgi_flip() tgi_ioctl(1, (void*)0)
153 #define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
154 #define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
155 #define tgi_busy() tgi_ioctl(4, (void*)0)
156 #define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
157 #define tgi_setcollisiondetection(active) tgi_ioctl(5, (void*)(active))
159 /* Define Hardware */
161 #define MIKEY (*(struct __mikey *)0xFD00)
163 #define _MIKEY_TIMERS (*(struct _mikey_all_timers *) 0xFD00) // mikey_timers[8]
164 #define _HBL_TIMER (*(struct _mikey_timer *) 0xFD00) // timer0 (HBL)
165 #define _VBL_TIMER (*(struct _mikey_timer *) 0xFD08) // timer2 (VBL)
166 #define _UART_TIMER (*(struct _mikey_timer *) 0xFD14) // timer4 (UART)
167 #define _VIDDMA (*(unsigned int *) 0xFD92) // dispctl/viddma
170 #define SUZY (*(struct __suzy*)0xFC00)