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 rts
.endp .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 .proc WaitForKeyRelease
;-------------------------------------------------- ;--------------------------------------------------
+13 -2
View File
@@ -78,7 +78,7 @@
OptionsMainLoop OptionsMainLoop
jsr OptionsInversion jsr OptionsInversion
jsr getkey jsr GetKey
bit escFlag bit escFlag
spl:rts spl:rts
@@ -124,11 +124,16 @@ OptionsNoLeft
OptionsNoRight OptionsNoRight
cmp #@kbcode._ret ; $c ;Return key cmp #@kbcode._ret ; $c ;Return key
bne OptionsNoReturn bne OptionsNoReturn
; wait for long press
jsr WaitForLongPress
bcs TabPressed ; if long press (fire or Return)
EndOfOptions
rts ; options selected rts ; options selected
OptionsNoReturn OptionsNoReturn
cmp #@kbcode._tab ; Tab key cmp #@kbcode._tab ; Tab key
bne OptionsNoTab bne OptionsNoTab
TabPressed
jsr SelectNextGradient jsr SelectNextGradient
OptionsNoTab OptionsNoTab
jmp OptionsMainLoop jmp OptionsMainLoop
@@ -409,7 +414,13 @@ ChoosingItemForPurchase
cmp #@kbcode._left ; $06 ; cursor left cmp #@kbcode._left ; $06 ; cursor left
jeq ListChange jeq ListChange
cmp #@kbcode._ret ; $0c ; Return 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 cmp #@kbcode._up ; $e
beq PurchaseKeyUp beq PurchaseKeyUp
cmp #@kbcode._down ; $f cmp #@kbcode._down ; $f
BIN
View File
Binary file not shown.
+3 -6
View File
@@ -1520,12 +1520,9 @@ pressedSpace
;we shoot here!!! ;we shoot here!!!
lda #0 lda #0
sta ATRACT ; reset atract mode sta ATRACT ; reset atract mode
sta pressTimer ; reset jsr WaitForLongPress
jsr WaitForKeyRelease.StillWait bcc fire ; short press
lda pressTimer jmp callInventory ; long press
cmp #25 ; 1/2s
bcc fire
jmp callInventory
fire fire
RTS RTS
.endp .endp