Prev: 67AE Up: Map Next: 68ED
68DD: Calculate Midges Movement
Used by the routine at UpdateMidges.
Prepares for the movement of the midges along one axis: a 16-bit value which has the position in H and the fraction of a pixel in L, and a distance to move which is 20 times the speed (so the distance is up to 01E0 which is just under two pixels).
Input
B The fraction of a pixel (in the high nibble)
C The speed
H The position
Output
DE The distance to move
HL The position and the fraction
CalculateMidgesMovement 68DD LD L,B L=the fraction.
68DE LD A,C Multiply the speed by sixteen.
68DF RLA
68E0 RLA
68E1 RLA
68E2 RLA
68E3 AND $F0
68E5 LD E,A E=the speed multiplied by sixteen.
68E6 LD D,$00 Clear the high byte of the distance in D.
68E8 SLA E Double DE.
68EA RL D
68EC RET Return.
Prev: 67AE Up: Map Next: 68ED