1 /*****************************************************************************/
5 /* Supervision specific definitions */
9 /* 2003 Peter Trauner (trap@utanet.at) */
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. */
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: */
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. */
29 /*****************************************************************************/
33 #ifndef _SUPERVISION_H
34 #define _SUPERVISION_H
38 /* Check for errors */
39 #if !defined(__SUPERVISION__)
40 # error This module may only be used when compiling for the Supervision!
45 /*****************************************************************************/
47 /*****************************************************************************/
57 #define SV_LCD ((struct __sv_lcd*)0x2000)
61 unsigned char control;
64 #define SV_RIGHT ((struct __sv_tone*)0x2010)
65 #define SV_LEFT ((struct __sv_tone*)0x2014)
68 unsigned char volume; /* and frequency */
70 unsigned char control;
72 #define SV_NOISE ((struct __sv_noise*)0x2028)
78 #define IO_PORT ((struct __io_port*)(0x2021)
83 unsigned char control;
86 #define SV_DMA ((struct __sv_dma*)0x2018)
88 #define SV_CONTROL (*(unsigned char*)0x2020)
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)
95 #define SV_VIDEO ((unsigned char*)0x4000)
96 #define SV_TIMER_COUNT (*(unsigned char*)0x2023)
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)
104 extern unsigned char sv_nmi_counter;
105 extern unsigned char sv_timer_irq_counter;
106 extern unsigned char sv_timer_dma_counter;
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
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
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)
128 /* No support for dynamically loadable drivers */
131 /* The addresses of the static drivers */
132 extern void supervision_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
136 /* End of supervision.h */