OSDN Git Service

going on vacation >.<
[proj16/16.git] / src / lib / hb / scale / c6_scale.c
1 /* Catacomb Apocalypse Source Code\r
2  * Copyright (C) 1993-2014 Flat Rock Software\r
3  *\r
4  * This program is free software; you can redistribute it and/or modify\r
5  * it under the terms of the GNU General Public License as published by\r
6  * the Free Software Foundation; either version 2 of the License, or\r
7  * (at your option) any later version.\r
8  *\r
9  * This program is distributed in the hope that it will be useful,\r
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12  * GNU General Public License for more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License along\r
15  * with this program; if not, write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
17  */\r
18 \r
19 // C3_SCALE.C\r
20 \r
21 #include "DEF.H"\r
22 #pragma hdrstop\r
23 \r
24 //const unsigned        viewheight = 144;\r
25 const   unsigned        screenbwide = 40;\r
26 const   byte            BACKGROUNDPIX   =   5;\r
27 \r
28 unsigned                shapesize[NUMSCALEPICS];\r
29 t_compscale _seg *scaledirectory[NUMSCALEPICS];\r
30 t_compshape _seg *shapedirectory[NUMSCALEPICS];\r
31 memptr                  walldirectory[NUMSCALEWALLS];\r
32 \r
33 /*\r
34 ===========================\r
35 =\r
36 = DeplanePic\r
37 =\r
38 = Takes a raw bit map of width bytes by height and creates a scaleable shape\r
39 =\r
40 = Returns the length of the shape in bytes\r
41 =\r
42 = Fills in spotvis (a convenient 64*64 array) with the color values\r
43 =\r
44 ===========================\r
45 */\r
46 \r
47 void DeplanePic (int picnum)\r
48 {\r
49         byte            far *plane0,far *plane1,far *plane2,far *plane3;\r
50         byte            by0,by1,by2,by3;\r
51         unsigned        x,y,b,color,shift,width,height;\r
52         byte            *dest;\r
53 \r
54 //\r
55 // convert ega pixels to byte color values in a temp buffer\r
56 //\r
57         width = pictable[picnum-STARTPICS].width;\r
58         height = pictable[picnum-STARTPICS].height;\r
59 \r
60         if (width>8 || height!=64)\r
61                 Quit ("DePlanePic: Bad size shape");\r
62 \r
63         memset (spotvis,BACKGROUNDPIX,sizeof(spotvis));\r
64 \r
65         plane0 = (byte _seg *)grsegs[picnum];\r
66         plane1 = plane0 + width*height;\r
67         plane2 = plane1 + width*height;\r
68         plane3 = plane2 + width*height;\r
69 \r
70         for (y=0;y<height;y++)\r
71         {\r
72                 dest = &spotvis[y][0];\r
73                 for (x=0;x<width;x++)\r
74                 {\r
75                         by0 = *plane0++;\r
76                         by1 = *plane1++;\r
77                         by2 = *plane2++;\r
78                         by3 = *plane3++;\r
79 \r
80                         for (b=0;b<8;b++)\r
81                         {\r
82                                 shift=8-b;\r
83 \r
84                                 color = 0;\r
85                                 asm     mov     cl,[BYTE PTR shift]\r
86                                 asm     mov     al,[BYTE PTR by3]\r
87                                 asm     rcr     al,cl;\r
88                                 asm     rcl     [BYTE PTR color],1;\r
89 \r
90                                 asm     mov     cl,[BYTE PTR shift]\r
91                                 asm     mov     al,[BYTE PTR by2]\r
92                                 asm     rcr     al,cl;\r
93                                 asm     rcl     [BYTE PTR color],1;\r
94 \r
95                                 asm     mov     cl,[BYTE PTR shift]\r
96                                 asm     mov     al,[BYTE PTR by1]\r
97                                 asm     rcr     al,cl;\r
98                                 asm     rcl     [BYTE PTR color],1;\r
99 \r
100                                 asm     mov     cl,[BYTE PTR shift]\r
101                                 asm     mov     al,[BYTE PTR by0]\r
102                                 asm     rcr     al,cl;\r
103                                 asm     rcl     [BYTE PTR color],1;\r
104 \r
105                                 *dest++ = color;\r
106                         }       // B\r
107                 }               // X\r
108         }                       // Y\r
109 }\r
110 \r
111 \r
112 \r
113 \r
114 /*\r
115 ========================\r
116 =\r
117 = BuildCompScale\r
118 =\r
119 = Builds a compiled scaler object that will scale a 64 tall object to\r
120 = the given height (centered vertically on the screen)\r
121 =\r
122 = height should be even\r
123 =\r
124 = Call with\r
125 = ---------\r
126 = DS:SI         Source for scale\r
127 = ES:DI         Dest for scale\r
128 =\r
129 = Calling the compiled scaler only destroys AL\r
130 =\r
131 ========================\r
132 */\r
133 \r
134 unsigned BuildCompScale (int height, memptr *finalspot)\r
135 {\r
136         t_compscale     _seg *work;\r
137         byte            far *code;\r
138 \r
139         int                     i;\r
140         long            fix,step;\r
141         unsigned        src,totalscaled,totalsize;\r
142         int                     startpix,endpix,toppix;\r
143 \r
144 \r
145         MM_GetPtr (&(memptr)work,20000);\r
146 \r
147         step = ((long)height<<16) / 64;\r
148         code = &work->code[0];\r
149         toppix = (viewheight-height)/2;\r
150         fix = 0;\r
151 \r
152         for (src=0;src<=64;src++)\r
153         {\r
154                 startpix = fix>>16;\r
155                 fix += step;\r
156                 endpix = fix>>16;\r
157 \r
158                 work->start[src] = startpix;\r
159                 if (endpix>startpix)\r
160                         work->width[src] = endpix-startpix;\r
161                 else\r
162                         work->width[src] = 0;\r
163 \r
164 //\r
165 // mark the start of the code\r
166 //\r
167                 work->codeofs[src] = FP_OFF(code);\r
168 \r
169 //\r
170 // compile some code if the source pixel generates any screen pixels\r
171 //\r
172                 startpix+=toppix;\r
173                 endpix+=toppix;\r
174 \r
175                 if (startpix == endpix || endpix < 0 || startpix >= VIEWHEIGHT || src == 64)\r
176                         continue;\r
177 \r
178         //\r
179         // mov al,[si+src]\r
180         //\r
181                 *code++ = 0x8a;\r
182                 *code++ = 0x44;\r
183                 *code++ = src;\r
184 \r
185                 for (;startpix<endpix;startpix++)\r
186                 {\r
187                         if (startpix >= VIEWHEIGHT)\r
188                                 break;                                          // off the bottom of the view area\r
189                         if (startpix < 0)\r
190                                 continue;                                       // not into the view area\r
191 \r
192                 //\r
193                 // and [es:di+heightofs],al\r
194                 //\r
195                         *code++ = 0x26;\r
196                         *code++ = 0x20;\r
197                         *code++ = 0x85;\r
198                         *((unsigned far *)code)++ = startpix*screenbwide;\r
199                 }\r
200 \r
201         }\r
202 \r
203 //\r
204 // retf\r
205 //\r
206         *code++ = 0xcb;\r
207 \r
208         totalsize = FP_OFF(code);\r
209         MM_GetPtr (finalspot,totalsize);\r
210         _fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize);\r
211         MM_FreePtr (&(memptr)work);\r
212 \r
213         return totalsize;\r
214 }\r
215 \r
216 \r
217 \r
218 \r
219 /*\r
220 ========================\r
221 =\r
222 = BuildCompShape\r
223 =\r
224 = typedef struct\r
225 = {\r
226 =       unsigned        width;\r
227 =       unsigned        codeofs[64];\r
228 = }     t_compshape;\r
229 =\r
230 = Width is the number of compiled line draws in the shape.  The shape\r
231 = drawing code will assume that the midpoint of the shape is in the\r
232 = middle of the width.\r
233 =\r
234 = The non background pixel data will start at codeofs[width], so codeofs\r
235 = greater than width will be invalid.\r
236 =\r
237 = Each code offset will draw one vertical line of the shape, consisting\r
238 = of 0 or more segments of scaled pixels.\r
239 =\r
240 = The scaled shapes use ss:0-4 as a scratch variable for the far call to\r
241 = the compiled scaler, so zero it back out after the shape is scaled, or\r
242 = a "null pointer assignment" will result upon termination.\r
243 =\r
244 = Setup for a call to a compiled shape\r
245 = -----------------------------------\r
246 = ax    toast\r
247 = bx    toast\r
248 = cx    toast\r
249 = dx    segment of compiled shape\r
250 = si    toast\r
251 = di    byte at top of view area to draw the line in\r
252 = bp    0\r
253 = ss:2 and ds  the segment of the compiled scaler to use\r
254 = es    screenseg\r
255 =\r
256 = Upon return, ds IS NOT SET to the data segment.  Do:\r
257 =       mov     ax,ss\r
258 =       mov     ds,ax\r
259 =\r
260 =\r
261 = GC_BITMASK    set to the pixels to be drawn in the row of bytes under DI\r
262 = GC_MODE               read mode 1, write mode 2\r
263 = GC_COLORDONTCARE  set to 0, so all reads from video memory return 0xff\r
264 =\r
265 =\r
266 = Code generated for each segment\r
267 = -------------------------------\r
268 =       mov     bx,[(segend+1)*2]\r
269 =       mov     cx,[bx]\r
270 =       mov     [BYTE PTR bx],0xc8              // far return\r
271 =       mov     ax,[segstart*2]\r
272 =       mov     [ss:0],ax                               // entry point into the compiled scaler\r
273 =       mov     ds,dx                   // (mov ds,cs) the data is after the compiled code\r
274 =       mov     si,ofs data\r
275 =       call    [bp]                            // scale some pixels\r
276 =       mov     ds,[bp+2]\r
277 =       mov     [bx],cx                                 // un patch return\r
278 =\r
279 = Code generated after all segments on a line\r
280 = -------------------------------------------\r
281 =       retf\r
282 =\r
283 ========================\r
284 */\r
285 \r
286 unsigned BuildCompShape (t_compshape _seg **finalspot)\r
287 {\r
288         t_compshape     _seg *work;\r
289         byte            far *code;\r
290         int                     firstline,lastline,x,y;\r
291         unsigned        firstpix,lastpix,width;\r
292         unsigned        totalsize,pixelofs;\r
293         unsigned        buff;\r
294 \r
295 \r
296 //      MM_GetPtr (&(memptr)work,20000);\r
297         EGAWRITEMODE(0);\r
298         EGAREADMAP(0);          // use ega screen memory for temp buffer\r
299         EGAMAPMASK(1);\r
300         buff = screenloc[1];\r
301         work = (t_compshape _seg *)(0xa000+(buff+15)/16);\r
302 \r
303 //\r
304 // find the width of the shape\r
305 //\r
306         firstline = -1;\r
307         x=0;\r
308         do\r
309         {\r
310                 for (y=0;y<64;y++)\r
311                         if (spotvis[y][x] != BACKGROUNDPIX)\r
312                         {\r
313                                 firstline = x;\r
314                                 break;\r
315                         }\r
316                 if (++x == 64)\r
317                         Quit ("BuildCompShape: No shape data!");\r
318         } while (firstline == -1);\r
319 \r
320         lastline = -1;\r
321         x=63;\r
322         do\r
323         {\r
324                 for (y=0;y<64;y++)\r
325                         if (spotvis[y][x] != BACKGROUNDPIX)\r
326                         {\r
327                                 lastline = x;\r
328                                 break;\r
329                         }\r
330                 x--;\r
331         } while (lastline == -1);\r
332 \r
333         width = lastline-firstline+1;\r
334 \r
335         work->width = width;\r
336         code = (byte far *)&work->codeofs[width];\r
337 \r
338 //\r
339 // copy all non background pixels to the work space\r
340 //\r
341         pixelofs = FP_OFF(code);\r
342 \r
343         for (x=firstline;x<=lastline;x++)\r
344                 for (y=0;y<64;y++)\r
345                         if (spotvis[y][x] != BACKGROUNDPIX)\r
346                                 *code++ = spotvis[y][x];\r
347 \r
348 //\r
349 // start compiling the vertical lines\r
350 //\r
351         for (x=firstline;x<=lastline;x++)\r
352         {\r
353                 work->codeofs[x-firstline] = FP_OFF(code);\r
354 \r
355                 y=0;\r
356                 do\r
357                 {\r
358                 //\r
359                 // scan past black background pixels\r
360                 //\r
361                         while (spotvis[y][x] == BACKGROUNDPIX && y<64)\r
362                                 y++;\r
363 \r
364                         if (y>63)               // no more segments\r
365                                 break;\r
366 \r
367                         firstpix = y+1;         // +1 because width is before codeofs\r
368 \r
369                 //\r
370                 // scan past scalable pixels\r
371                 //\r
372                         while (spotvis[y][x] != BACKGROUNDPIX && y<64)\r
373                                 y++;\r
374 \r
375                         if (y>63)\r
376                                 lastpix = 65;\r
377                         else\r
378                                 lastpix = y+1;  // actually one pixel past the last displayed\r
379 \r
380                 //\r
381                 // compile the scale call\r
382                 //\r
383                         *code++ = 0x8b;         // mov bx,[lastpix*2]\r
384                         *code++ = 0x1e;\r
385                         *((unsigned far *)code)++ = lastpix*2;\r
386 \r
387                         *code++ = 0x8b;         // mov cx,[bx]\r
388                         *code++ = 0x0f;\r
389 \r
390                         *code++ = 0xc6;         // move [BYTE bx],0xcb\r
391                         *code++ = 0x07;\r
392                         *code++ = 0xcb;\r
393 \r
394                         *code++ = 0xa1;         // mov ax,[firstpix*2]  /*************\r
395                         *((unsigned far *)code)++ = firstpix*2;\r
396 \r
397                         *code++ = 0x36;         // mov [ss:0],ax\r
398                         *code++ = 0xa3;\r
399                         *code++ = 0x00;\r
400                         *code++ = 0x00;\r
401 \r
402                         *code++ = 0x8e;         // mov ds,dx    (mov ds,cs)\r
403                         *code++ = 0xda;\r
404 \r
405                         *code++ = 0xbe;         // mov si,OFFSET pixelofs-firstpixel\r
406                         *((unsigned far *)code)++ = pixelofs-firstpix;\r
407 \r
408                         *code++ = 0xff;         // call [DWORD bp]\r
409                         *code++ = 0x5e;\r
410                         *code++ = 0x00;\r
411 \r
412                         *code++ = 0x8e;         // mov ds,[bp+2]\r
413                         *code++ = 0x5e;\r
414                         *code++ = 0x02;\r
415 \r
416                         *code++ = 0x89;         // mov [bx],cx\r
417                         *code++ = 0x0f;\r
418 \r
419                         pixelofs += (lastpix-firstpix);\r
420                 } while (y<63);\r
421 \r
422         //\r
423         // retf\r
424         //\r
425                 *code++ = 0xcb;\r
426         }\r
427 \r
428 \r
429 //\r
430 // copy the final shape to a properly sized buffer\r
431 //\r
432         totalsize = FP_OFF(code);\r
433 \r
434         if (totalsize >= (PAGELEN*2))\r
435                 Quit("BuildCompShape(): Shape is too complex!");\r
436 \r
437         MM_GetPtr ((memptr *)finalspot,totalsize);\r
438         _fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize);\r
439 //      MM_FreePtr (&(memptr)work);\r
440 \r
441         return totalsize;\r
442 }\r
443 \r
444 \r
445 \r
446 /*\r
447 =======================\r
448 =\r
449 = ScaleShape\r
450 =\r
451 = Draws a compiled shape at [scale] pixels high\r
452 =\r
453 = Setup for call\r
454 = --------------\r
455 = GC_MODE                       read mode 1, write mode 2\r
456 = GC_COLORDONTCARE  set to 0, so all reads from video memory return 0xff\r
457 = GC_INDEX                      pointing at GC_BITMASK\r
458 =\r
459 =======================\r
460 */\r
461 \r
462 static  long            longtemp;\r
463 \r
464 void ScaleShape (int xcenter, t_compshape _seg *compshape, unsigned scale)\r
465 {\r
466         #define MAX_OBJ_SCALE (MAXSCALE)\r
467 \r
468 \r
469         t_compscale _seg *comptable;\r
470         unsigned        width,scalewidth;\r
471         int                     x,pixel,lastpixel,pixwidth,min;\r
472         unsigned        far *codehandle, far *widthptr;\r
473         unsigned        badcodeptr;\r
474         int                     rightclip;\r
475 \r
476         if (!compshape)\r
477                 Quit ("ScaleShape: NULL compshape ptr!");\r
478 \r
479         scale = (scale+1)/2;\r
480         if (!scale)\r
481                 return;                                                         // too far away\r
482         if (scale>MAX_OBJ_SCALE)\r
483                 scale = MAX_OBJ_SCALE;\r
484         comptable = scaledirectory[scale];\r
485 \r
486         width = compshape->width;\r
487         scalewidth = comptable->start[width];\r
488 \r
489         pixel = xcenter - scalewidth/2;\r
490         lastpixel = pixel+scalewidth-1;\r
491         if (pixel >= VIEWWIDTH || lastpixel < 0)\r
492                 return;                                                         // totally off screen\r
493 \r
494 //\r
495 // scan backwards from the right edge until pixels are visable\r
496 // rightclip is the first NON VISABLE pixel\r
497 //\r
498         if (lastpixel>=VIEWWIDTH-1)\r
499                 rightclip = VIEWWIDTH-1;\r
500         else\r
501                 rightclip = lastpixel;\r
502 \r
503         if (zbuffer[rightclip]>scale)\r
504         {\r
505                 if (pixel>0)\r
506                         min = pixel;\r
507                 else\r
508                         min = 0;\r
509                 do\r
510                 {\r
511                         if (--rightclip < min)\r
512                                 return;                                                 // totally covered or before 0\r
513                         if (zbuffer[rightclip]<=scale)\r
514                                 break;\r
515                 } while (1);\r
516         }\r
517         rightclip++;\r
518 \r
519 //\r
520 // scan from the left until it is on screen, leaving\r
521 // [pixel],[pixwidth],[codehandle],and [widthptr] set correctly\r
522 //\r
523         *(((unsigned *)&longtemp)+1) = (unsigned)compshape;     // seg of shape\r
524         codehandle = &compshape->codeofs[0];\r
525         badcodeptr = compshape->codeofs[width];\r
526         widthptr = &comptable->width[0];\r
527         asm     mov     ax,[comptable]\r
528         asm     mov     WORD PTR [2],ax                         // ds:0-4 is used as a far call pointer\r
529                                                                                 // by the compiled shapes\r
530         pixwidth = *widthptr;                           // scaled width of this pixel\r
531         while (!pixwidth)\r
532         {\r
533                 pixwidth = *++widthptr;                 // find the first visable pixel\r
534                 codehandle++;\r
535         }\r
536 \r
537         if (pixel<0)\r
538         {\r
539                 do\r
540                 {\r
541                         if (pixel+pixwidth>0)\r
542                         {\r
543                                 pixwidth += pixel;\r
544                                 pixel = 0;\r
545                                 break;\r
546                         }\r
547                         do\r
548                         {\r
549                                 pixwidth = *++widthptr;\r
550                                 codehandle++;\r
551                         } while (!pixwidth);\r
552                         pixel+=pixwidth;\r
553                 } while (1);\r
554         }\r
555 \r
556 //\r
557 // scan until it is visable, leaving\r
558 // [pixel],[pixwidth],[codehandle],and [widthptr] set correctly\r
559 //\r
560         do\r
561         {\r
562                 if (zbuffer[pixel] <= scale)\r
563                         break;                                                  // start drawing here\r
564                 pixel++;\r
565                 if (!--pixwidth)\r
566                 {\r
567                         do\r
568                         {\r
569                                 pixwidth = *++widthptr;\r
570                                 codehandle++;\r
571                         } while (!pixwidth);\r
572                 }\r
573         } while (1);\r
574 \r
575         if (pixel+pixwidth>rightclip)\r
576                 pixwidth = rightclip-pixel;\r
577 //\r
578 // draw lines\r
579 //\r
580         do              // while (1)\r
581         {\r
582         //\r
583         // scale a vertical segment [pixwidth] pixels wide at [pixel]\r
584         //\r
585                 (unsigned)longtemp = *codehandle;       // offset of compiled code\r
586                 if ((unsigned)longtemp == badcodeptr)\r
587                         Quit ("ScaleShape: codehandle past end!");\r
588 \r
589                 asm     mov     bx,[pixel]\r
590                 asm     mov     di,bx\r
591                 asm     shr     di,1\r
592                 asm     shr     di,1\r
593                 asm     shr     di,1                                            // X in bytes\r
594                 asm     add     di,[bufferofs]\r
595                 asm     and     bx,7\r
596                 asm     shl     bx,1\r
597                 asm     shl     bx,1\r
598                 asm     shl     bx,1\r
599                 asm     add     bx,[pixwidth]                           // bx = pixel*8+pixwidth-1\r
600                 asm     dec     bx\r
601                 asm     push    bx\r
602                 asm     mov     al,BYTE PTR [bitmasks1+bx]\r
603                 asm     mov     dx,GC_INDEX+1\r
604                 asm     out     dx,al                                           // set bit mask register\r
605 \r
606                 asm     mov     es,[screenseg]\r
607                 asm     push    si\r
608                 asm     push    di\r
609                 asm     push    bp\r
610                 asm     xor     bp,bp\r
611                 asm     mov     dx,[WORD PTR longtemp+2]\r
612                 asm     mov     ds,[2]\r
613                 asm     call ss:[DWORD PTR longtemp]            // scale the line of pixels\r
614                 asm     mov     ax,ss\r
615                 asm     mov     ds,ax\r
616                 asm     pop             bp\r
617                 asm     pop             di\r
618                 asm     pop             si\r
619 \r
620                 asm     pop     bx\r
621                 asm     mov     al,BYTE PTR [bitmasks2+bx]\r
622                 asm     or      al,al\r
623                 asm     jz      nosecond\r
624 \r
625         //\r
626         // draw a second byte for vertical strips that cross two bytes\r
627         //\r
628                 asm     inc     di\r
629                 asm     mov     dx,GC_INDEX+1\r
630                 asm     out     dx,al                                           // set bit mask register\r
631                 asm     push    si\r
632                 asm     push    di\r
633                 asm     push    bp\r
634                 asm     xor     bp,bp\r
635                 asm     mov     dx,[WORD PTR longtemp+2]\r
636                 asm     mov     ds,[2]\r
637                 asm     call ss:[DWORD PTR longtemp]            // scale the line of pixels\r
638                 asm     mov     ax,ss\r
639                 asm     mov     ds,ax\r
640                 asm     pop             bp\r
641                 asm     pop             di\r
642                 asm     pop             si\r
643 \r
644 \r
645         //\r
646         // advance to the next drawn line\r
647         //\r
648 nosecond:;\r
649                 if ( (pixel+=pixwidth) == rightclip )\r
650                 {\r
651                         asm     mov     WORD PTR [0],0\r
652                         asm     mov     WORD PTR [2],0\r
653                         return;                                                 // all done!\r
654                 }\r
655 \r
656                 do\r
657                 {\r
658                         pixwidth = *++widthptr;\r
659                         codehandle++;\r
660                 } while (!pixwidth);\r
661 \r
662                 if (pixel+pixwidth > rightclip)\r
663                         pixwidth = rightclip-pixel;\r
664 \r
665         } while (1);\r
666 \r
667 }\r
668 \r
669 //\r
670 // bit mask tables for drawing scaled strips up to eight pixels wide\r
671 //\r
672 \r
673 byte    bitmasks1[8][8] = {\r
674 {0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff},\r
675 {0x40,0x60,0x70,0x78,0x7c,0x7e,0x7f,0x7f},\r
676 {0x20,0x30,0x38,0x3c,0x3e,0x3f,0x3f,0x3f},\r
677 {0x10,0x18,0x1c,0x1e,0x1f,0x1f,0x1f,0x1f},\r
678 {0x8,0xc,0xe,0xf,0xf,0xf,0xf,0xf},\r
679 {0x4,0x6,0x7,0x7,0x7,0x7,0x7,0x7},\r
680 {0x2,0x3,0x3,0x3,0x3,0x3,0x3,0x3},\r
681 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1} };\r
682 \r
683 byte    bitmasks2[8][8] = {\r
684 {0,0,0,0,0,0,0,0},\r
685 {0,0,0,0,0,0,0,0x80},\r
686 {0,0,0,0,0,0,0x80,0xc0},\r
687 {0,0,0,0,0,0x80,0xc0,0xe0},\r
688 {0,0,0,0,0x80,0xc0,0xe0,0xf0},\r
689 {0,0,0,0x80,0xc0,0xe0,0xf0,0xf8},\r
690 {0,0,0x80,0xc0,0xe0,0xf0,0xf8,0xfc},\r
691 {0,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe} };\r
692 \r
693 \r
694 \r
695 \r
696 \r
697 \r