Prev: 54985 Up: Map Next: 55044
55023: Get Sprite Address
Used by the routines at CalculateSpriteSize and PrintSprite.
Finds the sprite for the graphic number of an object. The data of the sprite is flipped, in place, if it is not the same way round as the flags of the object say. If there is no sprite for the graphic number, this returns to the routine that called the routine that called it.
Input
IX The address of the object
Output
DE The address of the sprite
Find the address of the sprite.
GetSpriteAddress 55023 LD L,(IX+0) Fetch the sprite number.
55026 LD H,0 Set H to 0.
55028 ADD HL,HL Double HL.
55029 LD BC,28946 Point BC at SpriteTable.
55032 ADD HL,BC Add BC to HL.
55033 LD E,(HL) Fetch the address of the sprite.
55034 INC HL
55035 LD D,(HL)
Flip it if there is a sprite.
55036 LD A,(DE) Fetch the width of the sprite and test it.
55037 AND A
55038 JP NZ,FlipSprite Jump to FlipSprite if there is a sprite, to flip it if needed.
55041 INC SP Drop the return address.
55042 INC SP
55043 RET Return.
View the equivalent code in;
Prev: 54985 Up: Map Next: 55044