]> git.sur5r.net Git - cc65/blob - include/lynx.h
4928ec1c76a664fa54a3e466df02f582e8792b09
[cc65] / include / lynx.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                  lynx.h                                   */
4 /*                                                                           */
5 /*                     Lynx system specific definitions                      */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2003      Shawn Jefferson                                             */
10 /*                                                                           */
11 /* Adapted with many changes Ullrich von Bassewitz, 2004-10-09               */
12 /*                                                                           */
13 /*                                                                           */
14 /*                                                                           */
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.                                    */
18 /*                                                                           */
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:                            */
22 /*                                                                           */
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              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef _LYNX_H
37 #define _LYNX_H
38
39
40
41 /* Check for errors */
42 #if !defined(__LYNX__)
43 #  error This module may only be used when compiling for the Lynx game console!
44 #endif
45
46
47
48 /*****************************************************************************/
49 /*                                   Data                                    */
50 /*****************************************************************************/
51
52
53
54 /* Color defines */
55 #define COLOR_BLACK             0x00
56 #define COLOR_RED               0x01
57 #define COLOR_BLUE              0x02
58 #define COLOR_GREEN             0x03
59 #define COLOR_VIOLET            0x04
60 #define COLOR_PURPLE            COLOR_VIOLET
61 #define COLOR_CYAN              0x05
62 #define COLOR_PEAGREEN          0x06
63 #define COLOR_GREY              0x07
64 #define COLOR_NAVYBLUE          0x08
65 #define COLOR_LIGHTRED          0x09
66 #define COLOR_LIGHTBLUE         0x0A
67 #define COLOR_LIGHTGREEN        0x0B
68 #define COLOR_LIGHTPURPLE       0x0C
69 #define COLOR_LIGHTCYAN         0x0D
70 #define COLOR_YELLOW            0x0E
71 #define COLOR_WHITE             0x0F
72
73 /* TGI color defines (default palette) */
74 #define TGI_COLOR_BLACK         COLOR_BLACK
75 #define TGI_COLOR_RED           COLOR_RED
76 #define TGI_COLOR_BLUE          COLOR_BLUE
77 #define TGI_COLOR_GREEN         COLOR_GREEN
78 #define TGI_COLOR_VIOLET        COLOR_VIOLET
79 #define TGI_COLOR_PURPLE        COLOR_PURPLE
80 #define TGI_COLOR_CYAN          COLOR_CYAN
81 #define TGI_COLOR_PEAGREEN      COLOR_PEAGREEN
82 #define TGI_COLOR_GREY          COLOR_GREY
83 #define TGI_COLOR_NAVYBLUE      COLOR_NAVYBLUE
84 #define TGI_COLOR_LIGHTRED      COLOR_LIGHTRED
85 #define TGI_COLOR_LIGHTBLUE     COLOR_LIGHTBLUE
86 #define TGI_COLOR_LIGHTGREEN    COLOR_LIGHTGREEN
87 #define TGI_COLOR_LIGHTPURPLE   COLOR_LIGHTPURPLE
88 #define TGI_COLOR_LIGHTCYAN     COLOR_LIGHTCYAN
89 #define TGI_COLOR_YELLOW        COLOR_YELLOW
90 #define TGI_COLOR_WHITE         COLOR_WHITE
91
92
93
94
95
96 /*****************************************************************************/
97 /*                           Accessing the cart                              */
98 /*****************************************************************************/
99
100
101
102 void __fastcall__ lynx_load (int fileno);
103 /* Load a file into ram. The first entry is fileno=0. */
104
105 void __fastcall__ lynx_exec (int fileno);
106 /* Load a file into ram and execute it. */
107
108
109
110 /*****************************************************************************/
111 /*                           Accessing the EEPROM                            */
112 /*****************************************************************************/
113
114
115
116 unsigned __fastcall__ lynx_eeprom_read (unsigned char cell);
117 /* Read a 16 bit word from the given address */
118
119 unsigned __fastcall__ lynx_eeprom_write (unsigned char cell, unsigned val);
120 /* Write the word at the given address */
121
122 void __fastcall__ lynx_eeprom_erase (unsigned char cell);
123 /* Clear the word at the given address */
124
125 unsigned __fastcall__ lynx_eeread (unsigned cell);
126 /* Read a 16 bit word from the given address 93C46 93C66 or 93C86*/
127
128 unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val);
129 /* Write the word at the given address 93C46 93C66 or 93C86*/
130
131
132
133 /*****************************************************************************/
134 /*                           TGI extras                                      */
135 /*****************************************************************************/
136
137
138
139 #define tgi_sprite(spr) tgi_ioctl(0, spr)
140 #define tgi_flip() tgi_ioctl(1, (void*)0)
141 #define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
142 #define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
143 #define tgi_busy() tgi_ioctl(4, (void*)0)
144 #define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
145 #define tgi_setcollisiondetection(active) tgi_ioctl(5, (void*)(active))
146
147
148
149 /*****************************************************************************/
150 /*                           Sprites                                         */
151 /*****************************************************************************/
152
153
154
155 #define SPRCTL0_1_bit_per_pixel 0
156 #define SPRCTL0_2_bits_per_pixel 0x40
157 #define SPRCTL0_3_bits_per_pixel 0x80
158 #define SPRCTL0_4_bits_per_pixel 0xc0
159 #define SPRCTL0_h_flip 0x20
160 #define SPRCTL0_v_flip 0x10
161 #define SPRCTL0_shadow 7
162 #define SPRCTL0_xor_shadow 6
163 #define SPRCTL0_non_collide 5
164 #define SPRCTL0_normal 4
165 #define SPRCTL0_boundary 3
166 #define SPRCTL0_boundary_shadow 2
167 #define SPRCTL0_background_no_coll 1
168 #define SPRCTL0_background_shadow 0
169
170 #define SPRCTL1_literal 0x80
171 #define SPRCTL1_hsize_vsize_strech_tilt 0x30
172 #define SPRCTL1_hsize_vsize_strech 0x20
173 #define SPRCTL1_hsize_vsize 0x10
174 #define SPRCTL1_no_palette 0x08
175 #define SPRCTL1_skip_sprite 0x04
176 #define SPRCTL1_start_drawing_up 0x02
177 #define SPRCTL1_start_drawing_left 0x01
178
179 #define SPRCOLL_dont_collide 0x20
180 #define SPRCOLL_number_0_3 0x00
181
182
183 /* Define Hardware */
184 #include <_mikey.h>
185 #define MIKEY (*(struct __mikey *)0xFD00)
186
187 #define _MIKEY_TIMERS (*(struct _mikey_all_timers *) 0xFD00)    // mikey_timers[8]
188 #define _HBL_TIMER (*(struct _mikey_timer *) 0xFD00)                    // timer0 (HBL)
189 #define _VBL_TIMER (*(struct _mikey_timer *) 0xFD08)                    // timer2 (VBL)
190 #define _UART_TIMER (*(struct _mikey_timer *) 0xFD14)                   // timer4 (UART)
191 #define _VIDDMA (*(unsigned int *) 0xFD92)                                              // dispctl/viddma
192
193 #include <_suzy.h>
194 #define SUZY        (*(struct __suzy*)0xFC00)
195
196
197 /* End of lynx.h */
198 #endif
199
200
201