Hello.
This is indeed a silly idiosyncrasy of mine, but I can't stand the blinking of text-mode cursor.
I'd like to change it to get the same behaviour FreeBSD uses by default (that is, a white, non-flashing
block).
I got the block shape by changing some VGA registers, but I cannot figure out how to restrain
the cursor from blinking. A useful article on Osdever states that it's quite difficult to change
blinking rate from VGA, but I hope there is a way to disable it. As far as I know, FreeBSD boots in text
mode, but has the cursor behaviour I like. I tried to look up involved code in its kernel. It should be
somewhere around syscons.c, but I couldn't find anything useful.
Thanks for any help,
-- mghis
P.S.: please forgive me for my poor English. I am not a native speaker.
Disable VGA Text-mode Cursor Blinking
Re: Disable VGA Text-mode Cursor Blinking
Hi,
Note: I'd assume that FreeBSD doesn't draw a white solid block, but actually swaps the foreground and background colours (e.g. so you get black text on a white background where the cursor is). This would look like a solid block when the cursor is at the end of the line (or over white space), but if you move the cursor left until a (non-whitespace) character is under the cursor you'd be able to see that character.
Cheers,
Brendan
You can't make the cursor solid using VGA registers. Instead, disable the hardware's cursor completely and draw your own "white block" character. Ironically, the BIOS function for disabling the hardware's cursor is the same function for changing how often it flashes.mghis wrote:This is indeed a silly idiosyncrasy of mine, but I can't stand the blinking of text-mode cursor.
I'd like to change it to get the same behaviour FreeBSD uses by default (that is, a white, non-flashing
block).
Note: I'd assume that FreeBSD doesn't draw a white solid block, but actually swaps the foreground and background colours (e.g. so you get black text on a white background where the cursor is). This would look like a solid block when the cursor is at the end of the line (or over white space), but if you move the cursor left until a (non-whitespace) character is under the cursor you'd be able to see that character.
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.
Re: Disable VGA Text-mode Cursor Blinking
Thank you very much for your helpful response, Brendan. Disabling the cursor and writing a white block or a space with swapped colours is indeed an useful approach. Probably FreeBSD does this way.Brendan wrote:Hi,
You can't make the cursor solid using VGA registers. Instead, disable the hardware's cursor completely and draw your own "white block" character. Ironically, the BIOS function for disabling the hardware's cursor is the same function for changing how often it flashes.
Note: I'd assume that FreeBSD doesn't draw a white solid block, but actually swaps the foreground and background colours (e.g. so you get black text on a white background where the cursor is). This would look like a solid block when the cursor is at the end of the line (or over white space), but if you move the cursor left until a (non-whitespace) character is under the cursor you'd be able to see that character.
Cheers,
Brendan
However, I'd like to point out that, as I said in the post before, you can get block-shaped hardware cursor by setting some VGA registers. (I just couldn't figure out how to disable the blink). The following code works for me: (I'm using pmode set by GRUB, and Bochs emulator)
Code: Select all
/* Set a block-shaped cursor */
mov $0x0a, %al
mov $0x3d4,%dx
outb %al, %dx
xor %ax, %ax
inc %dx
outb %al, %dx
http://www.stanford.edu/class/cs140/pro ... extcur.htm
http://www.stanford.edu/class/cs140/pro ... reg.htm#0E
I'm changing index 0x0A, that corresponds to the "Cursor Start Register". As you can see in the second link, it defines the top-most scanline of the cursor. Fifth bit of that register allows to disable the cursor.
But I will indeed use the way explained in your post, if it's not possible to disable the blink of the hardware cursor.
Thank you again!
--mghis
- 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: Disable VGA Text-mode Cursor Blinking
You can only hide the hardware cursor. Blinking is fixed according to the documentation:mghis wrote:if it's not possible to disable the blink of the hardware cursor.
FreeVGA wrote:On the standard VGA, the blink rate is dependent on the vertical frame rate. The on/off state of the cursor changes every 16 vertical frames, which amounts to 1.875 blinks per second at 60 vertical frames per second. The cursor blink rate is thus fixed and cannot be software controlled on the standard VGA.
Re: Disable VGA Text-mode Cursor Blinking
Well, then I'll disable it and I'll follow Brendan's advice.
Thank you both!
Thank you both!