Prev: 40582 Up: Map Next: 40598
40585: Fetch Sprite
Looks up the address of the graphic for a sprite in the table at SpritesTable. The table has a two byte entry for each sprite ID, starting at ID 1.
Input
A The sprite ID
Output
DE The sprite address
FetchSprite 40585 DEC A Decrease the sprite ID by one, as the table starts at ID 1.
40586 LD L,A Fetch the sprite ID.
40587 LD H,0
40589 ADD HL,HL Multiply by 2 as each entry in the table is a two byte address.
40590 LD BC,42174 HL=SpritesTable + the offset of the entry.
40593 ADD HL,BC
40594 LD E,(HL) Fetch the sprite address.
40595 INC HL
40596 LD D,(HL)
40597 RET Return.
View the equivalent code in;
Prev: 40582 Up: Map Next: 40598