From d27b10b6fd0e35fd98c9f4ffbda6eadd0097ee7e Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Sun, 22 May 2022 23:52:54 -0500 Subject: [PATCH] Fix nasty RTable initialization bug --- src/Graphics.s | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Graphics.s b/src/Graphics.s index 25166f2..c4d7d3d 100644 --- a/src/Graphics.s +++ b/src/Graphics.s @@ -244,7 +244,7 @@ SetScreenRect sty ScreenHeight ; Save the screen height and lda ScreenY0 ; Calculate the address of the first byte asl ; of the right side of the playfield tax - lda ScreenAddr,x ; This is the address for the left edge of the physical screen + lda ScreenAddr,x ; This is the address for the edge of the physical screen clc adc ScreenX1 dec @@ -252,9 +252,6 @@ SetScreenRect sty ScreenHeight ; Save the screen height and ldx #0 ldy ScreenHeight - jsr :loop - pla ; Reset the address and continue filling in the - ldy ScreenHeight ; second half of the table :loop clc sta RTable,x adc #160 @@ -263,6 +260,16 @@ SetScreenRect sty ScreenHeight ; Save the screen height and dey bne :loop + ldy ScreenHeight + pla ; Reset the address and continue filling in the +:loop2 clc + sta RTable,x + adc #160 + inx + inx + dey + bne :loop2 + ; Calculate the screen locations for each tile corner lda ScreenY0 ; Calculate the address of the first byte