One thing, this does not clear 0 to 255 bytes, it clears 1 to 255
; Clear Ram Player/Missile
.proc clear_pmg
ldx #255 ; Erase all the area from 0 to bottom 255
lda #0
loop
sta pmg+$400,x ; Player 0
sta pmg+$500,x ; Player 1
dex
bne loop
rts
.endp
This will do the 256 bytes, x register is not tested until it's been incremented
so BNE still works.
; Clear Ram Player/Missile
.proc clear_pmg
ldx #0 ; Erase all the area from 0 to bottom 255
txa
loop
sta pmg+$400,x ; Player 0
sta pmg+$500,x ; Player 1
dex
bne loop
rts
.endp