Prev: 53202 Up: Map Next: 53267
53246: Get Sprite Address
Used by the routines at CalculateSpriteSize and PrintSprite.
Fetches the sprite for the sprite number of an object from SpritePointers. 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 sprite 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 53246 LD L,(IX+0) Fetch the sprite number.
53249 LD H,0 Set H to 0.
53251 ADD HL,HL Double HL.
53252 LD BC,30759 Point BC at SpritePointers.
53255 ADD HL,BC Add BC to HL.
53256 LD E,(HL) Fetch the address of the sprite.
53257 INC HL
53258 LD D,(HL)
Flip it if there is a sprite.
53259 LD A,(DE) Fetch the width and test it.
53260 AND A
53261 JP NZ,FlipSprite Jump to FlipSprite if it is not zero.
53264 INC SP Drop the return address.
53265 INC SP
53266 RET Return.
View the equivalent code in;
Prev: 53202 Up: Map Next: 53267