Hi Daniel -- and welcome!
Nothing like a little game to practice programming skills! I can see you're off to a good start with this.
My first suggestion is that you give symbolic names (labels) to the memory locations you're using, and then always refer to the locations by name. Maybe that seems like more trouble, but once you get in the habit it will pay off in the long run. That's because the code will be much more readable, both to others and to yourself -- and mistakes and opportunities for improvement will become more obvious. For example if you say
Code:
PaddleIndexL =$00 ;low address pointer to paddle index
PaddleIndexH =$01 ;high address pointer to paddle index
then later you can say
Code:
lda PaddleIndexL
adc #$20 ;incr to next pixel of paddle
sta PaddleIndexL
lda #$00
adc PaddleIndexH
sta PaddleIndexH
which is much clearer than your original code, isn't it.
I've only looked at the first portion of the program... partly because it's hard to read. (The comments are helpful at least.) Here are a few pointers. First, an addition sequence like the one above usually requires a CLC instruction as a prelude. You can omit the CLC if you
know the Carry flag will already be clear, but these sorts of assumptions can cause trouble when you modify the code later, so always include the CLC or at least make an appropriate warning comment.
There's another little bug regarding location $02, which is not initialized to a known quantity before the first call to drawPaddle. The emulator might provide a consistent starting value in $02 without being asked to do so, but the memory in an actual computer is not so obliging! When the program starts (before the first call to drawPaddle) you need to go
Code:
lda #$00 ;reset counter for very FIRST run
sta Counter
(Notice I've chosen a name for the memory location.)
Care to polish up your code and post it again? Then we can advance from bug fixes to some potential optimizations!
cheers,
Jeff
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html