Which version are you using? Anyway, look at line 18 and 19. You're using DX$ twice. It should be DX$ and DY$. That's why you're getting diagonal. You're not using DY$!