Page 1 of 1

Color Codes

Posted: Wed Aug 19, 2009 12:45 pm
by overburn
so to not start another thread i have a small misunderstanding with the virtual machine.
when i set the background color to F , in bochs the screen blinks like hell, but in virtual pc it's white. on my pc it's white too. what's the catch?

Re: Color Codes

Posted: Wed Aug 19, 2009 12:55 pm
by AJ
Hi,

I have split the topic as this post was on a completely different subject to your original thread.

To answer the question: If you look at the VGA registers, they can be set up so that the high bit of the background colour represents a 'blink' attribute. This means that you get a dark blinking colour rather than a bright stable one. I assume the VGA registers are initialised differently in Bochs to in hardware - I don't know if the 'Correct' initial setting for this is even defined in any standard (any idea Combuster?)

Cheers,
Adam

Re: Color Codes

Posted: Wed Aug 19, 2009 1:20 pm
by Brendan
Hi,

I just wanted to mention that you can use "BIOS Int 0x10, AX = 0x1003" to either enable blinking (and disable 16 background colours) or disable blinking (and enable 16 background colours).

Every time I set a 16-colour text mode (mostly in every boot loader I write, as I don't assume anything if I can help it), I enable 16 background colours and disable the cursor. If I really want to flash I'll do it in software (and still have 16 background colours), and IMHO the cursor should never be visible until/unless you're waiting for the user to type something. :)


Cheers,

Brendan

Re: Color Codes

Posted: Thu Aug 20, 2009 3:27 am
by jal
AJ wrote:I assume the VGA registers are initialised differently in Bochs
Blinking is the default in all reall PC's I have seen back in the days when text mode was your default UI. I can imagine however that some emulators do not bother to emulate blinking, as textmode is hardly used anymore.


JAL

Re: Color Codes

Posted: Thu Aug 20, 2009 5:09 am
by Creature
Brendan wrote:Hi,

I just wanted to mention that you can use "BIOS Int 0x10, AX = 0x1003" to either enable blinking (and disable 16 background colours) or disable blinking (and enable 16 background colours).

Every time I set a 16-colour text mode (mostly in every boot loader I write, as I don't assume anything if I can help it), I enable 16 background colours and disable the cursor. If I really want to flash I'll do it in software (and still have 16 background colours), and IMHO the cursor should never be visible until/unless you're waiting for the user to type something. :)


Cheers,

Brendan
Is there also a protected mode way of doing it (i.e. without interrupts)? Or is it required to do it through BIOS interrupts?

Re: Color Codes

Posted: Thu Aug 20, 2009 5:19 am
by gravaera
@Creature: Exactly what I was just about to ask. I had no idea you could actually disable the cursor: I guess I should read the real datasheets for devices from now on, and not just the tutorials I find.

Re: Color Codes

Posted: Thu Aug 20, 2009 5:41 am
by kmtdk
well
just to help you:
of cause you can disable the cursor:
http://www.osdever.net/FreeVGA/vga/crtcreg.htm#0B is a GOOD start.
actualy it can be done in one register:
Cursor Start Register (Index 0Ah), and set bit 5 ( 7 and 6 are unused) to 0, that should do it, however you can also make the size 0 , or huge. .. all should "make it" dissapere :D


@creature
you can just ude the Attribute Mode Control Register (Index 10h) bit 3, change it to 0 makes it color intense( and 1 = blinking). so you can do it in pmode


edit:
forgot to mentinon the IO: 3C0h for the blinking and the cursor is at 3x5h and 3x4h
KMT dk

Re: Color Codes

Posted: Thu Aug 20, 2009 9:51 am
by Creature
Thanks for the information, the link is useful and when I started looking up the ports, I found it.