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