Qoppa wrote:(written by someone on this board... I forget who)
If you bothered to look at the link...
Just to note, there's also a DX there (which is not quite a byte...)
As for your code: there are signed conversions, and color can have bit 7 set which causes blinking as well - try a black background.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
If the most significant bit is set, it can be interpreted as both blinking text and brighter background depending on a setting in the VGA I/O memory area. If the blinking is fast (Bochs by default has a rather high blink rate) then it looks like what you described. It's also best to use specifically unsigned quantities, especially with char. Char is not required to be either signed or unsigned, so you should always specify it if you depend on its (lack of) signedness. And as Combuster said, if a signed value is casted to a larger value, it is sign-extended, which will result in extending the value with 1-bits if the original value had its most significant bit set. I.e. 8 bits 1000 0001 (-127 signed, 129 unsigned) is sign-extended to 16 bits 1111 1111 1000 0001 (-127 signed, 65409 unsigned).
Also, what type does color have? If it's a char, then shifting it left by 8 places will shift all the bits off the end, and you get zero. You need to cast it to a short first before shifting so that there is additional room for the shift.
I assume that you didn't get around to handling cursor position, newlines and scrolling yet.