mirror of
https://github.com/pkali/scorch_src.git
synced 2026-05-20 22:34:21 +02:00
smol optimization by moving out a portion of a proc to a separate subroutine
This commit is contained in:
+25
-21
@@ -2022,27 +2022,10 @@ AngleDisplay
|
|||||||
;-------------------------------------------------
|
;-------------------------------------------------
|
||||||
.proc DisplayWeaponName
|
.proc DisplayWeaponName
|
||||||
; nr of weapon in A, address to put in weaponPointer
|
; nr of weapon in A, address to put in weaponPointer
|
||||||
@weapon_index = temp
|
@weapon_index = TextNumberOff
|
||||||
sta @weapon_index ;get back number of the weapon
|
sta @weapon_index ;get back number of the weapon
|
||||||
|
|
||||||
@inverse_counter = temp+1
|
|
||||||
|
|
||||||
mwa #0 @inverse_counter
|
|
||||||
tay ; ldy #0
|
|
||||||
mwa #(NamesOfWeapons-1) LineAddress4x4
|
mwa #(NamesOfWeapons-1) LineAddress4x4
|
||||||
|
jsr _calc_inverse_display
|
||||||
@
|
|
||||||
inw LineAddress4x4
|
|
||||||
lda (LineAddress4x4),y
|
|
||||||
spl:inc @inverse_counter
|
|
||||||
lda @weapon_index
|
|
||||||
beq zeroth_talk ; special treatment of talk #0
|
|
||||||
cmp @inverse_counter
|
|
||||||
bne @-
|
|
||||||
|
|
||||||
inw LineAddress4x4 ; we were pointing at the char with inverse, must go 1 further
|
|
||||||
zeroth_talk
|
|
||||||
|
|
||||||
; now copy text to screen
|
; now copy text to screen
|
||||||
dey ; ldy #-1
|
dey ; ldy #-1
|
||||||
@
|
@
|
||||||
@@ -2058,6 +2041,27 @@ clearingOnly
|
|||||||
bne clearingonly
|
bne clearingonly
|
||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
|
;-------------------------------------------------
|
||||||
|
.proc _calc_inverse_display
|
||||||
|
; optymalization station. not a real function
|
||||||
|
; or is it?
|
||||||
|
@weapon_index = TextNumberOff
|
||||||
|
@inverse_counter = temp+1
|
||||||
|
|
||||||
|
mwa #0 @inverse_counter
|
||||||
|
tay ; ldy #0
|
||||||
|
@
|
||||||
|
inw LineAddress4x4
|
||||||
|
lda (LineAddress4x4),y
|
||||||
|
spl:inc @inverse_counter
|
||||||
|
lda @weapon_index
|
||||||
|
beq zeroth_talk ; special treatment of talk #0
|
||||||
|
cmp @inverse_counter
|
||||||
|
bne @-
|
||||||
|
|
||||||
|
inw LineAddress4x4 ; we were pointing at the char with inverse, must go 1 further
|
||||||
|
zeroth_talk
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
@@ -340,6 +340,28 @@ DisplayAngle
|
|||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
;-------------------------------------------------
|
;-------------------------------------------------
|
||||||
|
.proc _calc_inverse_display
|
||||||
|
; optymalization station. not a real function
|
||||||
|
; or is it?
|
||||||
|
@weapon_index = TextNumberOff
|
||||||
|
@inverse_counter = temp+1
|
||||||
|
|
||||||
|
mwa #0 @inverse_counter
|
||||||
|
tay ; ldy #0
|
||||||
|
@
|
||||||
|
inw LineAddress4x4
|
||||||
|
lda (LineAddress4x4),y
|
||||||
|
spl:inc @inverse_counter
|
||||||
|
lda @weapon_index
|
||||||
|
beq zeroth_talk ; special treatment of talk #0
|
||||||
|
cmp @inverse_counter
|
||||||
|
bne @-
|
||||||
|
|
||||||
|
inw LineAddress4x4 ; we were pointing at the char with inverse, must go 1 further
|
||||||
|
zeroth_talk
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
;-------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
+1
-16
@@ -1599,25 +1599,10 @@ NotHigher
|
|||||||
; all text start from `talk` and end with an inverse.
|
; all text start from `talk` and end with an inverse.
|
||||||
; we go through the `talk`, count number of inverses.
|
; we go through the `talk`, count number of inverses.
|
||||||
; if equal to TextNumberOff, it is our text, printit
|
; if equal to TextNumberOff, it is our text, printit
|
||||||
inverse_counter = temp+1
|
|
||||||
|
|
||||||
tya
|
tya
|
||||||
tax ; save Y
|
tax ; save Y
|
||||||
mwa #0 inverse_counter
|
|
||||||
tay ; ldy #0
|
|
||||||
mwa #(talk-1) LineAddress4x4
|
mwa #(talk-1) LineAddress4x4
|
||||||
|
jsr _calc_inverse_display
|
||||||
@
|
|
||||||
inw LineAddress4x4
|
|
||||||
lda (LineAddress4x4),y
|
|
||||||
spl:inc inverse_counter
|
|
||||||
lda TextNumberOff
|
|
||||||
beq zeroth_talk ; special treatment of talk #0
|
|
||||||
cmp inverse_counter
|
|
||||||
bne @-
|
|
||||||
|
|
||||||
inw LineAddress4x4 ; we were pointing at the char with inverse, must go 1 further
|
|
||||||
zeroth_talk
|
|
||||||
|
|
||||||
; now find length of the text
|
; now find length of the text
|
||||||
@
|
@
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user