The text-mode screen is laid out as a series of byte-pairs, where the
first byte is any of 256 ASCII characters and the second byte is a video
attribute; see Color Table for a complete list.  For color/graphics
adapters in text mode, the attribute is defined as:

ScrnAttrRec -- blink enabled (default BIOS setting)
 7 6 5 4 3 2 1 0 
   bkgnd  frgnd  
                  bits  mask
                  0-3:  0fH  foreground color
                  4-6:  70H  background color
                    7:  80H  1=foreground flashes

ScrnAttrRec -- blink disabled
 7 6 5 4 3 2 1 0 
  bkgnd   frgnd  
                  bits  mask
                  0-3:  0fH  foreground color
               4-6:  f0H  background color

bits 0-3  the foreground color (the color of the character itself).  It
may have one of the values:
00H black     08H gray
01H blue      09H bright blue
02H green     0aH bright green
03H cyan      0bH bright cyan
04H red       0cH bright red
05H magenta   0dH bright magenta
06H brown     0eH yellow
07H white     0fH bright white

bits 4-6  the background color.  When blink is enabled (the default BIOS
setting), this may have only values 0xH-7xH; that is, dark
colors.  When blink is disabled, the background may be any of
the 16 colors (0xH-fxH).

bit 7  foreground blinks.  When blink is enabled (the default), this
bit may be 1 (values 8xH-FxH) to make the foreground color
flash.  When blinks is disabled, this bit is part of the
background color.

  Blink Enabled/Disabled  
By default, the video hardware is set to interpret attribute bit 7 as the
"foreground blinks" flag.  This makes it possible to use only 8 background
colors.  Many modern programs enable all 16 background colors (256
combinations) by disabling character blink.  All standard monitor types
(MDA , CGA , EGA , and VGA ) are capable of disabling blink.

On EGA and VGA, just use INT 10H 1003H to enable or disable blinking.
On MDA and CGA, you can turn off blinking by clearing bit 5 of the Mode
Select Register.  For instance:

mov ax,40H
mov es,ax
mov dx,es:[063H]  ;get port address of the card
add dx,4

mov al,es:[065H]  ;get current value of Mode Select Register
and al,0dfH       ;mask value by 1101 1111 (to clear bit 5)
out dx,al         ;disable blink
mov es:[065H],al  ;save the new setting

When DOS 4.0+ ANSI.SYS is installed, you may use DOS fn 440cH 5fH to
change the blink/bold status; see the IoctlDisplayModeRec.wFlags field.

  EGA and VGA Colors  
On EGA and VGA adapters, the color attributes can be redefined.  An
attribute byte stored in video memory actually specifies one of 64
different color combinations (plus blink).

For instance, you can use fn INT 10H 1000H to set the color attribute
that normally displays as "black-on-white" to show as "yellow-on-blue" or
any other combination.

On VGAs, you can have very fine control over the colors displayed.  You
can use INT 10H 1010H (et. al) to reprogram the DAC color registers to
select any of 262,144 possible colors for any attribute.

  EGA and VGA 512-character Fonts  
EGAs and VGAs can be set in a rarely-seen mode in which bit 3 of the
attribute selects a different screen font.  For instance, this provides a
way to display both italics and upright text simultaneously (though you
end up with only 8 foreground colors).

ScrnAttrRec -- 512-character set enabled
 7 6 5 4 3 2 1 0 
   bkgnd s frgnd 
                   bits mask
                  0-2:  07H  foreground color (0-7)
                    3:  08H  character set (font) number (0-1)
                  4-6:  70H  background color
                    7:  80H  foreground flashes (or bold background)

See INT 10H 1103H (enable/select 512-character font) for details.

  MDA Limitations  
Although any attribute can be used on any monitor, some monitors aren't
capable of displaying the full range of colors.  Use this chart for
selecting pleasing and readable combinations for your target monitor:

TTL Monochrome Monitors            Black-and-White Monitors
                                                                   
01H underline                      07H normal (white on black)
07H normal (white on black)        08H grey on black
09H bright underline               0fH bold (bright white on black)
0fH bold (bright white on black)   70H reverse (black on white)
70H reverse (black on white)       78H grey on white
81H blinking underline             7fH bright white on white
87H blinking normal                87H blinking normal
89H blinking bright underline      8fH blinking bold
8fH blinking bold                 

The IBM Monochrome monitor  is able to display only the combinations
listed above.  Other attributes are displayed as "normal" white on black.

See Also: CGA  MDA  EGA  VGA
- -

Screen Attributes