View Single Post
  #1  
Old January 2nd, 2009, 09:56 PM
icemanind icemanind is offline
Newbie
 
Join Date: Jan 2009
Posts: 3
Country:
Thanks: 0
Thanked 0 Times in 0 Posts
icemanind is on a distinguished road
Default Simple pre-algebra help needed

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

Last edited by mr fantastic; January 2nd, 2009 at 10:30 PM. Reason: Deleted potentially offensive language
Reply With Quote