![]() |
Routines |
| Prev: 64E0 | Up: Map | Next: 666E |
|
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 | 6653 | LD E,(IX+$00) | Fetch the type of the entity. | |||||||||
| 6656 | LD D,$00 | Clear D. | ||||||||||
| 6658 | LD HL,$669E | Point HL at SpriteTable. | ||||||||||
| 665B | ADD HL,DE | Add the type twice, as the table has two bytes per entry. | ||||||||||
| 665C | ADD HL,DE | |||||||||||
| 665D | LD E,(HL) | Fetch the low byte of the address of the frame table of the type. | ||||||||||
| 665E | INC HL | Move onto the high byte. | ||||||||||
| 665F | LD D,(HL) | Fetch the high byte of the address of the frame table. | ||||||||||
| 6660 | LD A,(IX+$01) | Fetch the frame number of the entity. | ||||||||||
| 6663 | AND %00011111 | Keep the frame number in the range 00-1F. | ||||||||||
| 6665 | ADD A,A | Double it, as the table has two bytes per frame. | ||||||||||
| 6666 | LD L,A | Set HL to the frame number multiplied by two. | ||||||||||
| 6667 | LD H,$00 | Clear the high byte. | ||||||||||
| 6669 | ADD HL,DE | Add the address of the frame table to find the address of the entry. | ||||||||||
| 666A | LD E,(HL) | Fetch the low byte of the address of the sprite. | ||||||||||
| 666B | INC HL | Move onto the high byte. | ||||||||||
| 666C | LD D,(HL) | Fetch the high byte of the address of the sprite. | ||||||||||
| 666D | RET | Return. | ||||||||||
| Prev: 64E0 | Up: Map | Next: 666E |