Added support for long button press in the main menu (like Tab) and in the activation menu (activation).

This commit is contained in:
Pecusx
2023-11-08 09:48:44 +01:00
parent 44610ec89e
commit dfef25c7b2
4 changed files with 27 additions and 8 deletions
+11
View File
@@ -108,6 +108,17 @@ Check2button
rts
.endp
;--------------------------------------------------
.proc WaitForLongPress
;--------------------------------------------------
lda #0
sta pressTimer ; reset
jsr WaitForKeyRelease.StillWait
lda pressTimer
cmp #25 ; 1/2s
rts ; if CARRY is set then long press
.endp
;--------------------------------------------------
.proc WaitForKeyRelease
;--------------------------------------------------
+13 -2
View File
@@ -78,7 +78,7 @@
OptionsMainLoop
jsr OptionsInversion
jsr getkey
jsr GetKey
bit escFlag
spl:rts
@@ -124,11 +124,16 @@ OptionsNoLeft
OptionsNoRight
cmp #@kbcode._ret ; $c ;Return key
bne OptionsNoReturn
; wait for long press
jsr WaitForLongPress
bcs TabPressed ; if long press (fire or Return)
EndOfOptions
rts ; options selected
OptionsNoReturn
cmp #@kbcode._tab ; Tab key
bne OptionsNoTab
TabPressed
jsr SelectNextGradient
OptionsNoTab
jmp OptionsMainLoop
@@ -409,7 +414,13 @@ ChoosingItemForPurchase
cmp #@kbcode._left ; $06 ; cursor left
jeq ListChange
cmp #@kbcode._ret ; $0c ; Return
sne:rts
bne NoReturn
jsr WaitForLongPress
bcc exitthismenu ; short press
jmp PurchaseWeaponNow ; long press
exitthismenu
rts
NoReturn
cmp #@kbcode._up ; $e
beq PurchaseKeyUp
cmp #@kbcode._down ; $f