hide cursor using vga registers
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
hide cursor using vga registers
I had been looking for a register to hide the cursor but i didn't find anything. How can i hide my cursor without using bios?
MatÃas Beretta
Are you trying to hide a text-mode cursor? If not... disregard, nothing to see here...
I couldn't get writing a value directly to 0x0040:0060 for the cursor scan lines to do anything. I'm sure someone more expert than myself has a better solution.. but if you can't use int 0x10 ah=0x01, I think that you could:
- save the current cursor position in your data section
- set the cursor position to FF, FF or something else 'off screen'
- restore the cursor position when you need to write in teletype mode
Of course once you start doing all of this, you may as well write your chars directly to video memory too , and just leave the cursor off screen.
Just a suggestion. If I'm not understanding your question correctly, just pretend I'm talking to myself. I'm comfortable with that.
I couldn't get writing a value directly to 0x0040:0060 for the cursor scan lines to do anything. I'm sure someone more expert than myself has a better solution.. but if you can't use int 0x10 ah=0x01, I think that you could:
- save the current cursor position in your data section
- set the cursor position to FF, FF or something else 'off screen'
- restore the cursor position when you need to write in teletype mode
Of course once you start doing all of this, you may as well write your chars directly to video memory too , and just leave the cursor off screen.
Just a suggestion. If I'm not understanding your question correctly, just pretend I'm talking to myself. I'm comfortable with that.
~R
Re: hide cursor using vga registers
Hi,
The first method is to clear bit 5 in CRT controller register 0x0A, which is a "cursor enable/disable" flag. The next method is to shift the cursor off the screen (e.g. set the cursor start address to 0xFFFFF) using CRT controller registers 0x0E and 0x0F. Both of these methods assume your video card is VGA compatible at the hardware level (and not just VGA compatible at the BIOS level).
The other option is to disable the hardware cursor completely (e.g. when you set the video mode using the BIOS, also use
the BIOS function to disable the cursor), and then emulate your own cursor in software rather than using the hardware cursor (e.g. do "attribute = old_attribute XOR 0xFF") . This should work, even if your video card is not VGA compatible at the hardware level (and it might make things easier later when your video driver sets up a graphics video mode and emulates text mode for your application, because the video driver won't need to emulate the hardware cursor).
Cheers,
Brendan
There's a few options...matias_beretta wrote:I had been looking for a register to hide the cursor but i didn't find anything. How can i hide my cursor without using bios?
The first method is to clear bit 5 in CRT controller register 0x0A, which is a "cursor enable/disable" flag. The next method is to shift the cursor off the screen (e.g. set the cursor start address to 0xFFFFF) using CRT controller registers 0x0E and 0x0F. Both of these methods assume your video card is VGA compatible at the hardware level (and not just VGA compatible at the BIOS level).
The other option is to disable the hardware cursor completely (e.g. when you set the video mode using the BIOS, also use
the BIOS function to disable the cursor), and then emulate your own cursor in software rather than using the hardware cursor (e.g. do "attribute = old_attribute XOR 0xFF") . This should work, even if your video card is not VGA compatible at the hardware level (and it might make things easier later when your video driver sets up a graphics video mode and emulates text mode for your application, because the video driver won't need to emulate the hardware cursor).
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: hide cursor using vga registers
Sorry for the necro, but just to be sure, the method for clearing bit 5 of CRT 0xa would be
and then you could pass 0 to SetCursorStartRegister (which would clear all the bits including 5) correct?
Code: Select all
static inline byte GetMiscOutputRegister() {
return inb(0x3CC);
}
static inline void SetMiscOutputRegister(byte b)
{
outb(0x3C2, b);
}
// crt 0xA
static inline void SetCursorStartRegister(byte b)
{
byte m = GetMiscOutputRegister();
m = m | 1;
SetMiscOutputRegister(b);
outb(0x3d4, 0xa);
outb(0x3d5, b);
}
Re: hide cursor using vga registers
Code: Select all
SetMiscOutputRegister(m);
What are you want to do? If you want to make cursor visible you should reset start line/end line registers. For example:MDM wrote:and then you could pass 0 to SetCursorStartRegister (which would clear all the bits including 5) correct?
Code: Select all
outw(0x3D4,0xE0A);
outw(0x3D4,0xF0B);
If you have seen bad English in my words, tell me what's wrong, please.
Re: hide cursor using vga registers
Im trying to make the cursor invisible.
Re: hide cursor using vga registers
Code: Select all
outw(0x3D4,0x200A);
/* In many sources end line register is reset too. */
outw(0x3D4,0xB);
If you have seen bad English in my words, tell me what's wrong, please.
Re: hide cursor using vga registers
That did it, thank you!