Prev: 52414 Up: Map Next: 52453
52418: Set Speeds From Heading
Turns a speed into HorizontalSpeed and VerticalSpeed from the heading of the object. Headings zero and two move vertically, one and three horizontally. Headings two and three have a negative speed.
Input
A The speed
IX The address of the object
Put the speed on the horizontal axis.
SetSpeedsFromHeading 52418 LD H,0 Make the speed the horizontal speed, with no vertical speed.
52420 LD L,A
52421 BIT 6,(IX+6) Jump to SetSpeedsFromHeading_Sign if the heading is horizontal.
52425 JR NZ,SetSpeedsFromHeading_Sign
Put the speed on the vertical axis.
52427 LD H,A Make the speed the vertical speed, with no horizontal speed.
52428 LD L,0
Make the speed negative for headings two and three.
SetSpeedsFromHeading_Sign 52430 BIT 7,(IX+6) Jump to SetSpeedsFromHeading_Store if the heading is not two or three.
52434 JR Z,SetSpeedsFromHeading_Store
52436 LD A,L Make the horizontal speed negative.
52437 NEG
52439 LD L,A
52440 LD A,H Make the vertical speed negative.
52441 NEG
52443 LD H,A
Store the speeds.
SetSpeedsFromHeading_Store 52444 LD A,L Set HorizontalSpeed.
52445 LD (41492),A
52448 LD A,H Set VerticalSpeed and return.
52449 LD (41493),A
52452 RET
View the equivalent code in;
Prev: 52414 Up: Map Next: 52453