]> git.sur5r.net Git - cc65/blob - include/apple2.h
Merge pull request #452 from mrdudz/kbrepeat
[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
45 #include <apple2_filetype.h>
46
47 /*****************************************************************************/
48 /*                                   Data                                    */
49 /*****************************************************************************/
50
51
52
53 /* Color defines */
54 #define COLOR_BLACK  0x00
55 #define COLOR_WHITE  0x01
56
57 /* TGI color defines */
58 #define TGI_COLOR_BLACK      0x00
59 #define TGI_COLOR_GREEN      0x01
60 #define TGI_COLOR_VIOLET     0x02
61 #define TGI_COLOR_WHITE      0x03
62 #define TGI_COLOR_BLACK2     0x04
63 #define TGI_COLOR_ORANGE     0x05
64 #define TGI_COLOR_BLUE       0x06
65 #define TGI_COLOR_WHITE2     0x07
66
67 #define TGI_COLOR_MAGENTA    TGI_COLOR_BLACK2
68 #define TGI_COLOR_DARKBLUE   TGI_COLOR_WHITE2
69 #define TGI_COLOR_DARKGREEN  0x08
70 #define TGI_COLOR_GRAY       0x09
71 #define TGI_COLOR_CYAN       0x0A
72 #define TGI_COLOR_BROWN      0x0B
73 #define TGI_COLOR_GRAY2      0x0C
74 #define TGI_COLOR_PINK       0x0D
75 #define TGI_COLOR_YELLOW     0x0E
76 #define TGI_COLOR_AQUA       0x0F
77
78 /* Characters codes */
79 #define CH_ENTER       0x0D
80 #define CH_ESC         0x1B
81 #define CH_CURS_LEFT   0x08
82 #define CH_CURS_RIGHT  0x15
83
84 #define CH_ULCORNER  '+'
85 #define CH_URCORNER  '+'
86 #define CH_LLCORNER  '+'
87 #define CH_LRCORNER  '+'
88 #define CH_TTEE      '+'
89 #define CH_BTEE      '+'
90 #define CH_LTEE      '+'
91 #define CH_RTEE      '+'
92 #define CH_CROSS     '+'
93
94 /* Masks for joy_read */
95 #define JOY_UP_MASK     0x10
96 #define JOY_DOWN_MASK   0x20
97 #define JOY_LEFT_MASK   0x04
98 #define JOY_RIGHT_MASK  0x08
99 #define JOY_BTN_1_MASK  0x40
100 #define JOY_BTN_2_MASK  0x80
101
102 /* Return codes for get_ostype */
103 #define APPLE_UNKNOWN  0x00
104 #define APPLE_II       0x10  /* Apple ][                    */
105 #define APPLE_IIPLUS   0x11  /* Apple ][+                   */
106 #define APPLE_IIIEM    0x20  /* Apple /// (emulation)       */
107 #define APPLE_IIE      0x30  /* Apple //e                   */
108 #define APPLE_IIEENH   0x31  /* Apple //e (enhanced)        */
109 #define APPLE_IIECARD  0x40  /* Apple //e Option Card       */
110 #define APPLE_IIC      0x50  /* Apple //c                   */
111 #define APPLE_IIC35    0x51  /* Apple //c (3.5 ROM)         */
112 #define APPLE_IICEXP   0x53  /* Apple //c (Mem. Exp.)       */
113 #define APPLE_IICREV   0x54  /* Apple //c (Rev. Mem. Exp.)  */
114 #define APPLE_IICPLUS  0x55  /* Apple //c Plus              */
115 #define APPLE_IIGS     0x80  /* Apple IIgs                  */
116 #define APPLE_IIGS1    0x81  /* Apple IIgs (ROM 1)          */
117 #define APPLE_IIGS3    0x83  /* Apple IIgs (ROM 3)          */
118
119 extern unsigned char _dos_type;
120 /* Valid _dos_type values:
121 **
122 ** AppleDOS 3.3   - 0x00
123 ** ProDOS 8 1.0.1 - 0x10
124 ** ProDOS 8 1.0.2 - 0x10
125 ** ProDOS 8 1.1.1 - 0x11
126 ** ProDOS 8 1.2   - 0x12
127 ** ProDOS 8 1.3   - 0x13
128 ** ProDOS 8 1.4   - 0x14
129 ** ProDOS 8 1.5   - 0x15
130 ** ProDOS 8 1.6   - 0x16
131 ** ProDOS 8 1.7   - 0x17
132 ** ProDOS 8 1.8   - 0x18
133 ** ProDOS 8 1.9   - 0x18 (!)
134 ** ProDOS 8 2.0.1 - 0x21
135 ** ProDOS 8 2.0.2 - 0x22
136 ** ProDOS 8 2.0.3 - 0x23
137 */
138
139
140
141 /*****************************************************************************/
142 /*                                 Variables                                 */
143 /*****************************************************************************/
144
145
146
147 /* The file stream implementation and the POSIX I/O functions will use the
148 ** following struct to set the date and time stamp on files. This specificially
149 ** applies to the open and fopen functions.
150 */
151 extern struct {
152     struct {
153         unsigned day  :5;
154         unsigned mon  :4;
155         unsigned year :7;
156     }             createdate;    /* Current date: 0 */ 
157     struct {
158         unsigned char min;
159         unsigned char hour;
160     }             createtime;    /* Current time: 0 */ 
161 } _datetime;
162
163 /* The addresses of the static drivers */
164 #if !defined(__APPLE2ENH__)
165 extern void a2_auxmem_emd[];
166 extern void a2_stdjoy_joy[];     /* Referred to by joy_static_stddrv[]   */
167 extern void a2_stdmou_mou[];     /* Referred to by mouse_static_stddrv[] */
168 extern void a2_ssc_ser[];
169 extern void a2_hi_tgi[];         /* Referred to by tgi_static_stddrv[]   */
170 extern void a2_lo_tgi[];
171 #endif
172
173
174
175 /*****************************************************************************/
176 /*                                   Code                                    */
177 /*****************************************************************************/
178
179
180
181 unsigned char get_ostype (void);
182 /* Get the machine type. Returns one of the APPLE_xxx codes. */
183
184 void rebootafterexit (void);
185 /* Reboot machine after program termination has completed. */
186
187 #define ser_apple2_slot(num)  ser_ioctl (0, (void*) (num))
188 /* Select a slot number from 1 to 7 prior to ser_open.
189 ** The default slot number is 2.
190 */
191
192 #define tgi_apple2_mix(onoff)  tgi_ioctl (0, (void*) (onoff))
193 /* If onoff is 1, graphics/text mixed mode is enabled.
194 ** If onoff is 0, graphics/text mixed mode is disabled.
195 */
196
197 /* The following #defines will cause the matching functions calls in conio.h
198 ** to be overlaid by macros with the same names, saving the function call
199 ** overhead.
200 */
201 #define _textcolor(color)    COLOR_WHITE
202 #define _bgcolor(color)      COLOR_BLACK
203 #define _bordercolor(color)  COLOR_BLACK
204
205
206
207 /* End of apple2.h */
208 #endif