0

I'm trying to print some rows of a char from the top and bottom, first row turns out as expected but next one doesn't print. I add 40 chars to "Currentline" to get the prog to print the next row, well - that was what I thought would work. It won't print, but if I set "Currentline" to 40 from the start it prints on the next row.

What am I doing wrong?

/*
****************************************
* Really awesome code by Cri33e - 2022 * 
****************************************
*/

*=$2000                             // Startas med sys8192


.var ScreenCTop_Adress = $d7ff
.var ScreenCBottom_Adress = $dbbf
.var ScreenTop_Adress = $03ff
.var ScreenBottom_Adress = $07bf

.var Currentline = 0
.var Char_color = 3
.var HowManyRows = 4

Next_row:              
                lda #Char_color
                ldy #20             
                ldx #40             

 loop1:          
                sta ScreenCTop_Adress+Currentline,x     
                sta ScreenCBottom_Adress-Currentline,x 
                tya
                sta ScreenTop_Adress+Currentline,x       
                sta ScreenBottom_Adress-Currentline,x   
                lda #Char_color
                dex
                bne loop1

                lda Currentline + 40  
                sta Currentline        

                ldx HowManyRows       
                dex
                stx HowManyRows
                bne Next_row

rts


enter code here
Stu
  • 30,392
  • 6
  • 14
  • 33
Cri33e
  • 1
  • 1
  • `lda Currentline + 40` is not how you add 40. That adds the 40 to the address and loads a value from there. You want `lda Currentline; clc; adc #40` – Jester Oct 03 '22 at 23:15
  • Then again, that won't work either because you need a true variable for that, and you need to fix all the other additions as well. – Jester Oct 03 '22 at 23:45
  • It's not a true variable? How so? – puppydrum64 Dec 20 '22 at 16:31

0 Answers0