Prev: D565 Up: Map Next: D5AE
D595: Draw Tile Block
Draws a block of tiles, which are held as one byte for each tile, row by row from left to right and top to bottom. The tiles are from the tile set whose address is in TileSetAddress.
Input
B The width of the block
C The height of the block
DE The address of the numbers of the tiles
HL The screen address of the top left
A' The attribute
Draw each row from left to right.
DrawTileBlock D595 PUSH BC Stash the size and the screen address on the stack.
D596 PUSH HL
Draw a tile.
DrawTileBlock_Tile D597 LD A,(DE) Fetch the number of the tile.
D598 INC DE
D599 PUSH BC Stash the counters on the stack.
D59A LD BC,($A20F) Fetch TileSetAddress.
D59E CALL DrawTile Call DrawTile.
D5A1 POP BC Restore the counters from the stack.
D5A2 INC L Move on to the next column.
D5A3 DJNZ DrawTileBlock_Tile Jump to DrawTileBlock_Tile if there are tiles left in the row.
Move down a row.
D5A5 POP HL Restore the screen address of the row from the stack.
D5A6 CALL MoveDownRow Call MoveDownRow.
D5A9 POP BC Restore the size from the stack.
D5AA DEC C Count down the rows.
D5AB JR NZ,DrawTileBlock Jump to DrawTileBlock if there are rows left.
D5AD RET Return.
Prev: D565 Up: Map Next: D5AE