Prev: 39896 Up: Map Next: 39952
39928: 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 39928 LD A,(DE) Fetch the height of the tile as the row counter.
39929 INC DE
39930 LD C,A
39931 LD A,(DE) Fetch the width of the tile as the width counter.
39932 INC DE
39933 LD B,A
This entry point is used by the routine at Draw_Top_Right_Corner.
Draw_Tile_Without_Header 39934 PUSH BC Stash the width of the tile on the stack.
Draw_Tile_Loop 39935 LD A,(DE) Fetch a byte of the tile.
39936 INC DE Move on to the next byte.
39937 LD (HL),A Write it to the screen.
39938 INC L Move on to the next cell.
39939 DJNZ Draw_Tile_Loop Decrease the width counter and loop back until the row is done.
39941 POP BC Restore the width of the tile.
39942 LD A,L Fetch the low byte of the screen address.
39943 SUB B Subtract the width to move back to the start of the row.
39944 LD L,A Store the low byte of the address.
39945 CALL ScreenPosition1PixelBelow Move down one pixel line.
39948 DEC C Decrease the row counter and loop back until all of the rows of the tile are drawn.
39949 JR NZ,Draw_Tile_Without_Header
39951 RET Return.
Prev: 39896 Up: Map Next: 39952