.DrawLandscapeRow LDA xTileViewLeftEdge \ Set xTileToDraw to the column number of the tile at STA xTileToDraw \ the left edge of the visible row we want to draw .draw1 CMP xTileViewRightEdge \ If we have gone past the right edge, jump to draw4 to BCS draw4 \ return from the subroutine CMP xTileViewer \ If we have gone past the viewer's tile column, jump to BCS draw2 \ draw2 to draw the second half JSR DrawTileAndObjects \ Draw the tile and any objects stacked on it INC xTileToDraw \ Increment the column number to move right along the \ row LDA xTileToDraw \ Set A to the updated column number of the tile we want \ to draw JMP draw1 \ Loop back to draw1 the next tile to the right until we \ reach the viewer's tile column or reach the end of the \ row .draw2 LDA xTileViewRightEdge \ Set A to the column number of the tile at the right \ edge of the visible row we want to draw .draw3 SEC \ Decrement the column counter in A to move left along SBC #1 \ the row BMI draw4 \ If we have reached the start of the row, jump to draw4 \ to return from the subroutine STA xTileToDraw \ Store the updated column number of the tile we want to \ draw CMP xTileViewLeftEdge \ If we have gone past the left edge, jump to draw4 to BCC draw4 \ return from the subroutine CMP xTileViewer \ If we have gone past the viewer's tile column, jump to BCC draw4 \ draw4 to return from the subroutine JSR DrawTileAndObjects \ Draw the tile and any objects stacked on it LDA xTileToDraw \ Set A to the column number of the tile we just drew JMP draw3 \ Loop back to draw1 the next tile to the left until we \ reach the viewer's tile column or reach the end of the \ row .draw4 RTS \ Return from the subroutineName: DrawLandscapeRow [Show more] Type: Subroutine Category: Drawing the landscape Summary: Draw a row of tiles between the left visible edge and the right visible, in two parts towards each side of the viewerContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DrawLandscapeView (Part 2 of 3) calls DrawLandscapeRow * DrawLandscapeView (Part 3 of 3) calls DrawLandscapeRow
[X]
Subroutine DrawTileAndObjects (category: Drawing the landscape)
Draw a tile and any objects stacked on it
[X]
Label draw1 is local to this routine
[X]
Label draw2 is local to this routine
[X]
Label draw3 is local to this routine
[X]
Label draw4 is local to this routine
[X]
Variable xTileToDraw in workspace Zero page
The column number of the tile we are currently drawing
[X]
Variable xTileViewLeftEdge in workspace Zero page
The tile number at the left edge of the visible portion of the row we are currently processing when drawing the landscape
[X]
Variable xTileViewRightEdge in workspace Zero page
The tile number at the right edge of the visible portion of the row we are currently processing when drawing the landscape
[X]
Variable xTileViewer in workspace Zero page
The tile x-coordinate of the viewer, but with the axes rotated to match the orientation of the viewer, so we can draw the landscape along the line of sight, towards the viewer's tile