]> git.sur5r.net Git - cc65/blob - include/apple2.h
atari5200: fix COLOR defines' names
[cc65] / include / apple2.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 apple2.h                                  */
4 /*                                                                           */
5 /*                   Apple ][ system specific definitions                    */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2000  Kevin Ruland, <kevin@rodin.wustl.edu>                           */
10 /* (C) 2003  Ullrich von Bassewitz, <uz@cc65.org>                            */
11 /*                                                                           */
12 /*                                                                           */
13 /* This software is provided 'as-is', without any expressed or implied       */
14 /* warranty.  In no event will the authors be held liable for any damages    */
15 /* arising from the use of this software.                                    */
16 /*                                                                           */
17 /* Permission is granted to anyone to use this software for any purpose,     */
18 /* including commercial applications, and to alter it and redistribute it    */
19 /* freely, subject to the following restrictions:                            */
20 /*                                                                           */
21 /* 1. The origin of this software must not be misrepresented; you must not   */
22 /*    claim that you wrote the original software. If you use this software   */
23 /*    in a product, an acknowledgment in the product documentation would be  */
24 /*    appreciated but is not required.                                       */
25 /* 2. Altered source versions must be plainly marked as such, and must not   */
26 /*    be misrepresented as being the original software.                      */
27 /* 3. This notice may not be removed or altered from any source              */
28 /*    distribution.                                                          */
29 /*                                                                           */
30 /*****************************************************************************/
31
32
33
34 #ifndef _APPLE2_H
35 #define _APPLE2_H
36
37
38
39 /* Check for errors */
40 #if !defined(__APPLE2__)
41 #  error This module may only be used when compiling for the Apple ][!
42 #endif
43
44 #include <apple2_filetype.h>
45
46
47
48 /*****************************************************************************/
49 /*                                   Data                                    */
50 /*****************************************************************************/
51
52
53
54 /* Color defines */
55 #define COLOR_BLACK     0x00
56 #define COLOR_WHITE     0x01
57
58 /* TGI color defines */
59 #define TGI_COLOR_BLACK         0x00
60 #define TGI_COLOR_GREEN         0x01
61 #define TGI_COLOR_VIOLET        0x02
62 #define TGI_COLOR_WHITE         0x03
63 #define TGI_COLOR_BLACK2        0x04
64 #define TGI_COLOR_ORANGE        0x05
65 #define TGI_COLOR_BLUE          0x06
66 #define TGI_COLOR_WHITE2        0x07
67
68 #define TGI_COLOR_MAGENTA       TGI_COLOR_BLACK2
69 #define TGI_COLOR_DARKBLUE      TGI_COLOR_WHITE2
70 #define TGI_COLOR_DARKGREEN     0x08
71 #define TGI_COLOR_GRAY          0x09
72 #define TGI_COLOR_CYAN          0x0A
73 #define TGI_COLOR_BROWN         0x0B
74 #define TGI_COLOR_GRAY2         0x0C
75 #define TGI_COLOR_PINK          0x0D
76 #define TGI_COLOR_YELLOW        0x0E
77 #define TGI_COLOR_AQUA          0x0F
78
79 /* Characters codes */
80 #define CH_ENTER        0x0D
81 #define CH_ESC          0x1B
82 #define CH_CURS_LEFT    0x08
83 #define CH_CURS_RIGHT   0x15
84
85 #if !defined(__APPLE2ENH__)
86 #define CH_HLINE        '-'
87 #define CH_VLINE        '!'
88 #define CH_ULCORNER     '+'
89 #define CH_URCORNER     '+'
90 #define CH_LLCORNER     '+'
91 #define CH_LRCORNER     '+'
92 #define CH_TTEE         '+'
93 #define CH_BTEE         '+'
94 #define CH_LTEE         '+'
95 #define CH_RTEE         '+'
96 #define CH_CROSS        '+'
97 #endif
98
99 /* Masks for joy_read */
100 #define JOY_UP_MASK     0x10
101 #define JOY_DOWN_MASK   0x20
102 #define JOY_LEFT_MASK   0x04
103 #define JOY_RIGHT_MASK  0x08
104 #define JOY_BTN_1_MASK  0x40
105 #define JOY_BTN_2_MASK  0x80
106
107 /* Return codes for get_ostype */
108 #define APPLE_UNKNOWN   0x00
109 #define APPLE_II        0x10  /* Apple ][                    */
110 #define APPLE_IIPLUS    0x11  /* Apple ][+                   */
111 #define APPLE_IIIEM     0x20  /* Apple /// (emulation)       */
112 #define APPLE_IIE       0x30  /* Apple //e                   */
113 #define APPLE_IIEENH    0x31  /* Apple //e (enhanced)        */
114 #define APPLE_IIECARD   0x40  /* Apple //e Option Card       */
115 #define APPLE_IIC       0x50  /* Apple //c                   */
116 #define APPLE_IIC35     0x51  /* Apple //c (3.5 ROM)         */
117 #define APPLE_IICEXP    0x53  /* Apple //c (Mem. Exp.)       */
118 #define APPLE_IICREV    0x54  /* Apple //c (Rev. Mem. Exp.)  */
119 #define APPLE_IICPLUS   0x55  /* Apple //c Plus              */
120 #define APPLE_IIGS      0x80  /* Apple IIgs                  */
121 #define APPLE_IIGS1     0x81  /* Apple IIgs (ROM 1)          */
122 #define APPLE_IIGS3     0x83  /* Apple IIgs (ROM 3)          */
123
124 extern unsigned char _dos_type;
125 /* Valid _dos_type values:
126 **
127 ** AppleDOS 3.3   - 0x00
128 ** ProDOS 8 1.0.1 - 0x10
129 ** ProDOS 8 1.0.2 - 0x10
130 ** ProDOS 8 1.1.1 - 0x11
131 ** ProDOS 8 1.2   - 0x12
132 ** ProDOS 8 1.3   - 0x13
133 ** ProDOS 8 1.4   - 0x14
134 ** ProDOS 8 1.5   - 0x15
135 ** ProDOS 8 1.6   - 0x16
136 ** ProDOS 8 1.7   - 0x17
137 ** ProDOS 8 1.8   - 0x18
138 ** ProDOS 8 1.9   - 0x18 (!)
139 ** ProDOS 8 2.0.1 - 0x21
140 ** ProDOS 8 2.0.2 - 0x22
141 ** ProDOS 8 2.0.3 - 0x23
142 ** ProDOS 8 2.4.x - 0x24
143 */
144
145
146
147 /*****************************************************************************/
148 /*                                 Variables                                 */
149 /*****************************************************************************/
150
151
152
153 /* The file stream implementation and the POSIX I/O functions will use the
154 ** following struct to set the date and time stamp on files. This specificially
155 ** applies to the open and fopen functions.
156 */
157 extern struct {
158     struct {
159         unsigned day  :5;
160         unsigned mon  :4;
161         unsigned year :7;
162     }             createdate;    /* Current date: 0 */ 
163     struct {
164         unsigned char min;
165         unsigned char hour;
166     }             createtime;    /* Current time: 0 */ 
167 } _datetime;
168
169 /* The addresses of the static drivers */
170 #if !defined(__APPLE2ENH__)
171 extern void a2_auxmem_emd[];
172 extern void a2_stdjoy_joy[];     /* Referred to by joy_static_stddrv[]   */
173 extern void a2_stdmou_mou[];     /* Referred to by mouse_static_stddrv[] */
174 extern void a2_ssc_ser[];
175 extern void a2_hi_tgi[];         /* Referred to by tgi_static_stddrv[]   */
176 extern void a2_lo_tgi[];
177 #endif
178
179
180
181 /*****************************************************************************/
182 /*                                   Code                                    */
183 /*****************************************************************************/
184
185
186
187 unsigned char get_ostype (void);
188 /* Get the machine type. Returns one of the APPLE_xxx codes. */
189
190 void rebootafterexit (void);
191 /* Reboot machine after program termination has completed. */
192
193 #define ser_apple2_slot(num)  ser_ioctl (0, (void*) (num))
194 /* Select a slot number from 1 to 7 prior to ser_open.
195 ** The default slot number is 2.
196 */
197
198 #define tgi_apple2_mix(onoff)  tgi_ioctl (0, (void*) (onoff))
199 /* If onoff is 1, graphics/text mixed mode is enabled.
200 ** If onoff is 0, graphics/text mixed mode is disabled.
201 */
202
203 /* The following #defines will cause the matching functions calls in conio.h
204 ** to be overlaid by macros with the same names, saving the function call
205 ** overhead.
206 */
207 #define _textcolor(color)       COLOR_WHITE
208 #define _bgcolor(color)         COLOR_BLACK
209 #define _bordercolor(color)     COLOR_BLACK
210
211
212
213 /* End of apple2.h */
214 #endif