Prev: CFD2 Up: Map Next: D013
CFFE: 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 CFFE LD L,(IX+$00) Fetch the sprite number.
D001 LD H,$00 Set H to 00.
D003 ADD HL,HL Double HL.
D004 LD BC,$7827 Point BC at SpritePointers.
D007 ADD HL,BC Add BC to HL.
D008 LD E,(HL) Fetch the address of the sprite.
D009 INC HL
D00A LD D,(HL)
Flip it if there is a sprite.
D00B LD A,(DE) Fetch the width and test it.
D00C AND A
D00D JP NZ,FlipSprite Jump to FlipSprite if it is not zero.
D010 INC SP Drop the return address.
D011 INC SP
D012 RET Return.
View the equivalent code in;
Prev: CFD2 Up: Map Next: D013