Prev: 27731 Up: Map Next: 27873
27847: Get Leaf Sprite
Used by the routine at UpdateLeaf.
Finds the sprite for the frame of a leaf. There are four frames for a leaf on the right and four for a leaf on the left.
Input
IX Leaf object
Output
DE Sprite data
GetLeafSprite 27847 LD A,(IX+0) A=the state of the leaf.
27850 RRCA Rotate bit 6 round to bit 3.
27851 RRCA
27852 RRCA
27853 AND %00001000 Keep only bit 3.
27855 LD C,A C=8 if the leaf is on the left, or 0 if not.
27856 LD A,(IX+6) A=the frame of the leaf.
27859 SLA A Double the frame to make an offset into the table.
27861 OR C Add the offset for the side of the flower.
27862 LD HL,27873 HL=LeafSpriteTable.
This entry point is used by the routine at GetFlowerSprite.
GetSpriteFromTable 27865 LD C,A C=the offset.
27866 LD B,0 B=0.
27868 ADD HL,BC Add the offset to HL.
27869 LD E,(HL) E=the low byte of the sprite address.
27870 INC HL Move onto the high byte.
27871 LD D,(HL) D=the high byte of the sprite address.
27872 RET Return.
Prev: 27731 Up: Map Next: 27873