Originally Posted by
SparTonberry
Why would you LDA and INC the number of lives in that second example? It's pointless.
The same would apply to the first example, too... I too would like to know why not to INC right after LDA? It might be because INC is like LDA #$01+STA.
A better way to do this would be:
Code:
CheckLives:
lda NumberofLives ;load the lives counter
cmp #$7f ;check if player has 127 lives
bcs EndCheckL ;skip to end of routine if so
inc NumberofLives ;otherwise increment counter by one
EndCheckL:
rtl
Saves a lot of bytes.
Another way...
Code:
CheckLives:
lda NumberofLives ;load the lives counter
bmi EndCheckL ;skip to end if negative flag set
inc NumberofLives ;otherwise increment counter by one
EndCheckL:
rtl
~Ben