Page 1 of 1

How to hide the cursor

Posted: Sun Feb 24, 2008 4:36 am
by AlfaOmega08
How can I hide the cursor in text mode like grub does?

Posted: Sun Feb 24, 2008 6:56 am
by Osbios
Just move the VGA text courser outside the view:

Code: Select all

mov  cx, 0x2000
mov  ah, 1
int  0x10
This is a BIOS int, so you have to do it at boot if you use the Protected mode!

Posted: Sun Feb 24, 2008 7:10 am
by AlfaOmega08
I don't want to hide cursor since the boot.

When I need to hide it, I'll hide.

Also in PMode I can put the cursor out the screen using the bran's tutorial method to update the cursor?

Posted: Sun Feb 24, 2008 7:20 am
by Osbios
I don't know how to change the cursor directly on the VGA card. I just hide the VGA cursor and use a blinking char to make my own cursor. I think that's more easy and faster.

Posted: Sun Feb 24, 2008 9:10 am
by jal
Osbios wrote:I don't know how to change the cursor directly on the VGA card. I just hide the VGA cursor and use a blinking char to make my own cursor. I think that's more easy and faster.
Ignorance is no excuse. Of course it is not easier nor faster to not use the hardware cursor.


JAL

Posted: Sun Feb 24, 2008 9:12 am
by jal
AlfaOmega08 wrote:I don't want to hide cursor since the boot.
When I need to hide it, I'll hide.
You may want to check the VGA register specifications. Readily available on the internet everywhere (Google is your friend), and on the Wiki no doubt.


JAL

Posted: Sun Feb 24, 2008 9:59 am
by Dex
Try

Code: Select all

;-------------------------------------------------------;
;                  Pmode  cursor demo                   ;
;             Coded by Dex(Craig Bamford)               ;
;-------------------------------------------------------;
        mov   bx,0x1c1b                     ; set cursor invisable
        call  ChangeCursor

; **PUT MORE CODE HERE ***

        mov   bx,0x0b0c                     ;Set cursor visable
        call  ChangeCursor

; **PUT MORE CODE HERE ***

;====================================================;
; GetCursor.                out: bx = cursor attribs ;
;====================================================;
GetCursor:
          push  ax
          push  dx
          mov   dx,0x3D4
          mov   al,0x0E
          out   dx,al
          inc   dx
          in    al,dx
          mov   bh,al
          mov   al,0x0F
          dec   dx
          out   dx,al
          inc   dx
          in    al,dx
          mov   bl,al
          pop   dx
          pop   ax
          ret

;====================================================;
; ChangeCursor.              in: bx = cursor attribs ;
;====================================================;
ChangeCursor:
          pushad
          mov   dx,0x3D4
          mov   al,0x0A
          mov   ah,bh
          out   dx,ax
          inc   ax
          mov   ah,bl
          out   dx,ax
          popad
          ret

;====================================================;
; CursorSetXY        in: al = cursorX   ah = cursorY ;
;====================================================;
CursorSetXY:
        mov   byte[PosX],al
        mov   byte[PosY],ah
        call  GoToXY
        ret

;====================================================;
; GoToXY.                           See  CursorSetXY ;
;====================================================;
GoToXY:
        pushad
        mov   dl,byte[PosX]
        mov   dh,byte[PosY]
        mov   al,80
        mul   dh
        xor   dh,dh
        add   ax,dx
        mov   cx,ax
        mov   dx,0x03d4
        mov   al,0x0e
        out   dx,al
        inc   dx
        mov   al,ch
        out   dx,al
        mov   dx,0x3d4
        mov   al,0x0f
        out   dx,al
        inc   dx
        mov   al,cl
        out   dx,al
        popad
        ret



Cursor dw 0
PosX   db 0
PosY   db 0


Posted: Sun Feb 24, 2008 10:09 am
by Osbios
jal wrote:
Osbios wrote:I don't know how to change the cursor directly on the VGA card. I just hide the VGA cursor and use a blinking char to make my own cursor. I think that's more easy and faster.
Ignorance is no excuse. Of course it is not easier nor faster to not use the hardware cursor.


JAL
What dos this have to do with ignorance??? o_O

I just told him how I do it and that I think is more easy. What is the reason we are using a forum? To share our ideas and not just to tell every one to look at the spec!

Posted: Mon Feb 25, 2008 2:45 am
by jal
Osbios wrote:What dos this have to do with ignorance??? o_O
I just told him how I do it and that I think is more easy.
He asks a question about a subject that you don't know about. Then you give him lousy advise based on that.
What is the reason we are using a forum? To share our ideas and not just to tell every one to look at the spec!
Sharing bad ideas is bad. One should only reply to a topic if one has a clue (e.g. Dex).


JAL

Posted: Mon Feb 25, 2008 1:24 pm
by Osbios
jal wrote:
Osbios wrote:What dos this have to do with ignorance??? o_O
I just told him how I do it and that I think is more easy.
He asks a question about a subject that you don't know about. Then you give him lousy advise based on that.
You just told him to look at some specifications and google. Seems like you know less about the subject then me. :P
jal wrote:
What is the reason we are using a forum? To share our ideas and not just to tell every one to look at the spec!
Sharing bad ideas is bad. One should only reply to a topic if one has a clue (e.g. Dex).
Or e.g. jal??? Come one...
And the quality of my ideas can AlfaOmega08 judge by him self!

Posted: Mon Feb 25, 2008 3:02 pm
by Combuster
Osbios wrote:I don't know how to change the cursor directly on the VGA card. I just hide the VGA cursor and use a blinking char to make my own cursor. I think that's more easy and faster.
The problem with this is that you didn't bother to answer the OP's question, instead you come with an ugly hack that has only remotely to do with the problem, and even less interesting.
jal wrote:Ignorance is no excuse. Of course it is not easier nor faster to not use the hardware cursor.
The problem here is just as serious and uninformed. Apart from the many negatives, using the blink bit _is_ faster because you are accessing video memory rather than I/O ports. Ease is in this case too subjective to judge.

For both of you, If you can't make a decent attempt to help, its better to not post at all.

@AlfaOmega: http://www.osdever.net/FreeVGA/vga/textcur.htm

Posted: Mon Feb 25, 2008 4:28 pm
by Osbios
A bit conservatively?
Combuster wrote:The problem with this is that you didn't bother to answer the OP's question, instead you come with an ugly hack that has only remotely to do with the problem, and even less interesting.

...

For both of you, If you can't make a decent attempt to help, its better to not post at all.
Well, ... the problem was to move a the courser around and hide it, wasn't it?
That's exactly what I solved by hiding the hardware courser and only use the blink-bit and a char.

I don't care if YOU dislike this way so much. I wont ask you every time before I post if you like my Ideas or not.

And hell, my OS is using the UGLY blink-but char courser. ]:D

Posted: Wed Feb 27, 2008 2:00 am
by jal
Combuster wrote:sing the blink bit _is_ faster because you are accessing video memory rather than I/O ports.
You are right. Point taken.


JAL

Posted: Wed Feb 27, 2008 2:02 am
by jal
Osbios wrote:Well, ... the problem was to move a the courser around and hide it, wasn't it? That's exactly what I solved by hiding the hardware courser and only use the blink-bit and a char.
That won't help you with in-line editing, if you want a blinking cursor underneath an already typed character.


JAL