video.h revision 1.2 1 1.2 leo /* $NetBSD: video.h,v 1.2 1995/08/17 20:34:04 leo Exp $ */
2 1.1 leo
3 1.1 leo /*
4 1.1 leo * Copyright (c) 1995 Leo Weppelman.
5 1.1 leo * All rights reserved.
6 1.1 leo *
7 1.1 leo * Redistribution and use in source and binary forms, with or without
8 1.1 leo * modification, are permitted provided that the following conditions
9 1.1 leo * are met:
10 1.1 leo * 1. Redistributions of source code must retain the above copyright
11 1.1 leo * notice, this list of conditions and the following disclaimer.
12 1.1 leo * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 leo * notice, this list of conditions and the following disclaimer in the
14 1.1 leo * documentation and/or other materials provided with the distribution.
15 1.1 leo * 3. All advertising materials mentioning features or use of this software
16 1.1 leo * must display the following acknowledgement:
17 1.1 leo * This product includes software developed by Leo Weppelman.
18 1.1 leo * 4. The name of the author may not be used to endorse or promote products
19 1.1 leo * derived from this software without specific prior written permission
20 1.1 leo *
21 1.1 leo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 1.1 leo * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.1 leo * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 1.1 leo * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 1.1 leo * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 1.1 leo * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 1.1 leo * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 1.1 leo * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 1.1 leo * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 1.1 leo * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 1.1 leo */
32 1.1 leo
33 1.1 leo #ifndef _MACHINE_VIDEO_H
34 1.1 leo #define _MACHINE_VIDEO_H
35 1.1 leo /*
36 1.1 leo * Access to circuitry for video
37 1.1 leo */
38 1.1 leo
39 1.1 leo #define VIDEO ((struct video *)AD_VIDEO)
40 1.1 leo
41 1.1 leo struct video {
42 1.2 leo volatile char vdb[14]; /* sparsely filled */
43 1.2 leo volatile u_short vd_line_wide; /* Falcon line word distance */
44 1.2 leo volatile u_short vd_vert_wrap; /* Falcon line length */
45 1.2 leo volatile char vd_fill0[45]; /* filler */
46 1.1 leo volatile u_short vd_st_rgb[16]; /* RGB for simultaneous colors (ST)*/
47 1.1 leo volatile u_char vd_st_res; /* ST resolution */
48 1.1 leo volatile char vd_fill1; /* filler */
49 1.1 leo volatile u_short vd_tt_res; /* TT-resultion mode */
50 1.1 leo volatile u_char vd_ste_hscroll; /* MEGA STe hor bitwise scroll */
51 1.2 leo volatile u_short vd_fal_res; /* Falcon resolution */
52 1.2 leo volatile char vd_fill2[23];
53 1.2 leo volatile u_short vd_h_hold_cnt; /* Falcon horizontal hold counter */
54 1.2 leo volatile u_short vd_h_hold_tim; /* Falcon horizontal hold timer */
55 1.2 leo volatile u_short vd_h_bord_beg; /* Falcon horizontal border begin */
56 1.2 leo volatile u_short vd_h_bord_end; /* Falcon horizontal border end */
57 1.2 leo volatile u_short vd_h_dis_beg; /* Falcon horizontal display begin */
58 1.2 leo volatile u_short vd_h_dis_end; /* Falcon horizontal display end */
59 1.2 leo volatile u_short vd_h_ss; /* Falcon horizontal SS */
60 1.2 leo volatile u_short vd_h_fs; /* Falcon horizontal FS */
61 1.2 leo volatile u_short vd_h_hh; /* Falcon horizontal HH */
62 1.2 leo volatile char vd_fill3[13];
63 1.2 leo volatile u_short vd_v_freq_cnt; /* Falcon vertical frequency count */
64 1.2 leo volatile u_short vd_v_freq_tim; /* Falcon vertical frequency timer */
65 1.2 leo volatile u_short vd_v_bord_beg; /* Falcon vertical border begin */
66 1.2 leo volatile u_short vd_v_bord_end; /* Falcon vertical border end */
67 1.2 leo volatile u_short vd_v_dis_beg; /* Falcon vertical display begin */
68 1.2 leo volatile u_short vd_v_dis_end; /* Falcon vertical display end */
69 1.2 leo volatile u_short vd_v_ss; /* Falcon vertical SS */
70 1.2 leo volatile char vd_fill4[17];
71 1.2 leo volatile u_short vd_unknown; /* Falcon, purpose unknown */
72 1.2 leo volatile u_short vd_fal_ctrl; /* Falcon video control */
73 1.2 leo volatile char vd_fill5[315];
74 1.1 leo volatile u_short vd_tt_rgb[256]; /* RGB for simultaneous TT colors */
75 1.2 leo volatile char vd_fill6[4608];
76 1.2 leo volatile u_long vd_fal_rgb[256];/* RGB for Falcon colors */
77 1.1 leo };
78 1.1 leo
79 1.1 leo #define vd_ramh vdb[ 1] /* base address Video RAM, high byte */
80 1.1 leo #define vd_ramm vdb[ 3] /* base address Video RAM, mid byte */
81 1.1 leo #define vd_raml vdb[13] /* base address Video RAM, low byte */
82 1.1 leo #define vd_ptrh vdb[ 5] /* scan address Video RAM, high byte */
83 1.1 leo #define vd_ptrm vdb[ 7] /* scan address Video RAM, mid byte */
84 1.1 leo #define vd_ptrl vdb[ 9] /* scan address Video RAM, low byte */
85 1.1 leo #define vd_sync vdb[10] /* synchronization mode */
86 1.1 leo
87 1.1 leo /* bits in vd_sync: */
88 1.1 leo #define SYNC_EXT 0x01 /* extern sync */
89 1.1 leo #define SYNC_50 0x02 /* 50 Hertz (used for color) */
90 1.1 leo
91 1.1 leo /* bits in vd_st_rgb[]: */
92 1.1 leo #define RGB_B 0x0007
93 1.1 leo #define RGB_G 0x0070
94 1.1 leo #define RGB_R 0x0700
95 1.1 leo
96 1.1 leo /* some values for vd_st_rgb[]: */
97 1.1 leo #define RGB_BLACK 0x0000
98 1.1 leo #define RGB_RED 0x0700
99 1.1 leo #define RGB_GREEN 0x0070
100 1.1 leo #define RGB_BLUE 0x0007
101 1.1 leo #define RGB_WHITE 0x0777
102 1.1 leo #define RGB_MAGENTA 0x0707
103 1.1 leo #define RGB_CYAN 0x0077
104 1.1 leo #define RGB_YELLOW 0x0770
105 1.1 leo #define RGB_LGREY 0x0555
106 1.1 leo #define RGB_DGREY 0x0222
107 1.1 leo
108 1.1 leo /* values for vd_st_res: */
109 1.1 leo #define RES_LOW 0x00 /* 320x200, 16 colors */
110 1.1 leo #define RES_MID 0x01 /* 640x200, 4 colors */
111 1.1 leo #define RES_HIGH 0x02 /* 640x400, monochrome */
112 1.1 leo
113 1.1 leo /* masks for vd_tt_res: */
114 1.1 leo #define RES_STLOW 0x0000 /* 320x200, 16 colors */
115 1.1 leo #define RES_STMID 0x0100 /* 640x200, 4 colors */
116 1.1 leo #define RES_STHIGH 0x0200 /* 640x400, monochrome */
117 1.1 leo #define RES_TTMID 0x0400 /* 640x480, 16 colors */
118 1.1 leo #define RES_TTHIGH 0x0600 /* 1280x960, monochrome */
119 1.1 leo #define RES_TTLOW 0x0700 /* 320x480, 256 colors */
120 1.1 leo #define TT_PALLET 0x000f /* Pallette number */
121 1.1 leo #define TT_HYMONO 0x8000 /* Hyper mono mode */
122 1.1 leo #define TT_SHOLD 0x1000 /* Sample/hold mode */
123 1.2 leo
124 1.2 leo /* The falcon video modes */
125 1.2 leo #define RES_FALAUTO 0 /* Falcon resolution dedected at boot */
126 1.2 leo #define RES_VGA2 1 /* 640x480, 2 colors */
127 1.2 leo #define RES_VGA4 2 /* 640x480, 4 colors */
128 1.2 leo #define RES_VGA16 3 /* 640x480, 16 colors */
129 1.2 leo #define RES_VGA256 4 /* 640x480, 256 colors */
130 1.2 leo #define RES_DIRECT 5 /* 320x200, 65536 colors */
131 1.2 leo #define RES_FAL_STLOW 6 /* 320x200, 16 colors */
132 1.2 leo #define RES_FAL_STMID 7 /* 640x200, 4 colors */
133 1.2 leo #define RES_FAL_STHIGH 8 /* 640x400, 2 colors */
134 1.2 leo #define RES_FAL_TTLOW 9 /* 320x480, 256 colors */
135 1.1 leo
136 1.1 leo /*
137 1.1 leo * Yahama YM-2149 Programmable Sound Generator
138 1.1 leo */
139 1.1 leo
140 1.1 leo #define SOUND ((struct sound *)AD_SOUND)
141 1.1 leo
142 1.1 leo struct sound {
143 1.1 leo char sdb[4]; /* use only the even bytes */
144 1.1 leo };
145 1.1 leo
146 1.1 leo #define sd_selr sdb[0] /* select register */
147 1.1 leo #define sd_rdat sdb[0] /* read register data */
148 1.1 leo #define sd_wdat sdb[2] /* write register data */
149 1.1 leo
150 1.1 leo /*
151 1.1 leo * Accessing the YM-2149 registers is indirect through ST-specific
152 1.1 leo * circuitry by writing the register number into sd_selr.
153 1.1 leo */
154 1.1 leo #define YM_PA0 0 /* Period Channel A, bits 0-7 */
155 1.1 leo #define YM_PA1 1 /* Period Channel A, bits 8-11 */
156 1.1 leo #define YM_PB0 2 /* Period Channel B, bits 0-7 */
157 1.1 leo #define YM_PB1 3 /* Period Channel B, bits 8-11 */
158 1.1 leo #define YM_PC0 4 /* Period Channel C, bits 0-7 */
159 1.1 leo #define YM_PC1 5 /* Period Channel C, bits 8-11 */
160 1.1 leo #define YM_PNG 6 /* Period Noise Generator, bits 0-4 */
161 1.1 leo #define YM_MFR 7 /* Multi Function Register */
162 1.1 leo #define YM_VA 8 /* Volume Channel A */
163 1.1 leo #define YM_VB 9 /* Volume Channel B */
164 1.1 leo #define YM_VC 10 /* Volume Channel C */
165 1.1 leo #define YM_PE0 11 /* Period Envelope, bits 0-7 */
166 1.1 leo #define YM_PE1 12 /* Period Envelope, bits 8-15 */
167 1.1 leo #define YM_WFE 13 /* Wave Form Envelope */
168 1.1 leo #define YM_IOA 14 /* I/O port A */
169 1.1 leo #define YM_IOB 15 /* I/O port B */
170 1.1 leo
171 1.1 leo /* bits in MFR: */
172 1.1 leo #define SA_OFF 0x01 /* Sound Channel A off */
173 1.1 leo #define SB_OFF 0x02 /* Sound Channel B off */
174 1.1 leo #define SC_OFF 0x04 /* Sound Channel C off */
175 1.1 leo #define NA_OFF 0x08 /* Noise Channel A off */
176 1.1 leo #define NB_OFF 0x10 /* Noise Channel B off */
177 1.1 leo #define NC_OFF 0x20 /* Noise Channel C off */
178 1.1 leo #define PA_OUT 0x40 /* Port A for Output */
179 1.1 leo #define PB_OUT 0x80 /* Port B for Output */
180 1.1 leo
181 1.1 leo /* bits in Vx: */
182 1.1 leo #define VOLUME 0x0F /* 16 steps */
183 1.1 leo #define ENVELOP 0x10 /* volume steered by envelope */
184 1.1 leo
185 1.1 leo /* bits in WFE: */
186 1.1 leo #define WF_HOLD 0x01 /* hold after one period */
187 1.1 leo #define WF_ALTERNAT 0x02 /* up and down (no saw teeth) */
188 1.1 leo #define WF_ATTACK 0x04 /* start up */
189 1.1 leo #define WF_CONTINUE 0x08 /* multiple periods */
190 1.1 leo
191 1.1 leo /* names for bits in Port A (ST specific): */
192 1.1 leo #define PA_SIDEB 0x01 /* select floppy head - if double sided */
193 1.1 leo #define PA_FLOP0 0x02 /* Drive Select Floppy 0 */
194 1.1 leo #define PA_FLOP1 0x04 /* Drive Select Floppy 1 */
195 1.1 leo #define PA_SRTS 0x08 /* Serial RTS */
196 1.1 leo #define PA_SDTR 0x10 /* Serial DTR */
197 1.1 leo #define PA_PSTROBE 0x20 /* Parallel Strobe */
198 1.1 leo #define PA_USER 0x40 /* Free Pin on Monitor Connector */
199 1.1 leo /* 0x80 reserved */
200 1.1 leo
201 1.1 leo #endif /* _MACHINE_VIDEO_H */
202