More cleanup and optimization

This commit is contained in:
Pecusx
2023-03-29 20:20:26 +02:00
parent d12102ad60
commit e1a930ca44
3 changed files with 21 additions and 25 deletions
+21 -25
View File
@@ -1130,20 +1130,19 @@ NotNegativeShieldEnergy
;this algiorithm is a little longer than one in Ruszczyc 6502 book ;this algiorithm is a little longer than one in Ruszczyc 6502 book
;but it is faster ;but it is faster
LDy #8 ldy #8
LDA #0 lda #0
CLC clc
LP0 LP0 ror
ror L1
bcc B0
clc
adc #10 ; (L2) multiplication by 10
B0 dey
bne LP0
ror ror
ROR L1 ror L1
BCC B0 sta MaxForceTableH,x
CLC
ADC #10 ; (L2) multiplication by 10
B0 DEY
BNE LP0
ror
ROR L1
STA MaxForceTableH,x
lda L1 lda L1
sta MaxForceTableL,x sta MaxForceTableL,x
rts rts
@@ -1157,21 +1156,18 @@ B0 DEY
ldx #(number_of_weapons - 1) ldx #(number_of_weapons - 1)
@ lda #$0 @ lda #$0
cpx #ind_White_Flag_____ ; White Flag cpx #ind_White_Flag_____ ; White Flag
bne @+ bne no99
lda #99 set99 lda #99
@ sta TanksWeapon1,x no99 sta TanksWeapon1,x
sta TanksWeapon2,x sta TanksWeapon2,x
sta TanksWeapon3,x sta TanksWeapon3,x
sta TanksWeapon4,x sta TanksWeapon4,x
sta TanksWeapon5,x sta TanksWeapon5,x
sta TanksWeapon6,x sta TanksWeapon6,x
dex dex
beq setBmissile ; Baby Missile (index=0) beq set99 ; Baby Missile (index=0)
bpl @-1 bpl @-
rts rts
setBmissile
lda #99
bne @-
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
@@ -1403,11 +1399,11 @@ MoveBarrel
lda NewAngle lda NewAngle
cmp AngleTable,x cmp AngleTable,x
beq BarrelPositionIsFine beq BarrelPositionIsFine
bcc rotateLeft ; older is bigger bcc rotateLeft
rotateRight;older is lower rotateRight ; older is lower
inc angleTable,x inc angleTable,x
jmp MoveBarrel jmp MoveBarrel
rotateLeft rotateLeft ; older is bigger
dec angleTable,x dec angleTable,x
jmp MoveBarrel jmp MoveBarrel
BarrelPositionIsFine BarrelPositionIsFine
@@ -1769,7 +1765,7 @@ YesCheat
lda #99 lda #99
@ iny @ iny
sta (temp),y sta (temp),y
cpy #(last_defensive_____ - first_offensive____) cpy #(number_of_weapons - 1)
bne @- bne @-
NoCheat NoCheat
rts rts
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.