Page 2 of 2

Posted: Sun Sep 02, 2007 6:07 am
by urxae
Buck1000 wrote:Does it have to be an unsigned char?
No, an unsigned short is also pretty common. That way, you can write both the character and the attribute byte in a single write, and incrementing the pointer points it to the next character on the screen.
(You could also use a regular char instead of an unsigned one if that's what you meant, but if that's a signed type on your compiler it might be tricky to use attributes with the high bit set)

Posted: Sun Sep 02, 2007 8:18 pm
by neon
Buck1000 wrote:Does it have to be an unsigned char?
No.

It is guaranteed an unsigned char is a byte in size, though. Hence, an unsigned char* can easily be used to point to any byte in memory.

Other data type sizes are complier dependent. If you wanted, you can use a WORD size type, and just write one WORD for each character.

unsigned short is a pretty common WORD size.