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