1 |
2 |
alfik |
/*
|
2 |
|
|
* Copyright (c) 2014, Aleksander Osman
|
3 |
|
|
* All rights reserved.
|
4 |
|
|
*
|
5 |
|
|
* Redistribution and use in source and binary forms, with or without
|
6 |
|
|
* modification, are permitted provided that the following conditions are met:
|
7 |
|
|
*
|
8 |
|
|
* * Redistributions of source code must retain the above copyright notice, this
|
9 |
|
|
* list of conditions and the following disclaimer.
|
10 |
|
|
*
|
11 |
|
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
12 |
|
|
* this list of conditions and the following disclaimer in the documentation
|
13 |
|
|
* and/or other materials provided with the distribution.
|
14 |
|
|
*
|
15 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
16 |
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18 |
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
19 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
20 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
21 |
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22 |
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
23 |
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
24 |
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25 |
|
|
*/
|
26 |
|
|
|
27 |
|
|
package ao486.utils;
|
28 |
|
|
|
29 |
|
|
public class VGAParams {
|
30 |
|
|
public static void main(String args[]) throws Exception {
|
31 |
|
|
int mode_4[] = //320x200 APA
|
32 |
|
|
{
|
33 |
|
|
/* index=0x04 vga mode 0x04 */
|
34 |
|
|
40, 24, 8, 0x00, 0x08, /* tw, th-1, ch, slength */
|
35 |
|
|
0x09, 0x03, 0x00, 0x02, /* sequ_regs */
|
36 |
|
|
0x63, /* miscreg */
|
37 |
|
|
0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f,
|
38 |
|
|
0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
39 |
|
|
0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2,
|
40 |
|
|
0xff, /* crtc_regs */
|
41 |
|
|
0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07,
|
42 |
|
|
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
43 |
|
|
0x01, 0x00, 0x03, 0x00, /* actl_regs */
|
44 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x0f, 0xff, /* grdc_regs */
|
45 |
|
|
};
|
46 |
|
|
|
47 |
|
|
int mode_6[] = //640x200 APA
|
48 |
|
|
{
|
49 |
|
|
/* index=0x06 vga mode 0x06 */
|
50 |
|
|
80, 24, 8, 0x00, 0x10, /* tw, th-1, ch, slength */
|
51 |
|
|
0x01, 0x01, 0x00, 0x06, /* sequ_regs */
|
52 |
|
|
0x63, /* miscreg */
|
53 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
|
54 |
|
|
0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
55 |
|
|
0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xc2,
|
56 |
|
|
0xff, /* crtc_regs */
|
57 |
|
|
0x00, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
|
58 |
|
|
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
|
59 |
|
|
0x01, 0x00, 0x01, 0x00, /* actl_regs */
|
60 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x0f, 0xff, /* grdc_regs */
|
61 |
|
|
};
|
62 |
|
|
|
63 |
|
|
int mode_7[] = //720x400 A/N
|
64 |
|
|
{
|
65 |
|
|
/* index=0x07 vga mode 0x07 */
|
66 |
|
|
80, 24, 16, 0x00, 0x10, /* tw, th-1, ch, slength */
|
67 |
|
|
0x00, 0x03, 0x00, 0x02, /* sequ_regs */
|
68 |
|
|
0x66, /* miscreg */
|
69 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
|
70 |
|
|
0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
|
71 |
|
|
0x9c, 0x8e, 0x8f, 0x28, 0x0f, 0x96, 0xb9, 0xa3,
|
72 |
|
|
0xff, /* crtc_regs */
|
73 |
|
|
0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
|
74 |
|
|
0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
75 |
|
|
0x0e, 0x00, 0x0f, 0x08, /* actl_regs */
|
76 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x0f, 0xff, /* grdc_regs */
|
77 |
|
|
};
|
78 |
|
|
|
79 |
|
|
int mode_d[] = //320x200 APA
|
80 |
|
|
{
|
81 |
|
|
/* index=0x0d vga mode 0x0d */
|
82 |
|
|
40, 24, 8, 0x00, 0x20, /* tw, th-1, ch, slength */
|
83 |
|
|
0x09, 0x0f, 0x00, 0x06, /* sequ_regs */
|
84 |
|
|
0x63, /* miscreg */
|
85 |
|
|
0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f,
|
86 |
|
|
0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
87 |
|
|
0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xe3,
|
88 |
|
|
0xff, /* crtc_regs */
|
89 |
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
90 |
|
|
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
91 |
|
|
0x01, 0x00, 0x0f, 0x00, /* actl_regs */
|
92 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff, /* grdc_regs */
|
93 |
|
|
};
|
94 |
|
|
|
95 |
|
|
int mode_e[] = //640x200 APA
|
96 |
|
|
{
|
97 |
|
|
/* index=0x0e vga mode 0x0e */
|
98 |
|
|
80, 24, 8, 0x00, 0x40, /* tw, th-1, ch, slength */
|
99 |
|
|
0x01, 0x0f, 0x00, 0x06, /* sequ_regs */
|
100 |
|
|
0x63, /* miscreg */
|
101 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
|
102 |
|
|
0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
103 |
|
|
0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xe3,
|
104 |
|
|
0xff, /* crtc_regs */
|
105 |
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
106 |
|
|
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
107 |
|
|
0x01, 0x00, 0x0f, 0x00, /* actl_regs */
|
108 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff, /* grdc_regs */
|
109 |
|
|
};
|
110 |
|
|
|
111 |
|
|
int mode_f[] = //640x350
|
112 |
|
|
{
|
113 |
|
|
/* index=0x11 vga mode 0x0f */
|
114 |
|
|
80, 24, 14, 0x00, 0x80, /* tw, th-1, ch, slength */
|
115 |
|
|
0x01, 0x0f, 0x00, 0x06, /* sequ_regs */
|
116 |
|
|
0xa3, /* miscreg */
|
117 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
|
118 |
|
|
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
119 |
|
|
0x83, 0x85, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3,
|
120 |
|
|
0xff, /* crtc_regs */
|
121 |
|
|
0x00, 0x08, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
|
122 |
|
|
0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
|
123 |
|
|
0x01, 0x00, 0x01, 0x00, /* actl_regs */
|
124 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff, /* grdc_regs */
|
125 |
|
|
};
|
126 |
|
|
|
127 |
|
|
int mode_10[] = //640x350
|
128 |
|
|
{
|
129 |
|
|
/* index=0x12 vga mode 0x10 */
|
130 |
|
|
80, 24, 14, 0x00, 0x80, /* tw, th-1, ch, slength */
|
131 |
|
|
0x01, 0x0f, 0x00, 0x06, /* sequ_regs */
|
132 |
|
|
0xa3, /* miscreg */
|
133 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
|
134 |
|
|
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
135 |
|
|
0x83, 0x85, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3,
|
136 |
|
|
0xff, /* crtc_regs */
|
137 |
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
|
138 |
|
|
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
139 |
|
|
0x01, 0x00, 0x0f, 0x00, /* actl_regs */
|
140 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff, /* grdc_regs */
|
141 |
|
|
};
|
142 |
|
|
|
143 |
|
|
int mode_1[] = //360x400
|
144 |
|
|
{
|
145 |
|
|
/* index=0x17 vga mode 0x01 */
|
146 |
|
|
40, 24, 16, 0x00, 0x08, /* tw, th-1, ch, slength */
|
147 |
|
|
0x08, 0x03, 0x00, 0x02, /* sequ_regs */
|
148 |
|
|
0x67, /* miscreg */
|
149 |
|
|
0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f,
|
150 |
|
|
0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
|
151 |
|
|
0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3,
|
152 |
|
|
0xff, /* crtc_regs */
|
153 |
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
|
154 |
|
|
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
155 |
|
|
0x0c, 0x00, 0x0f, 0x08, /* actl_regs */
|
156 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x0f, 0xff, /* grdc_regs */
|
157 |
|
|
};
|
158 |
|
|
|
159 |
|
|
int mode_3[] = //720x400
|
160 |
|
|
{
|
161 |
|
|
/* index=0x18 vga mode 0x03 */
|
162 |
|
|
80, 24, 16, 0x00, 0x10, /* tw, th-1, ch, slength */
|
163 |
|
|
0x00, 0x03, 0x00, 0x02, /* sequ_regs */
|
164 |
|
|
0x67, /* miscreg */
|
165 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
|
166 |
|
|
0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
|
167 |
|
|
0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3,
|
168 |
|
|
0xff, /* crtc_regs */
|
169 |
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
|
170 |
|
|
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
171 |
|
|
0x0c, 0x00, 0x0f, 0x08, /* actl_regs */
|
172 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x0f, 0xff, /* grdc_regs */
|
173 |
|
|
};
|
174 |
|
|
|
175 |
|
|
int mode_7_2[] = //720x400
|
176 |
|
|
{
|
177 |
|
|
/* index=0x19 vga mode 0x07 */
|
178 |
|
|
80, 24, 16, 0x00, 0x10, /* tw, th-1, ch, slength */
|
179 |
|
|
0x00, 0x03, 0x00, 0x02, /* sequ_regs */
|
180 |
|
|
0x66, /* miscreg */
|
181 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
|
182 |
|
|
0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
|
183 |
|
|
0x9c, 0x8e, 0x8f, 0x28, 0x0f, 0x96, 0xb9, 0xa3,
|
184 |
|
|
0xff, /* crtc_regs */
|
185 |
|
|
0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
|
186 |
|
|
0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
187 |
|
|
0x0e, 0x00, 0x0f, 0x08, /* actl_regs */
|
188 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x0f, 0xff, /* grdc_regs */
|
189 |
|
|
};
|
190 |
|
|
|
191 |
|
|
int mode_11[] = //640x480
|
192 |
|
|
{
|
193 |
|
|
/* index=0x1a vga mode 0x11 */
|
194 |
|
|
80, 29, 16, 0x00, 0x00, /* tw, th-1, ch, slength */
|
195 |
|
|
0x01, 0x0f, 0x00, 0x06, /* sequ_regs */
|
196 |
|
|
0xe3, /* miscreg */
|
197 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
|
198 |
|
|
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
199 |
|
|
0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
|
200 |
|
|
0xff, /* crtc_regs */
|
201 |
|
|
0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f,
|
202 |
|
|
0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f,
|
203 |
|
|
0x01, 0x00, 0x0f, 0x00, /* actl_regs */
|
204 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff, /* grdc_regs */
|
205 |
|
|
};
|
206 |
|
|
|
207 |
|
|
int mode_12[] = //640x480
|
208 |
|
|
{
|
209 |
|
|
/* index=0x1b vga mode 0x12 */
|
210 |
|
|
80, 29, 16, 0x00, 0x00, /* tw, th-1, ch, slength */
|
211 |
|
|
0x01, 0x0f, 0x00, 0x06, /* sequ_regs */
|
212 |
|
|
0xe3, /* miscreg */
|
213 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
|
214 |
|
|
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
215 |
|
|
0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
|
216 |
|
|
0xff, /* crtc_regs */
|
217 |
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
|
218 |
|
|
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
219 |
|
|
0x01, 0x00, 0x0f, 0x00, /* actl_regs */
|
220 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff, /* grdc_regs */
|
221 |
|
|
};
|
222 |
|
|
|
223 |
|
|
int mode_13[] = //320x200
|
224 |
|
|
{
|
225 |
|
|
/* index=0x1c vga mode 0x13 */
|
226 |
|
|
40, 24, 8, 0x00, 0x00, /* tw, th-1, ch, slength */
|
227 |
|
|
0x01, 0x0f, 0x00, 0x0e, /* sequ_regs */
|
228 |
|
|
0x63, /* miscreg */
|
229 |
|
|
0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
|
230 |
|
|
0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
231 |
|
|
0x9c, 0x8e, 0x8f, 0x28, 0x40, 0x96, 0xb9, 0xa3,
|
232 |
|
|
0xff, /* crtc_regs */
|
233 |
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
234 |
|
|
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
235 |
|
|
0x41, 0x00, 0x0f, 0x00, /* actl_regs */
|
236 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, 0xff, /* grdc_regs */
|
237 |
|
|
};
|
238 |
|
|
|
239 |
|
|
int mode_6a[] = //800x600
|
240 |
|
|
{
|
241 |
|
|
/* index=0x1d vga mode 0x6a */
|
242 |
|
|
100, 36, 16, 0x00, 0x00, /* tw, th-1, ch, slength */
|
243 |
|
|
0x01, 0x0f, 0x00, 0x06, /* sequ_regs */
|
244 |
|
|
0xe3, /* miscreg */
|
245 |
|
|
0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0,
|
246 |
|
|
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
247 |
|
|
0x59, 0x8d, 0x57, 0x32, 0x00, 0x57, 0x73, 0xe3,
|
248 |
|
|
0xff, /* crtc_regs */
|
249 |
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
|
250 |
|
|
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
251 |
|
|
0x01, 0x00, 0x0f, 0x00, /* actl_regs */
|
252 |
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff, /* grdc_regs */
|
253 |
|
|
};
|
254 |
|
|
|
255 |
|
|
int vals[] = mode_1;
|
256 |
|
|
|
257 |
|
|
int seq1 = vals[5];
|
258 |
|
|
boolean seq_9pixel_char = ((seq1 >> 0) & 1) == 0;
|
259 |
|
|
boolean seq_dotclock_divided = ((seq1 >> 3) & 1) == 1;
|
260 |
|
|
|
261 |
|
|
int crtc0 = vals[10+0];
|
262 |
|
|
int crtc1 = vals[10+1];
|
263 |
|
|
int crtc2 = vals[10+2];
|
264 |
|
|
int crtc3 = vals[10+3];
|
265 |
|
|
int crtc4 = vals[10+4];
|
266 |
|
|
int crtc5 = vals[10+5];
|
267 |
|
|
int crtc6 = vals[10+6];
|
268 |
|
|
int crtc7 = vals[10+7];
|
269 |
|
|
int crtc9 = vals[10+9];
|
270 |
|
|
int crtc16= vals[10+16];
|
271 |
|
|
int crtc17= vals[10+17];
|
272 |
|
|
int crtc18= vals[10+18];
|
273 |
|
|
int crtc21= vals[10+21];
|
274 |
|
|
int crtc22= vals[10+22];
|
275 |
|
|
|
276 |
|
|
int misc = vals[9];
|
277 |
|
|
|
278 |
|
|
//---
|
279 |
|
|
|
280 |
|
|
int crtc_horizontal_total = crtc0 & 0xFF;
|
281 |
|
|
|
282 |
|
|
int crtc_horizontal_display_size = crtc1 & 0xFF;
|
283 |
|
|
|
284 |
|
|
int crtc_horizontal_blanking_start = crtc2 & 0xFF;
|
285 |
|
|
|
286 |
|
|
int crtc_horizontal_blanking_end = ((crtc5 >> 2) & 0x20) | (crtc3 & 0x1F);
|
287 |
|
|
|
288 |
|
|
int horiz_blank = 1;
|
289 |
|
|
while(((crtc_horizontal_blanking_start + horiz_blank) & 0x3F) != crtc_horizontal_blanking_end) horiz_blank++;
|
290 |
|
|
|
291 |
|
|
int crtc_horizontal_retrace_start = (crtc4 & 0xFF) + ((crtc5 >> 5) & 3);
|
292 |
|
|
|
293 |
|
|
int crtc_horizontal_retrace_end = crtc5 & 0x1F;
|
294 |
|
|
|
295 |
|
|
int horiz_retrace = 1;
|
296 |
|
|
while(((crtc_horizontal_retrace_start + horiz_retrace) & 0x1F) != crtc_horizontal_retrace_end) horiz_retrace++;
|
297 |
|
|
|
298 |
|
|
int crtc_vertical_total = ((crtc7 << 4) & 0x200) | ((crtc7 << 8) & 0x100) | (crtc6 & 0xFF);
|
299 |
|
|
|
300 |
|
|
boolean crtc_vertical_doublescan = ((crtc9 >> 7) & 1) == 1;
|
301 |
|
|
|
302 |
|
|
int crtc_vertical_retrace_start = ((crtc7 << 2) & 0x200) | ((crtc7 << 6) & 0x100) | (crtc16 & 0xFF);
|
303 |
|
|
|
304 |
|
|
int crtc_vertical_retrace_end = crtc17 & 0xF;
|
305 |
|
|
|
306 |
|
|
int vert_retrace = 1;
|
307 |
|
|
while(((crtc_vertical_retrace_start + vert_retrace) & 0xF) != crtc_vertical_retrace_end) vert_retrace++;
|
308 |
|
|
|
309 |
|
|
int crtc_vertical_display_size = ((crtc7 << 3) & 0x200) | ((crtc7 << 7) & 0x100) | (crtc18 & 0xFF);
|
310 |
|
|
|
311 |
|
|
int crtc_vertical_blanking_start = ((crtc9 << 4) & 0x200) | ((crtc7 << 5) & 0x100) | (crtc21 & 0xFF);
|
312 |
|
|
|
313 |
|
|
int crtc_vertical_blanking_end = crtc22 & 0x7F;
|
314 |
|
|
|
315 |
|
|
int vert_blank = 1;
|
316 |
|
|
while(((crtc_vertical_blanking_start + vert_blank) & 0x7F) != crtc_vertical_blanking_end) vert_blank++;
|
317 |
|
|
|
318 |
|
|
boolean general_vsync = ((misc >> 7) & 1) == 1;
|
319 |
|
|
boolean general_hsync = ((misc >> 6) & 1) == 1;
|
320 |
|
|
|
321 |
|
|
//---------------
|
322 |
|
|
|
323 |
|
|
System.out.printf("wire seq_9pixel_char = 1'b%d;\n",
|
324 |
|
|
seq_9pixel_char? 1 : 0);
|
325 |
|
|
System.out.printf("wire seq_dotclock_divided = 1'b%d;\n",
|
326 |
|
|
seq_dotclock_divided? 1 : 0);
|
327 |
|
|
|
328 |
|
|
System.out.println("");
|
329 |
|
|
|
330 |
|
|
System.out.printf("wire [7:0] crtc_horizontal_total = 8'd%d; // +5 real value\n",
|
331 |
|
|
crtc_horizontal_total);
|
332 |
|
|
System.out.printf("wire [7:0] crtc_horizontal_display_size = 8'd%d; // +1 for full display size\n",
|
333 |
|
|
crtc_horizontal_display_size);
|
334 |
|
|
System.out.printf("wire [7:0] crtc_horizontal_blanking_start = 8'd%d; // start on this character\n",
|
335 |
|
|
crtc_horizontal_blanking_start);
|
336 |
|
|
System.out.printf("wire [5:0] crtc_horizontal_blanking_end = 6'd%d; // blank for %d character clocks (one side); last %d; %d first after\n",
|
337 |
|
|
crtc_horizontal_blanking_end, horiz_blank, crtc_horizontal_blanking_start+horiz_blank-1, crtc_horizontal_blanking_start+horiz_blank);
|
338 |
|
|
System.out.printf("wire [7:0] crtc_horizontal_retrace_start = 8'd%d; // start on this\n",
|
339 |
|
|
crtc_horizontal_retrace_start);
|
340 |
|
|
System.out.printf("wire [4:0] crtc_horizontal_retrace_end = 5'd%d; // retrace for %d character clocks (one side); last %d; %d first after\n",
|
341 |
|
|
crtc_horizontal_retrace_end, horiz_retrace, crtc_horizontal_retrace_start+horiz_retrace-1, crtc_horizontal_retrace_start+horiz_retrace);
|
342 |
|
|
|
343 |
|
|
System.out.println("");
|
344 |
|
|
|
345 |
|
|
System.out.printf("wire [9:0] crtc_vertical_total = 10'd%d;\n",
|
346 |
|
|
crtc_vertical_total);
|
347 |
|
|
System.out.printf("wire [9:0] crtc_vertical_display_size = 10'd%d; // 0-%d active display = %d lines\n",
|
348 |
|
|
crtc_vertical_display_size,crtc_vertical_display_size,crtc_vertical_display_size+1);
|
349 |
|
|
System.out.printf("wire [9:0] crtc_vertical_blanking_start = 10'd%d; // starts on this line\n",
|
350 |
|
|
crtc_vertical_blanking_start);
|
351 |
|
|
System.out.printf("wire [6:0] crtc_vertical_blanking_end = 7'd%d; // %d lines (one side); last %d; %d first after\n",
|
352 |
|
|
crtc_vertical_blanking_end,vert_blank,crtc_vertical_blanking_start+vert_blank-1,crtc_vertical_blanking_start+vert_blank);
|
353 |
|
|
System.out.printf("wire [9:0] crtc_vertical_retrace_start = 10'd%d; // starts on this line\n",
|
354 |
|
|
crtc_vertical_retrace_start);
|
355 |
|
|
System.out.printf("wire [3:0] crtc_vertical_retrace_end = 4'd%d; // %d lines (one side); last %d; %d first after\n",
|
356 |
|
|
crtc_vertical_retrace_end,vert_retrace,crtc_vertical_retrace_start+vert_retrace-1,crtc_vertical_retrace_start+vert_retrace);
|
357 |
|
|
|
358 |
|
|
System.out.println("");
|
359 |
|
|
|
360 |
|
|
System.out.printf("wire crtc_vertical_doublescan = 1'b%d;\n", crtc_vertical_doublescan? 1 : 0);
|
361 |
|
|
|
362 |
|
|
System.out.printf("wire general_vsync = 1'b%d; //pusle is ~(general_vsync)\n",
|
363 |
|
|
general_vsync? 1 : 0);
|
364 |
|
|
System.out.printf("wire general_hsync = 1'b%d; //pusle is ~(general_vsync)\n",
|
365 |
|
|
general_hsync? 1 : 0);
|
366 |
|
|
}
|
367 |
|
|
}
|