Prev: 8F66 Up: Map Next: 8F96
8F80: Get Whole Pixels
Used by the routine at UpdateVelocity.
Converts a velocity, which has four bits after the point, to the number of whole pixels to move. This is the velocity divided by sixteen, rounded towards zero.
Input
A The velocity (signed)
Output
A The whole pixels
GetWholePixels 8F80 AND A Test the sign of the velocity.
8F81 JP P,GetWholePixels_Positive Jump to GetWholePixels_Positive if it is positive.
8F84 NEG Make the velocity positive.
8F86 RRCA Shift the velocity right four times, to drop the bits after the point.
8F87 RRCA
8F88 RRCA
8F89 RRCA
8F8A AND %00001111 Keep only bits 0-3.
8F8C NEG Make the result negative.
8F8E RET Return.
GetWholePixels_Positive 8F8F RRCA Shift the velocity right four times, to drop the bits after the point.
8F90 RRCA
8F91 RRCA
8F92 RRCA
8F93 AND %00001111 Keep only bits 0-3.
8F95 RET Return.
View the equivalent code in;
Prev: 8F66 Up: Map Next: 8F96