Browse Source

Refactor jmp -> bra.

main
Colin McMillen 9 years ago
parent
commit
d81c9a9e4b
  1. 13
      pewpew.asm

13
pewpew.asm

@ -278,7 +278,7 @@ MainLoop:
jsr UpdateSprites jsr UpdateSprites
jsr FillSecondarySpriteTable jsr FillSecondarySpriteTable
jsr SetBackgroundColor jsr SetBackgroundColor
jmp MainLoop
bra MainLoop
@ -419,7 +419,7 @@ MaybeShoot:
; If we went all the way to the end, bail out. ; If we went all the way to the end, bail out.
cpx #(playerShotArray + playerShotArrayLength * shotSize) cpx #(playerShotArray + playerShotArrayLength * shotSize)
beq MaybeShootDone beq MaybeShootDone
jmp -
bra -
+ +
; Enable shot; set its position based on player position. ; Enable shot; set its position based on player position.
; TODO(mcmillen): it might be easier/faster to keep N arrays: one for each ; TODO(mcmillen): it might be easier/faster to keep N arrays: one for each
@ -503,7 +503,7 @@ UpdateShot: ; Updates position of one shot.
adc $00 adc $00
bcs DisableShot bcs DisableShot
sta playerShotArray + 1, X ; Store new x-coord. sta playerShotArray + 1, X ; Store new x-coord.
jmp UpdateShotY
bra UpdateShotY
UpdateShotWithNegativeXVelocity: UpdateShotWithNegativeXVelocity:
; TODO(mcmillen): wrap sprites when they go negative here, like we do ; TODO(mcmillen): wrap sprites when they go negative here, like we do
@ -513,7 +513,6 @@ UpdateShotWithNegativeXVelocity:
adc $00 adc $00
bcc DisableShot bcc DisableShot
sta playerShotArray + 1, X sta playerShotArray + 1, X
jmp UpdateShotY
UpdateShotY: UpdateShotY:
; Add to the y-coordinate. ; Add to the y-coordinate.
@ -528,7 +527,7 @@ UpdateShotY:
cmp #224 cmp #224
bcs DisableShot bcs DisableShot
sta playerShotArray + 2, X ; Store new y-coord. sta playerShotArray + 2, X ; Store new y-coord.
jmp ShotDone
bra ShotDone
UpdateShotWithNegativeYVelocity: UpdateShotWithNegativeYVelocity:
lda playerShotArray + 2, X ; Current y. lda playerShotArray + 2, X ; Current y.
@ -536,14 +535,14 @@ UpdateShotWithNegativeYVelocity:
bcs + ; If the shot was "off the top" before moving, maybe we'll reap it. bcs + ; If the shot was "off the top" before moving, maybe we'll reap it.
adc $00 ; Otherwise, just update it, adc $00 ; Otherwise, just update it,
sta playerShotArray + 2, X ; save the result, sta playerShotArray + 2, X ; save the result,
jmp ShotDone ; and we know it shouldn't be reaped.
bra ShotDone ; and we know it shouldn't be reaped.
+ +
clc clc
adc $00 adc $00
cmp #224 cmp #224
bcc DisableShot ; If it's now wrapped around, reap it. bcc DisableShot ; If it's now wrapped around, reap it.
sta playerShotArray + 2, X sta playerShotArray + 2, X
jmp ShotDone
bra ShotDone
DisableShot: DisableShot:
stz playerShotArray, X stz playerShotArray, X

Loading…
Cancel
Save