Exit optimizations and better delay for C64

This commit is contained in:
Pecusx
2023-05-19 10:24:25 +02:00
parent f6a7217114
commit eb15ce0d78
7 changed files with 25 additions and 41 deletions
+9 -9
View File
@@ -43,8 +43,8 @@ MainGameLoop
jsr MainRoundLoop
bit escFlag
bmi START
jvs GoGameOver
bmi START
jsr CalculateGains
@@ -369,8 +369,8 @@ RoboTanks
cmp #@kbcode._esc ; 28 ; ESC
bne @+
jsr AreYouSure
@ lda escFlag
seq:rts ; keys Esc or O
@ bit escFlag
spl:rts ; keys Esc or O
jmp AfterManualShooting
@@ -382,8 +382,8 @@ ManualShooting
lda #%00000000
sta TestFlightFlag ; set "Test Fight" off
jsr BeforeFire
lda escFlag
seq:rts ; keys Esc or O
bit escFlag
spl:rts ; keys Esc or O
AfterManualShooting
mva #$00 plot4x4color
@@ -410,8 +410,8 @@ GoFloat
jsr TankFlying
lda #0
sta ActiveDefenceWeapon,x ; deactivate after use
lda escFlag
beq ManualShooting ; after floating tank can shoot
bit escFlag
bpl ManualShooting ; after floating tank can shoot
rts
StandardShoot
inc noDeathCounter
@@ -429,8 +429,8 @@ ShootNow
mva #$00 plot4x4color
jsr DisplayOffensiveTextNr
lda escFlag
seq:rts ; keys Esc or O
bit escFlag
spl:rts ; keys Esc or O
lda HitFlag ;0 if missed
beq missed
+2 -8
View File
@@ -126,7 +126,7 @@ FirstZpageVariable = $57
.zpvar RangeLeft .word
.zpvar RangeRight .word
.zpvar NewAngle .byte
.zpvar escFlag .byte
.zpvar escFlag .byte ; 7 bit - Exit game, 6 bit - Exit to GameOver (cleared - exit to Menu), 0 - nothing
.zpvar LineYdraw .byte
.zpvar LineXdraw .word
.zpvar plot4x4color .byte ; $00 / $ff
@@ -585,7 +585,7 @@ MakeDarkScreen
bpl nokeys
;---O pressed-quit game to game over screen---
QuitToGameover
mva #$40 escFlag
mva #$C0 escFlag ; bits 7 and 6 set
rts
CheckEsc
cmp #@kbcode._esc ; 28 ; ESC
@@ -600,12 +600,6 @@ nokeys
;--------------------------------------------------
.proc ShellDelay
;--------------------------------------------------
lda CONSOL
and #%00000101 ; Start + Option
bne @+
mva #$40 escFlag
@ and #%00000001
beq noShellDelay
ldx flyDelay
DelayLoop
lda VCOUNT
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+4 -1
View File
@@ -128,7 +128,7 @@ FirstZpageVariable = $58 ; $57
.zpvar RangeLeft .word
.zpvar RangeRight .word
.zpvar NewAngle .byte
.zpvar escFlag .byte
.zpvar escFlag .byte ; 7 bit - Exit game, 6 bit - Exit to GameOver (cleared - exit to Menu), 0 - nothing
.zpvar LineYdraw .byte
.zpvar LineXdraw .word
.zpvar plot4x4color .byte ; $00 / $ff
@@ -334,6 +334,9 @@ MakeDarkScreen
ldx flyDelay
DelayLoop
lda $d012
@ cmp $d012
beq @-
lda $d012
@ cmp $d012
beq @-
dex
BIN
View File
Binary file not shown.
+10 -23
View File
@@ -1100,11 +1100,8 @@ ContinueToCheckMaxForce2
notpressed
jsr CheckExitKeys ; Check for O, Esc or Start+Option keys
bit escFlag
bmi EscPressed
bvc OnotPressed
EscPressed
rts ; exit if pressed 'Exit keys'
OnotPressed
spl:rts ; exit if pressed 'Exit keys'
ldx TankNr ; for optimize
; Select and Option
lda CONSOL
@@ -1768,11 +1765,7 @@ nonowait
;
jsr CheckExitKeys ; Check for O, Esc or Start+Option keys
bit escFlag
bmi EscPressed
bvc OnotPressed
EscPressed
rts ; exit if pressed 'Exit keys'
OnotPressed
spl:rts ; exit if pressed 'Exit keys'
ldx TankNr
;
nowait
@@ -2112,12 +2105,10 @@ mrLoopi
phx
jsr CheckExitKeys ; Check for O, Esc or Start+Option keys
bit escFlag
bmi EscPressed
bvc OnotPressed
EscPressed
bpl ExitnotPressed
plx
rts ; exit if pressed 'Exit keys'
OnotPressed
ExitnotPressed
plx
;
@@ -2611,10 +2602,14 @@ KeyboardAndJoyCheck
sbc #12
sta LineYdraw
jsr TypeLine4x4.variableLength
ldx TankNr
LotOfFuel
notpressed
jsr CheckExitKeys
bit escFlag
spl:rts ;---Exit key pressed-quit game---
ldx TankNr
; let's animate "engine"
jsr DrawTankEngine
; enimation ends
@@ -2628,14 +2623,6 @@ notpressed
lda kbcode
and #%00111111 ; CTRL and SHIFT elimination
cmp #@kbcode._esc ; 28 ; ESC
bne @+
jsr AreYouSure
bit escFlag
bpl notpressed
;---esc pressed-quit game---
rts
@
jumpFromStick
cmp #@kbcode._left ; $6
jeq pressedLeft