DEX and DEY player sprites

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Elijah

Hello everyone,

I've been experimenting with sprites lately and noticed a limitation: I'm unable to DEX and DEY player sprites, at least not in the manner I've been attempting. While it's not a major issue, I'm curious about the technical reasons behind this. I've, of course, been able to with the playfield and player color. Despite searching online, I haven't found a clear answer, so I'm reaching out to all of you for insights. Any help would be appreciated.

Best regards,
Elijah

Thomas Jentzsch

Please post some code, so that we can help.

Elijah

right, sorry
I was messing around with the session 21 sprites code from Andrew Davie
MiddleLines     

               stx COLUP0
               sty COLUP0
               inx
               iny
               SLEEP 20



               sta RESP0



               SLEEP 10

               sta RESP1



               sty GRP0
               iny             ; modify sprite 0 shape

               stx GRP1



               sta WSYNC

               inx



               cpx #184

               bne MiddleLines
this code that does work.

But, when I dex or dey
MiddleLines     

               stx COLUP0
               sty COLUP0
               dex
               iny
               SLEEP 20



               sta RESP0



               SLEEP 10

               sta RESP1



               sty GRP0
               iny             ; modify sprite 0 shape

               stx GRP1



               sta WSYNC

               inx



               cpx #184

               bne MiddleLines
The other sprite just becomes a square! I have no idea why this happens, but it only seems to happen with DEX and DEY

Thomas Jentzsch

Well, if you do DEX and INX in the same loop, the value will stay constant. Also, since X is the loop counter, the loop will never be exited.

So, better leave X alone and change both INYs into DEYs instead.