How to hide the cursor
- AlfaOmega08
- Member
- Posts: 226
- Joined: Wed Nov 07, 2007 12:15 pm
- Location: Italy
How to hide the cursor
How can I hide the cursor in text mode like grub does?
Just move the VGA text courser outside the view:
This is a BIOS int, so you have to do it at boot if you use the Protected mode!
Code: Select all
mov cx, 0x2000
mov ah, 1
int 0x10
- AlfaOmega08
- Member
- Posts: 226
- Joined: Wed Nov 07, 2007 12:15 pm
- Location: Italy
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
Last edited by Dex on Mon Feb 25, 2008 9:36 am, edited 1 time in total.
What dos this have to do with ignorance??? o_Ojal wrote:Ignorance is no excuse. Of course it is not easier nor faster to not use the hardware cursor.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.
JAL
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!
He asks a question about a subject that you don't know about. Then you give him lousy advise based on that.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.
Sharing bad ideas is bad. One should only reply to a topic if one has a clue (e.g. Dex).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!
JAL
You just told him to look at some specifications and google. Seems like you know less about the subject then me.jal wrote:He asks a question about a subject that you don't know about. Then you give him lousy advise based on that.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.
Or e.g. jal??? Come one...jal wrote:Sharing bad ideas is bad. One should only reply to a topic if one has a clue (e.g. Dex).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!
And the quality of my ideas can AlfaOmega08 judge by him self!
- 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:
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.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 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.jal wrote:Ignorance is no excuse. Of course it is not easier nor faster to not use the hardware cursor.
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
A bit conservatively?
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
Well, ... the problem was to move a the courser around and hide it, wasn't it?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.
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
That won't help you with in-line editing, if you want a blinking cursor underneath an already typed character.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.
JAL