Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Tom Rettigs Library - biosattr() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 BIOSATTR()
 Obtains the current screen attributes from the ROM BIOS.
 Returns <expN> value of screen attribute at the cursor.

 Uses interrupt 16 (hex 10), service 8.

 Number returned is in the range zero to 255 with each color or
 attribute represented by each of eight bits (in binary notation).

 Bit   Color Attribute
 ---   ---------------------------------------
  0    Blue component of foreground color
  1    Green component of foreground color
  2    Red component of foreground color
  3    Intensity component of foreground color
  4    Blue component of background color
  5    Green component of background color
  6    Red component of background color
  7    Blinking component of foreground color

 Bit zero is the rightmost (or least significant) bit,
 and bit seven is the leftmost (or most significant) bit.

 For more information about your ROM BIOS, see your
 operating system or hardware technical reference manual
 or The Peter Norton Programmer's Guide to the IBM-PC.

 * Used by .prg function to store current set color values
 * by taking a substring of color-setting letters which are
 * positioned in a string array for this purpose.
 FUNCTION SCRATTR
 attribute = BIOSATTR()
 RETURN TRIM( SUBSTR( "N  B  G  BG R  BR GR W  "+;
                      "N+ B+ G+ BG+R+ BR+GR+W+ ",;
                      (attribute % 16)*3+1, 3 ) ) + "/" +;
              SUBSTR( "N  B  G  BG R  BR GR W  "+;
                      "N* B* G* BG*R* BR*GR*W* ",;
                      INT(attribute/16)*3+1, 3 )
 .
 . <code that changes color>
 .
 SET COLOR TO (set_color)  && restore original color settings

 Hazard  Shows only the screen attribute of the one byte
             at the current cursor position.


             Placed in the Public Domain by Tom Rettig Assoc.

See Also: SCRATTR()

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