]> git.sur5r.net Git - cc65/blob - include/atari.h
ba2a43549d5235fbb0ed42edd007f25e4bf81c43
[cc65] / include / atari.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 atari.h                                   */
4 /*                                                                           */
5 /*                      Atari system specific definitions                    */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2000-2019 Mark Keates <markk@dendrite.co.uk>                          */
10 /*               Freddy Offenga <taf_offenga@yahoo.com>                      */
11 /*               Christian Groessler <chris@groessler.org>                   */
12 /*               Bill Kendrick <nbs@sonic.net>                               */
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 _ATARI_H
37 #define _ATARI_H
38
39
40
41 /* Check for errors */
42 #if !defined(__ATARI__)
43 #  error This module may only be used when compiling for the Atari!
44 #endif
45
46
47
48 /*****************************************************************************/
49 /* Character codes                                                           */
50 /*****************************************************************************/
51
52 #define CH_DELCHR       0xFE   /* delete char under the cursor */
53 #define CH_ENTER        0x9B
54 #define CH_ESC          0x1B
55 #define CH_CURS_UP      28
56 #define CH_CURS_DOWN    29
57 #define CH_CURS_LEFT    30
58 #define CH_CURS_RIGHT   31
59
60 #define CH_TAB          0x7F   /* tabulator */
61 #define CH_EOL          0x9B   /* end-of-line marker */
62 #define CH_CLR          0x7D   /* clear screen */
63 #define CH_BEL          0xFD   /* bell */
64 #define CH_DEL          0x7E   /* back space (delete char to the left) */
65 #define CH_RUBOUT       0x7E   /* back space (old, deprecated) */
66 #define CH_DELLINE      0x9C   /* delete line */
67 #define CH_INSLINE      0x9D   /* insert line */
68
69 /* These are defined to be Atari + NumberKey */
70 #define CH_F1           177
71 #define CH_F2           178
72 #define CH_F3           179
73 #define CH_F4           180
74 #define CH_F5           181
75 #define CH_F6           182
76 #define CH_F7           183
77 #define CH_F8           184
78 #define CH_F9           185
79 #define CH_F10          176
80
81 #define CH_ULCORNER     0x11
82 #define CH_URCORNER     0x05
83 #define CH_LLCORNER     0x1A
84 #define CH_LRCORNER     0x03
85 #define CH_TTEE         0x17
86 #define CH_BTEE         0x18
87 #define CH_LTEE         0x01
88 #define CH_RTEE         0x04
89 #define CH_CROSS        0x13
90 #define CH_HLINE        0x12
91 #define CH_VLINE        0x7C
92
93
94 /*****************************************************************************/
95 /* Color definitions                                                         */
96 /*****************************************************************************/
97
98 /* Make a GTIA color value */
99 #define _gtia_mkcolor(hue,lum) (((hue) << 4) | ((lum) << 1))
100
101 /* Luminance values go from 0 (black) to 7 (white) */
102
103 /* Hue values */
104 /* (These can vary depending on TV standard (NTSC vs PAL),
105 ** tint potentiometer settings, TV tint settings, emulator palette, etc.)
106 */
107 #define HUE_GREY        0
108 #define HUE_GOLD        1
109 #define HUE_GOLDORANGE  2
110 #define HUE_REDORANGE   3
111 #define HUE_ORANGE      4
112 #define HUE_MAGENTA     5
113 #define HUE_PURPLE      6
114 #define HUE_BLUE        7
115 #define HUE_BLUE2       8
116 #define HUE_CYAN        9
117 #define HUE_BLUEGREEN   10
118 #define HUE_BLUEGREEN2  11
119 #define HUE_GREEN       12
120 #define HUE_YELLOWGREEN 13
121 #define HUE_YELLOW      14
122 #define HUE_YELLOWRED   15
123
124 /* Color defines, similar to c64 colors (untested) */
125 /* Note that the conio color implementation is monochrome
126 ** (bgcolor and textcolor are only placeholders)
127 */
128 /* Use the defines with the setcolor() or _atari_xxxcolor() functions */
129 #define COLOR_BLACK             _gtia_mkcolor(HUE_GREY,0)
130 #define COLOR_WHITE             _gtia_mkcolor(HUE_GREY,7)
131 #define COLOR_RED               _gtia_mkcolor(HUE_REDORANGE,1)
132 #define COLOR_CYAN              _gtia_mkcolor(HUE_CYAN,3)
133 #define COLOR_VIOLET            _gtia_mkcolor(HUE_PURPLE,4)
134 #define COLOR_GREEN             _gtia_mkcolor(HUE_GREEN,2)
135 #define COLOR_BLUE              _gtia_mkcolor(HUE_BLUE,2)
136 #define COLOR_YELLOW            _gtia_mkcolor(HUE_YELLOW,7)
137 #define COLOR_ORANGE            _gtia_mkcolor(HUE_ORANGE,5)
138 #define COLOR_BROWN             _gtia_mkcolor(HUE_YELLOW,2)
139 #define COLOR_LIGHTRED          _gtia_mkcolor(HUE_REDORANGE,6)
140 #define COLOR_GRAY1             _gtia_mkcolor(HUE_GREY,2)
141 #define COLOR_GRAY2             _gtia_mkcolor(HUE_GREY,3)
142 #define COLOR_LIGHTGREEN        _gtia_mkcolor(HUE_GREEN,6)
143 #define COLOR_LIGHTBLUE         _gtia_mkcolor(HUE_BLUE,6)
144 #define COLOR_GRAY3             _gtia_mkcolor(HUE_GREY,5)
145
146 /* TGI color defines */
147 #define TGI_COLOR_BLACK         COLOR_BLACK
148 #define TGI_COLOR_WHITE         COLOR_WHITE
149 #define TGI_COLOR_RED           COLOR_RED
150 #define TGI_COLOR_CYAN          COLOR_CYAN
151 #define TGI_COLOR_VIOLET        COLOR_VIOLET
152 #define TGI_COLOR_GREEN         COLOR_GREEN
153 #define TGI_COLOR_BLUE          COLOR_BLUE
154 #define TGI_COLOR_YELLOW        COLOR_YELLOW
155 #define TGI_COLOR_ORANGE        COLOR_ORANGE
156 #define TGI_COLOR_BROWN         COLOR_BROWN
157 #define TGI_COLOR_LIGHTRED      COLOR_LIGHTRED
158 #define TGI_COLOR_GRAY1         COLOR_GRAY1
159 #define TGI_COLOR_GRAY2         COLOR_GRAY2
160 #define TGI_COLOR_LIGHTGREEN    COLOR_LIGHTGREEN
161 #define TGI_COLOR_LIGHTBLUE     COLOR_LIGHTBLUE
162 #define TGI_COLOR_GRAY3         COLOR_GRAY3
163
164
165 /*****************************************************************************/
166 /* Masks for joy_read                                                        */
167 /*****************************************************************************/
168
169 #define JOY_UP_MASK     0x01
170 #define JOY_DOWN_MASK   0x02
171 #define JOY_LEFT_MASK   0x04
172 #define JOY_RIGHT_MASK  0x08
173 #define JOY_BTN_1_MASK  0x10
174
175 #define JOY_FIRE_MASK   JOY_BTN_1_MASK
176 #define JOY_FIRE(v)     ((v) & JOY_FIRE_MASK)
177
178
179 /*****************************************************************************/
180 /* Keyboard values returned by kbcode / CH                                   */
181 /*****************************************************************************/
182
183 #define KEY_NONE        ((unsigned char) 0xFF)
184
185 #define KEY_0           ((unsigned char) 0x32)
186 #define KEY_1           ((unsigned char) 0x1F)
187 #define KEY_2           ((unsigned char) 0x1E)
188 #define KEY_3           ((unsigned char) 0x1A)
189 #define KEY_4           ((unsigned char) 0x18)
190 #define KEY_5           ((unsigned char) 0x1D)
191 #define KEY_6           ((unsigned char) 0x1B)
192 #define KEY_7           ((unsigned char) 0x33)
193 #define KEY_8           ((unsigned char) 0x35)
194 #define KEY_9           ((unsigned char) 0x30)
195
196 #define KEY_A           ((unsigned char) 0x3F)
197 #define KEY_B           ((unsigned char) 0x15)
198 #define KEY_C           ((unsigned char) 0x12)
199 #define KEY_D           ((unsigned char) 0x3A)
200 #define KEY_E           ((unsigned char) 0x2A)
201 #define KEY_F           ((unsigned char) 0x38)
202 #define KEY_G           ((unsigned char) 0x3D)
203 #define KEY_H           ((unsigned char) 0x39)
204 #define KEY_I           ((unsigned char) 0x0D)
205 #define KEY_J           ((unsigned char) 0x01)
206 #define KEY_K           ((unsigned char) 0x05)
207 #define KEY_L           ((unsigned char) 0x00)
208 #define KEY_M           ((unsigned char) 0x25)
209 #define KEY_N           ((unsigned char) 0x23)
210 #define KEY_O           ((unsigned char) 0x08)
211 #define KEY_P           ((unsigned char) 0x0A)
212 #define KEY_Q           ((unsigned char) 0x2F)
213 #define KEY_R           ((unsigned char) 0x28)
214 #define KEY_S           ((unsigned char) 0x3E)
215 #define KEY_T           ((unsigned char) 0x2D)
216 #define KEY_U           ((unsigned char) 0x0B)
217 #define KEY_V           ((unsigned char) 0x10)
218 #define KEY_W           ((unsigned char) 0x2E)
219 #define KEY_X           ((unsigned char) 0x16)
220 #define KEY_Y           ((unsigned char) 0x2B)
221 #define KEY_Z           ((unsigned char) 0x17)
222
223 #define KEY_COMMA       ((unsigned char) 0x20)
224 #define KEY_PERIOD      ((unsigned char) 0x22)
225 #define KEY_SLASH       ((unsigned char) 0x26)
226 #define KEY_SEMICOLON   ((unsigned char) 0x02)
227 #define KEY_PLUS        ((unsigned char) 0x06)
228 #define KEY_ASTERISK    ((unsigned char) 0x07)
229 #define KEY_DASH        ((unsigned char) 0x0E)
230 #define KEY_EQUALS      ((unsigned char) 0x0F)
231 #define KEY_LESSTHAN    ((unsigned char) 0x36)
232 #define KEY_GREATERTHAN ((unsigned char) 0x37)
233
234 #define KEY_ESC         ((unsigned char) 0x1C)
235 #define KEY_TAB         ((unsigned char) 0x2C)
236 #define KEY_SPACE       ((unsigned char) 0x21)
237 #define KEY_RETURN      ((unsigned char) 0x0C)
238 #define KEY_DELETE      ((unsigned char) 0x34)
239 #define KEY_CAPS        ((unsigned char) 0x3C)
240 #define KEY_INVERSE     ((unsigned char) 0x27)
241 #define KEY_HELP        ((unsigned char) 0x11)
242
243 /* Function keys only exist on the 1200XL model. */
244 #define KEY_F1          ((unsigned char) 0x03)
245 #define KEY_F2          ((unsigned char) 0x04)
246 #define KEY_F3          ((unsigned char) 0x13)
247 #define KEY_F4          ((unsigned char) 0x14)
248
249 /* N.B. Cannot read Ctrl key alone */
250 #define KEY_CTRL        ((unsigned char) 0x80)
251
252 /* N.B. Cannot read Shift key alone via KBCODE;
253 ** instead, check "Shfit key press" bit of SKSTAT register.
254 ** Also, no way to tell left Shift from right Shift.
255 */
256 #define KEY_SHIFT       ((unsigned char) 0x40)
257
258
259 /* Composed keys
260 ** (Other combinations are possible, including Shift+Ctrl+key,
261 ** though not all such combinations are available.)
262 */
263
264 #define KEY_EXCLAMATIONMARK     (KEY_1 | KEY_SHIFT)
265 #define KEY_QUOTE               (KEY_2 | KEY_SHIFT)
266 #define KEY_HASH                (KEY_3 | KEY_SHIFT)
267 #define KEY_DOLLAR              (KEY_4 | KEY_SHIFT)
268 #define KEY_PERCENT             (KEY_5 | KEY_SHIFT)
269 #define KEY_AMPERSAND           (KEY_6 | KEY_SHIFT)
270 #define KEY_APOSTROPHE          (KEY_7 | KEY_SHIFT)
271 #define KEY_AT                  (KEY_8 | KEY_SHIFT)
272 #define KEY_OPENINGPARAN        (KEY_9 | KEY_SHIFT)
273 #define KEY_CLOSINGPARAN        (KEY_0 | KEY_SHIFT)
274 #define KEY_UNDERLINE           (KEY_DASH | KEY_SHIFT)
275 #define KEY_BAR                 (KEY_EQUALS | KEY_SHIFT)
276 #define KEY_COLON               (KEY_SEMICOLON | KEY_SHIFT)
277 #define KEY_BACKSLASH           (KEY_PLUS | KEY_SHIFT)
278 #define KEY_CIRCUMFLEX          (KEY_ASTERISK | KEY_SHIFT)
279 #define KEY_OPENINGBRACKET      (KEY_COMMA | KEY_SHIFT)
280 #define KEY_CLOSINGBRACKET      (KEY_PERIOD | KEY_SHIFT)
281 #define KEY_QUESTIONMARK        (KEY_SLASH | KEY_SHIFT)
282 #define KEY_CLEAR               (KEY_LESSTHAN | KEY_SHIFT)
283 #define KEY_INSERT              (KEY_GREATERTHAN | KEY_SHIFT)
284
285 #define KEY_UP      (KEY_UNDERLINE | KEY_CTRL)
286 #define KEY_DOWN    (KEY_EQUALS | KEY_CTRL)
287 #define KEY_LEFT    (KEY_PLUS | KEY_CTRL)
288 #define KEY_RIGHT   (KEY_ASTERISK | KEY_CTRL)
289
290
291 /*****************************************************************************/
292 /* Color register functions                                                  */
293 /*****************************************************************************/
294
295 extern void __fastcall__ _setcolor     (unsigned char color_reg, unsigned char hue, unsigned char luminace);
296 extern void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
297 extern unsigned char __fastcall__ _getcolor (unsigned char color_reg);
298
299 /*****************************************************************************/
300 /* Other screen functions                                                    */
301 /*****************************************************************************/
302
303 extern int  __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */
304 extern void __fastcall__ _scroll (signed char numlines);
305                                           /* numlines > 0  scrolls up */
306                                           /* numlines < 0  scrolls down */
307
308
309 /*****************************************************************************/
310 /* Misc. functions                                                           */
311 /*****************************************************************************/
312
313 extern unsigned char get_ostype(void);       /* get ROM version */
314 extern unsigned char get_tv(void);           /* get TV system */
315 extern void _save_vecs(void);                /* save system vectors */
316 extern void _rest_vecs(void);                /* restore system vectors */
317 extern char *_getdefdev(void);               /* get default floppy device */
318 extern unsigned char _is_cmdline_dos(void);  /* does DOS support command lines */
319
320
321 /*****************************************************************************/
322 /* Global variables                                                          */
323 /*****************************************************************************/
324
325 extern unsigned char _dos_type;         /* the DOS flavour */
326 #ifndef __ATARIXL__
327 extern void atr130_emd[];
328 extern void atrstd_joy[];               /* referred to by joy_static_stddrv[] */
329 extern void atrmj8_joy[];
330 extern void atrjoy_mou[];
331 extern void atrst_mou[];                /* referred to by mouse_static_stddrv[] */
332 extern void atrami_mou[];
333 extern void atrtrk_mou[];
334 extern void atrtt_mou[];
335 extern void atrrdev_ser[];
336 extern void atr3_tgi[];
337 extern void atr4_tgi[];
338 extern void atr5_tgi[];
339 extern void atr6_tgi[];
340 extern void atr7_tgi[];
341 extern void atr8_tgi[];                 /* referred to by tgi_static_stddrv[] */
342 extern void atr8p2_tgi[];
343 extern void atr9_tgi[];
344 extern void atr9p2_tgi[];
345 extern void atr10_tgi[];
346 extern void atr10p2_tgi[];
347 extern void atr11_tgi[];
348 extern void atr14_tgi[];
349 extern void atr15_tgi[];
350 extern void atr15p2_tgi[];
351 #else
352 extern void atrx130_emd[];
353 extern void atrxstd_joy[];              /* referred to by joy_static_stddrv[] */
354 extern void atrxmj8_joy[];
355 extern void atrxjoy_mou[];
356 extern void atrxst_mou[];               /* referred to by mouse_static_stddrv[] */
357 extern void atrxami_mou[];
358 extern void atrxtrk_mou[];
359 extern void atrxtt_mou[];
360 extern void atrxrdev_ser[];
361 extern void atrx3_tgi[];
362 extern void atrx4_tgi[];
363 extern void atrx5_tgi[];
364 extern void atrx6_tgi[];
365 extern void atrx7_tgi[];
366 extern void atrx8_tgi[];                /* referred to by tgi_static_stddrv[] */
367 extern void atrx8p2_tgi[];
368 extern void atrx9_tgi[];
369 extern void atrx9p2_tgi[];
370 extern void atrx10_tgi[];
371 extern void atrx10p2_tgi[];
372 extern void atrx11_tgi[];
373 extern void atrx14_tgi[];
374 extern void atrx15_tgi[];
375 extern void atrx15p2_tgi[];
376 #endif
377
378
379 /*****************************************************************************/
380 /* get_ostype return value defines (for explanation, see ostype.s)           */
381 /*****************************************************************************/
382
383 /* masks */
384 #define AT_OS_TYPE_MAIN  7
385 #define AT_OS_TYPE_MINOR (7 << 3)
386 /* AT_OS_TYPE_MAIN values */
387 #define AT_OS_UNKNOWN  0
388 #define AT_OS_400800   1
389 #define AT_OS_1200XL   2
390 #define AT_OS_XLXE     3
391 /* AS_OS_TYPE_MINOR values */
392 /* for 400/800 remember this are the ROM versions */
393 /* to check whether the hw is PAL or NTSC, use get_tv() */
394 #define AT_OS_400800PAL_A  1
395 #define AT_OS_400800PAL_B  2
396 #define AT_OS_400800NTSC_A 1
397 #define AT_OS_400800NTSC_B 2
398 #define AT_OS_1200_10  1
399 #define AT_OS_1200_11  2
400 #define AT_OS_XLXE_1   1
401 #define AT_OS_XLXE_2   2
402 #define AT_OS_XLXE_3   3
403 #define AT_OS_XLXE_4   4
404
405
406 /*****************************************************************************/
407 /* get_tv return values                                                      */
408 /*****************************************************************************/
409
410 #define AT_NTSC     0
411 #define AT_PAL      1
412
413
414 /*****************************************************************************/
415 /* valid _dos_type values                                                    */
416 /*****************************************************************************/
417
418 #define SPARTADOS   0
419 #define REALDOS     1
420 #define BWDOS       2
421 #define OSADOS      3
422 #define XDOS        4
423 #define ATARIDOS    5
424 #define MYDOS       6
425 #define NODOS       255
426
427
428 /*****************************************************************************/
429 /* Define hardware and where they're mapped in memory                        */
430 /*****************************************************************************/
431
432 #include <_gtia.h>
433 #define GTIA_READ  (*(struct __gtia_read*)0xD000)
434 #define GTIA_WRITE (*(struct __gtia_write*)0xD000)
435
436 #include <_pbi.h>
437
438 #include <_pokey.h>
439 #define POKEY_READ  (*(struct __pokey_read*)0xD200)
440 #define POKEY_WRITE (*(struct __pokey_write*)0xD200)
441
442 #include <_pia.h>
443 #define PIA (*(struct __pia*)0xD300)
444
445 #include <_antic.h>
446 #define ANTIC (*(struct __antic*)0xD400)
447
448
449 /*****************************************************************************/
450 /* Shadow registers for hardware registers                                   */
451 /*****************************************************************************/
452
453 /* GTIA */
454 #define STRIG0 (*(unsigned char*)0x284) /* TRIG0 */
455 #define STRIG1 (*(unsigned char*)0x285) /* TRIG1 */
456 #define STRIG2 (*(unsigned char*)0x286) /* TRIG2 */
457 #define STRIG3 (*(unsigned char*)0x287) /* TRIG3 */
458 #define PCOLR0 (*(unsigned char*)0x2C0) /* COLPM0 */
459 #define PCOLR1 (*(unsigned char*)0x2C1) /* COLPM1 */
460 #define PCOLR2 (*(unsigned char*)0x2C2) /* COLPM2 */
461 #define PCOLR3 (*(unsigned char*)0x2C3) /* COLPM3 */
462 #define COLOR0 (*(unsigned char*)0x2C4) /* COLPF0 */
463 #define COLOR1 (*(unsigned char*)0x2C5) /* COLPF1 */
464 #define COLOR2 (*(unsigned char*)0x2C6) /* COLPF2 */
465 #define COLOR3 (*(unsigned char*)0x2C7) /* COLPF3 */
466 #define COLOR4 (*(unsigned char*)0x2C8) /* COLPBK */
467 #define GPRIOR (*(unsigned char*)0x264) /* PRIOR */
468
469 /* ANTIC */
470 #define SDMCTL (*(unsigned char*)0x22F) /* DMACTL */
471 #define CHACT  (*(unsigned char*)0x2F3) /* CHACTL */
472 #define SDLSTL (*(unsigned char*)0x230) /* DLISTL */
473 #define SDLSTH (*(unsigned char*)0x231) /* DLISTH */
474 #define SDLST  (*(unsigned int*)0x230)  /* DLISTL/H together */
475 #define CHBAS  (*(unsigned char*)0x2F4) /* CHBASE */
476 #define LPENH  (*(unsigned char*)0x233) /* PENH */
477 #define LPENV  (*(unsigned char*)0x234) /* PENV */
478
479 /* POKEY */
480 #define PADDL0 (*(unsigned char*)0x270) /* POT0 */
481 #define PADDL1 (*(unsigned char*)0x271) /* POT1 */
482 #define PADDL2 (*(unsigned char*)0x272) /* POT2 */
483 #define PADDL3 (*(unsigned char*)0x273) /* POT3 */
484 #define PADDL4 (*(unsigned char*)0x274) /* POT4 */
485 #define PADDL5 (*(unsigned char*)0x275) /* POT5 */
486 #define PADDL6 (*(unsigned char*)0x276) /* POT6 */
487 #define PADDL7 (*(unsigned char*)0x277) /* POT7 */
488 #define CH     (*(unsigned char*)0x2FC) /* KBCODE */
489 #define POKMSK (*(unsigned char*)0x10)  /* IRQEN */
490
491 /* PIA */
492 #define STICK0 (*(unsigned char*)0x278) /* PORTA for controller port 1 */
493 #define STICK1 (*(unsigned char*)0x279) /* PORTA for controller port 2 */
494 #define STICK2 (*(unsigned char*)0x27A) /* PORTB for controller port 3 */
495 #define STICK3 (*(unsigned char*)0x27B) /* PORTB for controller port 4 */
496 #define PTRIG0 (*(unsigned char*)0x27C) /* PORTA for controller port 1, paddle 1 */
497 #define PTRIG1 (*(unsigned char*)0x27D) /* PORTA for controller port 1, paddle 2 */
498 #define PTRIG2 (*(unsigned char*)0x27E) /* PORTA for controller port 1, paddle 3 */
499 #define PTRIG3 (*(unsigned char*)0x27F) /* PORTA for controller port 1, paddle 4 */
500 #define PTRIG4 (*(unsigned char*)0x280) /* PORTA for controller port 2, paddle 5 */
501 #define PTRIG5 (*(unsigned char*)0x281) /* PORTA for controller port 2, paddle 6 */
502 #define PTRIG6 (*(unsigned char*)0x282) /* PORTA for controller port 2, paddle 7 */
503 #define PTRIG7 (*(unsigned char*)0x283) /* PORTA for controller port 2, paddle 8 */
504
505
506 /*****************************************************************************/
507 /* Device control block                                                      */
508 /*****************************************************************************/
509
510 struct __dcb {
511     unsigned char device;     /* device id */
512     unsigned char unit;       /* unit number */
513     unsigned char command;    /* command */
514     unsigned char status;     /* command type / status return */
515     void          *buffer;    /* pointer to buffer */
516     unsigned char timeout;    /* device timeout in seconds */
517     unsigned char unused;
518     unsigned int  xfersize;   /* # of bytes to transfer */
519     unsigned char aux1;       /* 1st command auxiliary byte */
520     unsigned char aux2;       /* 2nd command auxiliary byte */
521 };
522 #define DCB (*(struct __dcb *)0x300)
523
524
525 /*****************************************************************************/
526 /* I/O control block                                                         */
527 /*****************************************************************************/
528
529 struct __iocb {
530     unsigned char handler;    /* handler index number (0xff free) */
531     unsigned char drive;      /* device number (drive) */
532     unsigned char command;    /* command */
533     unsigned char status;     /* status of last operation */
534     void          *buffer;    /* pointer to buffer */
535     void          *put_byte;  /* pointer to device's PUT BYTE routine */
536     unsigned int  buflen;     /* length of buffer */
537     unsigned char aux1;       /* 1st auxiliary byte */
538     unsigned char aux2;       /* 2nd auxiliary byte */
539     unsigned char aux3;       /* 3rd auxiliary byte */
540     unsigned char aux4;       /* 4th auxiliary byte */
541     unsigned char aux5;       /* 5th auxiliary byte */
542     unsigned char spare;      /* spare byte */
543 };
544 #define ZIOCB (*(struct __iocb *)0x20)  /* zero page IOCB */
545 #define IOCB (*(struct __iocb *)0x340)  /* system IOCB buffers */
546
547 /* IOCB Command Codes */
548 #define IOCB_OPEN        0x03  /* open */
549 #define IOCB_GETREC      0x05  /* get record */
550 #define IOCB_GETCHR      0x07  /* get character(s) */
551 #define IOCB_PUTREC      0x09  /* put record */
552 #define IOCB_PUTCHR      0x0B  /* put character(s) */
553 #define IOCB_CLOSE       0x0C  /* close */
554 #define IOCB_STATIS      0x0D  /* status */
555 #define IOCB_SPECIL      0x0E  /* special */
556 #define IOCB_DRAWLN      0x11  /* draw line */
557 #define IOCB_FILLIN      0x12  /* draw line with right fill */
558 #define IOCB_RENAME      0x20  /* rename disk file */
559 #define IOCB_DELETE      0x21  /* delete disk file */
560 #define IOCB_LOCKFL      0x23  /* lock file (set to read-only) */
561 #define IOCB_UNLOCK      0x24  /* unlock file */
562 #define IOCB_POINT       0x25  /* point sector */
563 #define IOCB_NOTE        0x26  /* note sector */
564 #define IOCB_GETFL       0x27  /* get file length */
565 #define IOCB_CHDIR_MYDOS 0x29  /* change directory (MyDOS) */
566 #define IOCB_MKDIR       0x2A  /* make directory (MyDOS/SpartaDOS) */
567 #define IOCB_RMDIR       0x2B  /* remove directory (SpartaDOS) */
568 #define IOCB_CHDIR_SPDOS 0x2C  /* change directory (SpartaDOS) */
569 #define IOCB_GETCWD      0x30  /* get current directory (MyDOS/SpartaDOS) */
570 #define IOCB_FORMAT      0xFE  /* format */
571
572
573 /* End of atari.h */
574 #endif