Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  Service 09H (decimal 9) writes one or more copies of a single character
  and its color attribute. The character is specified in AL, and the
  text-mode attribute or graphics-mode color is specified in BL. The number
  of times the character is to be written (one or more times) is placed in
  CX, and BH contains the display page number. (See Figure 9-9.)

  Service Number           Parameters
  --------------------------------------------------------------------------
  AH = 09H                 AL = ASCII character to write to screen
                           BL = attribute value (text modes) or foreground
                           color (graphics modes)
                           BH = background color (video mode 13H only) or
                           display page number (all other modes)
                           CX = number of times to write character and
                           attribute
  --------------------------------------------------------------------------

  Figure 9-9.  The registers used to write a text character and attribute
  using service 09H.

  The ROM BIOS writes the character and its color attributes as many times
  as requested, starting at the current cursor location. Although the cursor
  is not moved, duplicate characters are written at subsequent screen
  locations. In text mode, the duplicated characters will successfully wrap
  around from line to line, which increases the usefulness of this service.
  In graphics mode, the characters will not wrap around.

  Service 09H is quite useful both for writing individual characters and for
  replicating a character. The repeat operation is most often used to
  rapidly lay out blanks or other repeated characters, such as the
  horizontal lines that are part of box drawings. (See Appendix C.) When
  you want to make a single copy of the character, be sure to set the count
  in CX to 1. If it's set to 0, the number of repetitions will be a lot more
  than you want.

  Service 09H has an advantage over the similar service 0EH, in that you
  can control the color attributes. However, its one disadvantage is that
  the cursor is not automatically advanced.

  In graphics modes, the value specified in BL is the foreground color--the
  color of the pixels that make up the character drawing. Normally the ROM
  BIOS displays the character with the specified foreground color on a black
  background. If, however, you set bit 7 of the color value in BL to 1, then
  the ROM BIOS creates the character's new foreground color by using an
  exclusive OR operation (XOR) to combine each of the previous foreground
  pixels with the value in BL. The same feature also applies to the
  character and pixel writing services, services 0AH and 0CH.

  Here's an example of what can happen when the ROM BIOS uses the XOR
  operation to display a character. Imagine you're in 320 x 200, 4-color
  graphics mode and the screen is completely filled with white pixels. If
  you now write a white character in the usual way, with a color value of
  03H (white) in register BL, the ROM BIOS displays a white character on a
  black background. If, however, you write the same character with a color
  value of 83H (bit 7 set to 1), the ROM BIOS uses XOR to display a black
  character on a white background.

  See page 82 for more on display attributes in text modes. See page 84
  for more on color attributes in graphics modes.

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