1 /*###################################################################################################
2 **
3 ** TMS34010: Portable Texas Instruments TMS34010 emulator
4 **
5 ** Copyright (C) Alex Pasadyn/Zsolt Vasvari 1998
6 ** Parts based on code by Aaron Giles
7 **
8 **#################################################################################################*/
9
10 #ifndef RECURSIVE_INCLUDE
11
12 #if LOG_GRAPHICS_OPS
13 #define LOGGFX(x) do { if (keyboard_pressed(KEYCODE_L)) logerror x ; } while (0)
14 #else
15 #define LOGGFX(x)
16 #endif
17
18
19 /* Graphics Instructions */
20
line(void)21 static void line(void)
22 {
23 if (!P_FLAG)
24 {
25 #if 0
26 if (state.window_checking != 0 && state.window_checking != 3)
27 logerror("LINE XY %08X - Window Checking Mode %d not supported\n", PC, state.window_checking);
28 #endif
29
30 P_FLAG = 1;
31 TEMP = (state.op & 0x80) ? 1 : 0; /* boundary value depends on the algorithm */
32 //LOGGFX(("%08X(%3d):LINE (%d,%d)-(%d,%d)\n", PC, cpu_getscanline(), DADDR_X, DADDR_Y, DADDR_X + DYDX_X, DADDR_Y + DYDX_Y));
33 }
34
35 if (COUNT > 0)
36 {
37 INT16 x1,y1;
38
39 COUNT--;
40 if (state.window_checking != 3 ||
41 (DADDR_X >= WSTART_X && DADDR_X <= WEND_X &&
42 DADDR_Y >= WSTART_Y && DADDR_Y <= WEND_Y))
43 WPIXEL(DXYTOL(DADDR_XY),COLOR1);
44
45 if (SADDR >= TEMP)
46 {
47 SADDR += DYDX_Y*2 - DYDX_X*2;
48 x1 = INC1_X;
49 y1 = INC1_Y;
50 }
51 else
52 {
53 SADDR += DYDX_Y*2;
54 x1 = INC2_X;
55 y1 = INC2_Y;
56 }
57 DADDR_X += x1;
58 DADDR_Y += y1;
59
60 COUNT_UNKNOWN_CYCLES(2);
61 PC -= 0x10; /* not done yet, check for interrupts and restart instruction */
62 return;
63 }
64 P_FLAG = 0;
65 }
66
67
68 /*
69 cases:
70 * window modes (0,1,2,3)
71 * boolean/arithmetic ops (16+6)
72 * transparency (on/off)
73 * plane masking
74 * directions (left->right/right->left, top->bottom/bottom->top)
75 */
76
apply_window(const char * inst_name,int srcbpp,UINT32 * srcaddr,XY * dst,int * dx,int * dy)77 static int apply_window(const char *inst_name,int srcbpp, UINT32 *srcaddr, XY *dst, int *dx, int *dy)
78 {
79 /* apply the window */
80 if (state.window_checking == 0)
81 return 0;
82 else
83 {
84 int sx = dst->x;
85 int sy = dst->y;
86 int ex = sx + *dx - 1;
87 int ey = sy + *dy - 1;
88 int diff, cycles = 3;
89
90 #if 0
91 if (state.window_checking == 1 || state.window_checking == 2)
92 logerror("%08x: %s apply_window window mode %d not supported!\n", activecpu_get_pc(), inst_name, state.window_checking);
93 #endif
94
95 if (state.window_checking == 1)
96 V_FLAG = 1;
97 else
98 CLR_V; /* clear the V flag by default */
99
100 /* clip X */
101 diff = WSTART_X - sx;
102 if (diff > 0)
103 {
104 if (srcaddr)
105 *srcaddr += diff * srcbpp;
106 sx += diff;
107 V_FLAG = 1;
108 }
109 diff = ex - WEND_X;
110 if (diff > 0)
111 {
112 ex -= diff;
113 V_FLAG = 1;
114 }
115
116 /* clip Y */
117 diff = WSTART_Y - sy;
118 if (diff > 0)
119 {
120 if (srcaddr)
121 *srcaddr += diff * SPTCH;
122 sy += diff;
123 V_FLAG = 1;
124 }
125 diff = ey - WEND_Y;
126 if (diff > 0)
127 {
128 ey -= diff;
129 V_FLAG = 1;
130 }
131
132 /* compute cycles */
133 if (*dx != ex - sx + 1 || *dy != ey - sy + 1)
134 {
135 if (dst->x != sx || dst->y != sy)
136 cycles += 11;
137 else
138 cycles += 3;
139 }
140 else if (dst->x != sx || dst->y != sy)
141 cycles += 7;
142
143 /* update the values */
144 dst->x = sx;
145 dst->y = sy;
146 *dx = ex - sx + 1;
147 *dy = ey - sy + 1;
148 return cycles;
149 }
150 }
151
152
153 /*******************************************************************
154
155 About the timing of gfx operations:
156
157 The 34010 manual lists a fairly intricate and accurate way of
158 computing cycle timings for graphics ops. However, there are
159 enough typos and misleading statements to make the reliability
160 of the timing info questionable.
161
162 So, to address this, here is a simplified approximate version
163 of the timing.
164
165 timing = setup + (srcwords * 2 + dstwords * gfxop) * rows
166
167 Each read access takes 2 cycles. Each gfx operation has
168 its own timing as specified in the 34010 manual. So, it's 2
169 cycles per read plus gfxop cycles per operation. Pretty
170 simple, no?
171
172 *******************************************************************/
173
compute_fill_cycles(int left_partials,int right_partials,int full_words,int rows,int op_timing)174 int compute_fill_cycles(int left_partials, int right_partials, int full_words, int rows, int op_timing)
175 {
176 int dstwords;
177
178 if (left_partials) full_words += 1;
179 if (right_partials) full_words += 1;
180 dstwords = full_words;
181
182 return (dstwords * op_timing) * rows + 2;
183 }
184
compute_pixblt_cycles(int left_partials,int right_partials,int full_words,int op_timing)185 int compute_pixblt_cycles(int left_partials, int right_partials, int full_words, int op_timing)
186 {
187 int srcwords, dstwords;
188
189 if (left_partials) full_words += 1;
190 if (right_partials) full_words += 1;
191 srcwords = full_words;
192 dstwords = full_words;
193
194 return (dstwords * op_timing + srcwords * 2) + 2;
195 }
196
compute_pixblt_b_cycles(int left_partials,int right_partials,int full_words,int rows,int op_timing,int bpp)197 int compute_pixblt_b_cycles(int left_partials, int right_partials, int full_words, int rows, int op_timing, int bpp)
198 {
199 int srcwords, dstwords;
200
201 if (left_partials) full_words += 1;
202 if (right_partials) full_words += 1;
203 srcwords = full_words * bpp / 16;
204 dstwords = full_words;
205
206 return (dstwords * op_timing + srcwords * 2) * rows + 2;
207 }
208
209
210 /* Shift register handling */
shiftreg_w(offs_t offset,data16_t data)211 static void shiftreg_w(offs_t offset,data16_t data)
212 {
213 if (state.config->from_shiftreg)
214 (*state.config->from_shiftreg)((UINT32)(offset << 3) & ~15, &state.shiftreg[0]);
215 #if 0
216 else
217 logerror("From ShiftReg function not set. PC = %08X\n", PC);
218 #endif
219 }
220
shiftreg_r(offs_t offset)221 static data16_t shiftreg_r(offs_t offset)
222 {
223 if (state.config->to_shiftreg)
224 (*state.config->to_shiftreg)((UINT32)(offset << 3) & ~15, &state.shiftreg[0]);
225 #if 0
226 else
227 logerror("To ShiftReg function not set. PC = %08X\n", PC);
228 #endif
229 return state.shiftreg[0];
230 }
231
dummy_shiftreg_r(offs_t offset)232 static data16_t dummy_shiftreg_r(offs_t offset)
233 {
234 return state.shiftreg[0];
235 }
236
237
238
239 /* Pixel operations */
pixel_op00(UINT16 dstpix,UINT16 mask,UINT16 srcpix)240 static UINT16 pixel_op00(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return srcpix; }
pixel_op01(UINT16 dstpix,UINT16 mask,UINT16 srcpix)241 static UINT16 pixel_op01(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return srcpix & dstpix; }
pixel_op02(UINT16 dstpix,UINT16 mask,UINT16 srcpix)242 static UINT16 pixel_op02(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return srcpix & ~dstpix; }
pixel_op03(UINT16 dstpix,UINT16 mask,UINT16 srcpix)243 static UINT16 pixel_op03(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return 0; }
pixel_op04(UINT16 dstpix,UINT16 mask,UINT16 srcpix)244 static UINT16 pixel_op04(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (srcpix | ~dstpix) & mask; }
pixel_op05(UINT16 dstpix,UINT16 mask,UINT16 srcpix)245 static UINT16 pixel_op05(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return ~(srcpix ^ dstpix) & mask; }
pixel_op06(UINT16 dstpix,UINT16 mask,UINT16 srcpix)246 static UINT16 pixel_op06(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return ~dstpix & mask; }
pixel_op07(UINT16 dstpix,UINT16 mask,UINT16 srcpix)247 static UINT16 pixel_op07(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return ~(srcpix | dstpix) & mask; }
pixel_op08(UINT16 dstpix,UINT16 mask,UINT16 srcpix)248 static UINT16 pixel_op08(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (srcpix | dstpix) & mask; }
pixel_op09(UINT16 dstpix,UINT16 mask,UINT16 srcpix)249 static UINT16 pixel_op09(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return dstpix & mask; }
pixel_op10(UINT16 dstpix,UINT16 mask,UINT16 srcpix)250 static UINT16 pixel_op10(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (srcpix ^ dstpix) & mask; }
pixel_op11(UINT16 dstpix,UINT16 mask,UINT16 srcpix)251 static UINT16 pixel_op11(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (~srcpix & dstpix) & mask; }
pixel_op12(UINT16 dstpix,UINT16 mask,UINT16 srcpix)252 static UINT16 pixel_op12(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return mask; }
pixel_op13(UINT16 dstpix,UINT16 mask,UINT16 srcpix)253 static UINT16 pixel_op13(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (~srcpix & dstpix) & mask; }
pixel_op14(UINT16 dstpix,UINT16 mask,UINT16 srcpix)254 static UINT16 pixel_op14(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return ~(srcpix & dstpix) & mask; }
pixel_op15(UINT16 dstpix,UINT16 mask,UINT16 srcpix)255 static UINT16 pixel_op15(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return srcpix ^ mask; }
pixel_op16(UINT16 dstpix,UINT16 mask,UINT16 srcpix)256 static UINT16 pixel_op16(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (srcpix + dstpix) & mask; }
pixel_op17(UINT16 dstpix,UINT16 mask,UINT16 srcpix)257 static UINT16 pixel_op17(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { INT32 tmp = srcpix + (dstpix & mask); return (tmp > mask) ? mask : tmp; }
pixel_op18(UINT16 dstpix,UINT16 mask,UINT16 srcpix)258 static UINT16 pixel_op18(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (dstpix - srcpix) & mask; }
pixel_op19(UINT16 dstpix,UINT16 mask,UINT16 srcpix)259 static UINT16 pixel_op19(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { INT32 tmp = srcpix - (dstpix & mask); return (tmp < 0) ? 0 : tmp; }
pixel_op20(UINT16 dstpix,UINT16 mask,UINT16 srcpix)260 static UINT16 pixel_op20(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { dstpix &= mask; return (srcpix > dstpix) ? srcpix : dstpix; }
pixel_op21(UINT16 dstpix,UINT16 mask,UINT16 srcpix)261 static UINT16 pixel_op21(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { dstpix &= mask; return (srcpix < dstpix) ? srcpix : dstpix; }
262
263 static UINT16 (*pixel_op_table[])(UINT16, UINT16, UINT16) =
264 {
265 pixel_op00, pixel_op01, pixel_op02, pixel_op03, pixel_op04, pixel_op05, pixel_op06, pixel_op07,
266 pixel_op08, pixel_op09, pixel_op10, pixel_op11, pixel_op12, pixel_op13, pixel_op14, pixel_op15,
267 pixel_op16, pixel_op17, pixel_op18, pixel_op19, pixel_op20, pixel_op21, pixel_op00, pixel_op00,
268 pixel_op00, pixel_op00, pixel_op00, pixel_op00, pixel_op00, pixel_op00, pixel_op00, pixel_op00
269 };
270 static UINT8 pixel_op_timing_table[] =
271 {
272 2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,6,5,5,2,2,2,2,2,2,2,2,2,2,2
273 };
274 static UINT16 (*pixel_op)(UINT16, UINT16, UINT16);
275 static UINT32 pixel_op_timing;
276
277
278 /* Blitters/fillers */
279 static void pixblt_1_op0(int src_is_linear, int dst_is_linear);
280 static void pixblt_2_op0(int src_is_linear, int dst_is_linear);
281 static void pixblt_4_op0(int src_is_linear, int dst_is_linear);
282 static void pixblt_8_op0(int src_is_linear, int dst_is_linear);
283 static void pixblt_16_op0(int src_is_linear, int dst_is_linear);
284 static void pixblt_r_1_op0(int src_is_linear, int dst_is_linear);
285 static void pixblt_r_2_op0(int src_is_linear, int dst_is_linear);
286 static void pixblt_r_4_op0(int src_is_linear, int dst_is_linear);
287 static void pixblt_r_8_op0(int src_is_linear, int dst_is_linear);
288 static void pixblt_r_16_op0(int src_is_linear, int dst_is_linear);
289 static void pixblt_b_1_op0(int dst_is_linear);
290 static void pixblt_b_2_op0(int dst_is_linear);
291 static void pixblt_b_4_op0(int dst_is_linear);
292 static void pixblt_b_8_op0(int dst_is_linear);
293 static void pixblt_b_16_op0(int dst_is_linear);
294 static void fill_1_op0(int dst_is_linear);
295 static void fill_2_op0(int dst_is_linear);
296 static void fill_4_op0(int dst_is_linear);
297 static void fill_8_op0(int dst_is_linear);
298 static void fill_16_op0(int dst_is_linear);
299
300 static void pixblt_1_op0_trans(int src_is_linear, int dst_is_linear);
301 static void pixblt_2_op0_trans(int src_is_linear, int dst_is_linear);
302 static void pixblt_4_op0_trans(int src_is_linear, int dst_is_linear);
303 static void pixblt_8_op0_trans(int src_is_linear, int dst_is_linear);
304 static void pixblt_16_op0_trans(int src_is_linear, int dst_is_linear);
305 static void pixblt_r_1_op0_trans(int src_is_linear, int dst_is_linear);
306 static void pixblt_r_2_op0_trans(int src_is_linear, int dst_is_linear);
307 static void pixblt_r_4_op0_trans(int src_is_linear, int dst_is_linear);
308 static void pixblt_r_8_op0_trans(int src_is_linear, int dst_is_linear);
309 static void pixblt_r_16_op0_trans(int src_is_linear, int dst_is_linear);
310 static void pixblt_b_1_op0_trans(int dst_is_linear);
311 static void pixblt_b_2_op0_trans(int dst_is_linear);
312 static void pixblt_b_4_op0_trans(int dst_is_linear);
313 static void pixblt_b_8_op0_trans(int dst_is_linear);
314 static void pixblt_b_16_op0_trans(int dst_is_linear);
315 static void fill_1_op0_trans(int dst_is_linear);
316 static void fill_2_op0_trans(int dst_is_linear);
317 static void fill_4_op0_trans(int dst_is_linear);
318 static void fill_8_op0_trans(int dst_is_linear);
319 static void fill_16_op0_trans(int dst_is_linear);
320
321 static void pixblt_1_opx(int src_is_linear, int dst_is_linear);
322 static void pixblt_2_opx(int src_is_linear, int dst_is_linear);
323 static void pixblt_4_opx(int src_is_linear, int dst_is_linear);
324 static void pixblt_8_opx(int src_is_linear, int dst_is_linear);
325 static void pixblt_16_opx(int src_is_linear, int dst_is_linear);
326 static void pixblt_r_1_opx(int src_is_linear, int dst_is_linear);
327 static void pixblt_r_2_opx(int src_is_linear, int dst_is_linear);
328 static void pixblt_r_4_opx(int src_is_linear, int dst_is_linear);
329 static void pixblt_r_8_opx(int src_is_linear, int dst_is_linear);
330 static void pixblt_r_16_opx(int src_is_linear, int dst_is_linear);
331 static void pixblt_b_1_opx(int dst_is_linear);
332 static void pixblt_b_2_opx(int dst_is_linear);
333 static void pixblt_b_4_opx(int dst_is_linear);
334 static void pixblt_b_8_opx(int dst_is_linear);
335 static void pixblt_b_16_opx(int dst_is_linear);
336 static void fill_1_opx(int dst_is_linear);
337 static void fill_2_opx(int dst_is_linear);
338 static void fill_4_opx(int dst_is_linear);
339 static void fill_8_opx(int dst_is_linear);
340 static void fill_16_opx(int dst_is_linear);
341
342 static void pixblt_1_opx_trans(int src_is_linear, int dst_is_linear);
343 static void pixblt_2_opx_trans(int src_is_linear, int dst_is_linear);
344 static void pixblt_4_opx_trans(int src_is_linear, int dst_is_linear);
345 static void pixblt_8_opx_trans(int src_is_linear, int dst_is_linear);
346 static void pixblt_16_opx_trans(int src_is_linear, int dst_is_linear);
347 static void pixblt_r_1_opx_trans(int src_is_linear, int dst_is_linear);
348 static void pixblt_r_2_opx_trans(int src_is_linear, int dst_is_linear);
349 static void pixblt_r_4_opx_trans(int src_is_linear, int dst_is_linear);
350 static void pixblt_r_8_opx_trans(int src_is_linear, int dst_is_linear);
351 static void pixblt_r_16_opx_trans(int src_is_linear, int dst_is_linear);
352 static void pixblt_b_1_opx_trans(int dst_is_linear);
353 static void pixblt_b_2_opx_trans(int dst_is_linear);
354 static void pixblt_b_4_opx_trans(int dst_is_linear);
355 static void pixblt_b_8_opx_trans(int dst_is_linear);
356 static void pixblt_b_16_opx_trans(int dst_is_linear);
357 static void fill_1_opx_trans(int dst_is_linear);
358 static void fill_2_opx_trans(int dst_is_linear);
359 static void fill_4_opx_trans(int dst_is_linear);
360 static void fill_8_opx_trans(int dst_is_linear);
361 static void fill_16_opx_trans(int dst_is_linear);
362
363
364 /* tables */
365 static void (*pixblt_op_table[])(int, int) =
366 {
367 pixblt_1_op0, pixblt_1_op0_trans, pixblt_1_opx, pixblt_1_opx_trans,
368 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
369 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
370 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
371 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
372 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
373 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
374 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
375 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
376 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
377 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
378 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
379 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
380 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
381 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
382 pixblt_1_opx, pixblt_1_opx_trans, pixblt_1_opx, pixblt_1_opx_trans,
383
384 pixblt_2_op0, pixblt_2_op0_trans, pixblt_2_opx, pixblt_2_opx_trans,
385 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
386 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
387 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
388 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
389 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
390 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
391 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
392 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
393 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
394 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
395 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
396 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
397 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
398 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
399 pixblt_2_opx, pixblt_2_opx_trans, pixblt_2_opx, pixblt_2_opx_trans,
400
401 pixblt_4_op0, pixblt_4_op0_trans, pixblt_4_opx, pixblt_4_opx_trans,
402 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
403 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
404 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
405 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
406 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
407 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
408 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
409 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
410 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
411 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
412 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
413 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
414 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
415 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
416 pixblt_4_opx, pixblt_4_opx_trans, pixblt_4_opx, pixblt_4_opx_trans,
417
418 pixblt_8_op0, pixblt_8_op0_trans, pixblt_8_opx, pixblt_8_opx_trans,
419 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
420 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
421 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
422 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
423 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
424 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
425 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
426 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
427 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
428 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
429 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
430 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
431 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
432 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
433 pixblt_8_opx, pixblt_8_opx_trans, pixblt_8_opx, pixblt_8_opx_trans,
434
435 pixblt_16_op0, pixblt_16_op0_trans, pixblt_16_opx, pixblt_16_opx_trans,
436 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
437 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
438 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
439 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
440 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
441 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
442 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
443 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
444 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
445 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
446 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
447 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
448 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
449 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans,
450 pixblt_16_opx, pixblt_16_opx_trans, pixblt_16_opx, pixblt_16_opx_trans
451 };
452
453 static void (*pixblt_r_op_table[])(int, int) =
454 {
455 pixblt_r_1_op0, pixblt_r_1_op0_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
456 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
457 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
458 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
459 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
460 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
461 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
462 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
463 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
464 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
465 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
466 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
467 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
468 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
469 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
470 pixblt_r_1_opx, pixblt_r_1_opx_trans, pixblt_r_1_opx, pixblt_r_1_opx_trans,
471
472 pixblt_r_2_op0, pixblt_r_2_op0_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
473 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
474 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
475 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
476 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
477 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
478 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
479 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
480 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
481 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
482 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
483 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
484 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
485 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
486 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
487 pixblt_r_2_opx, pixblt_r_2_opx_trans, pixblt_r_2_opx, pixblt_r_2_opx_trans,
488
489 pixblt_r_4_op0, pixblt_r_4_op0_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
490 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
491 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
492 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
493 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
494 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
495 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
496 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
497 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
498 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
499 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
500 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
501 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
502 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
503 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
504 pixblt_r_4_opx, pixblt_r_4_opx_trans, pixblt_r_4_opx, pixblt_r_4_opx_trans,
505
506 pixblt_r_8_op0, pixblt_r_8_op0_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
507 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
508 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
509 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
510 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
511 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
512 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
513 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
514 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
515 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
516 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
517 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
518 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
519 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
520 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
521 pixblt_r_8_opx, pixblt_r_8_opx_trans, pixblt_r_8_opx, pixblt_r_8_opx_trans,
522
523 pixblt_r_16_op0,pixblt_r_16_op0_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
524 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
525 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
526 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
527 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
528 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
529 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
530 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
531 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
532 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
533 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
534 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
535 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
536 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
537 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans,
538 pixblt_r_16_opx,pixblt_r_16_opx_trans, pixblt_r_16_opx,pixblt_r_16_opx_trans
539 };
540
541 static void (*pixblt_b_op_table[])(int) =
542 {
543 pixblt_b_1_op0, pixblt_b_1_op0_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
544 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
545 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
546 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
547 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
548 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
549 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
550 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
551 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
552 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
553 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
554 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
555 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
556 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
557 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
558 pixblt_b_1_opx, pixblt_b_1_opx_trans, pixblt_b_1_opx, pixblt_b_1_opx_trans,
559
560 pixblt_b_2_op0, pixblt_b_2_op0_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
561 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
562 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
563 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
564 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
565 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
566 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
567 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
568 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
569 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
570 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
571 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
572 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
573 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
574 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
575 pixblt_b_2_opx, pixblt_b_2_opx_trans, pixblt_b_2_opx, pixblt_b_2_opx_trans,
576
577 pixblt_b_4_op0, pixblt_b_4_op0_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
578 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
579 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
580 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
581 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
582 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
583 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
584 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
585 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
586 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
587 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
588 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
589 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
590 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
591 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
592 pixblt_b_4_opx, pixblt_b_4_opx_trans, pixblt_b_4_opx, pixblt_b_4_opx_trans,
593
594 pixblt_b_8_op0, pixblt_b_8_op0_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
595 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
596 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
597 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
598 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
599 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
600 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
601 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
602 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
603 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
604 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
605 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
606 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
607 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
608 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
609 pixblt_b_8_opx, pixblt_b_8_opx_trans, pixblt_b_8_opx, pixblt_b_8_opx_trans,
610
611 pixblt_b_16_op0,pixblt_b_16_op0_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
612 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
613 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
614 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
615 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
616 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
617 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
618 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
619 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
620 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
621 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
622 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
623 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
624 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
625 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans,
626 pixblt_b_16_opx,pixblt_b_16_opx_trans, pixblt_b_16_opx,pixblt_b_16_opx_trans
627 };
628
629 static void (*fill_op_table[])(int) =
630 {
631 fill_1_op0, fill_1_op0_trans, fill_1_opx, fill_1_opx_trans,
632 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
633 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
634 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
635 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
636 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
637 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
638 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
639 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
640 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
641 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
642 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
643 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
644 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
645 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
646 fill_1_opx, fill_1_opx_trans, fill_1_opx, fill_1_opx_trans,
647
648 fill_2_op0, fill_2_op0_trans, fill_2_opx, fill_2_opx_trans,
649 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
650 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
651 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
652 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
653 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
654 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
655 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
656 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
657 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
658 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
659 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
660 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
661 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
662 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
663 fill_2_opx, fill_2_opx_trans, fill_2_opx, fill_2_opx_trans,
664
665 fill_4_op0, fill_4_op0_trans, fill_4_opx, fill_4_opx_trans,
666 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
667 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
668 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
669 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
670 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
671 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
672 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
673 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
674 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
675 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
676 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
677 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
678 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
679 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
680 fill_4_opx, fill_4_opx_trans, fill_4_opx, fill_4_opx_trans,
681
682 fill_8_op0, fill_8_op0_trans, fill_8_opx, fill_8_opx_trans,
683 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
684 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
685 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
686 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
687 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
688 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
689 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
690 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
691 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
692 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
693 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
694 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
695 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
696 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
697 fill_8_opx, fill_8_opx_trans, fill_8_opx, fill_8_opx_trans,
698
699 fill_16_op0, fill_16_op0_trans, fill_16_opx, fill_16_opx_trans,
700 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
701 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
702 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
703 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
704 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
705 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
706 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
707 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
708 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
709 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
710 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
711 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
712 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
713 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans,
714 fill_16_opx, fill_16_opx_trans, fill_16_opx, fill_16_opx_trans
715 };
716
717
718 #define RECURSIVE_INCLUDE
719
720 /* non-transparent replace ops */
721 #define PIXEL_OP(src, mask, pixel) pixel = pixel
722 #define PIXEL_OP_TIMING 2
723 #define PIXEL_OP_REQUIRES_SOURCE 0
724 #define TRANSPARENCY 0
725
726 /* 1bpp cases */
727 #define BITS_PER_PIXEL 1
728 #define FUNCTION_NAME(base) base##_1_op0
729 #include "34010gfx.c"
730 #undef FUNCTION_NAME
731 #undef BITS_PER_PIXEL
732
733 /* 2bpp cases */
734 #define BITS_PER_PIXEL 2
735 #define FUNCTION_NAME(base) base##_2_op0
736 #include "34010gfx.c"
737 #undef FUNCTION_NAME
738 #undef BITS_PER_PIXEL
739
740 /* 4bpp cases */
741 #define BITS_PER_PIXEL 4
742 #define FUNCTION_NAME(base) base##_4_op0
743 #include "34010gfx.c"
744 #undef FUNCTION_NAME
745 #undef BITS_PER_PIXEL
746
747 /* 8bpp cases */
748 #define BITS_PER_PIXEL 8
749 #define FUNCTION_NAME(base) base##_8_op0
750 #include "34010gfx.c"
751 #undef FUNCTION_NAME
752 #undef BITS_PER_PIXEL
753
754 /* 16bpp cases */
755 #define BITS_PER_PIXEL 16
756 #define FUNCTION_NAME(base) base##_16_op0
757 #include "34010gfx.c"
758 #undef FUNCTION_NAME
759 #undef BITS_PER_PIXEL
760
761 #undef TRANSPARENCY
762 #undef PIXEL_OP_REQUIRES_SOURCE
763 #undef PIXEL_OP_TIMING
764 #undef PIXEL_OP
765
766
767 #define PIXEL_OP(src, mask, pixel) pixel = (*pixel_op)(src, mask, pixel)
768 #define PIXEL_OP_TIMING pixel_op_timing
769 #define PIXEL_OP_REQUIRES_SOURCE 1
770 #define TRANSPARENCY 0
771
772 /* 1bpp cases */
773 #define BITS_PER_PIXEL 1
774 #define FUNCTION_NAME(base) base##_1_opx
775 #include "34010gfx.c"
776 #undef FUNCTION_NAME
777 #undef BITS_PER_PIXEL
778
779 /* 2bpp cases */
780 #define BITS_PER_PIXEL 2
781 #define FUNCTION_NAME(base) base##_2_opx
782 #include "34010gfx.c"
783 #undef FUNCTION_NAME
784 #undef BITS_PER_PIXEL
785
786 /* 4bpp cases */
787 #define BITS_PER_PIXEL 4
788 #define FUNCTION_NAME(base) base##_4_opx
789 #include "34010gfx.c"
790 #undef FUNCTION_NAME
791 #undef BITS_PER_PIXEL
792
793 /* 8bpp cases */
794 #define BITS_PER_PIXEL 8
795 #define FUNCTION_NAME(base) base##_8_opx
796 #include "34010gfx.c"
797 #undef FUNCTION_NAME
798 #undef BITS_PER_PIXEL
799
800 /* 16bpp cases */
801 #define BITS_PER_PIXEL 16
802 #define FUNCTION_NAME(base) base##_16_opx
803 #include "34010gfx.c"
804 #undef FUNCTION_NAME
805 #undef BITS_PER_PIXEL
806
807 #undef TRANSPARENCY
808 #undef PIXEL_OP_REQUIRES_SOURCE
809 #undef PIXEL_OP_TIMING
810 #undef PIXEL_OP
811
812
813 /* transparent replace ops */
814 #define PIXEL_OP(src, mask, pixel) pixel = pixel
815 #define PIXEL_OP_REQUIRES_SOURCE 0
816 #define PIXEL_OP_TIMING 4
817 #define TRANSPARENCY 1
818
819 /* 1bpp cases */
820 #define BITS_PER_PIXEL 1
821 #define FUNCTION_NAME(base) base##_1_op0_trans
822 #include "34010gfx.c"
823 #undef FUNCTION_NAME
824 #undef BITS_PER_PIXEL
825
826 /* 2bpp cases */
827 #define BITS_PER_PIXEL 2
828 #define FUNCTION_NAME(base) base##_2_op0_trans
829 #include "34010gfx.c"
830 #undef FUNCTION_NAME
831 #undef BITS_PER_PIXEL
832
833 /* 4bpp cases */
834 #define BITS_PER_PIXEL 4
835 #define FUNCTION_NAME(base) base##_4_op0_trans
836 #include "34010gfx.c"
837 #undef FUNCTION_NAME
838 #undef BITS_PER_PIXEL
839
840 /* 8bpp cases */
841 #define BITS_PER_PIXEL 8
842 #define FUNCTION_NAME(base) base##_8_op0_trans
843 #include "34010gfx.c"
844 #undef FUNCTION_NAME
845 #undef BITS_PER_PIXEL
846
847 /* 16bpp cases */
848 #define BITS_PER_PIXEL 16
849 #define FUNCTION_NAME(base) base##_16_op0_trans
850 #include "34010gfx.c"
851 #undef FUNCTION_NAME
852 #undef BITS_PER_PIXEL
853
854 #undef TRANSPARENCY
855 #undef PIXEL_OP_REQUIRES_SOURCE
856 #undef PIXEL_OP_TIMING
857 #undef PIXEL_OP
858
859
860 #define PIXEL_OP(src, mask, pixel) pixel = (*pixel_op)(src, mask, pixel)
861 #define PIXEL_OP_REQUIRES_SOURCE 1
862 #define PIXEL_OP_TIMING (2+pixel_op_timing)
863 #define TRANSPARENCY 1
864
865 /* 1bpp cases */
866 #define BITS_PER_PIXEL 1
867 #define FUNCTION_NAME(base) base##_1_opx_trans
868 #include "34010gfx.c"
869 #undef FUNCTION_NAME
870 #undef BITS_PER_PIXEL
871
872 /* 2bpp cases */
873 #define BITS_PER_PIXEL 2
874 #define FUNCTION_NAME(base) base##_2_opx_trans
875 #include "34010gfx.c"
876 #undef FUNCTION_NAME
877 #undef BITS_PER_PIXEL
878
879 /* 4bpp cases */
880 #define BITS_PER_PIXEL 4
881 #define FUNCTION_NAME(base) base##_4_opx_trans
882 #include "34010gfx.c"
883 #undef FUNCTION_NAME
884 #undef BITS_PER_PIXEL
885
886 /* 8bpp cases */
887 #define BITS_PER_PIXEL 8
888 #define FUNCTION_NAME(base) base##_8_opx_trans
889 #include "34010gfx.c"
890 #undef FUNCTION_NAME
891 #undef BITS_PER_PIXEL
892
893 /* 16bpp cases */
894 #define BITS_PER_PIXEL 16
895 #define FUNCTION_NAME(base) base##_16_opx_trans
896 #include "34010gfx.c"
897 #undef FUNCTION_NAME
898 #undef BITS_PER_PIXEL
899
900 #undef TRANSPARENCY
901 #undef PIXEL_OP_REQUIRES_SOURCE
902 #undef PIXEL_OP_TIMING
903 #undef PIXEL_OP
904
905 static UINT8 pixelsize_lookup[32] =
906 {
907 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
908 };
909
910
pixblt_b_l(void)911 static void pixblt_b_l(void)
912 {
913 int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
914 int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
915 int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
916 int ix = trans | (rop << 1) | (psize << 6);
917 //if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT B,L (%dx%d) depth=%d\n", PC, cpu_getscanline(), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32));
918 pixel_op = pixel_op_table[rop];
919 pixel_op_timing = pixel_op_timing_table[rop];
920 (*pixblt_b_op_table[ix])(1);
921 }
922
pixblt_b_xy(void)923 static void pixblt_b_xy(void)
924 {
925 int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
926 int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
927 int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
928 int ix = trans | (rop << 1) | (psize << 6);
929 //if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT B,XY (%d,%d) (%dx%d) depth=%d\n", PC, cpu_getscanline(), DADDR_X, DADDR_Y, DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32));
930 pixel_op = pixel_op_table[rop];
931 pixel_op_timing = pixel_op_timing_table[rop];
932 (*pixblt_b_op_table[ix])(0);
933 }
934
pixblt_l_l(void)935 static void pixblt_l_l(void)
936 {
937 int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
938 int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
939 int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
940 int pbh = (IOREG(REG_CONTROL) >> 8) & 1;
941 int ix = trans | (rop << 1) | (psize << 6);
942 //if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT L,L (%dx%d) depth=%d\n", PC, cpu_getscanline(), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32));
943 pixel_op = pixel_op_table[rop];
944 pixel_op_timing = pixel_op_timing_table[rop];
945 if (!pbh)
946 (*pixblt_op_table[ix])(1, 1);
947 else
948 (*pixblt_r_op_table[ix])(1, 1);
949 }
950
pixblt_l_xy(void)951 static void pixblt_l_xy(void)
952 {
953 int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
954 int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
955 int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
956 int pbh = (IOREG(REG_CONTROL) >> 8) & 1;
957 int ix = trans | (rop << 1) | (psize << 6);
958 //if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT L,XY (%d,%d) (%dx%d) depth=%d\n", PC, cpu_getscanline(), DADDR_X, DADDR_Y, DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32));
959 pixel_op = pixel_op_table[rop];
960 pixel_op_timing = pixel_op_timing_table[rop];
961 if (!pbh)
962 (*pixblt_op_table[ix])(1, 0);
963 else
964 (*pixblt_r_op_table[ix])(1, 0);
965 }
966
pixblt_xy_l(void)967 static void pixblt_xy_l(void)
968 {
969 int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
970 int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
971 int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
972 int pbh = (IOREG(REG_CONTROL) >> 8) & 1;
973 int ix = trans | (rop << 1) | (psize << 6);
974 //if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT XY,L (%dx%d) depth=%d\n", PC, cpu_getscanline(), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32));
975 pixel_op = pixel_op_table[rop];
976 pixel_op_timing = pixel_op_timing_table[rop];
977 if (!pbh)
978 (*pixblt_op_table[ix])(0, 1);
979 else
980 (*pixblt_r_op_table[ix])(0, 1);
981 }
982
pixblt_xy_xy(void)983 static void pixblt_xy_xy(void)
984 {
985 int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
986 int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
987 int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
988 int pbh = (IOREG(REG_CONTROL) >> 8) & 1;
989 int ix = trans | (rop << 1) | (psize << 6);
990 //if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT XY,XY (%dx%d) depth=%d\n", PC, cpu_getscanline(), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32));
991 pixel_op = pixel_op_table[rop];
992 pixel_op_timing = pixel_op_timing_table[rop];
993 if (!pbh)
994 (*pixblt_op_table[ix])(0, 0);
995 else
996 (*pixblt_r_op_table[ix])(0, 0);
997 }
998
fill_l(void)999 static void fill_l(void)
1000 {
1001 int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
1002 int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
1003 int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
1004 int ix = trans | (rop << 1) | (psize << 6);
1005 //if (!P_FLAG) LOGGFX(("%08X(%3d):FILL L (%dx%d) depth=%d\n", PC, cpu_getscanline(), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32));
1006 pixel_op = pixel_op_table[rop];
1007 pixel_op_timing = pixel_op_timing_table[rop];
1008 (*fill_op_table[ix])(1);
1009 }
1010
fill_xy(void)1011 static void fill_xy(void)
1012 {
1013 int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
1014 int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
1015 int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
1016 int ix = trans | (rop << 1) | (psize << 6);
1017 //if (!P_FLAG) LOGGFX(("%08X(%3d):FILL XY (%d,%d) (%dx%d) depth=%d\n", PC, cpu_getscanline(), DADDR_X, DADDR_Y, DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32));
1018 pixel_op = pixel_op_table[rop];
1019 pixel_op_timing = pixel_op_timing_table[rop];
1020 (*fill_op_table[ix])(0);
1021 }
1022
1023
1024 #else
1025
1026
1027 #undef PIXELS_PER_WORD
1028 #undef PIXEL_MASK
1029
1030 #define PIXELS_PER_WORD (16 / BITS_PER_PIXEL)
1031 #define PIXEL_MASK ((1 << BITS_PER_PIXEL) - 1)
1032
1033 #ifdef macintosh
1034 #pragma optimization_level 1
1035 #endif
1036
FUNCTION_NAME(pixblt)1037 static void FUNCTION_NAME(pixblt)(int src_is_linear, int dst_is_linear)
1038 {
1039 /* if this is the first time through, perform the operation */
1040 if (!P_FLAG)
1041 {
1042 int dx, dy, x, y, words, yreverse;
1043 void (*word_write)(offs_t address,data16_t data);
1044 data16_t (*word_read)(offs_t address);
1045 UINT32 saddr, daddr;
1046
1047 /* determine read/write functions */
1048 if (IOREG(REG_DPYCTL) & 0x0800)
1049 {
1050 word_write = shiftreg_w;
1051 word_read = shiftreg_r;
1052 }
1053 else
1054 {
1055 word_write = cpu_writemem29lew_word;
1056 word_read = cpu_readmem29lew_word;
1057 }
1058
1059 /* compute the starting addresses */
1060 saddr = src_is_linear ? SADDR : SXYTOL(SADDR_XY);
1061 saddr &= ~(BITS_PER_PIXEL - 1);
1062
1063 /* compute the bounds of the operation */
1064 dx = (INT16)DYDX_X;
1065 dy = (INT16)DYDX_Y;
1066
1067 /* apply the window for non-linear destinations */
1068 state.gfxcycles = 7 + (src_is_linear ? 0 : 2);
1069 if (!dst_is_linear)
1070 {
1071 XY temp = DADDR_XY;
1072 state.gfxcycles += 2 + (!src_is_linear) + apply_window("PIXBLT", BITS_PER_PIXEL, &saddr, &temp, &dx, &dy);
1073 daddr = DXYTOL(temp);
1074 }
1075 else
1076 daddr = DADDR;
1077 daddr &= ~(BITS_PER_PIXEL - 1);
1078 //LOGGFX((" saddr=%08X daddr=%08X sptch=%08X dptch=%08X\n", saddr, daddr, SPTCH, DPTCH));
1079
1080 /* bail if we're clipped */
1081 if (dx <= 0 || dy <= 0)
1082 return;
1083
1084 /* handle flipping the addresses */
1085 yreverse = (IOREG(REG_CONTROL) >> 9) & 1;
1086 if (!src_is_linear || !dst_is_linear)
1087 if (yreverse)
1088 {
1089 saddr += (dy - 1) * SPTCH;
1090 daddr += (dy - 1) * DPTCH;
1091 }
1092
1093 P_FLAG = 1;
1094
1095 /* loop over rows */
1096 for (y = 0; y < dy; y++)
1097 {
1098 int left_partials, right_partials, full_words, bitshift, bitshift_alt;
1099 UINT16 srcword, srcmask, dstword, dstmask, pixel;
1100 UINT32 swordaddr, dwordaddr;
1101
1102 /* determine the bit shift to get from source to dest */
1103 bitshift = ((daddr & 15) - (saddr & 15)) & 15;
1104 bitshift_alt = (16 - bitshift) & 15;
1105
1106 /* how many left and right partial pixels do we have? */
1107 left_partials = (PIXELS_PER_WORD - ((daddr & 15) / BITS_PER_PIXEL)) & (PIXELS_PER_WORD - 1);
1108 right_partials = ((daddr + dx * BITS_PER_PIXEL) & 15) / BITS_PER_PIXEL;
1109 full_words = dx - left_partials - right_partials;
1110 if (full_words < 0)
1111 left_partials = dx, right_partials = full_words = 0;
1112 else
1113 full_words /= PIXELS_PER_WORD;
1114
1115 /* compute cycles */
1116 state.gfxcycles += compute_pixblt_cycles(left_partials, right_partials, full_words, PIXEL_OP_TIMING);
1117
1118 /* use word addresses each row */
1119 swordaddr = saddr >> 4;
1120 dwordaddr = daddr >> 4;
1121
1122 /* fetch the initial source word */
1123 srcword = (*word_read)(swordaddr++ << 1);
1124 srcmask = PIXEL_MASK << (saddr & 15);
1125
1126 /* handle the left partial word */
1127 if (left_partials != 0)
1128 {
1129 /* fetch the destination word */
1130 dstword = (*word_read)(dwordaddr << 1);
1131 dstmask = PIXEL_MASK << (daddr & 15);
1132
1133 /* loop over partials */
1134 for (x = 0; x < left_partials; x++)
1135 {
1136 /* fetch another word if necessary */
1137 if (srcmask == 0)
1138 {
1139 srcword = (*word_read)(swordaddr++ << 1);
1140 srcmask = PIXEL_MASK;
1141 }
1142
1143 /* process the pixel */
1144 pixel = srcword & srcmask;
1145 if (dstmask > srcmask)
1146 pixel <<= bitshift;
1147 else
1148 pixel >>= bitshift_alt;
1149 PIXEL_OP(dstword, dstmask, pixel);
1150 if (!TRANSPARENCY || pixel != 0)
1151 dstword = (dstword & ~dstmask) | pixel;
1152
1153 /* update the source */
1154 srcmask <<= BITS_PER_PIXEL;
1155
1156 /* update the destination */
1157 dstmask <<= BITS_PER_PIXEL;
1158 }
1159
1160 /* write the result */
1161 (*word_write)(dwordaddr++ << 1, dstword);
1162 }
1163
1164 /* loop over full words */
1165 for (words = 0; words < full_words; words++)
1166 {
1167 /* fetch the destination word (if necessary) */
1168 if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
1169 dstword = (*word_read)(dwordaddr << 1);
1170 else
1171 dstword = 0;
1172 dstmask = PIXEL_MASK;
1173
1174 /* loop over partials */
1175 for (x = 0; x < PIXELS_PER_WORD; x++)
1176 {
1177 /* fetch another word if necessary */
1178 if (srcmask == 0)
1179 {
1180 srcword = (*word_read)(swordaddr++ << 1);
1181 srcmask = PIXEL_MASK;
1182 }
1183
1184 /* process the pixel */
1185 pixel = srcword & srcmask;
1186 if (dstmask > srcmask)
1187 pixel <<= bitshift;
1188 else
1189 pixel >>= bitshift_alt;
1190 PIXEL_OP(dstword, dstmask, pixel);
1191 if (!TRANSPARENCY || pixel != 0)
1192 dstword = (dstword & ~dstmask) | pixel;
1193
1194 /* update the source */
1195 srcmask <<= BITS_PER_PIXEL;
1196
1197 /* update the destination */
1198 dstmask <<= BITS_PER_PIXEL;
1199 }
1200
1201 /* write the result */
1202 (*word_write)(dwordaddr++ << 1, dstword);
1203 }
1204
1205 /* handle the right partial word */
1206 if (right_partials != 0)
1207 {
1208 /* fetch the destination word */
1209 dstword = (*word_read)(dwordaddr << 1);
1210 dstmask = PIXEL_MASK;
1211
1212 /* loop over partials */
1213 for (x = 0; x < right_partials; x++)
1214 {
1215 /* fetch another word if necessary */
1216 if (srcmask == 0)
1217 {
1218 srcword = (*word_read)(swordaddr++ << 1);
1219 srcmask = PIXEL_MASK;
1220 }
1221
1222 /* process the pixel */
1223 pixel = srcword & srcmask;
1224 if (dstmask > srcmask)
1225 pixel <<= bitshift;
1226 else
1227 pixel >>= bitshift_alt;
1228 PIXEL_OP(dstword, dstmask, pixel);
1229 if (!TRANSPARENCY || pixel != 0)
1230 dstword = (dstword & ~dstmask) | pixel;
1231
1232 /* update the source */
1233 srcmask <<= BITS_PER_PIXEL;
1234
1235 /* update the destination */
1236 dstmask <<= BITS_PER_PIXEL;
1237 }
1238
1239 /* write the result */
1240 (*word_write)(dwordaddr++ << 1, dstword);
1241 }
1242
1243 /* update for next row */
1244 if (!yreverse)
1245 {
1246 saddr += SPTCH;
1247 daddr += DPTCH;
1248 }
1249 else
1250 {
1251 saddr -= SPTCH;
1252 daddr -= DPTCH;
1253 }
1254 }
1255 //LOGGFX((" (%d cycles)\n", state.gfxcycles));
1256 }
1257
1258 /* eat cycles */
1259 if (state.gfxcycles > tms34010_ICount)
1260 {
1261 state.gfxcycles -= tms34010_ICount;
1262 tms34010_ICount = 0;
1263 PC -= 0x10;
1264 }
1265 else
1266 {
1267 tms34010_ICount -= state.gfxcycles;
1268 P_FLAG = 0;
1269 if (src_is_linear && dst_is_linear)
1270 SADDR += DYDX_Y * SPTCH;
1271 else if (src_is_linear)
1272 SADDR += DYDX_Y * SPTCH;
1273 else
1274 SADDR_Y += DYDX_Y;
1275 if (dst_is_linear)
1276 DADDR += DYDX_Y * DPTCH;
1277 else
1278 DADDR_Y += DYDX_Y;
1279 }
1280 }
1281
FUNCTION_NAME(pixblt_r)1282 static void FUNCTION_NAME(pixblt_r)(int src_is_linear, int dst_is_linear)
1283 {
1284 /* if this is the first time through, perform the operation */
1285 if (!P_FLAG)
1286 {
1287 int dx, dy, x, y, words, yreverse;
1288 void (*word_write)(offs_t address,data16_t data);
1289 data16_t (*word_read)(offs_t address);
1290 UINT32 saddr, daddr;
1291
1292 /* determine read/write functions */
1293 if (IOREG(REG_DPYCTL) & 0x0800)
1294 {
1295 word_write = shiftreg_w;
1296 word_read = shiftreg_r;
1297 }
1298 else
1299 {
1300 word_write = cpu_writemem29lew_word;
1301 word_read = cpu_readmem29lew_word;
1302 }
1303
1304 /* compute the starting addresses */
1305 saddr = src_is_linear ? SADDR : SXYTOL(SADDR_XY);
1306 saddr &= ~(BITS_PER_PIXEL - 1);
1307
1308 /* compute the bounds of the operation */
1309 dx = (INT16)DYDX_X;
1310 dy = (INT16)DYDX_Y;
1311
1312 /* apply the window for non-linear destinations */
1313 state.gfxcycles = 7 + (src_is_linear ? 0 : 2);
1314 if (!dst_is_linear)
1315 {
1316 XY temp = DADDR_XY;
1317 state.gfxcycles += 2 + (!src_is_linear) + apply_window("PIXBLT R", BITS_PER_PIXEL, &saddr, &temp, &dx, &dy);
1318 daddr = DXYTOL(temp);
1319 }
1320 else
1321 daddr = DADDR;
1322 daddr &= ~(BITS_PER_PIXEL - 1);
1323 //LOGGFX((" saddr=%08X daddr=%08X sptch=%08X dptch=%08X\n", saddr, daddr, SPTCH, DPTCH));
1324
1325 /* bail if we're clipped */
1326 if (dx <= 0 || dy <= 0)
1327 return;
1328
1329 /* handle flipping the addresses */
1330 yreverse = (IOREG(REG_CONTROL) >> 9) & 1;
1331 if (!src_is_linear || !dst_is_linear)
1332 {
1333 saddr += dx * BITS_PER_PIXEL;
1334 daddr += dx * BITS_PER_PIXEL;
1335 if (yreverse)
1336 {
1337 saddr += (dy - 1) * SPTCH;
1338 daddr += (dy - 1) * DPTCH;
1339 }
1340 }
1341
1342 P_FLAG = 1;
1343
1344 /* loop over rows */
1345 for (y = 0; y < dy; y++)
1346 {
1347 int left_partials, right_partials, full_words, bitshift, bitshift_alt;
1348 UINT16 srcword, srcmask, dstword, dstmask, pixel;
1349 UINT32 swordaddr, dwordaddr;
1350
1351 /* determine the bit shift to get from source to dest */
1352 bitshift = ((daddr & 15) - (saddr & 15)) & 15;
1353 bitshift_alt = (16 - bitshift) & 15;
1354
1355 /* how many left and right partial pixels do we have? */
1356 left_partials = (PIXELS_PER_WORD - (((daddr - dx * BITS_PER_PIXEL) & 15) / BITS_PER_PIXEL)) & (PIXELS_PER_WORD - 1);
1357 right_partials = (daddr & 15) / BITS_PER_PIXEL;
1358 full_words = dx - left_partials - right_partials;
1359 if (full_words < 0)
1360 right_partials = dx, left_partials = full_words = 0;
1361 else
1362 full_words /= PIXELS_PER_WORD;
1363
1364 /* compute cycles */
1365 state.gfxcycles += compute_pixblt_cycles(left_partials, right_partials, full_words, PIXEL_OP_TIMING);
1366
1367 /* use word addresses each row */
1368 swordaddr = (saddr + 15) >> 4;
1369 dwordaddr = (daddr + 15) >> 4;
1370
1371 /* fetch the initial source word */
1372 srcword = (*word_read)(--swordaddr << 1);
1373 srcmask = PIXEL_MASK << ((saddr - BITS_PER_PIXEL) & 15);
1374
1375 /* handle the right partial word */
1376 if (right_partials != 0)
1377 {
1378 /* fetch the destination word */
1379 dstword = (*word_read)(--dwordaddr << 1);
1380 dstmask = PIXEL_MASK << ((daddr - BITS_PER_PIXEL) & 15);
1381
1382 /* loop over partials */
1383 for (x = 0; x < right_partials; x++)
1384 {
1385 /* process the pixel */
1386 pixel = srcword & srcmask;
1387 if (dstmask > srcmask)
1388 pixel <<= bitshift;
1389 else
1390 pixel >>= bitshift_alt;
1391 PIXEL_OP(dstword, dstmask, pixel);
1392 if (!TRANSPARENCY || pixel != 0)
1393 dstword = (dstword & ~dstmask) | pixel;
1394
1395 /* update the source */
1396 srcmask >>= BITS_PER_PIXEL;
1397 if (srcmask == 0)
1398 {
1399 srcword = (*word_read)(--swordaddr << 1);
1400 srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
1401 }
1402
1403 /* update the destination */
1404 dstmask >>= BITS_PER_PIXEL;
1405 }
1406
1407 /* write the result */
1408 (*word_write)(dwordaddr << 1, dstword);
1409 }
1410
1411 /* loop over full words */
1412 for (words = 0; words < full_words; words++)
1413 {
1414 /* fetch the destination word (if necessary) */
1415 dwordaddr--;
1416 if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
1417 dstword = (*word_read)(dwordaddr << 1);
1418 else
1419 dstword = 0;
1420 dstmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
1421
1422 /* loop over partials */
1423 for (x = 0; x < PIXELS_PER_WORD; x++)
1424 {
1425 /* process the pixel */
1426 pixel = srcword & srcmask;
1427 if (dstmask > srcmask)
1428 pixel <<= bitshift;
1429 else
1430 pixel >>= bitshift_alt;
1431 PIXEL_OP(dstword, dstmask, pixel);
1432 if (!TRANSPARENCY || pixel != 0)
1433 dstword = (dstword & ~dstmask) | pixel;
1434
1435 /* update the source */
1436 srcmask >>= BITS_PER_PIXEL;
1437 if (srcmask == 0)
1438 {
1439 srcword = (*word_read)(--swordaddr << 1);
1440 srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
1441 }
1442
1443 /* update the destination */
1444 dstmask >>= BITS_PER_PIXEL;
1445 }
1446
1447 /* write the result */
1448 (*word_write)(dwordaddr << 1, dstword);
1449 }
1450
1451 /* handle the left partial word */
1452 if (left_partials != 0)
1453 {
1454 /* fetch the destination word */
1455 dstword = (*word_read)(--dwordaddr << 1);
1456 dstmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
1457
1458 /* loop over partials */
1459 for (x = 0; x < left_partials; x++)
1460 {
1461 /* process the pixel */
1462 pixel = srcword & srcmask;
1463 if (dstmask > srcmask)
1464 pixel <<= bitshift;
1465 else
1466 pixel >>= bitshift_alt;
1467 PIXEL_OP(dstword, dstmask, pixel);
1468 if (!TRANSPARENCY || pixel != 0)
1469 dstword = (dstword & ~dstmask) | pixel;
1470
1471 /* update the source */
1472 srcmask >>= BITS_PER_PIXEL;
1473 if (srcmask == 0)
1474 {
1475 srcword = (*word_read)(--swordaddr << 1);
1476 srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
1477 }
1478
1479 /* update the destination */
1480 dstmask >>= BITS_PER_PIXEL;
1481 }
1482
1483 /* write the result */
1484 (*word_write)(dwordaddr << 1, dstword);
1485 }
1486
1487 /* update for next row */
1488 if (!yreverse)
1489 {
1490 saddr += SPTCH;
1491 daddr += DPTCH;
1492 }
1493 else
1494 {
1495 saddr -= SPTCH;
1496 daddr -= DPTCH;
1497 }
1498 }
1499 //LOGGFX((" (%d cycles)\n", state.gfxcycles));
1500 }
1501
1502 /* eat cycles */
1503 if (state.gfxcycles > tms34010_ICount)
1504 {
1505 state.gfxcycles -= tms34010_ICount;
1506 tms34010_ICount = 0;
1507 PC -= 0x10;
1508 }
1509 else
1510 {
1511 tms34010_ICount -= state.gfxcycles;
1512 P_FLAG = 0;
1513 if (src_is_linear && dst_is_linear)
1514 SADDR += DYDX_Y * SPTCH;
1515 else if (src_is_linear)
1516 SADDR += DYDX_Y * SPTCH;
1517 else
1518 SADDR_Y += DYDX_Y;
1519 if (dst_is_linear)
1520 DADDR += DYDX_Y * DPTCH;
1521 else
1522 DADDR_Y += DYDX_Y;
1523 }
1524 }
1525
1526 #ifdef macintosh
1527 #pragma optimization_level reset
1528 #endif
1529
FUNCTION_NAME(pixblt_b)1530 static void FUNCTION_NAME(pixblt_b)(int dst_is_linear)
1531 {
1532 /* if this is the first time through, perform the operation */
1533 if (!P_FLAG)
1534 {
1535 int dx, dy, x, y, words, left_partials, right_partials, full_words;
1536 void (*word_write)(offs_t address,data16_t data);
1537 data16_t (*word_read)(offs_t address);
1538 UINT32 saddr, daddr;
1539
1540 /* determine read/write functions */
1541 if (IOREG(REG_DPYCTL) & 0x0800)
1542 {
1543 word_write = shiftreg_w;
1544 word_read = shiftreg_r;
1545 }
1546 else
1547 {
1548 word_write = cpu_writemem29lew_word;
1549 word_read = cpu_readmem29lew_word;
1550 }
1551
1552 /* compute the starting addresses */
1553 saddr = SADDR;
1554
1555 /* compute the bounds of the operation */
1556 dx = (INT16)DYDX_X;
1557 dy = (INT16)DYDX_Y;
1558
1559 /* apply the window for non-linear destinations */
1560 state.gfxcycles = 4;
1561 if (!dst_is_linear)
1562 {
1563 XY temp = DADDR_XY;
1564 state.gfxcycles += 2 + apply_window("PIXBLT B", 1, &saddr, &temp, &dx, &dy);
1565 daddr = DXYTOL(temp);
1566 }
1567 else
1568 daddr = DADDR;
1569 daddr &= ~(BITS_PER_PIXEL - 1);
1570 //LOGGFX((" saddr=%08X daddr=%08X sptch=%08X dptch=%08X\n", saddr, daddr, SPTCH, DPTCH));
1571
1572 /* bail if we're clipped */
1573 if (dx <= 0 || dy <= 0)
1574 return;
1575
1576 /* how many left and right partial pixels do we have? */
1577 left_partials = (PIXELS_PER_WORD - ((daddr & 15) / BITS_PER_PIXEL)) & (PIXELS_PER_WORD - 1);
1578 right_partials = ((daddr + dx * BITS_PER_PIXEL) & 15) / BITS_PER_PIXEL;
1579 full_words = dx - left_partials - right_partials;
1580 if (full_words < 0)
1581 left_partials = dx, right_partials = full_words = 0;
1582 else
1583 full_words /= PIXELS_PER_WORD;
1584
1585 /* compute cycles */
1586 state.gfxcycles += compute_pixblt_b_cycles(left_partials, right_partials, full_words, dy, PIXEL_OP_TIMING, BITS_PER_PIXEL);
1587 P_FLAG = 1;
1588
1589 /* loop over rows */
1590 for (y = 0; y < dy; y++)
1591 {
1592 UINT16 srcword, srcmask, dstword, dstmask, pixel;
1593 UINT32 swordaddr, dwordaddr;
1594
1595 /* use byte addresses each row */
1596 swordaddr = saddr >> 4;
1597 dwordaddr = daddr >> 4;
1598
1599 /* fetch the initial source word */
1600 srcword = (*word_read)(swordaddr++ << 1);
1601 srcmask = 1 << (saddr & 15);
1602
1603 /* handle the left partial word */
1604 if (left_partials != 0)
1605 {
1606 /* fetch the destination word */
1607 dstword = (*word_read)(dwordaddr << 1);
1608 dstmask = PIXEL_MASK << (daddr & 15);
1609
1610 /* loop over partials */
1611 for (x = 0; x < left_partials; x++)
1612 {
1613 /* process the pixel */
1614 pixel = (srcword & srcmask) ? COLOR1 : COLOR0;
1615 pixel &= dstmask;
1616 PIXEL_OP(dstword, dstmask, pixel);
1617 if (!TRANSPARENCY || pixel != 0)
1618 dstword = (dstword & ~dstmask) | pixel;
1619
1620 /* update the source */
1621 srcmask <<= 1;
1622 if (srcmask == 0)
1623 {
1624 srcword = (*word_read)(swordaddr++ << 1);
1625 srcmask = 0x0001;
1626 }
1627
1628 /* update the destination */
1629 dstmask <<= BITS_PER_PIXEL;
1630 }
1631
1632 /* write the result */
1633 (*word_write)(dwordaddr++ << 1, dstword);
1634 }
1635
1636 /* loop over full words */
1637 for (words = 0; words < full_words; words++)
1638 {
1639 /* fetch the destination word (if necessary) */
1640 if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
1641 dstword = (*word_read)(dwordaddr << 1);
1642 else
1643 dstword = 0;
1644 dstmask = PIXEL_MASK;
1645
1646 /* loop over partials */
1647 for (x = 0; x < PIXELS_PER_WORD; x++)
1648 {
1649 /* process the pixel */
1650 pixel = (srcword & srcmask) ? COLOR1 : COLOR0;
1651 pixel &= dstmask;
1652 PIXEL_OP(dstword, dstmask, pixel);
1653 if (!TRANSPARENCY || pixel != 0)
1654 dstword = (dstword & ~dstmask) | pixel;
1655
1656 /* update the source */
1657 srcmask <<= 1;
1658 if (srcmask == 0)
1659 {
1660 srcword = (*word_read)(swordaddr++ << 1);
1661 srcmask = 0x0001;
1662 }
1663
1664 /* update the destination */
1665 dstmask <<= BITS_PER_PIXEL;
1666 }
1667
1668 /* write the result */
1669 (*word_write)(dwordaddr++ << 1, dstword);
1670 }
1671
1672 /* handle the right partial word */
1673 if (right_partials != 0)
1674 {
1675 /* fetch the destination word */
1676 dstword = (*word_read)(dwordaddr << 1);
1677 dstmask = PIXEL_MASK;
1678
1679 /* loop over partials */
1680 for (x = 0; x < right_partials; x++)
1681 {
1682 /* process the pixel */
1683 pixel = (srcword & srcmask) ? COLOR1 : COLOR0;
1684 pixel &= dstmask;
1685 PIXEL_OP(dstword, dstmask, pixel);
1686 if (!TRANSPARENCY || pixel != 0)
1687 dstword = (dstword & ~dstmask) | pixel;
1688
1689 /* update the source */
1690 srcmask <<= 1;
1691 if (srcmask == 0)
1692 {
1693 srcword = (*word_read)(swordaddr++ << 1);
1694 srcmask = 0x0001;
1695 }
1696
1697 /* update the destination */
1698 dstmask <<= BITS_PER_PIXEL;
1699 }
1700
1701 /* write the result */
1702 (*word_write)(dwordaddr++ << 1, dstword);
1703 }
1704
1705 /* update for next row */
1706 saddr += SPTCH;
1707 daddr += DPTCH;
1708 }
1709 //LOGGFX((" (%d cycles)\n", state.gfxcycles));
1710 }
1711
1712 /* eat cycles */
1713 if (state.gfxcycles > tms34010_ICount)
1714 {
1715 state.gfxcycles -= tms34010_ICount;
1716 tms34010_ICount = 0;
1717 PC -= 0x10;
1718 }
1719 else
1720 {
1721 tms34010_ICount -= state.gfxcycles;
1722 P_FLAG = 0;
1723 SADDR += DYDX_Y * SPTCH;
1724 if (dst_is_linear)
1725 DADDR += DYDX_Y * DPTCH;
1726 else
1727 DADDR_Y += DYDX_Y;
1728 }
1729 }
1730
FUNCTION_NAME(fill)1731 static void FUNCTION_NAME(fill)(int dst_is_linear)
1732 {
1733 /* if this is the first time through, perform the operation */
1734 if (!P_FLAG)
1735 {
1736 int dx, dy, x, y, words, left_partials, right_partials, full_words;
1737 void (*word_write)(offs_t address,data16_t data);
1738 data16_t (*word_read)(offs_t address);
1739 UINT32 daddr;
1740
1741 /* determine read/write functions */
1742 if (IOREG(REG_DPYCTL) & 0x0800)
1743 {
1744 word_write = shiftreg_w;
1745 word_read = dummy_shiftreg_r;
1746 }
1747 else
1748 {
1749 word_write = cpu_writemem29lew_word;
1750 word_read = cpu_readmem29lew_word;
1751 }
1752
1753 /* compute the bounds of the operation */
1754 dx = (INT16)DYDX_X;
1755 dy = (INT16)DYDX_Y;
1756
1757 /* apply the window for non-linear destinations */
1758 state.gfxcycles = 4;
1759 if (!dst_is_linear)
1760 {
1761 XY temp = DADDR_XY;
1762 state.gfxcycles += 2 + apply_window("FILL", 0, NULL, &temp, &dx, &dy);
1763 daddr = DXYTOL(temp);
1764 }
1765 else
1766 daddr = DADDR;
1767 daddr &= ~(BITS_PER_PIXEL - 1);
1768 //LOGGFX((" daddr=%08X\n", daddr));
1769
1770 /* bail if we're clipped */
1771 if (dx <= 0 || dy <= 0)
1772 return;
1773
1774 /* how many left and right partial pixels do we have? */
1775 left_partials = (PIXELS_PER_WORD - ((daddr & 15) / BITS_PER_PIXEL)) & (PIXELS_PER_WORD - 1);
1776 right_partials = ((daddr + dx * BITS_PER_PIXEL) & 15) / BITS_PER_PIXEL;
1777 full_words = dx - left_partials - right_partials;
1778 if (full_words < 0)
1779 left_partials = dx, right_partials = full_words = 0;
1780 else
1781 full_words /= PIXELS_PER_WORD;
1782
1783 /* compute cycles */
1784 /* TODO: when state.window_checking == 1, we should count only the time to the first pixel hit */
1785 state.gfxcycles += compute_fill_cycles(left_partials, right_partials, full_words, dy, PIXEL_OP_TIMING);
1786 P_FLAG = 1;
1787
1788 /* loop over rows */
1789 for (y = 0; y < dy; y++)
1790 {
1791 UINT16 dstword, dstmask, pixel;
1792 UINT32 dwordaddr;
1793
1794 /* use byte addresses each row */
1795 dwordaddr = daddr >> 4;
1796
1797 /* handle the left partial word */
1798 if (left_partials != 0)
1799 {
1800 /* fetch the destination word */
1801 dstword = (*word_read)(dwordaddr << 1);
1802 dstmask = PIXEL_MASK << (daddr & 15);
1803
1804 /* loop over partials */
1805 for (x = 0; x < left_partials; x++)
1806 {
1807 /* process the pixel */
1808 pixel = COLOR1 & dstmask;
1809 PIXEL_OP(dstword, dstmask, pixel);
1810 if (!TRANSPARENCY || pixel != 0)
1811 {
1812 if (state.window_checking == 1 && !dst_is_linear)
1813 {
1814 CLR_V;
1815 goto bailout;
1816 }
1817 else
1818 dstword = (dstword & ~dstmask) | pixel;
1819 }
1820
1821 /* update the destination */
1822 dstmask <<= BITS_PER_PIXEL;
1823 }
1824
1825 /* write the result */
1826 (*word_write)(dwordaddr++ << 1, dstword);
1827 }
1828
1829 /* loop over full words */
1830 for (words = 0; words < full_words; words++)
1831 {
1832 /* fetch the destination word (if necessary) */
1833 if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
1834 dstword = (*word_read)(dwordaddr << 1);
1835 else
1836 dstword = 0;
1837 dstmask = PIXEL_MASK;
1838
1839 /* loop over partials */
1840 for (x = 0; x < PIXELS_PER_WORD; x++)
1841 {
1842 /* process the pixel */
1843 pixel = COLOR1 & dstmask;
1844 PIXEL_OP(dstword, dstmask, pixel);
1845 if (!TRANSPARENCY || pixel != 0)
1846 {
1847 if (state.window_checking == 1 && !dst_is_linear)
1848 {
1849 CLR_V;
1850 goto bailout;
1851 }
1852 else
1853 dstword = (dstword & ~dstmask) | pixel;
1854 }
1855
1856 /* update the destination */
1857 dstmask <<= BITS_PER_PIXEL;
1858 }
1859
1860 /* write the result */
1861 (*word_write)(dwordaddr++ << 1, dstword);
1862 }
1863
1864 /* handle the right partial word */
1865 if (right_partials != 0)
1866 {
1867 /* fetch the destination word */
1868 dstword = (*word_read)(dwordaddr << 1);
1869 dstmask = PIXEL_MASK;
1870
1871 /* loop over partials */
1872 for (x = 0; x < right_partials; x++)
1873 {
1874 /* process the pixel */
1875 pixel = COLOR1 & dstmask;
1876 PIXEL_OP(dstword, dstmask, pixel);
1877 if (!TRANSPARENCY || pixel != 0)
1878 {
1879 if (state.window_checking == 1 && !dst_is_linear)
1880 {
1881 CLR_V;
1882 goto bailout;
1883 }
1884 else
1885 dstword = (dstword & ~dstmask) | pixel;
1886 }
1887
1888 /* update the destination */
1889 dstmask <<= BITS_PER_PIXEL;
1890 }
1891
1892 /* write the result */
1893 (*word_write)(dwordaddr++ << 1, dstword);
1894 }
1895
1896 /* update for next row */
1897 daddr += DPTCH;
1898 }
1899 bailout:
1900 (void)0;
1901 //LOGGFX((" (%d cycles)\n", state.gfxcycles));
1902 }
1903
1904 /* eat cycles */
1905 if (state.gfxcycles > tms34010_ICount)
1906 {
1907 state.gfxcycles -= tms34010_ICount;
1908 tms34010_ICount = 0;
1909 PC -= 0x10;
1910 }
1911 else
1912 {
1913 tms34010_ICount -= state.gfxcycles;
1914 P_FLAG = 0;
1915 if (dst_is_linear)
1916 DADDR += DYDX_Y * DPTCH;
1917 else
1918 {
1919 if (state.window_checking == 1)
1920 {
1921 int dx = (INT16)DYDX_X;
1922 int dy = (INT16)DYDX_Y;
1923 int v = V_FLAG;
1924
1925 apply_window("FILL clip", 0, NULL, &DADDR_XY, &dx, &dy);
1926 DYDX_X = dx;
1927 DYDX_Y = dy;
1928
1929 V_FLAG = v; /* thrashed by apply_window */
1930
1931 if (v == 0)
1932 {
1933 IOREG(REG_INTPEND) |= TMS34010_WV;
1934 check_interrupt();
1935 }
1936 }
1937 else
1938 DADDR_Y += DYDX_Y;
1939 }
1940 }
1941 }
1942
1943 #endif
1944
1945