Prev: 9643 Up: Map Next: 9652
9646: Fetch Sprite
Used by the routine at FetchActorSprite.
Looks up the address of the graphic for a sprite in the table at Sprite_Address_Table. The table has a two byte entry for each sprite id, starting at id 00.
Input
A Sprite id
Output
DE Address of the sprite data
FetchSprite 9646 LD L,A Use the sprite id as the low byte of the offset.
9647 LD H,$00 Clear the high byte of the offset.
9649 ADD HL,HL Double the sprite id to get the offset into the table.
964A LD BC,$9332 Point at the sprite address table (Sprite_Address_Table).
964D ADD HL,BC Add the offset to the address of the table.
964E LD E,(HL) Fetch the low byte of the address of the sprite data.
964F INC HL Move on to the high byte.
9650 LD D,(HL) Fetch the high byte of the address of the sprite data.
9651 RET Return.
View the equivalent code in;
Prev: 9643 Up: Map Next: 9652