Solved

Question on using 640x480x32k colors mode

Posted on 1998-02-03
3
249 Views
Last Modified: 2006-11-17
Here's my question...

For your information, I am trying to program in a 640x480x32k colors mode. Before this, I've been in 320x200x256 colors mode and I'm able to play around with the 256 colors available for me and I'm able to create a palette
with 64 different shades of a color for my needs.

But I'm new to this 640x480x32k mode and I hope that someone could answer the following doubts:

1) How many different kinds of shades can a color element
   (eg: red) have in this mode? [eg: Red can have up to 64
   different shades in 320x200x256 colors mode]

2) How can I create a palette to contain all of the shades?
   [eg: for(index=0; index<64; index++)
            write_to_palette(index, index, 0, 0);
        I can have 64 different shades of red like this.]
   
3) I understand that in 320x200x256 colors mode, the 3
   important color element are Red, Green and Blue. What
   about in 640x480x32k colors mode?
 
4) How can I use the character set from the BIOS in
   640x480x32k colors mode? Can I create the font myself
   instead of using the character set? How?  

For more informations, I'm using Turbo C++ version 3.0 for
DOS compiler. Any help offered is very much appreciated!
0
Comment
Question by:justinng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Expert Comment

by:TheMadManiac
ID: 1180424
1) it depends on the card, but usually there are 5 bits for red, 5 bits for green and 5 bits for blue. this would mean that there can be 32 shades.

2) this mode does not use a palette. the 16 bits you need to write to the videomemory contain the all the color information it needs. much like in truecolor modus. Think about this: how big would a palette for 32k colors be ?

3) well, see 1. they still are red/green/blue

4) once you are in that mode, you can just use printf to write characters to the video-memory. this will take care of bios calls (which is just the same call as in textmode)
0
 

Author Comment

by:justinng
ID: 1180425
For:

1) You mean there can be 64 different shades for Red element in
   320x200x256 colors mode and only 32 different shades for the
   Red element in 640x480x32k colors mode??

2) Well... you've got a point there but how can I go about doing    that?

3) Fine.... thanx!

4) You mean using printf to write to video memory? But how?
   Like I use printf to print a string or character on the
   80x25 screen but how can I do that in 640x480x32k colors mode?
   Can I assign one of the 32k colors to the string or character?
   Sorry but can you tell me how can I go about doing it by some
   brief codes maybe?

Thanx!
0
 
LVL 1

Accepted Solution

by:
TheMadManiac earned 30 total points
ID: 1180426
1)
yes, the number of shades is reduced, but the number of colors that can be used at the same time has been increased from 256 to 32k colors. This is the cost of this modus

3)
think of the int made up out of bits:

 0 -> 4 = red
 5 -> 9 = green
 10->14 = blue

the 15th bit isn't used (it is in 64k color mode.. this is the only difference between 32k & 64k)

so, to write white, just write a in with the value 31+(31<<5)+(31<<10)

in which the first is red, the second is green and the last is blue. ( some cards use a different order of the colors in the int)

4)
printf writes to standard output device, and thus it is impossible to use colors with it (exceptions there, but do not apply for 32k color mode)
to write a character to that mode with a specified color, you probably just want to draw it yourself, with putpixels or something. this is faster as well.. i could explain it here, but that would take to much time, and it's done so many times before. besides, it's almost like putting an image on the screen.
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question