I don't know much about Basic, but it's usally better to right shift than divide, especially when you divide by a power of 2. Shifting is not as demanding a task as division. 1024 is the same as 2^10 so instead of division by 1024 you should right shift 10 times.
You should also do all multiplications before division, to minimize rounding errors.
In C it would look something like this: