Prev: 38467 Up: Map Next: 38482
38470: 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 0.
Input
A Sprite id
Output
DE Address of the sprite data
FetchSprite 38470 LD L,A Use the sprite id as the low byte of the offset.
38471 LD H,0 Clear the high byte of the offset.
38473 ADD HL,HL Double the sprite id to get the offset into the table.
38474 LD BC,37682 Point at the sprite address table (Sprite_Address_Table).
38477 ADD HL,BC Add the offset to the address of the table.
38478 LD E,(HL) Fetch the low byte of the address of the sprite data.
38479 INC HL Move on to the high byte.
38480 LD D,(HL) Fetch the high byte of the address of the sprite data.
38481 RET Return.
View the equivalent code in;
Prev: 38467 Up: Map Next: 38482