Battery lottery

This commit is contained in:
Pecusx
2022-08-12 22:34:56 +02:00
parent 0d210b8d88
commit 5070b11be3
3 changed files with 34 additions and 25 deletions
+32 -24
View File
@@ -625,30 +625,8 @@ NextPlayerShoots
SeteXistenZ SeteXistenZ
lda Energy,x lda Energy,x
sta eXistenZ,x sta eXistenZ,x
sta L1
jsr MaxForceCalculate
;DATA L1,L2
;Multiplication 8bit*8bit,
;result 16bit
;this algiorithm is a little longer than one in Ruszczyc 6502 book
;but it is faster
LDy #8
LDA #0
CLC
LP0
ror
ROR L1
BCC B0
CLC
ADC #10 ; (L2) multiplication by 10
B0 DEY
BNE LP0
ror
ROR L1
STA MaxForceTableH,x
lda L1
sta MaxForceTableL,x
dex dex
bpl SeteXistenZ bpl SeteXistenZ
@@ -908,7 +886,37 @@ NotNegativeShieldEnergy
.endr .endr
@ rts @ rts
.endp .endp
;--------------------------------------------------
.proc MaxForceCalculate
; calculates max force for tank (tanknr in X)
; Energy of tank X in A
;--------------------------------------------------
sta L1
;DATA L1,L2
;Multiplication 8bit*8bit,
;result 16bit
;this algiorithm is a little longer than one in Ruszczyc 6502 book
;but it is faster
LDy #8
LDA #0
CLC
LP0
ror
ROR L1
BCC B0
CLC
ADC #10 ; (L2) multiplication by 10
B0 DEY
BNE LP0
ror
ROR L1
STA MaxForceTableH,x
lda L1
sta MaxForceTableL,x
rts
.endp
;-------------------------------------------------- ;--------------------------------------------------
.proc PMoutofScreen .proc PMoutofScreen
;-------------------------------------------------- ;--------------------------------------------------
BIN
View File
Binary file not shown.
+2 -1
View File
@@ -835,7 +835,8 @@ invSelectDef
; if activate battery, we do it differently ; if activate battery, we do it differently
mva #sfx_battery sfx_effect mva #sfx_battery sfx_effect
mva #99 Energy,x mva #99 Energy,x
bne DecreaseDefensive ; bypass activation jsr MaxForceCalculate
jmp DecreaseDefensive ; bypass activation
NotBattery NotBattery
cmp #ind_Long_Barrel____ cmp #ind_Long_Barrel____
bne NotBarrel bne NotBarrel