Page 1 of 1
Hiding text mode cursor
Posted: Mon Sep 08, 2014 1:30 pm
by Svpam
Hi.
I'm trying to hide the cursor like this:
Code: Select all
void outb( unsigned short port, unsigned char val )
{
asm volatile("outb %0, %1" : : "a"(val), "Nd"(port) );
}
outb(3B5, 0x20)
I read that the port address was 3B5 or 3D5 and that the 6th bit controls the cursor being on or off, so I'm passing 0x20 which is 0010 0000.
Can someone tell me what I'm doing wrong? If I use 3B5 there's no change, if I use 3D5 the cursor appears further on the horizontal.
Re: Hiding text mode cursor
Posted: Mon Sep 08, 2014 2:13 pm
by Gigasoft
Unfortunately, this ancient knowledge seems to have been lost. VGA programming information used to be passed on from father to son through songs, poems and stories, but after many generations had passed, much of it had become corrupted. Now, it is rumored that somewhere out there, perhaps buried deep in the desert, lies a jar containing elderly scrolls written down by an ancient scribe, having fled hordes of heavily armed engineers from IBM after getting caught listening in through the air vent on a top secret meeting discussing IBM's most carefully guarded confidential trade secret: Their patented, revolutionary way to hide the text mode cursor, whose mysterious and enchanting power could easily lead the world into total darkness, should it fall into the wrong hands. No one has ever dared to embark on a journey to retrieve it, thinking that this dangerous power would best be left alone, buried where there would be no risk of a mortal using it to hide the cursor so well that it would be lost forever, wandering hopelessly about in a plane at the edge of existence itself, trapped where no one would be able to hear its wails...
Re: Hiding text mode cursor
Posted: Mon Sep 08, 2014 2:44 pm
by max
Gigasoft wrote:Unfortunately, this ancient knowledge seems to have been lost...
Haha dude
Well, you should first tell the VGA controller which register to write to
Code: Select all
outb(0x3D4, register);
outb(0x3D5, value);
Also, you shouldn't assume that the base port is 0x3D4 but read it from the
BIOS data area.
Heres the documentation of the function you want:
Cursor Start Register (Index 0Ah)
Re: Hiding text mode cursor
Posted: Mon Sep 08, 2014 9:20 pm
by Svpam
Gigasoft wrote:Unfortunately, this ancient knowledge seems to have been lost. VGA programming information used to be passed on from father to son through songs, poems and stories, but after many generations had passed, much of it had become corrupted. Now, it is rumored that somewhere out there, perhaps buried deep in the desert, lies a jar containing elderly scrolls written down by an ancient scribe, having fled hordes of heavily armed engineers from IBM after getting caught listening in through the air vent on a top secret meeting discussing IBM's most carefully guarded confidential trade secret: Their patented, revolutionary way to hide the text mode cursor, whose mysterious and enchanting power could easily lead the world into total darkness, should it fall into the wrong hands. No one has ever dared to embark on a journey to retrieve it, thinking that this dangerous power would best be left alone, buried where there would be no risk of a mortal using it to hide the cursor so well that it would be lost forever, wandering hopelessly about in a plane at the edge of existence itself, trapped where no one would be able to hear its wails...
We can rebuild it.
max wrote:Gigasoft wrote:Unfortunately, this ancient knowledge seems to have been lost...
Haha dude
Well, you should first tell the VGA controller which register to write to
Code: Select all
outb(0x3D4, register);
outb(0x3D5, value);
Also, you shouldn't assume that the base port is 0x3D4 but read it from the
BIOS data area.
Heres the documentation of the function you want:
Cursor Start Register (Index 0Ah)
Thanks. I got it working like this.
Code: Select all
outb(0x3D4, 0x0A);
outb(0x3D5, 0x20);
Didn't know I needed to do that first command.
Re: Hiding text mode cursor
Posted: Tue Sep 09, 2014 12:15 am
by max
Re: Hiding text mode cursor
Posted: Tue Sep 09, 2014 1:07 pm
by Brendan
Hi,
The code I use to disable the cursor in text mode is this:
Code: Select all
;Disable the cursor (which should NEVER be displayed, unless the system is waiting for the user type text in)
mov ah,0x01 ;ah = BIOS function number (Set Text Mode Cursor Shape)
mov cx,0x2D0E ;VGA cursor settings, bits 5 and 6 of CH disables cursor
int 0x10 ;Call BIOS function (Set Text Mode Cursor Shape)
Of course I only use text mode during early boot (before I switch to graphics mode), and during early boot the system never waits for the user type text in, so there's no reason to care about enabling the cursor in text mode and no reason to stab at random VGA IO ports.
Cheers,
Brendan