From your description, it looks like you are doing column first addressing. In this case, you can find x by calculating (address%w). Once you have x, you can get y by calculating (address-x)/w.
No One in Particular
2009-09-06 01:48:42