![]() |
Routines |
| Prev: BD62 | Up: Map | Next: BDAE |
|
Used by the routine at HandleCrosshair.
Draws each sprite in the sprite list of an object. A sprite list is made of three bytes for each sprite: the horizontal offset, the vertical offset and the number of the sprite. The offsets are added to the position of the object, and the vertical offset of the object in byte 0D. A sprite which would start outside the screen is not drawn. The last byte of the list is 80.
|
||||||||
| DrawSpriteList | BD69 | LD E,(IX+$0E) | Fetch the address of the sprite list into DE. | |||||
| BD6C | LD D,(IX+$0F) | |||||||
| DrawSpriteList_Next | BD6F | LD A,(DE) | Fetch the horizontal offset of the sprite. | |||||
| BD70 | INC DE | Move on to the next byte. | ||||||
| BD71 | CP $80 | Return if it is the terminator. | ||||||
| BD73 | RET Z | |||||||
| BD74 | LD HL,($A24E) | Fetch the horizontal position of the object. | ||||||
| BD77 | CALL AddSignedToHL | Add the offset to it. | ||||||
| BD7A | LD A,H | Fetch the high byte. | ||||||
| BD7B | AND A | Skip the sprite if its horizontal position is off the screen. | ||||||
| BD7C | JR NZ,DrawSpriteList_Skip | |||||||
| BD7E | LD A,L | Fetch the low byte. | ||||||
| BD7F | CP $CB | Jump to DrawSpriteList_Skip to skip the sprite if it is past it. | ||||||
| BD81 | JR NC,DrawSpriteList_Skip | |||||||
| BD83 | CP $10 | Jump to DrawSpriteList_Skip to skip the sprite if it is past it. | ||||||
| BD85 | JR C,DrawSpriteList_Skip | |||||||
| BD87 | LD ($A220),A | Set the horizontal pixel position. | ||||||
| BD8A | LD HL,($A250) | Fetch the vertical position of the object. | ||||||
| BD8D | LD A,(DE) | Fetch the vertical offset of the sprite. | ||||||
| BD8E | INC DE | Move on to the next byte. | ||||||
| BD8F | ADD A,(IX+$0D) | Add the vertical offset of the object. | ||||||
| BD92 | CALL AddSignedToHL | Add the offset to the vertical position. | ||||||
| BD95 | LD A,H | Fetch the high byte. | ||||||
| BD96 | AND A | Skip the sprite if its vertical position is off the screen. | ||||||
| BD97 | JR NZ,DrawSpriteList_SkipSprite | |||||||
| BD99 | LD A,L | Fetch the low byte. | ||||||
| BD9A | CP $B8 | Jump to DrawSpriteList_SkipSprite to skip the sprite if it is past it. | ||||||
| BD9C | JR NC,DrawSpriteList_SkipSprite | |||||||
| BD9E | LD ($A221),A | Set the vertical pixel position. | ||||||
| BDA1 | LD A,(DE) | Fetch the number of the sprite. | ||||||
| BDA2 | INC DE | Move on to the next byte. | ||||||
|
Draw the sprite.
|
||||||||
| BDA3 | PUSH DE | Stash the address in the list on the stack. | ||||||
| BDA4 | CALL DrawSprite | Call DrawSprite. | ||||||
| BDA7 | POP DE | Restore the address in the list from the stack. | ||||||
|
Go back for the next sprite.
|
||||||||
| BDA8 | JR DrawSpriteList_Next | Jump to DrawSpriteList_Next. | ||||||
|
The sprite is off the screen horizontally, so skip the vertical offset as well.
|
||||||||
| DrawSpriteList_Skip | BDAA | INC DE | Skip the vertical offset. | |||||
|
Skip the number of the sprite and go on to the next.
|
||||||||
| DrawSpriteList_SkipSprite | BDAB | INC DE | Skip the number of the sprite. | |||||
|
Go back for the next sprite.
|
||||||||
| BDAC | JR DrawSpriteList_Next | Jump to DrawSpriteList_Next. | ||||||
| Prev: BD62 | Up: Map | Next: BDAE |