Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telix/SALT v3.15 & RS-232, Hayes - <b>vputchrsa</b> <u>introduced: v3.12</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  VPUTCHRSA                             Introduced: v3.12

  .  Summary

  vputchrsa (int <x>, int <y>, str <buf>, int <pos>, int <num>);

  .  Description

  The vputchrsa function is used to place <num> (starting from position
  <pos> in the string variable <buf>) characters on the screen
  starting at column <x> row <y>, specifying color information at the
  same time. <buf> contains the characters to place on the screen; the
  first, third, ... bytes contain the ASCII values for the characters,
  while the second, fourth, ... bytes contain the color value. Ususally
  these values will have been created by vgetchrsa, although it is
  certainly possible to build up the string in a program.
     In general, a if 'c' is the character, and 'color' is the color to use,
  the proper value is obtained with the expression

       (c + color * 256)

  Possible colors are numbered as follows:

                      Black          00
                      Blue           01
                      Green          02
                      Cyan           03
                      Red            04
                      Magenta        05
                      Brown          06
                      Light Grey     07
                      Dark Grey      08
                      Light Blue     09
                      Light Green    10
                      Light Cyan     11
                      Light Red      12
                      Light Magenta  13
                      Yellow         14
                      White          15

  To obtain a color attribute value for a color combination, the for-
  mula is

       color attribute value =

             foreground color value + (16 * background color value)

  Therefore, a Yellow character on a Blue background would have a
  color attribute value of 30 (14 + (16 * 1)).

  .  Return Value

  None.

  .  Example

  // copy a 20 by 10 grid of characters with a left hand corner of
  // 10,5 to 40,7, and keep color attributes
  str buffer[400];   // 20 wide * 10 tall * 2 bytes per character
  int y;
  for (y = 5; y < 15; y = y+1)         // read chars in a loop
   vgetchrsa(10, y, buffer, 2 * 20 * (y - 5), 20);
  for (y = 7; y < 17; y = y+1)         // now write them in a loop
   vputchrs(10, y, buffer, 2 * 20 * (y - 7), 20);

See Also: vgetchr vgetchrs vgetchrsa vputchr vputchrs color chart

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson