Page 1 of 1

Error in tutorial #10...

Posted: Thu Feb 04, 2010 5:39 pm
by atc
This tutorial has an error in it: http://www.brokenthorn.com/Resources/OSDev10.html
The attribute byte is a byte that defines certain attributes, and defining both foreground and background colors. The byte follows the format:

* Bits 0 - 2: Foreground color
o Bit 0: Red
o Bit 1: Green
o Bit 2: Blue
* Bit 3: Foreground Intensity
* Bits 4 - 6: Background color
o Bit 4: Red
o Bit 5: Green
o Bit 6: Blue
* Bit 7: Blinking or background intensity
Bits 0 -2 & 4 - 6 are actually backwards for some reason, so it should read as:
* Bits 0 - 2: Foreground color
o Bit 0: Blue
o Bit 1: Green
o Bit 2: Red
* Bit 3: Foreground Intensity
* Bits 4 - 6: Background color
o Bit 4: Blue
o Bit 5: Green
o Bit 6: Red
* Bit 7: Blinking or background intensity
Yes, it does seem odd. Until you think of it like the way we read English, right to left. So you'd start from bit 7 and read to bit 0, thus reading the color bits as R,G,B! :)

0x9A or 10011010b -- You get blinking green text with blue background.
Then try...
0xCA or 10001010b -- Same thing, but red background.
0x11 or 00010001b -- Totally blue, can't even see it if you have blue BG! ;)

Not so weird when you think about it, is it? :lol: But definitely a bit counter-intuitive when you read the bits as a number (sorta Little-Endian-ish, lol), rather than the way we read English words. This doesn't mean there's anything wrong with the author, it means there's something wrong with INTEL! :lol:

Re: Error in tutorial #10...

Posted: Sat Feb 06, 2010 12:23 am
by Mike
Hello,

I believe you are correct, sorry for the error. It will be corrected :)

Re: Error in tutorial #10...

Posted: Sat Feb 06, 2010 3:10 am
by atc
Ah, no need to apologize, my friend! :D With such a huge series, this sort of thing will happen to any writer. ;) We thank you for the series!