]> git.sur5r.net Git - cc65/blob - include/supervision.h
Fixed _textcolor definition.
[cc65] / include / supervision.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                               supervision.h                               */
4 /*                                                                           */
5 /*                     Supervision specific definitions                      */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* 2003 Peter Trauner (trap@utanet.at)                                       */
10 /*                                                                           */
11 /*                                                                           */
12 /* This software is provided "as-is," without any expressed or implied       */
13 /* warranty.  In no event will the authors be held liable for any damages    */
14 /* arising from the use of this software.                                    */
15 /*                                                                           */
16 /* Permission is granted to anyone to use this software for any purpose,     */
17 /* including commercial applications, and to alter and redistribute it       */
18 /* freely, subject to the following restrictions:                            */
19 /*                                                                           */
20 /* 1. The origin of this software must not be misrepresented; you must not   */
21 /*    claim that you wrote the original software.  If you use this software  */
22 /*    in a product, an acknowledgment, in the product's documentation,       */
23 /*    would be appreciated, but is not required.                             */
24 /* 2. Alterred source versions must be marked plainly as such,               */
25 /*    and must not be misrepresented as being the original software.         */
26 /* 3. This notice may not be removed or alterred                             */
27 /*    from any source distribution.                                          */
28 /*                                                                           */
29 /*****************************************************************************/
30
31
32
33 #ifndef _SUPERVISION_H
34 #define _SUPERVISION_H
35
36
37
38 /* Check for errors */
39 #if !defined(__SUPERVISION__)
40 #  error This module may only be used when compiling for the Supervision!
41 #endif
42
43
44
45 /*****************************************************************************/
46 /*                                   Data                                    */
47 /*****************************************************************************/
48
49
50
51 struct __sv_lcd {
52     unsigned char       width;
53     unsigned char       height;
54     unsigned char       xpos;
55     unsigned char       ypos;
56 };
57 #define SV_LCD  (*(struct __sv_lcd*)0x2000)
58
59 struct __sv_tone {
60     unsigned            delay;
61     unsigned char       control;
62     unsigned char       timer;
63 };
64 #define SV_RIGHT (*(struct __sv_tone*)0x2010)
65 #define SV_LEFT  (*(struct __sv_tone*)0x2014)
66
67 struct __sv_noise {
68     unsigned char       volume;         /* and frequency */
69     unsigned char       timer;
70     unsigned char       control;
71 };
72 #define SV_NOISE (*(struct __sv_noise*)0x2028)
73
74 struct __io_port {
75     unsigned char       in;
76     unsigned char       out;
77 };
78 #define IO_PORT  (*(struct __io_port*)0x2021)
79
80 struct __sv_dma {
81     unsigned            start;
82     unsigned char       size;
83     unsigned char       control;
84     unsigned char       on;
85 };
86 #define SV_DMA   (*(struct __sv_dma*)0x2018)
87
88 #define SV_CONTROL (*(unsigned char*)0x2020)
89
90 #define SV_BANK  (*(unsigned char*)0x2026)
91 #define SV_BANK_COMBINE(nmi,irq_timer,irq_dma,lcd_on, timer_prescale, bank) \
92         ((nmi)?1:0)|((irq_timer)?2:0)|((irq_dma)?4:0)|((lcd_on)?8:0) \
93         |((timer_prescale)?0x10:0)|((bank)<<5)
94
95 #define SV_VIDEO ((unsigned char*)0x4000)
96 #define SV_TIMER_COUNT (*(unsigned char*)0x2023)
97
98
99
100 /* Counters incremented asynchronously!
101 ** If you want more complex, copy the crt0.s file from the libsrc/supervision
102 ** directory and code them yourself (in assembler)
103 */
104 extern unsigned char sv_nmi_counter;
105 extern unsigned char sv_timer_irq_counter;
106 extern unsigned char sv_timer_dma_counter;
107
108 /* Masks for joy_read */
109 #define JOY_UP_MASK     0x08
110 #define JOY_DOWN_MASK   0x04
111 #define JOY_LEFT_MASK   0x02
112 #define JOY_RIGHT_MASK  0x01
113 #define JOY_BTN_1_MASK  0x20
114 #define JOY_BTN_2_MASK  0x10
115 #define JOY_BTN_3_MASK  0x80
116 #define JOY_BTN_4_MASK  0x40
117
118 #define JOY_BTN_A_MASK  JOY_BTN_1_MASK
119 #define JOY_BTN_B_MASk  JOY_BTN_2_MASK
120 #define JOY_START_MASK  JOY_BTN_3_MASK
121 #define JOY_SELECT_MASK JOY_BTN_4_MASK
122
123 #define JOY_BTN_A(v)    ((v) & JOY_BTN_A_MASK)
124 #define JOY_BTN_B(v)    ((v) & JOY_BTN_B_MASK)
125 #define JOY_START(v)    ((v) & JOY_START_MASK)
126 #define JOY_SELECT(v)   ((v) & JOY_SELECT_MASK)
127
128 /* No support for dynamically loadable drivers */
129 #define DYN_DRV 0
130
131 /* The addresses of the static drivers */
132 extern void supervision_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
133
134
135
136 /* End of supervision.h */
137 #endif