From 8d31720e1c61300ea5a94be6b74ea467d31acb65 Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Sat, 7 Aug 2021 21:21:28 -0500 Subject: [PATCH] Add an extra column when coordinates are not tile-aligned --- src/TileMap.s | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/TileMap.s b/src/TileMap.s index 04e36b7..b3744d9 100644 --- a/src/TileMap.s +++ b/src/TileMap.s @@ -94,12 +94,19 @@ _UpdateBG0TileMap stz :Left ; prepare to do the entire screen lda ScreenTileWidth ; and then whack off the parts sta :Right ; that are not needed + lda StartX + and #$0003 ; If not tile-aligned, then we need to draw one extra column + beq *+2 + inc :Right stz :Top lda ScreenTileHeight sta :Bottom + and #$0007 + beq *+2 + inc :Bottom -; If we are supposed to refresh the while field, just do that and return +; If we are supposed to refresh the whole field, just do that and return lda :Refresh beq :NoRefresh jmp :DrawRectBG0 ; Let the DrawRectBG0 RTS take care of the return for us @@ -371,3 +378,6 @@ _UpdateBG0TileMap + + +