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