Prev: 9BD8 Up: Map Next: 9C10
9BF8: Draw Tile
Used by the routines at Draw_Ceiling and Draw_Right_Wall.
Draws a tile that starts with its height and width, at the screen address in HL. The entry at Draw_Tile_Without_Header draws a tile that has no header, using the size in BC.
The pixel data is drawn from left to right and from top to bottom, one row at a time, moving down one pixel line for each row. When it returns HL is the screen address of the line below the tile.
Input
DE Address of the tile (height, width, then pixel data)
HL Screen address of the top left corner
Output
DE Address of the byte after the tile
HL Screen address of the line below the tile
Draw_Tile 9BF8 LD A,(DE) Fetch the height of the tile as the row counter.
9BF9 INC DE
9BFA LD C,A
9BFB LD A,(DE) Fetch the width of the tile as the width counter.
9BFC INC DE
9BFD LD B,A
This entry point is used by the routine at Draw_Top_Right_Corner.
Draw_Tile_Without_Header 9BFE PUSH BC Stash the width of the tile on the stack.
Draw_Tile_Loop 9BFF LD A,(DE) Fetch a byte of the tile.
9C00 INC DE Move on to the next byte.
9C01 LD (HL),A Write it to the screen.
9C02 INC L Move on to the next cell.
9C03 DJNZ Draw_Tile_Loop Decrease the width counter and loop back until the row is done.
9C05 POP BC Restore the width of the tile.
9C06 LD A,L Fetch the low byte of the screen address.
9C07 SUB B Subtract the width to move back to the start of the row.
9C08 LD L,A Store the low byte of the address.
9C09 CALL ScreenPosition1PixelBelow Move down one pixel line.
9C0C DEC C Decrease the row counter and loop back until all of the rows of the tile are drawn.
9C0D JR NZ,Draw_Tile_Without_Header
9C0F RET Return.
Prev: 9BD8 Up: Map Next: 9C10