Home | History | Annotate | Line # | Download | only in dev
grfabs_ccglb.c revision 1.2
      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.2 1994/02/17 09:10:37 chopps Exp $
     31  */
     32 
     33 #include <sys/types.h>
     34 #include <amiga/amiga/dlists.h>
     35 #include <amiga/amiga/cc.h>
     36 #include <amiga/dev/grfabs_reg.h>
     37 #include <amiga/dev/grfabs_ccreg.h>
     38 
     39 /* the custom thips monitor */
     40 monitor_t *cc_monitor;
     41 
     42 cop_t std_copper_list[] = {
     43     { CI_WAIT (0, 12), 0xfffe },
     44 #if defined (GRF_ECS)
     45     { R_BEAMCON0, 0x0000 },
     46     { R_BPLCON3, 0x0020 },			  /* enable border blank */
     47 #endif
     48     /* bit plane pointers */
     49     { R_BPL0PTH, 0x0000 },    { R_BPL0PTL, 0x0000 },
     50     { R_BPL1PTH, 0x0000 },    { R_BPL1PTL, 0x0000 },
     51     { R_BPL2PTH, 0x0000 },    { R_BPL2PTL, 0x0000 },
     52     { R_BPL3PTH, 0x0000 },    { R_BPL3PTL, 0x0000 },
     53     { R_BPL4PTH, 0x0000 },    { R_BPL4PTL, 0x0000 },
     54     { R_BPL5PTH, 0x0000 },    { R_BPL5PTL, 0x0000 },
     55     { R_BPL6PTH, 0x0000 },    { R_BPL6PTL, 0x0000 },
     56     { R_BPL7PTH, 0x0000 },    { R_BPL7PTL, 0x0000 },
     57     /* view specific stuff. */
     58     { R_BPL1MOD, 0x0000 },
     59     { R_BPL2MOD, 0x0000 },
     60     { R_DIWSTRT, 0xffff },
     61     { R_BPLCON0, 0x0000 },
     62     { R_DIWSTOP, 0x0000 },
     63 #if defined (GRF_ECS)
     64     { R_DIWHIGH, 0x0000 },
     65 #endif
     66     { R_DDFSTRT, 0x0000 },
     67     { R_DDFSTOP, 0x0000 },
     68     { R_BPLCON1, 0x0000 },
     69     /* colors */
     70     { R_COLOR00, 0x0779 },    { R_COLOR01, 0x0000 },    { R_COLOR02, 0x0FFF },    { R_COLOR03, 0x068B },
     71     { R_COLOR04, 0x000f },    { R_COLOR05, 0x0f0f },    { R_COLOR06, 0x00ff },    { R_COLOR07, 0x0fff },
     72     { R_COLOR08, 0x0620 },    { R_COLOR09, 0x0e50 },    { R_COLOR0A, 0x09f1 },    { R_COLOR0B, 0x0eb0 },
     73     { R_COLOR0C, 0x055f },    { R_COLOR0D, 0x092f },    { R_COLOR0E, 0x00f8 },    { R_COLOR0F, 0x0ccc },
     74     { R_COLOR10, 0x0e44 },    { R_COLOR11, 0x0e44 },    { R_COLOR12, 0x0000 },    { R_COLOR13, 0x0eec },
     75     { R_COLOR14, 0x0444 },    { R_COLOR15, 0x0555 },    { R_COLOR16, 0x0666 },    { R_COLOR17, 0x0777 },
     76     { R_COLOR18, 0x0888 },    { R_COLOR19, 0x0999 },    { R_COLOR1A, 0x0aaa },    { R_COLOR1B, 0x0bbb },
     77     { R_COLOR1C, 0x0ccc },    { R_COLOR1D, 0x0ddd },    { R_COLOR1E, 0x0eee },    { R_COLOR1F, 0x0fff },
     78     { R_COP1LCH, 0x0000 },    { R_COP1LCL, 0x0000 },
     79     { 0xffff, 0xfffe },       { 0xffff, 0xfffe }  /* COPEND, COPEND */
     80 };
     81 
     82 /* standard custom chips copper list. */
     83 int std_copper_list_len = sizeof (std_copper_list) / sizeof (cop_t);
     84 int std_copper_list_size = sizeof (std_copper_list);
     85 
     86 
     87 #if defined (GRF_A2024)
     88 cop_t std_dlace_copper_list[] = {
     89     { CI_WAIT(0,12), 0xfffe },				  /* WAIT (0, 12) */
     90 #if defined (GRF_ECS)
     91     { R_BEAMCON0, 0x0000 },
     92     { R_BPLCON3, 0x0020 },			  /* enable border blank */
     93 #endif
     94     /* colors */
     95     { R_COLOR00, 0x0000  }, { R_COLOR01, 0x0000  }, { R_COLOR02, 0x0000 },  { R_COLOR03, 0x0000  },
     96     { R_COLOR04, 0x0000  }, { R_COLOR05, 0x0000  }, { R_COLOR06, 0x0000 }, { R_COLOR07, 0x0000 },
     97     { R_COLOR08, 0x0000  }, { R_COLOR09, 0x0000  }, { R_COLOR0A, 0x0000}, { R_COLOR0B, 0x0000 },
     98     { R_COLOR0C, 0x0000 }, { R_COLOR0D, 0x0000 }, { R_COLOR0E, 0x0000}, { R_COLOR0F, 0x0000 },
     99     { R_COLOR10, 0x0009 }, { R_COLOR11, 0x0009 }, { R_COLOR12, 0x0001 }, { R_COLOR13, 0x0809 },
    100     { R_COLOR14, 0x0009 }, { R_COLOR15, 0x0009 }, { R_COLOR16, 0x0001 }, { R_COLOR17, 0x0809 },
    101     { R_COLOR18, 0x0008 }, { R_COLOR19, 0x0008 }, { R_COLOR1A, 0x0000 }, { R_COLOR1B, 0x0808 },
    102     { R_COLOR1C, 0x0089 }, { R_COLOR1D, 0x0089 }, { R_COLOR1E, 0x0081 }, { R_COLOR1F, 0x0889 },
    103     /* set the registers up. */
    104     { R_DIWSTRT, 0xffff },
    105     { R_BPLCON0, 0x0000 },
    106     { R_DIWSTOP, 0x0000 },
    107 #if defined (GRF_ECS)
    108     { R_DIWHIGH, 0x0000 },
    109 #endif
    110     { R_DDFSTRT, 0x0000 },
    111     { R_DDFSTOP, 0x0000 },
    112     { R_BPLCON1, 0x0000 },
    113     /* view specific stuff. */
    114     { R_BPL1MOD, 0x0000 },
    115     { R_BPL2MOD, 0x0000 },
    116     /* bit plane pointers */
    117     { R_BPL0PTH, 0x0000 },    { R_BPL0PTL, 0x0000 },
    118     { R_BPL1PTH, 0x0000 },    { R_BPL1PTL, 0x0000 },
    119     { R_BPL2PTH, 0x0000 },    { R_BPL2PTL, 0x0000 },
    120     { R_BPL3PTH, 0x0000 },    { R_BPL3PTL, 0x0000 },
    121     { R_COP1LCH, 0x0000 },    { R_COP1LCL, 0x0000 },
    122     { 0xffff, 0xfffe },       { 0xffff, 0xfffe }  /* COPEND, COPEND */
    123 };
    124 int std_dlace_copper_list_len = sizeof (std_dlace_copper_list) / sizeof (cop_t);
    125 int std_dlace_copper_list_size = sizeof (std_dlace_copper_list);
    126 
    127 cop_t std_a2024_copper_list[] = {
    128     { CI_WAIT(0,12), 0xfffe },				  /* WAIT (0, 12) */
    129 #if defined (GRF_ECS)
    130     { R_BEAMCON0, 0x0000 },
    131 #endif
    132     /* hedley card init setup section */
    133     { R_COLOR00, 0x0f00 },
    134     { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 }, /* init plane of 1's with first set for centering */
    135     { R_DIWSTRT, 0x1561 }, { R_DIWSTOP, 0x16d1 },
    136 #if defined (GRF_ECS)
    137     { R_DIWHIGH, 0x2000 },
    138 #endif
    139     { R_DDFSTRT, 0x0040 }, { R_DDFSTOP, 0x00d0 },
    140     { R_BPLCON0, 0x9200 },
    141     /* actual data that will be latched by hedley card. */
    142     { R_COLOR01, 0x0001 },			  /* Stuff1 */
    143     { CI_WAIT(126,21), 0xfffe  }, { R_COLOR01, 0x0001 },	  /*  Display Quadrent */
    144     { CI_WAIT(158,21), 0xfffe  }, { R_COLOR01, 0x08f0 },	  /*  Stuff */
    145     { CI_WAIT(190,21), 0xfffe  }, { R_COLOR01, 0x0ff1 },	  /*  Stuff2 */
    146     { CI_WAIT(0,22), 0xfffe  },
    147     { R_COLOR00, 0x0000 }, { R_BPLCON0, 0x0000 },
    148     { CI_WAIT(0,43), 0xfffe  },
    149     /* set the registers up. */
    150     { R_COLOR00, 0x0009 }, { R_COLOR01, 0x0001 }, { R_COLOR02, 0x0008 }, { R_COLOR03, 0x0000 },
    151     { R_COLOR04, 0x0809 }, { R_COLOR05, 0x0801 }, { R_COLOR06, 0x0808 }, { R_COLOR07, 0x0800 },
    152     { R_COLOR08, 0x0089 }, { R_COLOR09, 0x0081 }, { R_COLOR0A, 0x0088 }, { R_COLOR0B, 0x0080 },
    153     { R_COLOR0C, 0x0889 }, { R_COLOR0D, 0x0881 }, { R_COLOR0E, 0x0888 }, { R_COLOR0F, 0x0880 },
    154     { R_COLOR10, 0x0009 }, { R_COLOR11, 0x0009 }, { R_COLOR12, 0x0001 }, { R_COLOR13, 0x0809 },
    155     { R_COLOR14, 0x0009 }, { R_COLOR15, 0x0009 }, { R_COLOR16, 0x0001 }, { R_COLOR17, 0x0809 },
    156     { R_COLOR18, 0x0008 }, { R_COLOR19, 0x0008 }, { R_COLOR1A, 0x0000 }, { R_COLOR1B, 0x0808 },
    157     { R_COLOR1C, 0x0089 }, { R_COLOR1D, 0x0089 }, { R_COLOR1E, 0x0081 }, { R_COLOR1F, 0x0889 },
    158     /* window size. */
    159     { R_DIWSTRT, 0x2c81 }, { R_BPLCON0, 0x0000 }, { R_DIWSTOP, 0xf481 },
    160     /* datafetch */
    161     { R_DDFSTRT, 0x0038 }, { R_DDFSTOP, 0x00b8 },
    162     { R_BPLCON1, 0x0000 },
    163     { R_BPL1MOD, 0x00bc }, { R_BPL2MOD, 0x00bc },
    164     /* bitplanes */
    165     { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 },
    166     { R_BPL1PTH, 0x0000 }, { R_BPL1PTL, 0x0000 },
    167     { R_BPL2PTH, 0x0000 }, { R_BPL2PTL, 0x0000 },
    168     { R_BPL3PTH, 0x0000 }, { R_BPL3PTL, 0x0000 },
    169 #if defined (GRF_ECS)
    170     { R_DIWHIGH, 0x2000 },
    171 #endif
    172     { R_COP1LCH, 0x0000 }, { R_COP1LCL, 0x0000 },
    173     { 0xffff, 0xfffe }, { 0xffff, 0xfffe }  /* COPEND, COPEND */
    174 };
    175 int std_a2024_copper_list_len = sizeof (std_a2024_copper_list) / sizeof (cop_t);
    176 int std_a2024_copper_list_size = sizeof (std_a2024_copper_list);
    177 
    178 cop_t std_pal_a2024_copper_list[] = {
    179     { CI_WAIT(0,20), 0xfffe },				  /* WAIT (0, 12) */
    180 #if defined (GRF_ECS)
    181     { R_BEAMCON0, STANDARD_PAL_BEAMCON },
    182 #endif
    183     /* hedley card init setup section */
    184     { R_COLOR00, 0x0f00 },
    185     { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 }, /* init plane of 1's with first set for centering */
    186     { R_DIWSTRT, 0x1d61 }, { R_DIWSTOP, 0x1ed1 },
    187 #if defined (GRF_ECS)
    188     { R_DIWHIGH, 0x2000 },
    189 #endif
    190     { R_DDFSTRT, 0x0040 }, { R_DDFSTOP, 0x00d0 },
    191     { R_BPLCON0, 0x9200 },
    192     /* actual data that will be latched by hedley card. */
    193     { R_COLOR01, 0x0001 },			  /* Stuff1 */
    194     { CI_WAIT(126,29), 0xfffe  }, { R_COLOR01, 0x0001 },	  /*  Display Quadrent */
    195     { CI_WAIT(158,29), 0xfffe  }, { R_COLOR01, 0x08f0 },	  /*  Stuff */
    196     { CI_WAIT(190,29), 0xfffe  }, { R_COLOR01, 0x0ff1 },	  /*  Stuff2 */
    197     { CI_WAIT(0,30), 0xfffe  },
    198     { R_COLOR00, 0x0000 }, { R_BPLCON0, 0x0000 },
    199     { CI_WAIT(0,43), 0xfffe  },
    200 
    201     /* set the registers up. */
    202     { R_COLOR00, 0x0009 }, { R_COLOR01, 0x0001 }, { R_COLOR02, 0x0008 }, { R_COLOR03, 0x0000 },
    203     { R_COLOR04, 0x0809 }, { R_COLOR05, 0x0801 }, { R_COLOR06, 0x0808 }, { R_COLOR07, 0x0800 },
    204     { R_COLOR08, 0x0089 }, { R_COLOR09, 0x0081 }, { R_COLOR0A, 0x0088 }, { R_COLOR0B, 0x0080 },
    205     { R_COLOR0C, 0x0889 }, { R_COLOR0D, 0x0881 }, { R_COLOR0E, 0x0888 }, { R_COLOR0F, 0x0880 },
    206     { R_COLOR10, 0x0009 }, { R_COLOR11, 0x0009 }, { R_COLOR12, 0x0001 }, { R_COLOR13, 0x0809 },
    207     { R_COLOR14, 0x0009 }, { R_COLOR15, 0x0009 }, { R_COLOR16, 0x0001 }, { R_COLOR17, 0x0809 },
    208     { R_COLOR18, 0x0008 }, { R_COLOR19, 0x0008 }, { R_COLOR1A, 0x0000 }, { R_COLOR1B, 0x0808 },
    209     { R_COLOR1C, 0x0089 }, { R_COLOR1D, 0x0089 }, { R_COLOR1E, 0x0081 }, { R_COLOR1F, 0x0889 },
    210     /* window size. */
    211     { R_DIWSTRT, 0x2c81 }, { R_BPLCON0, 0x0000 }, { R_DIWSTOP, 0x2c81 },
    212     /* datafetch */
    213     { R_DDFSTRT, 0x0038 }, { R_DDFSTOP, 0x00b8 },
    214     { R_BPLCON1, 0x0000 },
    215     { R_BPL1MOD, 0x00bc }, { R_BPL2MOD, 0x00bc },
    216     /* bitplanes */
    217     { R_BPL0PTH, 0x0000 }, { R_BPL0PTL, 0x0000 },
    218     { R_BPL1PTH, 0x0000 }, { R_BPL1PTL, 0x0000 },
    219     { R_BPL2PTH, 0x0000 }, { R_BPL2PTL, 0x0000 },
    220     { R_BPL3PTH, 0x0000 }, { R_BPL3PTL, 0x0000 },
    221 #if defined (GRF_ECS)
    222     { R_DIWHIGH, 0x2100 },
    223 #endif
    224     { R_COP1LCH, 0x0000 }, { R_COP1LCL, 0x0000 },
    225     { 0xffff, 0xfffe }, { 0xffff, 0xfffe }  /* COPEND, COPEND */
    226 };
    227 int std_pal_a2024_copper_list_len = sizeof (std_pal_a2024_copper_list) / sizeof (cop_t);
    228 int std_pal_a2024_copper_list_size = sizeof (std_pal_a2024_copper_list);
    229 
    230 /* color tables for figuring color regs for 2024 */
    231 u_short a2024_color_value_line0[4] = {
    232     A2024_L0_BLACK,
    233     A2024_L0_DGREY,
    234     A2024_L0_LGREY,
    235     A2024_L0_WHITE
    236 };
    237 
    238 u_short a2024_color_value_line1[4] = {
    239     A2024_L1_BLACK,
    240     A2024_L1_DGREY,
    241     A2024_L1_LGREY,
    242     A2024_L1_WHITE
    243 };
    244 
    245 #endif /* GRF_A2024 */
    246 
    247 u_short cc_default_colors[32] = {
    248 	0xAAA, 0x000, 0x68B, 0xFFF,
    249 	0x369, 0x963, 0x639, 0x936,
    250 	0x000, 0x00F, 0x0F0, 0xF00,
    251 	0x0FF, 0xFF0, 0xF0F, 0xFFF,
    252 	0x000, 0x111, 0x222, 0x333,
    253 	0x444, 0x555, 0x666, 0x777,
    254 	0x888, 0x999, 0xAAA, 0xBBB,
    255 	0xCCC, 0xDDD, 0xEEE, 0xFFF
    256 };
    257 #if defined (GRF_A2024)
    258 u_short cc_a2024_default_colors[4] = {
    259 	0x2,			/* LGREY */
    260 	0x0,			/* BLACK */
    261 	0x3,			/* WHITE */
    262 	0x1			/* DGREY */
    263 };
    264 #endif /* GRF_A2024 */
    265