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