OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Mar 24, 2019 7:02 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: hide cursor using vga registers
PostPosted: Sun Dec 16, 2007 8:32 pm 
Offline
Member
Member
User avatar

Joined: Mon Feb 26, 2007 3:39 pm
Posts: 101
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 16, 2007 9:51 pm 
Offline

Joined: Sat Dec 15, 2007 7:37 pm
Posts: 2
Location: Chicago, USA
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 :wink:, 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


Top
 Profile  
 
 Post subject: Re: hide cursor using vga registers
PostPosted: Sun Dec 16, 2007 10:25 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

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?


There's a few options...

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.


Top
 Profile  
 
 Post subject: Re: hide cursor using vga registers
PostPosted: Tue Mar 13, 2012 9:26 pm 
Offline
Member
Member
User avatar

Joined: Wed Jul 21, 2010 9:05 pm
Posts: 57
Sorry for the necro, but just to be sure, the method for clearing bit 5 of CRT 0xa would be

Code:
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);
}

and then you could pass 0 to SetCursorStartRegister (which would clear all the bits including 5) correct?


Top
 Profile  
 
 Post subject: Re: hide cursor using vga registers
PostPosted: Wed Mar 14, 2012 2:14 am 
Offline
Member
Member

Joined: Fri Nov 16, 2007 1:59 pm
Posts: 612
Code:
   SetMiscOutputRegister(m);


MDM wrote:
and then you could pass 0 to SetCursorStartRegister (which would clear all the bits including 5) correct?
What are you want to do? If you want to make cursor visible you should reset start line/end line registers. For example:
Code:
  outw(0x3D4,0xE0A);
  outw(0x3D4,0xF0B);

_________________
If you have seen bad English in my words, tell me what's wrong, please.


Top
 Profile  
 
 Post subject: Re: hide cursor using vga registers
PostPosted: Wed Mar 14, 2012 8:06 am 
Offline
Member
Member
User avatar

Joined: Wed Jul 21, 2010 9:05 pm
Posts: 57
Im trying to make the cursor invisible.


Top
 Profile  
 
 Post subject: Re: hide cursor using vga registers
PostPosted: Wed Mar 14, 2012 10:08 am 
Offline
Member
Member

Joined: Fri Nov 16, 2007 1:59 pm
Posts: 612
Code:
  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.


Top
 Profile  
 
 Post subject: Re: hide cursor using vga registers
PostPosted: Wed Mar 14, 2012 1:57 pm 
Offline
Member
Member
User avatar

Joined: Wed Jul 21, 2010 9:05 pm
Posts: 57
That did it, thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: doubletriplefault, nck and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group