[comp.os.msdos.programmer] How does BIOS define character attributes?

dsims@uceng.UC.EDU (david l sims) (10/30/90)

I want to use BIOS call 10H, function 09H (write attribute/character at
current cursor position). Register BL is supposed to hold the
attribute of the character that I want to write. However, I've searched
my BIOS manual high and low, and I can't find anything describing
this "character attribute."

Does anyone know how this character attribute is defined?
I'm using alpha mode only, but if
there's any information on graphics attributes as well, I would
appreciate having it.

stever@Octopus.COM (Steve Resnick ) (10/31/90)

In article <6558@uceng.UC.EDU> dsims@uceng.UC.EDU (david l sims) writes:
>I want to use BIOS call 10H, function 09H (write attribute/character at
>current cursor position). Register BL is supposed to hold the
>attribute of the character that I want to write. However, I've searched
>my BIOS manual high and low, and I can't find anything describing
>this "character attribute."
>
>Does anyone know how this character attribute is defined?
>I'm using alpha mode only, but if
>there's any information on graphics attributes as well, I would
>appreciate having it.

The attributes are the colors for the text you want. Each character is 
associated with a color byte. The attributes are set as follows:

	BbbbIfff  : Where each character represents a bit from MSB to LSB.
		     B = blink bit. If this is set, foreground chars blink.
		     b = background attribute.
		     I = foreground intensity.
		     f = foreground attribute.
		     
	Colors are: 0=Black, 1=Blue, 2=Green, 3=Cyan, 4=Red, 5=Magenta
	6 = brn (or yellow if intensity is set), 7 = white.
	
	
Hope this helps.....
Steve
.
-- 
----------------------------------------------------------------------------
steve.resnick@f105.n143.z1.FIDONET.ORG - or - apple!camphq!105!steve.resnick
Flames, grammar errors, spelling errrors >/dev/nul
The Asylum OS/2 BBS - (408)263-8017 IFNA 1:143/105.0

ts@uwasa.fi (Timo Salmi) (10/31/90)

In article <6558@uceng.UC.EDU> dsims@uceng.UC.EDU (david l sims) writes:
> I want to use BIOS call 10H, function 09H (write attribute/character
> at current cursor position). Register BL is supposed to hold the
> attribute of the character that I want to write. However, I've
> searched my BIOS manual high and low, and I can't find anything
> describing this "character attribute."
>
> Does anyone know how this character attribute is defined?

This may not be what you are looking for, but I'll list the
information just in case. I have rather seen the term character
attribute in the following context. In text mode the screen is
stored in memory as character + character attribute pairs (80x25).
The character attributes define the text color and background color
for each position of the screen. The formula for the attribute is
  (ord(backgroundColor) shl 4) or ord(foregroundColor)
using Turbo Pascal notation.

...................................................................
Prof. Timo Salmi        (Moderating at anon. ftp site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

lsalomo@hubcap.clemson.edu (lsalomo) (11/01/90)

From article <6558@uceng.UC.EDU>, by dsims@uceng.UC.EDU (david l sims):
> I want to use BIOS call 10H, function 09H (write attribute/character at
> current cursor position). Register BL is supposed to hold the
> attribute of the character that I want to write. However, I've searched
> my BIOS manual high and low, and I can't find anything describing
> this "character attribute."
> 
> Does anyone know how this character attribute is defined?
> I'm using alpha mode only, but if
> there's any information on graphics attributes as well, I would
> appreciate having it.

The attribute for a character is of the following format:

Bit     7  6  5  4  3  2  1  0
Meaning bl bc bc bc fc fc fc fc

where

bl - blink if set
bc - background color (0-7)
fc - foreground color (0-15)  Note that the high bit is the intensity bit,
     so 8-15 is actually the high intensity version of 0-7

You'll have to play with the colors to figure out the mapping.  I do remember
0=black,6=brown,7=light grey,8=dark grey,14=yellow,15=white.

Also note that there is a way to out() a specific number to the video chip
to tell it to interpret the blink bit as an intensity bit, but I do not
remember the details (consult the hardware tech. ref. for your machine).

Cheers,
Q - the "Q"uestor for knowledge (, a degree, etc.)

lsalomo@hubcap.clemson.edu
ibmman@prism.clemson.edu
ibmman@clemson.clemson.edu
=============================================================================
"Gee Wally, I think there's something wrong with the Beaver."
=============================================================================

wjb@moscom.UUCP (Bill de Beaubien) (11/02/90)

In article <6558@uceng.UC.EDU> dsims@uceng.UC.EDU (david l sims) writes:
>I want to use BIOS call 10H, function 09H (write attribute/character at
>current cursor position). Register BL is supposed to hold the
>attribute of the character that I want to write. However, I've searched
>my BIOS manual high and low, and I can't find anything describing
>this "character attribute."
>
>Does anyone know how this character attribute is defined?

The attribute byte is defined as follows:
bit 7 - blink, though can be background intensity if you're on an EGA or
		better, and use int 10h, service 3, subservice 3 to disable the
		blinking attribute.
bits 4-6 - background color
bit 3	 - foreground intensity
bits 0-2 - foreground color

Bill

-- 
Bill de Beaubien / wjb@moscom.com 

Ralf.Brown@B.GP.CS.CMU.EDU (11/03/90)

In article <2352@moscom.UUCP>, wjb@moscom.UUCP (Bill de Beaubien) wrote:
}The attribute byte is defined as follows:
}bit 7 - blink, though can be background intensity if you're on an EGA or
}                better, and use int 10h, service 3, subservice 3 to disable the
}                blinking attribute.

It can also be background intensity on a CGA, MDA, or Herc if you twiddle the
appropriate bit in the 6845 CRT controller.
--
UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=- 412-268-3053 (school) -=- FAX: ask
ARPA: ralf@cs.cmu.edu  BIT: ralf%cs.cmu.edu@CMUCCVMA  FIDO: 1:129/3.1
Disclaimer?    |   I was gratified to be able to answer promptly, and I did.
What's that?   |   I said I didn't know.  --Mark Twain