Quite frankly, the simplest way to write a program to find integers X and Y such that Offset = Y * 160 + X * 2 for a given "offset" is first to write X= (Offset- 160Y)/2 and then step through integer values for Y until you find one that gives X integer also. |