ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/Frodo4/Src/el_Acorn.h
Revision: 1.3
Committed: 2004-01-12T15:13:20Z (19 years, 1 month ago) by cebix
Content type: text/plain
Branch: MAIN
Changes since 1.2: +1 -1 lines
Log Message:
Happy New Year!

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * el_Acorn.h - Somewhat faster (on Acorn) versions of the el_-functions
3     * of VIC.cpp
4     *
5 cebix 1.3 * Frodo (C) 1994-1997,2002-2004 Christian Bauer
6 cebix 1.1 *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20     */
21    
22    
23     #ifdef GLOBAL_VARS
24     static inline void el_std_text(uint8 *p, uint8 *q, uint8 *r)
25     #else
26     inline void MOS6569::el_std_text(uint8 *p, uint8 *q, uint8 *r)
27     #endif
28     {
29     register uint32 *lp = (uint32 *)p, *t;
30     uint8 *cp = color_line;
31     uint8 *mp = matrix_line;
32     uint32 *tab = (uint32*)&TextColorTable[0][b0c][0][0];
33    
34     // Loop for 40 characters
35     for (int i=0; i<40; i++) {
36     uint8 data = r[i] = q[mp[i] << 3];
37    
38     t = tab + ((cp[i] & 15) << 13) + (data << 1);
39     *lp++ = *t++; *lp++ = *t++;
40     }
41     }
42    
43    
44     #ifdef GLOBAL_VARS
45     static inline void el_mc_text(uint8 *p, uint8 *q, uint8 *r)
46     #else
47     inline void MOS6569::el_mc_text(uint8 *p, uint8 *q, uint8 *r)
48     #endif
49     {
50     register uint32 *wp = (uint32 *)p, *t;
51     uint32 *tab = (uint32*)&TextColorTable[0][b0c][0][0];
52     uint8 *cp = color_line;
53     uint8 *mp = matrix_line;
54     uint8 *lookup = (uint8*)mc_color_lookup;
55    
56     // Loop for 40 characters
57     for (int i=0; i<40; i++) {
58     register uint32 color = cp[i];
59     uint8 data = q[mp[i] << 3];
60    
61     if (color & 8) {
62     r[i] = (data & 0xaa) | (data & 0xaa) >> 1;
63     lookup[6] = colors[color & 7];
64     color = lookup[(data & 0xc0) >> 5] | (lookup[(data & 0x30) >> 3] << 16);
65     *wp++ = color | (color << 8);
66     color = lookup[(data & 0x0c) >> 1] | (lookup[(data & 0x03) << 1] << 16);
67     *wp++ = color | (color << 8);
68    
69     } else { // Standard mode in multicolor mode
70     r[i] = data;
71     color = cp[i]; t = tab + (color << 13) + (data << 1);
72     *wp++ = *t++; *wp++ = *t++;
73     }
74     }
75     }
76    
77    
78     #ifdef GLOBAL_VARS
79     static inline void el_std_bitmap(uint8 *p, uint8 *q, uint8 *r)
80     #else
81     inline void MOS6569::el_std_bitmap(uint8 *p, uint8 *q, uint8 *r)
82     #endif
83     {
84     register uint32 *lp = (uint32 *)p, *t;
85     uint8 *mp = matrix_line;
86    
87     // Loop for 40 characters
88     for (int i=0; i<40; i++, q+=8) {
89     uint8 data = r[i] = *q;
90     uint8 h = mp[i];
91    
92     t = (uint32*)&TextColorTable[h >> 4][h & 15][data][0];
93     *lp++ = *t++; *lp++ = *t++;
94     }
95     }
96    
97    
98     #ifdef GLOBAL_VARS
99     static inline void el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
100     #else
101     inline void MOS6569::el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
102     #endif
103     {
104     uint8 lookup[4];
105     register uint32 *wp = (uint32 *)p;
106     uint8 *cp = color_line;
107     uint8 *mp = matrix_line;
108    
109     lookup[0] = b0c_color;
110    
111     // Loop for 40 characters
112     for (int i=0; i<40; i++, q+=8) {
113     uint8 data = *q;
114     register uint32 h = mp[i];
115    
116     lookup[1] = colors[h >> 4];
117     lookup[2] = colors[h];
118     lookup[3] = colors[cp[i]];
119    
120     r[i] = (data & 0xaa) | (data & 0xaa) >> 1;
121    
122     h = lookup[data >> 6] | (lookup[(data >> 4) & 3] << 16); *wp++ = h | (h << 8);
123     h = lookup[(data >> 2) & 3] | (lookup[data & 3] << 16); *wp++ = h | (h << 8);
124     }
125     }
126    
127    
128     #ifdef GLOBAL_VARS
129     static inline void el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
130     #else
131     inline void MOS6569::el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
132     #endif
133     {
134     register uint32 *lp = (uint32 *)p, *t;
135     uint8 *cp = color_line;
136     uint8 *mp = matrix_line;
137     uint8 *bcp = &b0c;
138    
139     // Loop for 40 characters
140     for (int i=0; i<40; i++) {
141     uint8 data = r[i] = mp[i];
142    
143     t = (uint32*)&TextColorTable[cp[i]][bcp[(data >> 6) & 3]][q[(data & 0x3f) << 3]][0];
144     *lp++ = *t++; *lp++ = *t++;
145     }
146     }
147    
148    
149     #ifdef GLOBAL_VARS
150     static inline void el_std_idle(uint8 *p, uint8 *r)
151     #else
152     inline void MOS6569::el_std_idle(uint8 *p, uint8 *r)
153     #endif
154     {
155     uint8 data = *get_physical(ctrl1 & 0x40 ? 0x39ff : 0x3fff);
156     uint32 *lp = (uint32 *)p;
157     uint32 conv0 = TextColorTable[0][b0c][data][0].b;
158     uint32 conv1 = TextColorTable[0][b0c][data][1].b;
159    
160     for (int i=0; i<40; i++) {
161     *lp++ = conv0;
162     *lp++ = conv1;
163     *r++ = data;
164     }
165     }
166    
167    
168     #ifdef GLOBAL_VARS
169     static inline void el_mc_idle(uint8 *p, uint8 *r)
170     #else
171     inline void MOS6569::el_mc_idle(uint8 *p, uint8 *r)
172     #endif
173     {
174     uint8 data = *get_physical(0x3fff);
175     register uint8 c0 = b0c_color, c1 = colors[0];
176     register uint32 *lp = (uint32 *)p;
177     register uint32 conv0, conv1;
178    
179     conv0 = (((data & 0xc0) == 0) ? c0 : c1) | (((data & 0x30) == 0) ? c0<<16 : c1<<16);
180     conv1 = (((data & 0x0c) == 0) ? c0 : c1) | (((data & 0x03) == 0) ? c0<<16 : c1<<16);
181     conv0 |= (conv0 << 8); conv1 |= (conv1 << 8);
182    
183     for (int i=0; i<40; i++) {
184     *lp++ = conv0;
185     *lp++ = conv1;
186     *r++ = data;
187     }
188     }