Prev: A893 Up: Map Next: A8D8
A8AF: Print Sprite Tiles
Used by the routine at DrawRoom.
Prints a sprite to the screen using PrintUDG, using the same width, height and starting ID as WriteSpriteBuffer.
Input
A Starting sprite ID
B Vertical position
C Horizontal position
D Height
E Width
PrintSpriteTiles A8AF PUSH HL Stash HL on the stack.
A8B0 DEC A Start one ID before the first tile so the increment lands on it.
A8B1 LD ($BAA2),A Write the tile ID to *DrawSpriteID.
A8B4 LD A,E Remember the remaining width in *DrawSpriteWidth.
A8B5 LD ($BAA3),A
PrintSpriteTiles_NextRow A8B8 LD A,($BAA3) Reload the remaining width.
A8BB LD E,A
A8BC PUSH BC Stash the position and size.
A8BD PUSH DE
A8BE CALL $0DD9 Set the cursor to this tile.
A8C1 POP DE Restore the position and size.
A8C2 POP BC
PrintSpriteTiles_NextTile A8C3 LD A,($BAA2) Advance *DrawSpriteID to the next tile ID.
A8C6 INC A
A8C7 LD ($BAA2),A
A8CA CALL PrintUDG Print that tile.
A8CD DEC E Move one column across.
A8CE JR NZ,PrintSpriteTiles_NextTile Jump to PrintSpriteTiles_NextTile until this row is complete.
A8D0 DEC D Move on to the next row of tiles.
A8D1 JR Z,PrintSpriteTiles_Done Jump to PrintSpriteTiles_Done if every row is printed.
A8D3 DEC B Move one row up.
A8D4 JR PrintSpriteTiles_NextRow Jump to PrintSpriteTiles_NextRow.
PrintSpriteTiles_Done A8D6 POP HL Restore HL from the stack.
A8D7 RET Return.
Prev: A893 Up: Map Next: A8D8