Small optimizations in status line display proc

This commit is contained in:
Pecusx
2023-03-15 14:48:58 +01:00
parent 0703a9db93
commit 2de654db32
3 changed files with 30 additions and 36 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+30 -36
View File
@@ -2033,34 +2033,33 @@ EndOfCredits
.proc DisplayStatus .proc DisplayStatus
;------------------------------------------------- ;-------------------------------------------------
;=========================
; displaying number of active controller port ; displaying number of active controller port
;=========================
ldy JoystickNumber ldy JoystickNumber
lda digits+1,y lda digits+1,y
sta statusBuffer+17 sta statusBuffer+17
;---------------------
;=========================
;displaying symbol of the weapon ;displaying symbol of the weapon
;--------------------- ;=========================
;display name and symbol of the weapon
;statusBuffer+18 - symbol (1 char)
;statusBuffer+20 - quantity left
;statusBuffer+23 - name
ldx TankNr ldx TankNr
ldy ActiveWeapon,x ldy ActiveWeapon,x
lda WeaponSymbols,y lda WeaponSymbols,y
sta statusBuffer+19 sta statusBuffer+19
;--------------------- ;=========================
;displaying quantity of the given weapon ;displaying quantity of the given weapon
;--------------------- ;=========================
lda ActiveWeapon,x lda ActiveWeapon,x
jsr HowManyBullets jsr HowManyBullets
sta decimal sta decimal
mwa #statusBuffer+21 displayposition mwa #statusBuffer+21 displayposition
jsr displaybyte jsr displaybyte
;--------------------- ;=========================
;displaying name of the weapon ;displaying name of the weapon
;--------------------- ;=========================
ldx TankNr ldx TankNr
lda ActiveWeapon,x lda ActiveWeapon,x
sta temp ;get back number of the weapon sta temp ;get back number of the weapon
@@ -2080,9 +2079,9 @@ EndOfCredits
dey dey
bpl @- bpl @-
;--------------------- ;=========================
;displaying name of the defence weapon (if active) ;displaying name of the defence weapon (if active)
;--------------------- ;=========================
lda AutoDefenseFlag,x ; Auto Defense symbol (space or "A" in inverse) lda AutoDefenseFlag,x ; Auto Defense symbol (space or "A" in inverse)
bpl @+ bpl @+
lda #$5e ; Auto Defense symbol lda #$5e ; Auto Defense symbol
@@ -2119,19 +2118,17 @@ ClearingOnly
dey dey
bpl @- bpl @-
;--------------------- ;=========================
;displaying the energy of a tank ;displaying the energy of a tank
;--------------------- ;=========================
lda Energy,x lda Energy,x
sta decimal sta decimal
mwa #statusBuffer+48 displayposition mwa #statusBuffer+48 displayposition
jsr displaybyte jsr displaybyte
;--------------------- ;=========================
;displaying the energy of a tank shield (if exist) ;displaying the energy of a tank shield (if exist)
;--------------------- ;=========================
; clear (if no shield) ; clear (if no shield)
lda #space lda #space
sta statusBuffer+40+10 sta statusBuffer+40+10
@@ -2155,17 +2152,20 @@ NoDefenceWeapon
NoShieldEnergy NoShieldEnergy
;========================= ;=========================
;display Wind ; display Wind
;========================= ;=========================
mwa Wind temp mwa Wind temp
lda Wind+3 ; highest byte of 4 byte wind lda #space
bit Wind+3 ; highest byte of 4 byte wind
bmi DisplayLeftWind bmi DisplayLeftWind
sta statusBuffer+80+17 ; (space) char
lda #$7f ; (tab) char lda #$7f ; (tab) char
sta statusBuffer+80+20 sta statusBuffer+80+20
lda #space bne DisplayWindValue
sta statusBuffer+80+17
beq DisplayWindValue
DisplayLeftWind DisplayLeftWind
sta statusBuffer+80+20 ; (space) char
lda #$7e ;(del) char
sta statusBuffer+80+17
sec ; Wind = -Wind sec ; Wind = -Wind
lda #$00 lda #$00
sbc temp sbc temp
@@ -2173,10 +2173,6 @@ DisplayLeftWind
lda #$00 lda #$00
sbc temp+1 sbc temp+1
sta temp+1 sta temp+1
lda #$7e ;(del) char
sta statusBuffer+80+17
lda #space
sta statusBuffer+80+20
DisplayWindValue DisplayWindValue
:4 lsrw temp ;divide by 16 to have a nice value on a screen :4 lsrw temp ;divide by 16 to have a nice value on a screen
lda temp lda temp
@@ -2207,6 +2203,7 @@ DisplayWindValue
;display Angle ;display Angle
;========================= ;=========================
displayAngle displayAngle
ldy #space
ldx TankNr ldx TankNr
lda AngleTable,x lda AngleTable,x
cmp #90 cmp #90
@@ -2215,28 +2212,25 @@ displayAngle
AngleToRight AngleToRight
; now we have values from 0 to 89 and right angle ; now we have values from 0 to 89 and right angle
sta decimal sta decimal
sty statusBuffer+40+22 ; (space) character
lda #$7f ; (tab) character lda #$7f ; (tab) character
sta statusBuffer+40+25 sta statusBuffer+40+25
lda #space bne AngleDisplay
sta statusBuffer+40+22
beq AngleDisplay
AngleToLeft AngleToLeft
sec sec
lda #180 lda #180
sbc AngleTable,x sbc AngleTable,x
; angles 180 - 91 converted to 0 - 89 ; angles 180 - 91 converted to 0 - 89
sta decimal sta decimal
sty statusBuffer+40+25 ; (space) character
lda #$7e ;(del) char lda #$7e ;(del) char
sta statusBuffer+40+22 sta statusBuffer+40+22
lda #space bne AngleDisplay
sta statusBuffer+40+25
beq AngleDisplay
VerticallyUp VerticallyUp
; now we have value 90 ; now we have value 90
sta decimal sta decimal
lda #space sty statusBuffer+40+25 ; (space) character
sta statusBuffer+40+25 sty statusBuffer+40+22 ; (space) character
sta statusBuffer+40+22
AngleDisplay AngleDisplay
mwa #statusBuffer+40+23 displayposition mwa #statusBuffer+40+23 displayposition