![]() |
Routines |
| Prev: 25824 | Up: Map | Next: 26222 |
|
Used by the routines at SetEntitySize and DrawSprite.
Finds the address of the sprite which shows an entity. The type of the entity selects a table of frames and the frame number of the entity selects one of the sprites in that table.
|
||||||||||||
| FindSpriteFrame | 26195 | LD E,(IX+0) | Fetch the type of the entity. | |||||||||
| 26198 | LD D,0 | Clear D. | ||||||||||
| 26200 | LD HL,26270 | Point HL at SpriteTable. | ||||||||||
| 26203 | ADD HL,DE | Add the type twice, as the table has two bytes per entry. | ||||||||||
| 26204 | ADD HL,DE | |||||||||||
| 26205 | LD E,(HL) | Fetch the low byte of the address of the frame table of the type. | ||||||||||
| 26206 | INC HL | Move onto the high byte. | ||||||||||
| 26207 | LD D,(HL) | Fetch the high byte of the address of the frame table. | ||||||||||
| 26208 | LD A,(IX+1) | Fetch the frame number of the entity. | ||||||||||
| 26211 | AND %00011111 | Keep the frame number in the range 0-31. | ||||||||||
| 26213 | ADD A,A | Double it, as the table has two bytes per frame. | ||||||||||
| 26214 | LD L,A | Set HL to the frame number multiplied by two. | ||||||||||
| 26215 | LD H,0 | Clear the high byte. | ||||||||||
| 26217 | ADD HL,DE | Add the address of the frame table to find the address of the entry. | ||||||||||
| 26218 | LD E,(HL) | Fetch the low byte of the address of the sprite. | ||||||||||
| 26219 | INC HL | Move onto the high byte. | ||||||||||
| 26220 | LD D,(HL) | Fetch the high byte of the address of the sprite. | ||||||||||
| 26221 | RET | Return. | ||||||||||
| Prev: 25824 | Up: Map | Next: 26222 |