some code size optimizations

This commit is contained in:
2022-06-05 09:33:28 -04:00
parent 079abc062f
commit 743114fd0d
3 changed files with 30 additions and 41 deletions
+3 -3
View File
@@ -403,9 +403,9 @@ RoboTanks
lda kbcode lda kbcode
cmp #28 ; ESC cmp #28 ; ESC
bne @+ bne @+
jsr AreYouSure jsr AreYouSure
lda escFlag lda escFlag
seq:rts seq:rts
@ @
; let's move the tank's barrel so it points the right ; let's move the tank's barrel so it points the right
BIN
View File
Binary file not shown.
+27 -38
View File
@@ -1395,10 +1395,9 @@ EndOfTypeLine4x4
adb ResultY #4 ;next line adb ResultY #4 ;next line
;bottom frame ;bottom frame
mwa #LineBottom LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering
mva ResultY LineYdraw mva ResultY LineYdraw
jsr TypeLine4x4 jsr TL4x4_bottom ; just go
jsr GetKey jsr GetKey
cmp #$2b ; "Y" cmp #$2b ; "Y"
@@ -1461,10 +1460,8 @@ seppuku_loop
adb ResultY #4 ;next line adb ResultY #4 ;next line
;bottom frame ;bottom frame
mwa #LineBottom LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering
mva ResultY LineYdraw mva ResultY LineYdraw
jsr TypeLine4x4 jsr TL4x4_bottom ; just go
;clean seppuku ;clean seppuku
@@ -1496,17 +1493,16 @@ quit_seppuku
;using 4x4 font ;using 4x4 font
mva #sfx_smoke_cloud sfx_effect mva #sfx_smoke_cloud sfx_effect
mva #1 plot4x4color
;centering the result screen ;centering the result screen
mwa #((ScreenWidth/2)-(8*4)) ResultX
mva #((ScreenHeight/2)-(8*4)) ResultY mva #((ScreenHeight/2)-(8*4)) ResultY
;upper frame ;upper frame
mwa #LineTop LineAddress4x4 mwa #LineTop LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color
jsr TypeLine4x4 jsr TypeLine4x4
adb ResultY #4 ;next line adb ResultY #4 ;next line
@@ -1522,17 +1518,15 @@ quit_seppuku
jsr displaybyte ;decimal (byte), displayposition (word) jsr displaybyte ;decimal (byte), displayposition (word)
mwa #LineHeader1 LineAddress4x4 mwa #LineHeader1 LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color
jsr TypeLine4x4 jsr TypeLine4x4
beq @+ ;unconditional jump, because TypeLine4x4 ends with beq beq @+ ;unconditional jump, because TypeLine4x4 ends with beq
GameOver4x4 GameOver4x4
mwa #LineGameOver LineAddress4x4 mwa #LineGameOver LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color
jsr TypeLine4x4 jsr TypeLine4x4
mva #1 GameIsOver mva #1 GameIsOver
@@ -1540,30 +1534,23 @@ GameOver4x4
adb ResultY #4 ;next line adb ResultY #4 ;next line
;Empty line ;Empty line
mwa #LineEmpty LineAddress4x4
mwa ResultX LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color jsr TL4x4_empty
jsr TypeLine4x4
adb ResultY #2 ;next line adb ResultY #2 ;next line
;Header2 ;Header2
mwa #LineHeader2 LineAddress4x4 mwa #LineHeader2 LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color
jsr TypeLine4x4 jsr TypeLine4x4
adb ResultY #4 ;next line adb ResultY #4 ;next line
;Empty line ;Empty line
mwa #LineEmpty LineAddress4x4
mwa ResultX LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color jsr TL4x4_empty
jsr TypeLine4x4
sbb ResultY #2 ;next line (was empty) sbb ResultY #2 ;next line (was empty)
@@ -1628,24 +1615,17 @@ TankNameCopyLoop
;result line display ;result line display
mwa #ResultLineBuffer LineAddress4x4 mwa #ResultLineBuffer LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color
jsr TypeLine4x4 jsr TypeLine4x4
adb ResultY #4 ;next line adb ResultY #4 ;next line
;Empty line ;Empty line
mwa #LineEmpty LineAddress4x4
mwa ResultX LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color jsr TL4x4_empty
jsr TypeLine4x4
dec ResultOfTankNr dec ResultOfTankNr
bmi FinishResultDisplay bmi FinishResultDisplay
sbb ResultY #2 ;distance between lines is smaller sbb ResultY #2 ;distance between lines is smaller
@@ -1653,16 +1633,25 @@ TankNameCopyLoop
jmp ResultOfTheNextPlayer jmp ResultOfTheNextPlayer
FinishResultDisplay FinishResultDisplay
mva ResultY LineYdraw
;jmp TL4x4_bottom ; just go
.endp
.proc TL4x4_bottom
;bottom of the frame ;bottom of the frame
mwa #LineBottom LineAddress4x4 mwa #LineBottom LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw jmp TypeLine4x4 ; jsr:rts
mva #1 plot4x4color
jsr TypeLine4x4
rts
.endp .endp
.proc TL4x4_empty
;empty frame
mwa #LineEmpty LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw
jmp TypeLine4x4 ; jsr:rts
.endp
;------------------------------------------------- ;-------------------------------------------------
.proc DisplayStatus .proc DisplayStatus
;------------------------------------------------- ;-------------------------------------------------