video.h revision 1.1 1 /* $NetBSD: video.h,v 1.1 1995/03/26 07:12:08 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[64]; /* sparsely filled */
43 volatile u_short vd_st_rgb[16]; /* RGB for simultaneous colors (ST)*/
44 volatile u_char vd_st_res; /* ST resolution */
45 volatile char vd_fill1; /* filler */
46 volatile u_short vd_tt_res; /* TT-resultion mode */
47 volatile u_char vd_ste_hscroll; /* MEGA STe hor bitwise scroll */
48 volatile u_char vd_fill2[411];
49 volatile u_short vd_tt_rgb[256]; /* RGB for simultaneous TT colors */
50 };
51
52 #define vd_ramh vdb[ 1] /* base address Video RAM, high byte */
53 #define vd_ramm vdb[ 3] /* base address Video RAM, mid byte */
54 #define vd_raml vdb[13] /* base address Video RAM, low byte */
55 #define vd_ptrh vdb[ 5] /* scan address Video RAM, high byte */
56 #define vd_ptrm vdb[ 7] /* scan address Video RAM, mid byte */
57 #define vd_ptrl vdb[ 9] /* scan address Video RAM, low byte */
58 #define vd_sync vdb[10] /* synchronization mode */
59
60 /* bits in vd_sync: */
61 #define SYNC_EXT 0x01 /* extern sync */
62 #define SYNC_50 0x02 /* 50 Hertz (used for color) */
63
64 /* bits in vd_st_rgb[]: */
65 #define RGB_B 0x0007
66 #define RGB_G 0x0070
67 #define RGB_R 0x0700
68
69 /* some values for vd_st_rgb[]: */
70 #define RGB_BLACK 0x0000
71 #define RGB_RED 0x0700
72 #define RGB_GREEN 0x0070
73 #define RGB_BLUE 0x0007
74 #define RGB_WHITE 0x0777
75 #define RGB_MAGENTA 0x0707
76 #define RGB_CYAN 0x0077
77 #define RGB_YELLOW 0x0770
78 #define RGB_LGREY 0x0555
79 #define RGB_DGREY 0x0222
80
81 /* values for vd_st_res: */
82 #define RES_LOW 0x00 /* 320x200, 16 colors */
83 #define RES_MID 0x01 /* 640x200, 4 colors */
84 #define RES_HIGH 0x02 /* 640x400, monochrome */
85
86 /* masks for vd_tt_res: */
87 #define RES_STLOW 0x0000 /* 320x200, 16 colors */
88 #define RES_STMID 0x0100 /* 640x200, 4 colors */
89 #define RES_STHIGH 0x0200 /* 640x400, monochrome */
90 #define RES_TTMID 0x0400 /* 640x480, 16 colors */
91 #define RES_TTHIGH 0x0600 /* 1280x960, monochrome */
92 #define RES_TTLOW 0x0700 /* 320x480, 256 colors */
93 #define TT_PALLET 0x000f /* Pallette number */
94 #define TT_HYMONO 0x8000 /* Hyper mono mode */
95 #define TT_SHOLD 0x1000 /* Sample/hold mode */
96
97 /*
98 * Yahama YM-2149 Programmable Sound Generator
99 */
100
101 #define SOUND ((struct sound *)AD_SOUND)
102
103 struct sound {
104 char sdb[4]; /* use only the even bytes */
105 };
106
107 #define sd_selr sdb[0] /* select register */
108 #define sd_rdat sdb[0] /* read register data */
109 #define sd_wdat sdb[2] /* write register data */
110
111 /*
112 * Accessing the YM-2149 registers is indirect through ST-specific
113 * circuitry by writing the register number into sd_selr.
114 */
115 #define YM_PA0 0 /* Period Channel A, bits 0-7 */
116 #define YM_PA1 1 /* Period Channel A, bits 8-11 */
117 #define YM_PB0 2 /* Period Channel B, bits 0-7 */
118 #define YM_PB1 3 /* Period Channel B, bits 8-11 */
119 #define YM_PC0 4 /* Period Channel C, bits 0-7 */
120 #define YM_PC1 5 /* Period Channel C, bits 8-11 */
121 #define YM_PNG 6 /* Period Noise Generator, bits 0-4 */
122 #define YM_MFR 7 /* Multi Function Register */
123 #define YM_VA 8 /* Volume Channel A */
124 #define YM_VB 9 /* Volume Channel B */
125 #define YM_VC 10 /* Volume Channel C */
126 #define YM_PE0 11 /* Period Envelope, bits 0-7 */
127 #define YM_PE1 12 /* Period Envelope, bits 8-15 */
128 #define YM_WFE 13 /* Wave Form Envelope */
129 #define YM_IOA 14 /* I/O port A */
130 #define YM_IOB 15 /* I/O port B */
131
132 /* bits in MFR: */
133 #define SA_OFF 0x01 /* Sound Channel A off */
134 #define SB_OFF 0x02 /* Sound Channel B off */
135 #define SC_OFF 0x04 /* Sound Channel C off */
136 #define NA_OFF 0x08 /* Noise Channel A off */
137 #define NB_OFF 0x10 /* Noise Channel B off */
138 #define NC_OFF 0x20 /* Noise Channel C off */
139 #define PA_OUT 0x40 /* Port A for Output */
140 #define PB_OUT 0x80 /* Port B for Output */
141
142 /* bits in Vx: */
143 #define VOLUME 0x0F /* 16 steps */
144 #define ENVELOP 0x10 /* volume steered by envelope */
145
146 /* bits in WFE: */
147 #define WF_HOLD 0x01 /* hold after one period */
148 #define WF_ALTERNAT 0x02 /* up and down (no saw teeth) */
149 #define WF_ATTACK 0x04 /* start up */
150 #define WF_CONTINUE 0x08 /* multiple periods */
151
152 /* names for bits in Port A (ST specific): */
153 #define PA_SIDEB 0x01 /* select floppy head - if double sided */
154 #define PA_FLOP0 0x02 /* Drive Select Floppy 0 */
155 #define PA_FLOP1 0x04 /* Drive Select Floppy 1 */
156 #define PA_SRTS 0x08 /* Serial RTS */
157 #define PA_SDTR 0x10 /* Serial DTR */
158 #define PA_PSTROBE 0x20 /* Parallel Strobe */
159 #define PA_USER 0x40 /* Free Pin on Monitor Connector */
160 /* 0x80 reserved */
161
162 #endif /* _MACHINE_VIDEO_H */
163