Get Cursor Position formula

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ManOfSteel

Get Cursor Position formula

Post 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.
Tim

Re:Get Cursor Position formula

Post 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.
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:Get Cursor Position formula

Post 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
Only Human
Post Reply