Prev: 24765 Up: Map Next: 24829
24802: Print Tile Block
Used by the routines at DrawPantry and DrawShelf.
Prints a block of tiles (using the font set up by DrawPantry).
Input
A Width of the block in tiles
C Number of rows
DE Address of the tile numbers
HL Position of the block
Output
DE Address of the tile numbers after the block
HL Position of the row below the block
PrintTileBlock 24802 LD (24360),A Record the width of the block at TileBlockWidth.
PrintTileBlock_Row 24805 LD A,(24360) Fetch the width of the block.
24808 LD B,A Set the column counter to the width.
24809 PUSH HL Stash the position of the row on the stack.
24810 CALL ScreenAddress Convert the position to a screen address using ScreenAddress.
PrintTileBlock_Loop 24813 LD A,(DE) Fetch the tile number.
24814 CALL PrintScreen Print the tile using PrintScreen.
24817 INC DE Move onto the next tile.
24818 DJNZ PrintTileBlock_Loop Decrease the column counter by one and loop back to PrintTileBlock_Loop until the row has been printed.
24820 POP HL Restore the position of the row from the stack.
24821 LD A,H Fetch the vertical position of the row.
24822 ADD A,8 Add 8 to move down one row of tiles.
24824 LD H,A Update the vertical position of the row.
24825 DEC C Decrease the row counter by one.
24826 JR NZ,PrintTileBlock_Row Loop back to PrintTileBlock_Row until all of the rows have been done.
24828 RET Return.
Prev: 24765 Up: Map Next: 24829