Browse Source

Fix subtraction / two's complement bug.

main
Colin McMillen 9 years ago
parent
commit
bac214a95b
  1. 7
      pewpew.asm

7
pewpew.asm

@ -473,17 +473,17 @@ MaybeShoot:
sta 1, X sta 1, X
lda playerY lda playerY
sta 2, X sta 2, X
lda #3 ; x-velocity.
lda #6 ; x-velocity.
sta 3, X sta 3, X
lda nextShotState lda nextShotState
cmp #1 cmp #1
beq + beq +
lda #1
lda #3
sta 4, X sta 4, X
inc nextShotState inc nextShotState
jmp ++ jmp ++
+ +
lda #-1
lda #-3
sta 4, X sta 4, X
dec nextShotState dec nextShotState
++ ++
@ -544,6 +544,7 @@ UpdateShotWithNegativeYVelocity:
jmp ShotDone ; and we know it shouldn't be reaped. jmp ShotDone ; and we know it shouldn't be reaped.
+ +
adc $00 adc $00
dec A ; Two's complement means that we need to -1 again in this case.
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 shotArray + 2, X sta shotArray + 2, X

Loading…
Cancel
Save