Color Codes

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
overburn
Member
Member
Posts: 50
Joined: Sun Feb 22, 2009 9:15 am

Color Codes

Post 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?
Last edited by overburn on Wed Aug 19, 2009 12:55 pm, edited 2 times in total.
One Tequila, Two Tequila, Three Tequila, Floor!
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Color Codes

Post 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
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Color Codes

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Color Codes

Post 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
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Color Codes

Post 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?
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: Color Codes

Post 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.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
User avatar
kmtdk
Member
Member
Posts: 263
Joined: Sat May 17, 2008 4:05 am
Location: Cyperspace, Denmark
Contact:

Re: Color Codes

Post 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
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Color Codes

Post by Creature »

Thanks for the information, the link is useful and when I started looking up the ports, I found it.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Post Reply