
January 2nd, 2009, 09:35 PM
|
 | Flow Master | | Join Date: Dec 2007 Location: Zeitgeist
Posts: 13,510
Country: Thanks: 2,979
Thanked 5,256 Times in 4,605 Posts
| |
Quote:
Originally Posted by icemanind Okay, this will be pretty elementary, I'm sure. But for some reason, I am having trouble. I am trying to write a program and I am using the following formula:
Offset = Y * 160 + X * 2
This formula works great for what I'm doing. My question is, what is the formula I use to retrieve X and Y, assuming I know Offset. For example, if Offset = 1500, what is the value of X and Y?
If it helps, what this is is X and Y coordinates for video memory. Video memory is broken down into 80x25 characters and each character takes 2 spaces.....So if I want to write to Y=10 and X=5, using my formula above, the offset to write to would be 1610.
So my question is, given 1610 as an Offset, what formula do I use to make Y=10 and X=5?
Hope this makes sense and thanks in advance
Alan | I'm afraid that the answer given by Mush appears to be how your question needs to be answered.
You could always write (or find) a computer program to implement this algorithm.
__________________ There are two things you should never try to prove: the impossible and the obvious. The greater danger for most of us lies not in setting our aim too high and falling short; but in setting our aim too low and achieving our mark. (Michelangelo Buonarroti) To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|