[Prev][Next][Index][Thread]
Re: moving the hardware cursor
Arturo Busleiman <buanzox@usa.net> writes:
> void
> actualizar_cursor ()
> {
> short pos=console.y*80+console.x;
> outb(0x0F,0x03d4);
> outb((char)pos,0x03d5);
> outb(0x0E,0x03d4);
> outb((char)(pos>>8),0x03d5);
> }
Someone else has already pointed out the problem but it's perhaps
worth mentioning that the code you want is in the oskit already:
kern/x86/pc/direct_cons_putchar.c:
> static void
> set_cursor(unsigned int pos)
> {
> /* set cursor position high byte */
> outb_p(video_port_reg, 0xe);
> outb_p(video_port_val, (unsigned char)((pos >> 8)) & 0xff);
>
> /* set cursor position low byte */
> outb_p(video_port_reg, 0xf);
> outb_p(video_port_val, (unsigned char)(pos & 0xff));
> }
Just remove the static declaration and you're all set.
Or, even easier, use the new adm5 support in the direct console library.
(In the Thanksgiving oskit snapshot.)
Metanote: there's lots of useful pieces of code in the oskit. If you
want something like what's already there, it's worth hunting through
the documentation to see if we already have something that will do the
job for you. If that fails, but you find a near match, go look at the
source code to see if you can easily adapt what is there, steal some
ideas or, at least, get a list of things you'll have to watch out for.
If you end up having to modify/copy the source code to get what you
want, it's probably worth telling us what you had to change and why.
Some parts of the OSKit are very flexible (ie shouldn't need changed)
but some are fairly inflexible because none of us can imagine ever
needing to do things differently from the way they're being done at
the moment (we're only human).
--
Alastair Reid reid@cs.utah.edu http://www2.cs.utah.edu/~reid/
Follow-Ups:
References: