]> git.sur5r.net Git - cc65/blob - include/atari.h
changed get_ostype defines for new return parameters; added get_tv
[cc65] / include / atari.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 atari.h                                   */
4 /*                                                                           */
5 /*                      Atari system specific definitions                    */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2000 Mark Keates <markk@dendrite.co.uk>                               */
10 /*          Freddy Offenga <taf_offenga@yahoo.com>                           */
11 /*          Christian Groessler <cpg@aladdin.de>                             */
12 /*                                                                           */
13 /*                                                                           */
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.                                    */
17 /*                                                                           */
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:                            */
21 /*                                                                           */
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              */
29 /*    distribution.                                                          */
30 /*                                                                           */
31 /*****************************************************************************/
32
33 #ifndef _ATARI_H
34 #define _ATARI_H
35
36 /* Character codes */
37 #define CH_DEL          0xFE
38 #define CH_ESC          0x1B
39 #define CH_CURS_UP      28
40 #define CH_CURS_DOWN    29
41 #define CH_CURS_LEFT    30
42 #define CH_CURS_RIGHT   31
43
44 #define CH_TAB          0x7F   /* tabulator */
45 #define CH_EOL          0x9B   /* end-of-line marker */
46 #define CH_CLR          0x7D   /* clear screen */
47 #define CH_BEL          0xFD   /* bell */
48 #define CH_RUBOUT       0x7E   /* back space (rubout) */
49 #define CH_DELLINE      0x9C   /* delete line */
50 #define CH_INSLINE      0x9D   /* insert line */
51
52 /* These are defined to be Atari + NumberKey */
53 #define CH_F1           177
54 #define CH_F2           178
55 #define CH_F3           179
56 #define CH_F4           180
57 #define CH_F5           181
58 #define CH_F6           182
59 #define CH_F7           183
60 #define CH_F8           184
61 #define CH_F9           185
62 #define CH_F10          176
63
64 #define CH_ULCORNER     0x11
65 #define CH_URCORNER     0x05
66 #define CH_LLCORNER     0x1A
67 #define CH_LRCORNER     0x03
68 #define CH_TTEE         0x17
69 #define CH_BTEE         0x18
70 #define CH_LTEE         0x01
71 #define CH_RTEE         0x04
72 #define CH_CROSS        0x19
73 #define CH_HLINE        0x12
74 #define CH_VLINE        0x16
75
76 /* color defines */
77
78 /* make GTIA color value */
79 #define _gtia_mkcolor(hue,lum) (((hue) << 4) | ((lum) << 1))
80
81 /* luminance values go from 0 (black) to 7 (white) */
82
83 /* hue values */
84 #define HUE_GREY        0
85 #define HUE_GOLD        1
86 #define HUE_GOLDORANGE  2
87 #define HUE_REDORANGE   3
88 #define HUE_ORANGE      4
89 #define HUE_MAGENTA     5
90 #define HUE_PURPLE      6
91 #define HUE_BLUE        7
92 #define HUE_BLUE2       8
93 #define HUE_CYAN        9
94 #define HUE_BLUEGREEN   10
95 #define HUE_BLUEGREEN2  11
96 #define HUE_GREEN       12
97 #define HUE_YELLOWGREEN 13
98 #define HUE_YELLOW      14
99 #define HUE_YELLOWRED   15
100
101 /* Color defines, similar to c64 colors (untested) */
102 #define COLOR_BLACK             _gtia_mkcolor(HUE_GREY,0)
103 #define COLOR_WHITE             _gtia_mkcolor(HUE_GREY,7)
104 #define COLOR_RED               _gtia_mkcolor(HUE_REDORANGE,1)
105 #define COLOR_CYAN              _gtia_mkcolor(HUE_CYAN,3)
106 #define COLOR_VIOLET            _gtia_mkcolor(HUE_PURPLE,4)
107 #define COLOR_GREEN             _gtia_mkcolor(HUE_GREEN,2)
108 #define COLOR_BLUE              _gtia_mkcolor(HUE_BLUE,2)
109 #define COLOR_YELLOW            _gtia_mkcolor(HUE_YELLOW,7)
110 #define COLOR_ORANGE            _gtia_mkcolor(HUE_ORANGE,5)
111 #define COLOR_BROWN             _gtia_mkcolor(HUE_YELLOW,2)
112 #define COLOR_LIGHTRED          _gtia_mkcolor(HUE_REDORANGE,6)
113 #define COLOR_GRAY1             _gtia_mkcolor(HUE_GREY,2)
114 #define COLOR_GRAY2             _gtia_mkcolor(HUE_GREY,3)
115 #define COLOR_LIGHTGREEN        _gtia_mkcolor(HUE_GREEN,6)
116 #define COLOR_LIGHTBLUE         _gtia_mkcolor(HUE_BLUE,6)
117 #define COLOR_GRAY3             _gtia_mkcolor(HUE_GREY,5)
118
119 /* color register functions */
120 extern void __fastcall__ setcolor     (unsigned char color_reg, unsigned char hue, unsigned char luminace);
121 extern void __fastcall__ setcolor_low (unsigned char color_reg, unsigned char color_value);
122 extern unsigned char __fastcall__ getcolor (unsigned char color_reg);
123
124 /* other screen functions */
125 extern void __fastcall__ scroll (signed char numlines);
126                                           /* numlines > 0  scrolls up */
127                                           /* numlines < 0  scrolls down */
128
129 /* misc. functions */
130 extern void save_vecs(void);           /* save system vectors */
131 extern void rest_vecs(void);           /* restore system vectors */
132 extern unsigned char get_ostype(void); /* get ROM version */
133 extern unsigned char get_tv(void);     /* get TV system */
134
135 /* get_ostype return value defines (for explanation, see ostype.s) */
136 /* masks */
137 #define AT_OS_TYPE_MAIN  7
138 #define AT_OS_TYPE_MINOR (7 << 3)
139 /* AT_OS_TYPE_MAIN values */
140 #define AT_OS_UNKNOWN  0
141 #define AT_OS_400800   1
142 #define AT_OS_1200XL   2
143 #define AT_OS_XLXE     3
144 /* AS_OS_TYPE_MINOR values */
145 /* for 400/800 remember this are the ROM versions */
146 /* to check whether the hw is PAL or NTSC, use get_tv() */
147 #define AT_OS_400800PAL_A  1
148 #define AT_OS_400800PAL_B  2
149 #define AT_OS_400800NTSC_A 1
150 #define AT_OS_400800NTSC_B 2
151 #define AT_OS_1200_10  1
152 #define AT_OS_1200_11  2
153 #define AT_OS_XLXE_1   1
154 #define AT_OS_XLXE_2   2
155 #define AT_OS_XLXE_3   3
156 #define AT_OS_XLXE_4   4
157
158 /* get_tv return values */
159 #define AT_NTSC     0
160 #define AT_PAL      1
161
162 /* Define hardware */
163 #include <_gtia.h>
164 #define GTIA_READ  (*(struct __gtia_read*)0xD000)
165 #define GTIA_WRITE (*(struct __gtia_write*)0xD000)
166
167 #include <_pbi.h>
168
169 #include <_pokey.h>
170 #define POKEY_READ  (*(struct __pokey_read*)0xD200)
171 #define POKEY_WRITE (*(struct __pokey_write*)0xD200)
172
173 #include <_pia.h>
174 #define PIA (*(struct __pia*)0xD300)
175
176 #include <_antic.h>
177 #define ANTIC (*(struct __antic*)0xD400)
178
179 /* device control block */
180 struct __dcb {
181     unsigned char device;     /* device id */
182     unsigned char unit;       /* unix number */
183     unsigned char command;    /* command */
184     unsigned char status;     /* command type / status return */
185     void          *buffer;    /* pointer to buffer */
186     unsigned char timeout;    /* device timeout in seconds */
187     unsigned char unused;
188     unsigned int  xfersize;   /* # of bytes to transfer */
189     unsigned char aux1;       /* 1st command auxiliary byte */
190     unsigned char aux2;       /* 2nd command auxiliary byte */
191 };
192 #define DCB (*(struct __dcb *)0x300)
193
194 /* End of atari.h */
195 #endif /* #ifndef _ATARI_H */