1 /*****************************************************************************/
5 /* Atari system specific definitions */
9 /* (C) 2000 Mark Keates <markk@dendrite.co.uk> */
10 /* Freddy Offenga <taf_offenga@yahoo.com> */
11 /* Christian Groessler <cpg@aladdin.de> */
14 /* This software is provided 'as-is', without any expressed or implied */
15 /* warranty. In no event will the authors be held liable for any damages */
16 /* arising from the use of this software. */
18 /* Permission is granted to anyone to use this software for any purpose, */
19 /* including commercial applications, and to alter it and redistribute it */
20 /* freely, subject to the following restrictions: */
22 /* 1. The origin of this software must not be misrepresented; you must not */
23 /* claim that you wrote the original software. If you use this software */
24 /* in a product, an acknowledgment in the product documentation would be */
25 /* appreciated but is not required. */
26 /* 2. Altered source versions must be plainly marked as such, and must not */
27 /* be misrepresented as being the original software. */
28 /* 3. This notice may not be removed or altered from any source */
31 /*****************************************************************************/
40 /* Check for errors */
41 #if !defined(__ATARI__)
42 # error This module may only be used when compiling for the Atari!
48 #define CH_DELCHR 0xFE /* delete char under the cursor */
51 #define CH_CURS_DOWN 29
52 #define CH_CURS_LEFT 30
53 #define CH_CURS_RIGHT 31
55 #define CH_TAB 0x7F /* tabulator */
56 #define CH_EOL 0x9B /* end-of-line marker */
57 #define CH_CLR 0x7D /* clear screen */
58 #define CH_BEL 0xFD /* bell */
59 #define CH_DEL 0x7E /* back space (delete char to the left) */
60 #define CH_RUBOUT 0x7E /* back space (old, deprecated) */
61 #define CH_DELLINE 0x9C /* delete line */
62 #define CH_INSLINE 0x9D /* insert line */
64 /* These are defined to be Atari + NumberKey */
76 #define CH_ULCORNER 0x11
77 #define CH_URCORNER 0x05
78 #define CH_LLCORNER 0x1A
79 #define CH_LRCORNER 0x03
90 /* make GTIA color value */
91 #define _gtia_mkcolor(hue,lum) (((hue) << 4) | ((lum) << 1))
93 /* luminance values go from 0 (black) to 7 (white) */
98 #define HUE_GOLDORANGE 2
99 #define HUE_REDORANGE 3
101 #define HUE_MAGENTA 5
106 #define HUE_BLUEGREEN 10
107 #define HUE_BLUEGREEN2 11
109 #define HUE_YELLOWGREEN 13
110 #define HUE_YELLOW 14
111 #define HUE_YELLOWRED 15
113 /* Color defines, similar to c64 colors (untested) */
114 /* Note that the conio color implementation is monochrome (bgcolor and textcolor are only placeholders) */
115 /* Use the defines with the setcolor() or _atari_xxxcolor() functions */
116 #define COLOR_BLACK _gtia_mkcolor(HUE_GREY,0)
117 #define COLOR_WHITE _gtia_mkcolor(HUE_GREY,7)
118 #define COLOR_RED _gtia_mkcolor(HUE_REDORANGE,1)
119 #define COLOR_CYAN _gtia_mkcolor(HUE_CYAN,3)
120 #define COLOR_VIOLET _gtia_mkcolor(HUE_PURPLE,4)
121 #define COLOR_GREEN _gtia_mkcolor(HUE_GREEN,2)
122 #define COLOR_BLUE _gtia_mkcolor(HUE_BLUE,2)
123 #define COLOR_YELLOW _gtia_mkcolor(HUE_YELLOW,7)
124 #define COLOR_ORANGE _gtia_mkcolor(HUE_ORANGE,5)
125 #define COLOR_BROWN _gtia_mkcolor(HUE_YELLOW,2)
126 #define COLOR_LIGHTRED _gtia_mkcolor(HUE_REDORANGE,6)
127 #define COLOR_GRAY1 _gtia_mkcolor(HUE_GREY,2)
128 #define COLOR_GRAY2 _gtia_mkcolor(HUE_GREY,3)
129 #define COLOR_LIGHTGREEN _gtia_mkcolor(HUE_GREEN,6)
130 #define COLOR_LIGHTBLUE _gtia_mkcolor(HUE_BLUE,6)
131 #define COLOR_GRAY3 _gtia_mkcolor(HUE_GREY,5)
133 /* color register functions */
134 extern void __fastcall__ setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminace);
135 extern void __fastcall__ setcolor_low (unsigned char color_reg, unsigned char color_value);
136 extern unsigned char __fastcall__ getcolor (unsigned char color_reg);
138 /* function similar to conio color functions; please note that _atari_textcolor only sets the */
139 /* luminance of the text in standard text mode */
140 extern unsigned char __fastcall__ _atari_textcolor (unsigned char color);
141 extern unsigned char __fastcall__ _atari_bgcolor (unsigned char color);
142 extern unsigned char __fastcall__ _atari_bordercolor (unsigned char color);
144 /* other screen functions */
145 extern int __fastcall__ graphics(unsigned char mode); /* mode value same as in BASIC */
146 extern void __fastcall__ scroll (signed char numlines);
147 /* numlines > 0 scrolls up */
148 /* numlines < 0 scrolls down */
150 /* misc. functions */
151 extern void save_vecs(void); /* save system vectors */
152 extern void rest_vecs(void); /* restore system vectors */
153 extern unsigned char get_ostype(void); /* get ROM version */
154 extern unsigned char get_tv(void); /* get TV system */
156 /* get_ostype return value defines (for explanation, see ostype.s) */
158 #define AT_OS_TYPE_MAIN 7
159 #define AT_OS_TYPE_MINOR (7 << 3)
160 /* AT_OS_TYPE_MAIN values */
161 #define AT_OS_UNKNOWN 0
162 #define AT_OS_400800 1
163 #define AT_OS_1200XL 2
165 /* AS_OS_TYPE_MINOR values */
166 /* for 400/800 remember this are the ROM versions */
167 /* to check whether the hw is PAL or NTSC, use get_tv() */
168 #define AT_OS_400800PAL_A 1
169 #define AT_OS_400800PAL_B 2
170 #define AT_OS_400800NTSC_A 1
171 #define AT_OS_400800NTSC_B 2
172 #define AT_OS_1200_10 1
173 #define AT_OS_1200_11 2
174 #define AT_OS_XLXE_1 1
175 #define AT_OS_XLXE_2 2
176 #define AT_OS_XLXE_3 3
177 #define AT_OS_XLXE_4 4
179 /* get_tv return values */
183 /* Define hardware */
185 #define GTIA_READ (*(struct __gtia_read*)0xD000)
186 #define GTIA_WRITE (*(struct __gtia_write*)0xD000)
191 #define POKEY_READ (*(struct __pokey_read*)0xD200)
192 #define POKEY_WRITE (*(struct __pokey_write*)0xD200)
195 #define PIA (*(struct __pia*)0xD300)
198 #define ANTIC (*(struct __antic*)0xD400)
200 /* device control block */
202 unsigned char device; /* device id */
203 unsigned char unit; /* unit number */
204 unsigned char command; /* command */
205 unsigned char status; /* command type / status return */
206 void *buffer; /* pointer to buffer */
207 unsigned char timeout; /* device timeout in seconds */
208 unsigned char unused;
209 unsigned int xfersize; /* # of bytes to transfer */
210 unsigned char aux1; /* 1st command auxiliary byte */
211 unsigned char aux2; /* 2nd command auxiliary byte */
213 #define DCB (*(struct __dcb *)0x300)
216 #endif /* #ifndef _ATARI_H */