I couldn't find any obvious way around it. The problem is, a negative less than 32 will give 0 when divided by 32 and so does a positive division. one way to do it's, lets say, it is moving in the positive direction, and the previous position was less than 0 and the new position is greater than 0 than add 32 to the direction being affected. the same principal applies when going the oposite direction. anyway that is the only solution I can think of.
[edited]
not quite what I thought but close. see below.
[edited]
not quite what I thought but close. see below.