Delay for first key autorepeat

This commit is contained in:
Pecusx
2023-08-24 22:50:25 +02:00
parent 58f5692090
commit 8a2960f41e
4 changed files with 12 additions and 3 deletions
+1
View File
@@ -26,6 +26,7 @@ TextForegroundColor = $0A
space = 0 ; space in screencodes space = 0 ; space in screencodes
KeyRepeatSpeed = 8 ; (max 127 !!!) KeyRepeatSpeed = 8 ; (max 127 !!!)
FirstKeySpeed = 8 ; additional delay for first keypress
;character codes for symbols (tank, parachute, etc. ) ;character codes for symbols (tank, parachute, etc. )
; characters from tanks.fnt (graphics screen) ; characters from tanks.fnt (graphics screen)
+11 -3
View File
@@ -38,8 +38,9 @@
icl 'definitions.asm' icl 'definitions.asm'
;--------------------------------------------------- ;---------------------------------------------------
FirstZpageVariable = $52 FirstZpageVariable = $51
.zpvar DliColorBack .byte = FirstZpageVariable .zpvar DliColorBack .byte = FirstZpageVariable
.zpvar FirstKeypressDelay .byte
.zpvar ClearSky .byte ; $ff - Crear sky during drawmountains, 0 - no clear sky .zpvar ClearSky .byte ; $ff - Crear sky during drawmountains, 0 - no clear sky
.zpvar PaddleState .byte ; old state 2nd button for 2 buttons joysticks .zpvar PaddleState .byte ; old state 2nd button for 2 buttons joysticks
.zpvar GradientNr .byte .zpvar GradientNr .byte
@@ -496,10 +497,13 @@ Check2button
;-------------------------------------------------- ;--------------------------------------------------
.proc WaitForKeyRelease .proc WaitForKeyRelease
;-------------------------------------------------- ;--------------------------------------------------
mva #128-KeyRepeatSpeed pressTimer ; tricky lda #128-KeyRepeatSpeed ; tricky
sec
sbc FirstKeypressDelay ; tricky 2 :)
sta pressTimer
StillWait StillWait
bit pressTimer bit pressTimer
bmi KeyReleased bmi KeyAutoReleased
lda STICK0 lda STICK0
and #$0f and #$0f
cmp #$0f cmp #$0f
@@ -520,6 +524,10 @@ StillWait
beq StillWait beq StillWait
.ENDIF .ENDIF
KeyReleased KeyReleased
mva #FirstKeySpeed FirstKeypressDelay
rts
KeyAutoReleased ; autorepeat
mva #0 FirstKeypressDelay
rts rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.