Prev: 9809 Up: Map Next: 9883
986A: Set Player Velocity
Used by the routine at EnterDoor.
Sets the velocities of the player (offsets 06 and 07) from bits 6-7 of the attribute of a door, using DoorVelocities. This is done by EnterDoor so that the player moves out of the door.
Input
IX The door entity
SetPlayerVelocity 986A LD A,(IX+$05) Fetch the attribute of the door.
986D RLCA Rotate A left three times.
986E RLCA
986F RLCA
9870 AND %00000110 Keep only bits 1-2, which were bits 6-7.
9872 LD C,A Keep the velocity index in C.
9873 LD B,$00 B=00.
9875 LD HL,$9883 Point HL at the door velocities at DoorVelocities.
9878 ADD HL,BC Find the velocities for the door in the table.
9879 LD A,(HL) Fetch the X velocity.
987A INC HL Move HL on to the next byte.
987B LD ($EA96),A Update the X velocity of the player (offset 06).
987E LD A,(HL) Fetch the Y velocity.
987F LD ($EA97),A Update the Y velocity of the player (offset 07).
9882 RET Return.
Prev: 9809 Up: Map Next: 9883