grfabs_ccglb.c revision 1.3 1 1.1 chopps /*
2 1.1 chopps * Copyright (c) 1994 Christian E. Hopps
3 1.1 chopps * All rights reserved.
4 1.1 chopps *
5 1.1 chopps * Redistribution and use in source and binary forms, with or without
6 1.1 chopps * modification, are permitted provided that the following conditions
7 1.1 chopps * are met:
8 1.1 chopps * 1. Redistributions of source code must retain the above copyright
9 1.1 chopps * notice, this list of conditions and the following disclaimer.
10 1.1 chopps * 2. Redistributions in binary form must reproduce the above copyright
11 1.1 chopps * notice, this list of conditions and the following disclaimer in the
12 1.1 chopps * documentation and/or other materials provided with the distribution.
13 1.1 chopps * 3. All advertising materials mentioning features or use of this software
14 1.1 chopps * must display the following acknowledgement:
15 1.1 chopps * This product includes software developed by Christian E. Hopps.
16 1.1 chopps * 4. The name of the author may not be used to endorse or promote products
17 1.1 chopps * derived from this software without specific prior written permission
18 1.1 chopps *
19 1.1 chopps * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 1.1 chopps * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 1.1 chopps * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 1.1 chopps * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 1.1 chopps * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 1.1 chopps * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 1.1 chopps * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 1.1 chopps * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 1.1 chopps * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 1.1 chopps * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 1.1 chopps *
30 1.3 chopps * $Id: grfabs_ccglb.c,v 1.3 1994/03/27 06:23:32 chopps Exp $
31 1.1 chopps */
32 1.1 chopps
33 1.1 chopps #include <sys/types.h>
34 1.3 chopps #include <sys/queue.h>
35 1.3 chopps
36 1.1 chopps #include <amiga/amiga/cc.h>
37 1.1 chopps #include <amiga/dev/grfabs_reg.h>
38 1.1 chopps #include <amiga/dev/grfabs_ccreg.h>
39 1.1 chopps
40 1.1 chopps /* the custom thips monitor */
41 1.1 chopps monitor_t *cc_monitor;
42 1.1 chopps
43 1.1 chopps cop_t std_copper_list[] = {
44 1.1 chopps { CI_WAIT (0, 12), 0xfffe },
45 1.1 chopps #if defined (GRF_ECS)
46 1.1 chopps { R_BEAMCON0, 0x0000 },
47 1.1 chopps { R_BPLCON3, 0x0020 }, /* enable border blank */
48 1.1 chopps #endif
49 1.1 chopps /* bit plane pointers */
50 1.1 chopps { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 },
51 1.1 chopps { R_BPL1PTH, 0x0000 }, { R_BPL1PTL, 0x0000 },
52 1.1 chopps { R_BPL2PTH, 0x0000 }, { R_BPL2PTL, 0x0000 },
53 1.1 chopps { R_BPL3PTH, 0x0000 }, { R_BPL3PTL, 0x0000 },
54 1.1 chopps { R_BPL4PTH, 0x0000 }, { R_BPL4PTL, 0x0000 },
55 1.1 chopps { R_BPL5PTH, 0x0000 }, { R_BPL5PTL, 0x0000 },
56 1.1 chopps { R_BPL6PTH, 0x0000 }, { R_BPL6PTL, 0x0000 },
57 1.1 chopps { R_BPL7PTH, 0x0000 }, { R_BPL7PTL, 0x0000 },
58 1.1 chopps /* view specific stuff. */
59 1.1 chopps { R_BPL1MOD, 0x0000 },
60 1.1 chopps { R_BPL2MOD, 0x0000 },
61 1.1 chopps { R_DIWSTRT, 0xffff },
62 1.1 chopps { R_BPLCON0, 0x0000 },
63 1.1 chopps { R_DIWSTOP, 0x0000 },
64 1.1 chopps #if defined (GRF_ECS)
65 1.1 chopps { R_DIWHIGH, 0x0000 },
66 1.1 chopps #endif
67 1.1 chopps { R_DDFSTRT, 0x0000 },
68 1.1 chopps { R_DDFSTOP, 0x0000 },
69 1.1 chopps { R_BPLCON1, 0x0000 },
70 1.1 chopps /* colors */
71 1.1 chopps { R_COLOR00, 0x0779 }, { R_COLOR01, 0x0000 }, { R_COLOR02, 0x0FFF }, { R_COLOR03, 0x068B },
72 1.1 chopps { R_COLOR04, 0x000f }, { R_COLOR05, 0x0f0f }, { R_COLOR06, 0x00ff }, { R_COLOR07, 0x0fff },
73 1.1 chopps { R_COLOR08, 0x0620 }, { R_COLOR09, 0x0e50 }, { R_COLOR0A, 0x09f1 }, { R_COLOR0B, 0x0eb0 },
74 1.1 chopps { R_COLOR0C, 0x055f }, { R_COLOR0D, 0x092f }, { R_COLOR0E, 0x00f8 }, { R_COLOR0F, 0x0ccc },
75 1.1 chopps { R_COLOR10, 0x0e44 }, { R_COLOR11, 0x0e44 }, { R_COLOR12, 0x0000 }, { R_COLOR13, 0x0eec },
76 1.1 chopps { R_COLOR14, 0x0444 }, { R_COLOR15, 0x0555 }, { R_COLOR16, 0x0666 }, { R_COLOR17, 0x0777 },
77 1.1 chopps { R_COLOR18, 0x0888 }, { R_COLOR19, 0x0999 }, { R_COLOR1A, 0x0aaa }, { R_COLOR1B, 0x0bbb },
78 1.1 chopps { R_COLOR1C, 0x0ccc }, { R_COLOR1D, 0x0ddd }, { R_COLOR1E, 0x0eee }, { R_COLOR1F, 0x0fff },
79 1.1 chopps { R_COP1LCH, 0x0000 }, { R_COP1LCL, 0x0000 },
80 1.1 chopps { 0xffff, 0xfffe }, { 0xffff, 0xfffe } /* COPEND, COPEND */
81 1.1 chopps };
82 1.1 chopps
83 1.1 chopps /* standard custom chips copper list. */
84 1.1 chopps int std_copper_list_len = sizeof (std_copper_list) / sizeof (cop_t);
85 1.1 chopps int std_copper_list_size = sizeof (std_copper_list);
86 1.1 chopps
87 1.1 chopps
88 1.1 chopps #if defined (GRF_A2024)
89 1.1 chopps cop_t std_dlace_copper_list[] = {
90 1.1 chopps { CI_WAIT(0,12), 0xfffe }, /* WAIT (0, 12) */
91 1.1 chopps #if defined (GRF_ECS)
92 1.1 chopps { R_BEAMCON0, 0x0000 },
93 1.1 chopps { R_BPLCON3, 0x0020 }, /* enable border blank */
94 1.1 chopps #endif
95 1.1 chopps /* colors */
96 1.1 chopps { R_COLOR00, 0x0000 }, { R_COLOR01, 0x0000 }, { R_COLOR02, 0x0000 }, { R_COLOR03, 0x0000 },
97 1.1 chopps { R_COLOR04, 0x0000 }, { R_COLOR05, 0x0000 }, { R_COLOR06, 0x0000 }, { R_COLOR07, 0x0000 },
98 1.1 chopps { R_COLOR08, 0x0000 }, { R_COLOR09, 0x0000 }, { R_COLOR0A, 0x0000}, { R_COLOR0B, 0x0000 },
99 1.1 chopps { R_COLOR0C, 0x0000 }, { R_COLOR0D, 0x0000 }, { R_COLOR0E, 0x0000}, { R_COLOR0F, 0x0000 },
100 1.1 chopps { R_COLOR10, 0x0009 }, { R_COLOR11, 0x0009 }, { R_COLOR12, 0x0001 }, { R_COLOR13, 0x0809 },
101 1.1 chopps { R_COLOR14, 0x0009 }, { R_COLOR15, 0x0009 }, { R_COLOR16, 0x0001 }, { R_COLOR17, 0x0809 },
102 1.1 chopps { R_COLOR18, 0x0008 }, { R_COLOR19, 0x0008 }, { R_COLOR1A, 0x0000 }, { R_COLOR1B, 0x0808 },
103 1.1 chopps { R_COLOR1C, 0x0089 }, { R_COLOR1D, 0x0089 }, { R_COLOR1E, 0x0081 }, { R_COLOR1F, 0x0889 },
104 1.1 chopps /* set the registers up. */
105 1.1 chopps { R_DIWSTRT, 0xffff },
106 1.1 chopps { R_BPLCON0, 0x0000 },
107 1.1 chopps { R_DIWSTOP, 0x0000 },
108 1.1 chopps #if defined (GRF_ECS)
109 1.1 chopps { R_DIWHIGH, 0x0000 },
110 1.1 chopps #endif
111 1.1 chopps { R_DDFSTRT, 0x0000 },
112 1.1 chopps { R_DDFSTOP, 0x0000 },
113 1.1 chopps { R_BPLCON1, 0x0000 },
114 1.1 chopps /* view specific stuff. */
115 1.1 chopps { R_BPL1MOD, 0x0000 },
116 1.1 chopps { R_BPL2MOD, 0x0000 },
117 1.1 chopps /* bit plane pointers */
118 1.1 chopps { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 },
119 1.1 chopps { R_BPL1PTH, 0x0000 }, { R_BPL1PTL, 0x0000 },
120 1.1 chopps { R_BPL2PTH, 0x0000 }, { R_BPL2PTL, 0x0000 },
121 1.1 chopps { R_BPL3PTH, 0x0000 }, { R_BPL3PTL, 0x0000 },
122 1.1 chopps { R_COP1LCH, 0x0000 }, { R_COP1LCL, 0x0000 },
123 1.1 chopps { 0xffff, 0xfffe }, { 0xffff, 0xfffe } /* COPEND, COPEND */
124 1.1 chopps };
125 1.1 chopps int std_dlace_copper_list_len = sizeof (std_dlace_copper_list) / sizeof (cop_t);
126 1.1 chopps int std_dlace_copper_list_size = sizeof (std_dlace_copper_list);
127 1.1 chopps
128 1.1 chopps cop_t std_a2024_copper_list[] = {
129 1.1 chopps { CI_WAIT(0,12), 0xfffe }, /* WAIT (0, 12) */
130 1.1 chopps #if defined (GRF_ECS)
131 1.1 chopps { R_BEAMCON0, 0x0000 },
132 1.1 chopps #endif
133 1.1 chopps /* hedley card init setup section */
134 1.1 chopps { R_COLOR00, 0x0f00 },
135 1.1 chopps { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 }, /* init plane of 1's with first set for centering */
136 1.1 chopps { R_DIWSTRT, 0x1561 }, { R_DIWSTOP, 0x16d1 },
137 1.1 chopps #if defined (GRF_ECS)
138 1.1 chopps { R_DIWHIGH, 0x2000 },
139 1.1 chopps #endif
140 1.1 chopps { R_DDFSTRT, 0x0040 }, { R_DDFSTOP, 0x00d0 },
141 1.1 chopps { R_BPLCON0, 0x9200 },
142 1.1 chopps /* actual data that will be latched by hedley card. */
143 1.1 chopps { R_COLOR01, 0x0001 }, /* Stuff1 */
144 1.1 chopps { CI_WAIT(126,21), 0xfffe }, { R_COLOR01, 0x0001 }, /* Display Quadrent */
145 1.1 chopps { CI_WAIT(158,21), 0xfffe }, { R_COLOR01, 0x08f0 }, /* Stuff */
146 1.1 chopps { CI_WAIT(190,21), 0xfffe }, { R_COLOR01, 0x0ff1 }, /* Stuff2 */
147 1.1 chopps { CI_WAIT(0,22), 0xfffe },
148 1.1 chopps { R_COLOR00, 0x0000 }, { R_BPLCON0, 0x0000 },
149 1.1 chopps { CI_WAIT(0,43), 0xfffe },
150 1.1 chopps /* set the registers up. */
151 1.1 chopps { R_COLOR00, 0x0009 }, { R_COLOR01, 0x0001 }, { R_COLOR02, 0x0008 }, { R_COLOR03, 0x0000 },
152 1.1 chopps { R_COLOR04, 0x0809 }, { R_COLOR05, 0x0801 }, { R_COLOR06, 0x0808 }, { R_COLOR07, 0x0800 },
153 1.1 chopps { R_COLOR08, 0x0089 }, { R_COLOR09, 0x0081 }, { R_COLOR0A, 0x0088 }, { R_COLOR0B, 0x0080 },
154 1.1 chopps { R_COLOR0C, 0x0889 }, { R_COLOR0D, 0x0881 }, { R_COLOR0E, 0x0888 }, { R_COLOR0F, 0x0880 },
155 1.1 chopps { R_COLOR10, 0x0009 }, { R_COLOR11, 0x0009 }, { R_COLOR12, 0x0001 }, { R_COLOR13, 0x0809 },
156 1.1 chopps { R_COLOR14, 0x0009 }, { R_COLOR15, 0x0009 }, { R_COLOR16, 0x0001 }, { R_COLOR17, 0x0809 },
157 1.1 chopps { R_COLOR18, 0x0008 }, { R_COLOR19, 0x0008 }, { R_COLOR1A, 0x0000 }, { R_COLOR1B, 0x0808 },
158 1.1 chopps { R_COLOR1C, 0x0089 }, { R_COLOR1D, 0x0089 }, { R_COLOR1E, 0x0081 }, { R_COLOR1F, 0x0889 },
159 1.1 chopps /* window size. */
160 1.1 chopps { R_DIWSTRT, 0x2c81 }, { R_BPLCON0, 0x0000 }, { R_DIWSTOP, 0xf481 },
161 1.1 chopps /* datafetch */
162 1.1 chopps { R_DDFSTRT, 0x0038 }, { R_DDFSTOP, 0x00b8 },
163 1.1 chopps { R_BPLCON1, 0x0000 },
164 1.1 chopps { R_BPL1MOD, 0x00bc }, { R_BPL2MOD, 0x00bc },
165 1.1 chopps /* bitplanes */
166 1.1 chopps { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 },
167 1.1 chopps { R_BPL1PTH, 0x0000 }, { R_BPL1PTL, 0x0000 },
168 1.1 chopps { R_BPL2PTH, 0x0000 }, { R_BPL2PTL, 0x0000 },
169 1.1 chopps { R_BPL3PTH, 0x0000 }, { R_BPL3PTL, 0x0000 },
170 1.1 chopps #if defined (GRF_ECS)
171 1.1 chopps { R_DIWHIGH, 0x2000 },
172 1.1 chopps #endif
173 1.1 chopps { R_COP1LCH, 0x0000 }, { R_COP1LCL, 0x0000 },
174 1.1 chopps { 0xffff, 0xfffe }, { 0xffff, 0xfffe } /* COPEND, COPEND */
175 1.1 chopps };
176 1.1 chopps int std_a2024_copper_list_len = sizeof (std_a2024_copper_list) / sizeof (cop_t);
177 1.1 chopps int std_a2024_copper_list_size = sizeof (std_a2024_copper_list);
178 1.1 chopps
179 1.1 chopps cop_t std_pal_a2024_copper_list[] = {
180 1.1 chopps { CI_WAIT(0,20), 0xfffe }, /* WAIT (0, 12) */
181 1.1 chopps #if defined (GRF_ECS)
182 1.1 chopps { R_BEAMCON0, STANDARD_PAL_BEAMCON },
183 1.1 chopps #endif
184 1.1 chopps /* hedley card init setup section */
185 1.1 chopps { R_COLOR00, 0x0f00 },
186 1.1 chopps { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 }, /* init plane of 1's with first set for centering */
187 1.1 chopps { R_DIWSTRT, 0x1d61 }, { R_DIWSTOP, 0x1ed1 },
188 1.1 chopps #if defined (GRF_ECS)
189 1.1 chopps { R_DIWHIGH, 0x2000 },
190 1.1 chopps #endif
191 1.1 chopps { R_DDFSTRT, 0x0040 }, { R_DDFSTOP, 0x00d0 },
192 1.1 chopps { R_BPLCON0, 0x9200 },
193 1.1 chopps /* actual data that will be latched by hedley card. */
194 1.1 chopps { R_COLOR01, 0x0001 }, /* Stuff1 */
195 1.1 chopps { CI_WAIT(126,29), 0xfffe }, { R_COLOR01, 0x0001 }, /* Display Quadrent */
196 1.1 chopps { CI_WAIT(158,29), 0xfffe }, { R_COLOR01, 0x08f0 }, /* Stuff */
197 1.1 chopps { CI_WAIT(190,29), 0xfffe }, { R_COLOR01, 0x0ff1 }, /* Stuff2 */
198 1.1 chopps { CI_WAIT(0,30), 0xfffe },
199 1.1 chopps { R_COLOR00, 0x0000 }, { R_BPLCON0, 0x0000 },
200 1.1 chopps { CI_WAIT(0,43), 0xfffe },
201 1.1 chopps
202 1.1 chopps /* set the registers up. */
203 1.1 chopps { R_COLOR00, 0x0009 }, { R_COLOR01, 0x0001 }, { R_COLOR02, 0x0008 }, { R_COLOR03, 0x0000 },
204 1.1 chopps { R_COLOR04, 0x0809 }, { R_COLOR05, 0x0801 }, { R_COLOR06, 0x0808 }, { R_COLOR07, 0x0800 },
205 1.1 chopps { R_COLOR08, 0x0089 }, { R_COLOR09, 0x0081 }, { R_COLOR0A, 0x0088 }, { R_COLOR0B, 0x0080 },
206 1.1 chopps { R_COLOR0C, 0x0889 }, { R_COLOR0D, 0x0881 }, { R_COLOR0E, 0x0888 }, { R_COLOR0F, 0x0880 },
207 1.1 chopps { R_COLOR10, 0x0009 }, { R_COLOR11, 0x0009 }, { R_COLOR12, 0x0001 }, { R_COLOR13, 0x0809 },
208 1.1 chopps { R_COLOR14, 0x0009 }, { R_COLOR15, 0x0009 }, { R_COLOR16, 0x0001 }, { R_COLOR17, 0x0809 },
209 1.1 chopps { R_COLOR18, 0x0008 }, { R_COLOR19, 0x0008 }, { R_COLOR1A, 0x0000 }, { R_COLOR1B, 0x0808 },
210 1.1 chopps { R_COLOR1C, 0x0089 }, { R_COLOR1D, 0x0089 }, { R_COLOR1E, 0x0081 }, { R_COLOR1F, 0x0889 },
211 1.1 chopps /* window size. */
212 1.1 chopps { R_DIWSTRT, 0x2c81 }, { R_BPLCON0, 0x0000 }, { R_DIWSTOP, 0x2c81 },
213 1.1 chopps /* datafetch */
214 1.1 chopps { R_DDFSTRT, 0x0038 }, { R_DDFSTOP, 0x00b8 },
215 1.1 chopps { R_BPLCON1, 0x0000 },
216 1.1 chopps { R_BPL1MOD, 0x00bc }, { R_BPL2MOD, 0x00bc },
217 1.1 chopps /* bitplanes */
218 1.1 chopps { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 },
219 1.1 chopps { R_BPL1PTH, 0x0000 }, { R_BPL1PTL, 0x0000 },
220 1.1 chopps { R_BPL2PTH, 0x0000 }, { R_BPL2PTL, 0x0000 },
221 1.1 chopps { R_BPL3PTH, 0x0000 }, { R_BPL3PTL, 0x0000 },
222 1.1 chopps #if defined (GRF_ECS)
223 1.1 chopps { R_DIWHIGH, 0x2100 },
224 1.1 chopps #endif
225 1.1 chopps { R_COP1LCH, 0x0000 }, { R_COP1LCL, 0x0000 },
226 1.1 chopps { 0xffff, 0xfffe }, { 0xffff, 0xfffe } /* COPEND, COPEND */
227 1.1 chopps };
228 1.1 chopps int std_pal_a2024_copper_list_len = sizeof (std_pal_a2024_copper_list) / sizeof (cop_t);
229 1.1 chopps int std_pal_a2024_copper_list_size = sizeof (std_pal_a2024_copper_list);
230 1.1 chopps
231 1.1 chopps /* color tables for figuring color regs for 2024 */
232 1.1 chopps u_short a2024_color_value_line0[4] = {
233 1.1 chopps A2024_L0_BLACK,
234 1.1 chopps A2024_L0_DGREY,
235 1.1 chopps A2024_L0_LGREY,
236 1.1 chopps A2024_L0_WHITE
237 1.1 chopps };
238 1.1 chopps
239 1.1 chopps u_short a2024_color_value_line1[4] = {
240 1.1 chopps A2024_L1_BLACK,
241 1.1 chopps A2024_L1_DGREY,
242 1.1 chopps A2024_L1_LGREY,
243 1.1 chopps A2024_L1_WHITE
244 1.1 chopps };
245 1.1 chopps
246 1.1 chopps #endif /* GRF_A2024 */
247 1.1 chopps
248 1.1 chopps u_short cc_default_colors[32] = {
249 1.1 chopps 0xAAA, 0x000, 0x68B, 0xFFF,
250 1.1 chopps 0x369, 0x963, 0x639, 0x936,
251 1.1 chopps 0x000, 0x00F, 0x0F0, 0xF00,
252 1.1 chopps 0x0FF, 0xFF0, 0xF0F, 0xFFF,
253 1.1 chopps 0x000, 0x111, 0x222, 0x333,
254 1.1 chopps 0x444, 0x555, 0x666, 0x777,
255 1.1 chopps 0x888, 0x999, 0xAAA, 0xBBB,
256 1.1 chopps 0xCCC, 0xDDD, 0xEEE, 0xFFF
257 1.1 chopps };
258 1.1 chopps #if defined (GRF_A2024)
259 1.1 chopps u_short cc_a2024_default_colors[4] = {
260 1.2 chopps 0x2, /* LGREY */
261 1.1 chopps 0x0, /* BLACK */
262 1.1 chopps 0x3, /* WHITE */
263 1.1 chopps 0x1 /* DGREY */
264 1.1 chopps };
265 1.1 chopps #endif /* GRF_A2024 */
266