another smol optimization based on a fact that you do not have to store a value before calling displaybyte proc

This commit is contained in:
2023-06-04 10:05:24 -04:00
parent a52ce70cd1
commit de0829665c
5 changed files with 23 additions and 26 deletions
+21 -24
View File
@@ -518,7 +518,7 @@ DeffensiveSelected
;now number of units (shells) to be purchased ;now number of units (shells) to be purchased
adw xbyte #22 displayposition ; 23 chars from the beginning of the line adw xbyte #22 displayposition ; 23 chars from the beginning of the line
lda WeaponUnits,x lda WeaponUnits,x
sta decimal ;sta decimal
jsr displaybyte jsr displaybyte
ldx @weapon_index ;getting back index of the weapon ldx @weapon_index ;getting back index of the weapon
@@ -562,11 +562,10 @@ itIsInventory
notInventory notInventory
; number of posessed shells ; number of posessed shells
adw xbyte #1 displayposition
lda @weapon_index ; weapon index again lda @weapon_index ; weapon index again
jsr HowManyBullets jsr HowManyBullets
sta decimal ;sta decimal
adw xbyte #1 displayposition
jsr displaybyte jsr displaybyte
ldx @weapon_index ldx @weapon_index
@@ -1456,6 +1455,7 @@ nexdigit
; leading zeores are removed ; leading zeores are removed
; the range is (00..99 - one byte) ; the range is (00..99 - one byte)
sta decimal
ldy #1 ; there will be 2 digits ldy #1 ; there will be 2 digits
NextDigit2 NextDigit2
ldx #8 ; 8-bit dividee so Rotate 8 times ldx #8 ; 8-bit dividee so Rotate 8 times
@@ -1825,8 +1825,8 @@ ThisIsAI
;========================= ;=========================
lda ActiveWeapon,x lda ActiveWeapon,x
jsr HowManyBullets jsr HowManyBullets
sta decimal ;sta decimal
mwa #statusBuffer+21 displayposition mwx #statusBuffer+21 displayposition
jsr displaybyte jsr displaybyte
;========================= ;=========================
@@ -1866,8 +1866,8 @@ ActiveDefence
;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 mwx #statusBuffer+48 displayposition
jsr displaybyte jsr displaybyte
;========================= ;=========================
@@ -1885,10 +1885,9 @@ ActiveDefence
beq NoDefenceWeapon beq NoDefenceWeapon
lda ShieldEnergy,x lda ShieldEnergy,x
beq NoShieldEnergy beq NoShieldEnergy
sta decimal ; displayed value ;sta decimal ; displayed value
lda #char_bracketO ; ( mvx #char_bracketO statusBuffer+40+10 ; (
sta statusBuffer+40+10 mwx #statusBuffer+40+11 displayposition
mwa #statusBuffer+40+11 displayposition
jsr displaybyte jsr displaybyte
lda #char_bracketC ; ) lda #char_bracketC ; )
sta statusBuffer+40+13 sta statusBuffer+40+13
@@ -1920,16 +1919,16 @@ DisplayLeftWind
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
sta decimal ;sta decimal
mwa #statusBuffer+80+18 displayposition mwx #statusBuffer+80+18 displayposition
jsr displaybyte jsr displaybyte
;========================= ;=========================
;display round number ;display round number
;========================= ;=========================
lda CurrentRoundNr lda CurrentRoundNr
sta decimal ;sta decimal
mwa #statusBuffer+80+7 displayposition mwx #statusBuffer+80+7 displayposition
jsr displaybyte ;decimal (byte), displayposition (word) jsr displaybyte ;decimal (byte), displayposition (word)
;========================= ;=========================
@@ -1955,29 +1954,27 @@ displayAngle
bcs AngleToLeft bcs AngleToLeft
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 sty statusBuffer+40+22 ; (space) character
lda #char_TAB ; (tab) character mvx #char_TAB statusBuffer+40+25 ; (tab) character
sta statusBuffer+40+25
bne AngleDisplay bne 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 sty statusBuffer+40+25 ; (space) character
lda #char_DEL ;(del) char mvx #char_DEL statusBuffer+40+22 ;(del) char
sta statusBuffer+40+22
bne AngleDisplay bne AngleDisplay
VerticallyUp VerticallyUp
; now we have value 90 ; now we have value 90
sta decimal ;sta decimal
sty statusBuffer+40+25 ; (space) character sty statusBuffer+40+25 ; (space) character
sty statusBuffer+40+22 ; (space) character sty statusBuffer+40+22 ; (space) character
AngleDisplay AngleDisplay
mwa #statusBuffer+40+23 displayposition mwx #statusBuffer+40+23 displayposition
jsr displaybyte jsr displaybyte
ldx TankNr ldx TankNr
rts rts
+2 -2
View File
@@ -1247,8 +1247,8 @@ SetRandomWalls
cmp RoundsInTheGame cmp RoundsInTheGame
beq GameOver4x4 beq GameOver4x4
sta decimal ;sta decimal
mwa #RoundNrDisplay displayposition mwx #RoundNrDisplay displayposition
jsr displaybyte ;decimal (byte), displayposition (word) jsr displaybyte ;decimal (byte), displayposition (word)
mwa #LineHeader1 LineAddress4x4 mwa #LineHeader1 LineAddress4x4
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.