Page 1 of 1

Get Cursor Position formula

Posted: Sat Mar 27, 2004 8:43 am
by ManOfSteel
hello,
I'm trying to program my own routine to get the cursor position.
Some days ago, I saw here a piece of code that does the same thing but in my OS I use two different registers for columns and rows.
What I need is the formula to do this (for example to move the cursor: newposition=column+row*80).
Thanks.

Re:Get Cursor Position formula

Posted: Sat Mar 27, 2004 10:14 am
by Tim
Your OS is the only thing controlling the cursor, so it's OK to keep track of the cursor position in a couple of variables.

Re:Get Cursor Position formula

Posted: Sat Mar 27, 2004 11:53 am
by Neo
if you want to update the position of the cursor to (x,y) what you should do is this.

1) new_offset= (y*80) + x ;
2) update the position of the cursor with the new_offset.

HTH