Blinking Text
Blinking Text
Hi,
I am again posting a problem I am having. Maybe you all maybe thinking how many questions would I post, but I think maybe their are some hurdles, so I am asking for a solution again from you. So the problem is that I am making a kernel booting from GRUB. Now the kernel is booting up properly, is displaying the text which it shall, with all the correct attributes, except that the text is blinking. Now I dont think the text should blink.
I searched everywhere for the solution but cant find any. Hope you can help.
P.S. Source code is attached.
I am again posting a problem I am having. Maybe you all maybe thinking how many questions would I post, but I think maybe their are some hurdles, so I am asking for a solution again from you. So the problem is that I am making a kernel booting from GRUB. Now the kernel is booting up properly, is displaying the text which it shall, with all the correct attributes, except that the text is blinking. Now I dont think the text should blink.
I searched everywhere for the solution but cant find any. Hope you can help.
P.S. Source code is attached.
- Attachments
-
- Monitor.c
- (3.75 KiB) Downloaded 229 times
Re: Blinking Text
IIRC, text tends to blink if you use invalid foreground colors on background colors (or the other way around). Some combinations just can't be done and will result in 'blinking'. I believe there is also a VGA register somewhere that controls blinking (but I don't know if it is related to your problem).
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Re: Blinking Text
I dont know whether I am using invalid colors. I am using a background of 9 (Light blue) with a text color of 15 (White).
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Blinking Text
The bit which would be used to control "lightness" of background colours is instead used to control whether they blink or not.
(I believe there may be a VGA register setting which controls this, however)
(I believe there may be a VGA register setting which controls this, however)
Re: Blinking Text
Bit 7 is the "Blinking bit" if the 7th bit == 1 then it will blink. (Remember the 7th bit is the one farthest to the left.)
[1]111 0001 == 0xF1 == Blue on white, since bit 7 = 1, then it will blink. There is a way to disable this.
I believe Baremetal OS does it like this.
[1]111 0001 == 0xF1 == Blue on white, since bit 7 = 1, then it will blink. There is a way to disable this.
I believe Baremetal OS does it like this.
Code: Select all
; Disable blink
mov dx, 0x3DA
in al, dx
mov dx, 0x3C0
mov al, 0x30
out dx, al
inc dx
in al, dx
and al, 0xF7
dec dx
out dx, al
My hero, is Mel.
Re: Blinking Text
Exactly! The code above tweaks the VGA registers to disable blinking.
BareMetal OS - http://www.returninfinity.com/
Mono-tasking 64-bit OS for x86-64 based computers, written entirely in Assembly
Mono-tasking 64-bit OS for x86-64 based computers, written entirely in Assembly
Re: Blinking Text
Heh, I'm suddenly feeling very old for thinking "what the ****? don't they know how to properly program a VGA card?", and even older for knowing that on CGA, it's a different bit :)
JAL
JAL
Re: Blinking Text
Hehe! Not just you, jal!
This has already been well answered but I must admit, I read the first few words and went "Oh, I know this one." LOL
Welcome to vagaries of the old video modes! ;¬)
This has already been well answered but I must admit, I read the first few words and went "Oh, I know this one." LOL
Welcome to vagaries of the old video modes! ;¬)
Re: Blinking Text
Indeed. Anyone remembers 160x100x16 colour semi-graphical textmode on CGA? Round 42 ftw!Gaidheal wrote:Welcome to vagaries of the old video modes! ;¬)
JAL
- StrangeBrew
- Posts: 7
- Joined: Tue Feb 01, 2011 6:37 pm
Re: Blinking Text
I apologize for bumping an old thread but how come the attribute index is at 0x30 and not 0x10 as FreeVGA, among other docs, states? This is a horrible bug to track down. I guess I'm asking where I can get a reliable updated specification from if I need to, or if this is just because of my Nvidia video card...Coty wrote:Bit 7 is the "Blinking bit" if the 7th bit == 1 then it will blink. (Remember the 7th bit is the one farthest to the left.)
[1]111 0001 == 0xF1 == Blue on white, since bit 7 = 1, then it will blink. There is a way to disable this.
I believe Baremetal OS does it like this.Code: Select all
; Disable blink mov dx, 0x3DA in al, dx mov dx, 0x3C0 mov al, 0x30 out dx, al inc dx in al, dx and al, 0xF7 dec dx out dx, al
Re: Blinking Text
Hm, the book I have refers to index 0x10 as the Mode Control Register, where bit 3 enables or disables blinking. The code doesnt look right although havnt tried it. Perhaps someone can explain the provided code?
*edit: Oh, woops, 0x30 selects attribute index 0x10 with PAS bit set in the Attribute Address Register.
*edit: Oh, woops, 0x30 selects attribute index 0x10 with PAS bit set in the Attribute Address Register.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: Blinking Text
Hi,
Cheers,
Brendan
The correct way it to use the int 10, ax = 0x1003" BIOS function instead; so that you don't need to rely on (potentially incorrect) assumptions about the video hardware (including the potentially incorrect assumption that the video card tried to be "VGA compatible" and actually succeeded).neon wrote:Hm, the book I have refers to index 0x10 as the Mode Control Register, where bit 3 enables or disables blinking. The code doesnt look right although havnt tried it. Perhaps someone can explain the provided code?
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.
- StrangeBrew
- Posts: 7
- Joined: Tue Feb 01, 2011 6:37 pm
Re: Blinking Text
I'm confused, so what's the meaning of 0x10 if one must use 0x30 to get to it?
http://www.osdever.net/FreeVGA/vga/attrreg.htm
makes no mention of 0x30.
Edit: also...
http://www.mcamafia.de/pdf/ibm_vgaxga_trm2.pdf
PDF page 98
Sorry if I seem pedantic but I need to know what I'm doing, and that I can trust the docs.
http://www.osdever.net/FreeVGA/vga/attrreg.htm
makes no mention of 0x30.
Edit: also...
http://www.mcamafia.de/pdf/ibm_vgaxga_trm2.pdf
PDF page 98
... and the index should be 0x10 and not 0x30, right?The following is the sequence for accessing the attribute data
registers:
1. Disable interrupts.
2. Reset the flip-flop for the Attribute Address register.
3. Write the index.
4. Access the data register.
5. Enable interrupts.
Sorry if I seem pedantic but I need to know what I'm doing, and that I can trust the docs.
Re: Blinking Text
Hello,
Using 0x10 (10000 binary) stores 0x10 as the index, with bit 5 cleared. 0x30 (110000 binary) does the same, but notice it just sets Bit 5 as well.
FreeVGA might have information on bit 5.. if it doesnt Ill post it here later.
There is none - its the same index register (0x10.) The address register that you write the index into follows the format:StrangeBrew wrote:I'm confused, so what's the meaning of 0x10 if one must use 0x30 to get to it?
Code: Select all
[PAS][ Index Register ]
Bit 5 Bits 0-4
FreeVGA might have information on bit 5.. if it doesnt Ill post it here later.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Blinking Text
Writing 0x10 works as expected, only you disable the hardware's palette access in the process which has the (unfortunate) side-effect of disabling the video output. You can write all registers as documented, and if you finish the sequence with writing 0x20 to port 0x3C0, the net effect is the same. It is also exactly how my VGA driver code operates.This bit [bit 5] is set to 0 to load color values to the registers in the internal palette. It is set to 1 for normal operation of the attribute controller