🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #383

VGA QUESTION : SUMMARY

#383
From: Bruce Stock
Date: Tue, 01 May 1990 15:56
20 lines
1115 bytes
Thanks to all who replied to my original query:

>Is the standard VGA palette (16 out of 64 colors) in 640x480 mode fixed, or is
>there a way to coax a 16 level gray scale out of it?

I suppose I should have realized that the 18 bit VGA palette was being
used, even in 16 color mode.

For general interest, the resulting code (based on an elegant suggestion
by psiesta.psi.siemens.com!torkil) is, for Turbo C 2.0:

#include <graphics.h>

struct palettetype pal16;

getpalette(&pal16);          /* read the 16 palette registers  to find out
				WHICH of the 18 bit registers are being used*/

for(i=0; i<16; i++)          /* set up the 16 level gray scale  */
	setrgbpalette(pal16.colors[i],4*i,4*i,4*i);
Technical Details
Message-ID: <3331@ssc-vax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cornell!uw-beaver!fluke!ssc-vax!bruce

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cornell!uw-beaver!fluke!ssc-vax!bruce
From: bruce@ssc-vax.UUCP (Bruce Stock)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: VGA QUESTION :   SUMMARY
Message-ID: <3331@ssc-vax.UUCP>
Date: 1 May 90 15:56:22 GMT
Distribution: usa
Organization: Boeing Aerospace & Electronics, Seattle WA
Lines: 20
Keywords: Yes it can be done