2 Copyright (C) 1998 BJ Eirich (aka vecna)
\r
3 This program is free software; you can redistribute it and/or
\r
4 modify it under the terms of the GNU General Public License
\r
5 as published by the Free Software Foundation; either version 2
\r
6 of the License, or (at your option) any later version.
\r
7 This program is distributed in the hope that it will be useful,
\r
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\r
10 See the GNU General Public Lic
\r
11 See the GNU General Public License for more details.
\r
12 You should have received a copy of the GNU General Public License
\r
13 along with this program; if not, write to the Free Software
\r
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
19 #include <sys\nearptr.h>
\r
22 // ================================= Data ====================================
\r
24 #define SEQU_ADDR 0x3c4
\r
25 #define CRTC_ADDR 0x3d4
\r
26 #define MISC_OUTPUT 0x3c2
\r
28 byte *screenbase; // ptr to A000:0000
\r
29 int endcol,nextl; // end column number thingy | next line
\r
32 // ================================= Code ====================================
\r
34 void ModeXSetMode(int mode)
\r
44 outpw(0x03c4, (hi<<8)|0x02);
\r
56 // set write to ALL PLANES simultaneously for extra-quick clears.
\r
57 asm("movw $0x3c4, %%dx \n\t"
\r
58 "movw $0x0f02, %%ax \n\t"
\r
59 "outw %%ax, %%dx \n\t"
\r
60 "movl _screenbase, %%edi \n\t"
\r
61 "movl $0, %%eax \n\t"
\r
62 "movl $11264, %%ecx \n\t"
\r
67 : "eax","edx","edi","ecx","cc" );
\r
70 void SetView(word offset)
\r
72 while (inportb(0x3da) & 1);
\r
76 outportb(0x3d4, (offset >> 8) | 0x0c);
\r
77 outportb(0x3d4, (offset & 0xff) | 0x0d);
\r
92 //s=screen+(16*tsx)+16;
\r
97 //while (!(inp(986) & 8));
\r
99 for (y=0; y<sy; ++y,d+=sx2)
\r
101 s=screen+(y*tsx)+b;
\r
102 for (k=0; k<4; k++,s-=sx)
\r
105 for (x=0; x<sx2; x++,s+=4)
\r
114 int ModeXCopySprite(int x, int y, int width, int height, byte *src)
\r
118 asm("movl %3, %%edx \n\t"
\r
119 "movl %4, %%esi \n\t"
\r
121 "movl %1, %%eax \n\t"
\r
122 "imul _tsx, %%eax \n\t"
\r
123 "addl %0, %%eax \n\t"
\r
124 "addl _screen, %%eax \n\t"
\r
125 "movl %%eax, %%edi \n\t"
\r
126 "movl %2, %%ecx \n\t"
\r
127 "shrl $2, %%ecx \n\t"
\r
134 : "m" (x), "m" (y), "m" (width), "m" (height), "m" (src)
\r
135 : "eax","edx","esi","edi","ecx","cc" );
\r
140 int ModeXTCopySprite(int x, int y, int width, int height, byte *src)
\r
144 asm("movl %3, %%ecx \n\t"
\r
145 "movl %4, %%esi \n\t"
\r
147 "movl %1, %%eax \n\t"
\r
148 "imul _tsx, %%eax \n\t"
\r
149 "addl %0, %%eax \n\t"
\r
150 "addl _screen, %%eax \n\t"
\r
151 "movl %%eax, %%edi \n\t"
\r
152 "movl %2, %%edx \n\t"
\r
155 "orb %%al, %%al \n\t"
\r
160 "jmp drawloop \n\t"
\r
164 "jnz drawloop \n\t"
\r
170 : "m" (x), "m" (y), "m" (width), "m" (height), "m" (src)
\r
171 : "eax","edx","esi","edi","ecx","cc" );
\r
177 int ModeXCopyTile(int x, int y, byte *spr)
\r
181 asm("movl $16, %%ecx \n\t"
\r
182 "movl %2, %%esi \n\t"
\r
183 "movl %1, %%edi \n\t"
\r
184 "imul _tsx, %%edi \n\t"
\r
185 "addl %0, %%edi \n\t"
\r
186 "addl _screen, %%edi \n\t"
\r
188 "movl (%%edi), %%eax \n\t"
\r
189 "andl $0, %%eax \n\t"
\r
190 "orl (%%esi), %%eax \n\t"
\r
191 "movl %%eax, (%%edi) \n\t"
\r
192 "movl 4(%%edi), %%eax \n\t"
\r
193 "andl $0, %%eax \n\t"
\r
194 "orl 4(%%esi), %%eax \n\t"
\r
195 "movl %%eax, 4(%%edi) \n\t"
\r
196 "movl 8(%%edi), %%eax \n\t"
\r
197 "andl $0, %%eax \n\t"
\r
198 "orl 8(%%esi), %%eax \n\t"
\r
199 "movl %%eax, 8(%%edi) \n\t"
\r
200 "movl 12(%%edi), %%eax \n\t"
\r
201 "andl $0, %%eax \n\t"
\r
202 "orl 12(%%esi), %%eax \n\t"
\r
203 "movl %%eax, 12(%%edi) \n\t"
\r
204 "addl $16, %%esi \n\t"
\r
205 "addl _tsx, %%edi \n\t"
\r
209 : "m" (x), "m" (y), "m" (spr)
\r
210 : "eax","ecx","esi","edi","cc" );
\r
215 int ModeXTCopyTile(int x, int y, byte *spr, byte *matte)
\r
218 asm("movl $16, %%ecx \n\t"
\r
219 "movl %2, %%esi \n\t"
\r
220 "movl %1, %%edi \n\t"
\r
221 "imul _tsx, %%edi \n\t"
\r
222 "addl %0, %%edi \n\t"
\r
223 "addl _screen, %%edi \n\t"
\r
224 "movl %3, %%edx \n\t"
\r
226 "movl (%%edi), %%eax \n\t"
\r
227 "andl (%%edx), %%eax \n\t"
\r
228 "orl (%%esi), %%eax \n\t"
\r
229 "movl %%eax, (%%edi) \n\t"
\r
230 "movl 4(%%edi), %%eax \n\t"
\r
231 "andl 4(%%edx), %%eax \n\t"
\r
232 "orl 4(%%esi), %%eax \n\t"
\r
233 "movl %%eax, 4(%%edi) \n\t"
\r
234 "movl 8(%%edi), %%eax \n\t"
\r
235 "andl 8(%%edx), %%eax \n\t"
\r
236 "orl 8(%%esi), %%eax \n\t"
\r
237 "movl %%eax, 8(%%edi) \n\t"
\r
238 "movl 12(%%edi), %%eax \n\t"
\r
239 "andl 12(%%edx), %%eax \n\t"
\r
240 "orl 12(%%esi), %%eax \n\t"
\r
241 "movl %%eax, 12(%%edi) \n\t"
\r
242 "addl $16, %%esi \n\t"
\r
243 "addl _tsx, %%edi \n\t"
\r
244 "addl $16, %%edx \n\t"
\r
248 : "m" (x), "m" (y), "m" (spr), "m" (matte)
\r
249 : "eax","ecx","edx","esi","edi","cc" );
\r
255 int ModeXCCopySprite(int x,int y,int width,int height,byte *src)
\r
259 int cx1=0, cy1=0, cx2=tsx-1, cy2=tsy-1;
\r
267 if (x>cx2 || y>cy2 || x+xl<cx1 || y+yl<cy1)
\r
270 if (x+xl > cx2) xl=cx2-x+1;
\r
271 if (y+yl > cy2) yl=cy2-y+1;
\r
273 if (x<cx1) { xs=cx1-x; xl-=xs; x=cx1; }
\r
274 if (y<cy1) { ys=cy1-y; yl-=ys; y=cy1; }
\r
277 if (xs+ys) s+=(ys*width)+xs;
\r
278 d=screen+(y*tsx)+x;
\r
291 int ModeXTCCopySprite(int x,int y,int width,int height,byte *src)
\r
295 int cx1=0, cy1=0, cx2=tsx-1, cy2=tsy-1;
\r
303 if (x>cx2 || y>cy2 || x+xl<cx1 || y+yl<cy1)
\r
306 if (x+xl > cx2) xl=cx2-x+1;
\r
307 if (y+yl > cy2) yl=cy2-y+1;
\r
309 if (x<cx1) { xs=cx1-x; xl-=xs; x=cx1; }
\r
310 if (y<cy1) { ys=cy1-y; yl-=ys; y=cy1; }
\r
313 if (xs+ys) s+=(ys*width)+xs;
\r
314 d=screen+(y*tsx)+x;
\r
318 for (x=0; x<xl; x++)
\r
332 int ModeXScaleSprite(int x, int y, int w, int h, int tw, int th, byte *s)
\r
333 { int i,j,xm,ym,xd,yd,sx,sy=0,xs,ys,dys=0;
\r
338 if (!tw || !th) return 0;
\r
339 tw += sgn(tw); th += sgn(th);
\r
340 xm = abs(tw); ym = abs(th);
\r
341 xs = (w<<16)/xm; ys = (h<<16)/ym;
\r
342 xd = sgn(tw); yd = sgn(th);
\r
344 if (tw>0 && th>0) dys=tsx-xm;
\r
345 else if (tw>0 && th<0) dys=(0-tsx)-xm;
\r
346 else if (tw<0 && th>0) dys=tsx+xm;
\r
347 else if (tw<0 && th<0) dys=(0-tsx)+xm;
\r
349 d = screen+(y*tsx)+x;
\r
350 for (i=0;i<ym;++i) {
\r
352 for (j=0;j<xm;++j) {
\r
366 int ModeXRenderMAPLine(int x, int y, int yofs, word *map)
\r
369 asm("movl %1, %%edi \n\t"
\r
370 "imul _tsx, %%edi \n\t"
\r
371 "addl %0, %%edi \n\t"
\r
372 "addl _screen, %%edi \n\t"
\r
373 "movl _tx, %%ebx \n\t"
\r
375 "movl %3, %%ecx \n\t"
\r
377 "movw (%%ecx), %%ax \n\t"
\r
378 "movzwl %%ax, %%edx \n\t"
\r
379 "shll $1, %%edx \n\t"
\r
380 "addl _tileidx, %%edx \n\t"
\r
381 "movw (%%edx), %%ax \n\t"
\r
382 "movzwl %%ax, %%esi \n\t"
\r
383 "shll $8, %%esi \n\t"
\r
384 "addl _vsp, %%esi \n\t"
\r
385 "movl %2, %%eax \n\t"
\r
386 "shll $4, %%eax \n\t"
\r
387 "addl %%eax, %%esi \n\t"
\r
388 "movl (%%esi), %%eax \n\t"
\r
389 "movl %%eax, (%%edi) \n\t"
\r
390 "movl 4(%%esi), %%eax \n\t"
\r
391 "movl %%eax, 4(%%edi) \n\t"
\r
392 "movl 8(%%esi), %%eax \n\t"
\r
393 "movl %%eax, 8(%%edi) \n\t"
\r
394 "movl 12(%%esi), %%eax \n\t"
\r
395 "movl %%eax, 12(%%edi) \n\t"
\r
396 "addl $16, %%edi \n\t"
\r
397 "addl $2, %%ecx \n\t"
\r
399 "jnz tileloop \n\t"
\r
401 : "m" (x), "m" (y), "m" (yofs), "m" (map)
\r
402 : "eax","ebx","ecx","edx","esi","edi","cc" );
\r
408 int ModeXTRenderMAPLine(int x, int y, int yofs, word *map)
\r
411 asm("movl %1, %%edi \n\t"
\r
412 "imul _tsx, %%edi \n\t"
\r
413 "addl %0, %%edi \n\t"
\r
414 "addl _screen, %%edi \n\t"
\r
415 "movl _tx, %%ebx \n\t"
\r
417 "movl %3, %%ecx \n\t"
\r
419 "movw (%%ecx), %%ax \n\t"
\r
420 "movzwl %%ax, %%edx \n\t"
\r
421 "shll $1, %%edx \n\t"
\r
422 "addl _tileidx, %%edx \n\t"
\r
423 "movw (%%edx), %%ax \n\t"
\r
424 "orw %%ax, %%ax \n\t"
\r
426 "movzwl %%ax, %%esi \n\t"
\r
427 "shll $8, %%esi \n\t"
\r
428 "movl %%esi, %%edx \n\t"
\r
429 "addl _vspmask, %%edx \n\t"
\r
430 "addl _vsp, %%esi \n\t"
\r
431 "movl %2, %%eax \n\t"
\r
432 "shll $4, %%eax \n\t"
\r
433 "addl %%eax, %%esi \n\t"
\r
434 "addl %%eax, %%edx \n\t"
\r
435 "movl (%%edi), %%eax \n\t"
\r
436 "andl (%%edx), %%eax \n\t"
\r
437 "orl (%%esi), %%eax \n\t"
\r
438 "movl %%eax, (%%edi) \n\t"
\r
439 "movl 4(%%edi), %%eax \n\t"
\r
440 "andl 4(%%edx), %%eax \n\t"
\r
441 "orl 4(%%esi), %%eax \n\t"
\r
442 "movl %%eax, 4(%%edi) \n\t"
\r
443 "movl 8(%%edi), %%eax \n\t"
\r
444 "andl 8(%%edx), %%eax \n\t"
\r
445 "orl 8(%%esi), %%eax \n\t"
\r
446 "movl %%eax, 8(%%edi) \n\t"
\r
447 "movl 12(%%edi), %%eax \n\t"
\r
448 "andl 12(%%edx), %%eax \n\t"
\r
449 "orl 12(%%esi), %%eax \n\t"
\r
450 "movl %%eax, 12(%%edi) \n\t"
\r
452 "addl $16, %%edi \n\t"
\r
453 "addl $2, %%ecx \n\t"
\r
455 "jnz tileloop1 \n\t"
\r
457 : "m" (x), "m" (y), "m" (yofs), "m" (map)
\r
458 : "eax","ebx","ecx","edx","esi","edi","cc" );
\r
464 int ModeXColorField(int x, int y, byte c)
\r
467 asm("movl %1, %%eax \n\t"
\r
468 "imul _tsx, %%eax \n\t"
\r
469 "addl %0, %%eax \n\t"
\r
470 "addl _screen, %%eax \n\t"
\r
471 "movl %%eax, %%edi \n\t"
\r
472 "movl $8, %%ecx \n\t"
\r
473 "movb %2, %%al \n\t"
\r
491 "addl _sx, %%edi \n\t"
\r
492 "addl $16, %%edi \n\t"
\r
509 "addl _sx, %%edi \n\t"
\r
510 "addl $16, %%edi \n\t"
\r
512 "jnz lineloop1 \n\t"
\r
514 : "m" (x), "m" (y), "m" (c)
\r
515 : "eax","edi","ecx","cc" );
\r
520 int ModeXClearScreen()
\r
523 memset(screen+(tsx*16)+16,0,(tsx*sy));
\r
528 int ModeXPutPixel(int x, int y, int color)
\r
532 if (x<cx1 || y<cy1 || x>cx2 || y>cy2)
\r
541 screen[(y*tsx)+x]=color;
\r
547 int ModeXGetPixel(int x, int y)
\r
551 if (x<cx1 || y<cy1 || x>cx2 || y>cy2)
\r
561 return screen[(y*tsx)+x];
\r
564 int ModeXHLine(int x, int y, int x2, int color)
\r
571 if (x2<x) { int t=x2; x=x2; x2=t; }
\r
574 if (x>cx2 || y>cy2 || x+width<cx1 || y<cy1)
\r
577 if (x+width > cx2) width=cx2-x+1;
\r
578 if (x<cx1) { width-=(cx1-x); x=cx1; }
\r
584 d=screen+(y*tsx)+x;
\r
585 memset(d,color,width);
\r
591 int ModeXVLine(int x, int y, int y2, int color)
\r
598 if (y2<y) { int t=y2; x=y2; y2=t; }
\r
601 if (x>cx2 || y>cy2 || x<cx1 || y+height<cy1)
\r
607 if (y+height > cy2) height=cy2-y+1;
\r
608 if (y<cy1) { height-=(cy1-y); y=cy1; }
\r
614 d=screen+(y*tsx)+x;
\r
615 for (; height; height--)
\r
625 int ModeXLine(int x1, int y1, int x2, int y2, int color)
\r
627 short i,xc,yc,er,n,m,xi,yi,xcxi,ycyi,xcyi;
\r
632 // check to see if the line is completly clipped off
\r
633 if ((x1<cx1 && x2<cx1) || (x1>cx2 && x2>cx2)
\r
634 || (y1<cy1 && y2<cy1) || (y1>cy2 && y2>cy2))
\r
646 // clip the left side
\r
657 b=y1-(y2-y1)*x1/mxx;
\r
664 // clip the right side
\r
675 b=y1-(y2-y1)*x1/mxx;
\r
699 b=y1-(y2-y1)*x1/mxx;
\r
700 x2=(cy2-b)*mxx/myy;
\r
717 b=y1-(y2-y1)*x1/mxx;
\r
718 x1=(cy1-b)*mxx/myy;
\r
725 // see if it got cliped into the box, out out
\r
726 if (x1<cx1 || x2<cx1 || x1>cx2 || x2>cx2 || y1<cy1 || y2 <cy1 || y1>cy2 || y2>cy2)
\r
734 else { xi=x2; xc=x1; }
\r
736 x1+=16;y1+=16; // aen; adjust these here??
\r
739 // assume y1<=y2 from above swap operation
\r
743 xc=(x2-x1); yc=(y2-y1);
\r
744 if (xc<0) xi=-1; else xi=1;
\r
745 if (yc<0) yi=-1; else yi=1;
\r
746 n=abs(xc); m=abs(yc);
\r
755 screen[(dcy*tsx)+dcx]=color;
\r
769 screen[(dcy*tsx)+dcx]=color;
\r
783 int ModeXCircle(int x, int y, int radius, int color)
\r
788 int d_se=-2*radius+5;
\r
793 ModeXPutPixel(x+cx,y+cy,color);
\r
794 if (cx) ModeXPutPixel(x-cx,y+cy,color);
\r
795 if (cy) ModeXPutPixel(x+cx,y-cy,color);
\r
796 if ((cx) && (cy)) ModeXPutPixel(x-cx,y-cy,color);
\r
800 ModeXPutPixel(x+cy,y+cx,color);
\r
801 if (cx) ModeXPutPixel(x+cy,y-cx,color);
\r
802 if (cy) ModeXPutPixel(x-cy,y+cx,color);
\r
803 if (cx && cy) ModeXPutPixel(x-cy,y-cx,color);
\r
822 } while (cx <= cy);
\r
828 int ModeXCircleFill(int x, int y, int radius, int color)
\r
833 int d_se=-2*radius+5;
\r
838 ModeXHLine(x-cy,y-cx,x+cy,color);
\r
839 if (cx) ModeXHLine(x-cy,y+cx,x+cy,color);
\r
851 ModeXHLine(x-cx,y-cy,x+cx,color);
\r
852 if (cy) ModeXHLine(x-cx,y+cy,x+cx,color);
\r
863 } while (cx <= cy);
\r
869 int ModeXRect(int x, int y, int x2, int y2, int color)
\r
871 ModeXHLine(x,y,x2,color);
\r
872 ModeXHLine(x,y2,x2,color);
\r
873 ModeXVLine(x,y+1,y2-1,color);
\r
874 ModeXVLine(x2,y+1,y2-1,color);
\r
878 int ModeXRectFill(int x, int y, int x2, int y2, int color)
\r
882 if (y2<y) { int t=y2; y=y2; y2=t; }
\r
885 ModeXHLine(x,y,x2,color);
\r
892 // -- ric: 15/Jun/98 --
\r
893 // My first attempt at graphics code :)
\r
897 outportw(SEQU_ADDR, 0x0100);
\r
898 outportb(CRTC_ADDR, 0x11);
\r
899 in_byte = inportb((CRTC_ADDR+1));
\r
900 in_byte = (in_byte && 0x7f);
\r
901 outportb((CRTC_ADDR+1), in_byte);
\r
902 outportw(SEQU_ADDR, 0x0604);
\r
903 outportb(MISC_OUTPUT, 0xe3);
\r
905 outportb(CRTC_ADDR, 0x0); outportb(CRTC_ADDR+1, 0x5f);
\r
906 outportb(CRTC_ADDR, 0x1); outportb(CRTC_ADDR+1, 0x3f);
\r
907 outportb(CRTC_ADDR, 0x2); outportb(CRTC_ADDR+1, 0x40);
\r
908 outportb(CRTC_ADDR, 0x3); outportb(CRTC_ADDR+1, 0x82);
\r
909 outportb(CRTC_ADDR, 0x4); outportb(CRTC_ADDR+1, 0x4a);
\r
910 outportb(CRTC_ADDR, 0x5); outportb(CRTC_ADDR+1, 0x9a);
\r
911 outportb(CRTC_ADDR, 0x6); outportb(CRTC_ADDR+1, 0x23);
\r
912 outportb(CRTC_ADDR, 0x7); outportb(CRTC_ADDR+1, 0xb2);
\r
913 outportb(CRTC_ADDR, 0x8); outportb(CRTC_ADDR+1, 0x0);
\r
914 outportb(CRTC_ADDR, 0x9); outportb(CRTC_ADDR+1, 0x61);
\r
915 outportb(CRTC_ADDR, 0x10); outportb(CRTC_ADDR+1, 0xa);
\r
916 outportb(CRTC_ADDR, 0x11); outportb(CRTC_ADDR+1, 0xac);
\r
917 outportb(CRTC_ADDR, 0x12); outportb(CRTC_ADDR+1, 0xff);
\r
918 outportb(CRTC_ADDR, 0x14); outportb(CRTC_ADDR+1, 0x0);
\r
919 outportb(CRTC_ADDR, 0x15); outportb(CRTC_ADDR+1, 0x7);
\r
920 outportb(CRTC_ADDR, 0x16); outportb(CRTC_ADDR+1, 0x1a);
\r
921 outportb(CRTC_ADDR, 0x17); outportb(CRTC_ADDR+1, 0xe3);
\r
922 outportb(SEQU_ADDR, 0x1); outportw(SEQU_ADDR+1, 0x1);
\r
923 outportb(0x3ce, 0x5); outportb(0x3cf, 0x40);
\r
924 outportb(0x3ce, 0x6); outportb(0x3cf, 0x5);
\r
926 outportb(0x3C0, 0x1 | 0x20);
\r
927 outportb(0x3C0, 0x41);
\r
928 outportb(CRTC_ADDR, 0x13);
\r
929 outportb(CRTC_ADDR+1, 0x20);
\r
931 outportw(SEQU_ADDR, 0x0300);
\r
938 endcol=272; nextl=64;
\r
940 DriverDesc = "256x256 (ModeX, planar)";
\r
946 outportw(SEQU_ADDR, 0x0604);
\r
947 outportw(SEQU_ADDR, 0x0110);
\r
948 outportb(MISC_OUTPUT, 0xe3);
\r
949 outportw(SEQU_ADDR, 0x0300);
\r
950 outportb(CRTC_ADDR, 0x11);
\r
951 in_byte = inportb((CRTC_ADDR+1));
\r
952 in_byte = (in_byte && 0x7f);
\r
953 outportb((CRTC_ADDR+1), in_byte);
\r
954 outportw(CRTC_ADDR, 0x0d06);
\r
955 outportw(CRTC_ADDR, 0x3e07);
\r
956 outportw(CRTC_ADDR, 0x4109);
\r
957 outportw(CRTC_ADDR, 0xea10);
\r
958 outportw(CRTC_ADDR, 0xac11);
\r
959 outportw(CRTC_ADDR, 0xdf12);
\r
960 outportw(CRTC_ADDR, 0x0014);
\r
961 outportw(CRTC_ADDR, 0xe715);
\r
962 outportw(CRTC_ADDR, 0x0616);
\r
963 outportw(CRTC_ADDR, 0xe317);
\r
970 endcol=336; nextl=80;
\r
972 DriverDesc = "320x240 (ModeX, planar)";
\r
978 outportw(SEQU_ADDR, 0x0604);
\r
979 outportw(SEQU_ADDR, 0x100);
\r
980 outportb(MISC_OUTPUT, 0xe7);
\r
981 outportw(SEQU_ADDR, 0x300);
\r
982 outportb(CRTC_ADDR, 0x11);
\r
983 in_byte = inportb((CRTC_ADDR+1));
\r
984 in_byte = (in_byte && 0x7f);
\r
985 outportb((CRTC_ADDR+1), in_byte);
\r
986 outportw(CRTC_ADDR, 0x6b00);
\r
987 outportw(CRTC_ADDR, 0x5901);
\r
988 outportw(CRTC_ADDR, 0x5a02);
\r
989 outportw(CRTC_ADDR, 0x8e03);
\r
990 outportw(CRTC_ADDR, 0x5e04);
\r
991 outportw(CRTC_ADDR, 0x8a05);
\r
992 outportw(CRTC_ADDR, 0x0d06);
\r
993 outportw(CRTC_ADDR, 0x3e07);
\r
994 outportw(CRTC_ADDR, 0x4109);
\r
995 outportw(CRTC_ADDR, 0xea10);
\r
996 outportw(CRTC_ADDR, 0xac11);
\r
997 outportw(CRTC_ADDR, 0xdf12);
\r
998 outportw(CRTC_ADDR, 0x2d13);
\r
999 outportw(CRTC_ADDR, 0x0014);
\r
1000 outportw(CRTC_ADDR, 0xe715);
\r
1001 outportw(CRTC_ADDR, 0x0616);
\r
1002 outportw(CRTC_ADDR, 0xe317);
\r
1008 cx2=sx-1;cy2=sy-1;
\r
1009 endcol=376; nextl=90;
\r
1011 DriverDesc = "360x240 (ModeX, planar)";
\r
1014 void InitModeX(int res)
\r
1016 ModeXSetMode(0x13);
\r
1020 case 0: Set320x240(); break;
\r
1021 case 1: Set360x240(); break;
\r
1022 case 2: Set256x256(); break; /* -- ric: 15/Jun/98 -- */
\r
1023 default: err("Internal error: unknown ModeX resolution code");
\r
1026 screenbase=(char *) 0xA0000+__djgpp_conventional_base;
\r
1027 screen=(char *) malloc(107648);
\r
1028 memset(screen,0,107648);
\r
1031 // Mode successfuly set, now lets set up the driver.
\r
1033 ShutdownVideo = ModeXShutdown;
\r
1034 ShowPage = ModeXShowPage;
\r
1035 CopySprite = ModeXCopySprite;
\r
1036 TCopySprite = ModeXTCopySprite;
\r
1037 CCopySprite = ModeXCCopySprite;
\r
1038 TCCopySprite = ModeXTCCopySprite;
\r
1039 CopyTile = ModeXCopyTile;
\r
1040 TCopyTile = ModeXTCopyTile;
\r
1041 ScaleSprite = ModeXScaleSprite;
\r
1042 RenderMAPLine = ModeXRenderMAPLine;
\r
1043 TRenderMAPLine = ModeXTRenderMAPLine;
\r
1044 ColorField = ModeXColorField;
\r
1045 ClearScreen = ModeXClearScreen;
\r
1046 PutPixel = ModeXPutPixel;
\r
1047 GetPixel = ModeXGetPixel;
\r
1048 HLine = ModeXHLine;
\r
1049 VLine = ModeXVLine;
\r
1051 Circle = ModeXCircle;
\r
1052 CircleFill = ModeXCircleFill;
\r
1054 RectFill = ModeXRectFill;
\r