vbdpss.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Article Q44412
                                                 Contents  Index  Back
─────────────────────────────────────────────────────────────────────────────
                           Knowledge Base Contents  Knowledge Base Index
 
 Color and Monochrome Attributes in SCREEN 0 (Text) Explained - Q44412
 
 The following information refers to the SCREEN 0 description in the
 following sources: the VBDOS.EXE on-line Help system of Visual Basic
 version 1.00 for MS-DOS.
 
 The documentation for SCREEN 0 states that the follow colors are
 available:
 
     o 16 colors assigned to two color attributes
     o 16 colors assigned to any of 16 color attributes (with CGA or EGA)
     o 64 colors assigned to any of 16 color attributes (with EGA or VGA)
 
 However, this is misleading because the word "attribute" is used
 inaccurately.
 
 A more accurate statement is that for each character in SCREEN 0, you
 can assign 16 colors for the foreground and any of 8 colors for the
 background on a color adapter (CGA, EGA, or VGA). In addition, you can
 make the character blink (flash on and off).
 
 On a monochrome adapter, only certain combinations of display
 attributes are supported, as described further below.
 
 More Information:
 
 Attribute Byte for Color Adapters
 ---------------------------------
 
 The reason for having only 8 colors (0 through 7) available for the
 background of each character is because of the arrangement of video
 memory. In text mode, each character position on the display screen is
 controlled by two contiguous bytes in video memory. The first byte
 contains the ASCII code for the character, and the second byte is that
 character's attribute byte, which controls colors, brightness, and
 blinking.
 
 In the foreground, there are 8 base colors, plus a 4th bit for
 intensity, which gives 16 colors (2^4 = 16). The background has only
 the 8 base colors. Another bit turns on blinking, which flashes
 foreground and background together for a given character.
 
 The following are the 8 bits of the attribute byte allocated per
 character in text mode (SCREEN 0) for color display adapters:
 
  ---------------------------------------------------------------
 |       |       |       |       |       |       |       |       |
 | Blink |  Red  | Green | Blue  |Intense|  Red  | Green | Blue  |
 |       |       |       |       |       |       |       |       |
 |   7   |   6   |   5   |   4   |   3   |   2   |   1   |   0   |
  ---------------------------------------------------------------
           \_____     ______/       \________     _________/
                  \  /                        \  /
                Background                  Foreground
 
 
 Attribute Byte for Monochrome Adapters
 --------------------------------------
 
 The following are the 8 bits of the attribute byte allocated per
 character in text mode (SCREEN 0) for monochrome display adapters:
 
  ---------------------------------------------------------------
 |       |       |       |       |       |       |       |       |
 |   7   |   6   |   5   |   4   |   3   |   2   |   1   |   0   |
 |       |       |       |       |       |       |       |       |
  ---------------------------------------------------------------
    \/    \_____     ______/      \/     \_____     ______/
     |            \  /              |             \  /
  Blinking      Background      Intensified      Foreground
 
 Only the following combinations of attribute bits are recognized by a
 monochrome adapter card. The appearance of some display attributes
 depends on the setting of the enable-blink bit at I/O port 3B8 hex.
 The attribute-bit combinations are as follows:
 
 Value of Attribute Byte
   (Binary)      (Hex)    Description of Display Attributes
 -----------------------  ---------------------------------
   00000000       00      Not displayed
   00000001       01      Underlined
   00000111       07      Normal (white on black)
   00001001       09      High intensity, underlined
   00001111       0F      High intensity
   01110000       70      White background, black foreground
                              (i.e., reverse video)
   10000111    *  87      If blinking enabled: blinking white on black
                          If blinking disabled: dim background, normal
                              foreground
   10001111    *  8F      If blinking enabled: blinking high intensity
                          If blinking disabled: dim background, high-
                              intensity foreground
   11110000       F0      If blinking enabled: blinking reverse video
                          If blinking disabled: high-intensity
                              background, black foreground
 
 * Combinations marked with asterisk (*) are not displayed on all
   monochrome monitors.
 
 Additional Reference:
 
    "Programmer's Guide to PC and PS/2 Video Systems," by Richard
    Wilton (published by Microsoft Press, 1987)