Date: Wed, 17 May 1995 09:59:01 +0200 From: emanne AT calvin DOT info DOT unicaen DOT fr (Emmanuel Anne) To: djgpp AT sun DOT soe DOT clarkson DOT edu How to access full color modes with grx 1.03 (65536 colors) Not that these modes are particularly usefull compared to the high color modes (32768 colors), but my card can not handle high color modes (MIRO). Since the updates are short, here they are : (in diff format) *** colors.c Mon Dec 6 14:22:00 1993 --- ..\colors.c Tue May 16 01:48:24 1995 *************** *** 141,146 **** --- 141,147 ---- switch(_GrNumColors) { #if (GRXPLANES & 16) case 32768: + case 65536: #endif case 2: whitecolor = _GrNumColors - 1; *************** *** 245,254 **** if(RGBmode) switch(_GrNumColors) { #if (GRXPLANES & 16) case 32768: KEEPBITS(r,5); - KEEPBITS(g,5); KEEPBITS(b,5); ! return((r << 7) | (g << 2) | (b >> 3)); #endif case 256: KEEPBITS(r,3); --- 246,261 ---- if(RGBmode) switch(_GrNumColors) { #if (GRXPLANES & 16) case 32768: + case 65536: KEEPBITS(r,5); KEEPBITS(b,5); ! if (_GrNumColors==32768) ! { ! KEEPBITS(g,5); ! return((r << 7) | (g << 2) | (b >> 3)); ! } ! KEEPBITS(g,6); ! return((r << 8) | (g << 3) | (b >> 3)); #endif case 256: KEEPBITS(r,3); *** layout.c Mon Dec 6 14:22:02 1993 --- ..\layout.c Tue May 16 01:07:02 1995 *************** *** 29,34 **** --- 29,35 ---- if(width > 0) switch(_GrNumColors) { #if (GRXPLANES & 16) case 32768: + case 65536: return(width << 1); #endif case 256: *** setmode.c Mon Dec 6 14:22:08 1993 --- ..\setmode.c Tue May 16 01:07:02 1995 *** 158,164 **** --- 157,168 ---- case GRD_16_PLANES: if(_GrAdapterType != GR_VGA) goto Default; _GrDriverIndex = VGA32K_DRIVER; + /* Borland C++ can not handle 16 planes modes, so ints can contain numbers */ + /* greater than 65535 (4 bytes / int) */ + if (colors<=32768) _GrNumColors = 32768; + else + _GrNumColors = 65536; break; #endif #if (GRXPLANES & 8) || (GRXPLANES & MODE_8514A) After this, you need to include the full color modes in the drivers using the VDR syntax : 640, 480, 0c000h+16 ... adds a 640x480 mode with 16 bits/pixel. This method allows to indicate the numbers of colors in a word. Still in the drivers, you need to allow these modes : At some place in the asm source of the driver, you have something like : mov bx,GRD_16_PLANES cmp WORD PTR [di+4],32768 ; 32K colors ? je doFLAG Replace it by : cmp WORD PTR [di+4],32768 ; 32K colors ? jae doFLAG ; if above, it is 65536 (full color mode) The drivers can still be in GRN format. For the moment the modified source take a mode with a number of colors>32768 as a full color mode with 65536 colors. This will have to be changed for true color support, but it looks a little more tricky ! Like high color modes, these modes are not supported with the Borland C++. To end, here is a new rgbtest.c to be abble to test the new modes : #include "test.h" char buff[80]; TESTFUNC(rgbtest) { int x = GrSizeX(); int y = GrSizeY(); int ww; int wh; int ii,jj; int maxx,maxy; GrSetRGBcolorMode(); maxx=32; maxy=8; ww= (x-10)/maxx; wh=(y-10)/maxy; if (GrNumColors()<=256) { for(ii = 0; ii < maxy; ii++) { for(jj = 0; jj < maxx; jj++) { GrFilledBox(5+jj*ww,5+ii*wh,5+jj*ww+ww-1,5+ii*wh+wh-1,ii*maxx+jj); } } } else { for (ii=0; ii<=127; ii++) for (jj=0; jj<=127; jj++) { GrPlot(30+ii,120+jj,GrAllocColor(ii*2,jj*2,0)); GrPlot(200+ii,120+jj,GrAllocColor(ii*2,0,jj*2)); GrPlot(370+ii,120+jj,GrAllocColor(0,ii*2,jj*2)); } for (ii=0; ii<=511; ii++) for (jj=260; jj<=269; jj++) { GrPlot(ii,jj,GrAllocColor(ii>>1,0,0)); GrPlot(ii,jj+10,GrAllocColor(0,ii>>1,0)); GrPlot(ii,jj+20,GrAllocColor(0,0,ii>>1)); } } getkey(); sprintf(buff,"%dx%d, %d",GrMaxX(),GrMaxY(),GrNumColors()); exit_message=buff; } For any questions, comments, I am not on the list at the moment. You can write to : emanne AT univ-caen DOT fr PS : did somebody implement the mode X functions ?