Error in tutorial #10...

Help us improve this website for you

Moderator: Moderators

Post Reply
atc
Posts: 23
Joined: Sun Jan 24, 2010 2:20 pm

Error in tutorial #10...

Post by atc » Thu Feb 04, 2010 5:39 pm

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:

User avatar
Mike
Site Admin
Posts: 465
Joined: Sat Oct 20, 2007 7:58 pm
Contact:

Re: Error in tutorial #10...

Post by Mike » Sat Feb 06, 2010 12:23 am

Hello,

I believe you are correct, sorry for the error. It will be corrected :)
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

atc
Posts: 23
Joined: Sun Jan 24, 2010 2:20 pm

Re: Error in tutorial #10...

Post by atc » Sat Feb 06, 2010 3:10 am

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!

Post Reply