launch from search mode

This commit is contained in:
4am 2019-06-20 14:18:23 -04:00
parent c9f40539a7
commit 2ae86337c5
2 changed files with 32 additions and 18 deletions

View File

@ -12,6 +12,18 @@
; (only valid during slideshows, not updated once a key is pressed) ; (only valid during slideshows, not updated once a key is pressed)
Play Play
lda Mode
bmi @playFromAttract
@playFromSearch
lda SelectedIndex
sta @selectedIndex
jsr okvs_nth
!word gGamesListStore
@selectedIndex
!byte $FD ; SMC
jmp Go
@playFromAttract
+LDADDR kAttractModeConfFile +LDADDR kAttractModeConfFile
jsr SetPath jsr SetPath
jsr LoadFile ; load attract-mode configuration file at $8000 jsr LoadFile ; load attract-mode configuration file at $8000

View File

@ -46,14 +46,19 @@ InputLoop
sta Mode ; switch to attract mode sta Mode ; switch to attract mode
rts rts
+ +
cmp #$9B ; Esc with no input returns to caller jsr _ResetInputTimeout
bne + ; and switches to attract mode
ldx InputLength cmp #$9B ; Esc clears the input buffer
bne + bne +
rts ldx #kInputClear
bne InputDispatch ; always branches
+
cmp #$8D ; ENTER launches the current game (if any)
bne +
ldx #kInputLaunch
bne InputDispatch ; always branches
+ +
bit $C010 bit $C010
jsr _ResetInputTimeout
and #$7F and #$7F
cmp #$7F ; delete key cmp #$7F ; delete key
@ -64,16 +69,6 @@ InputLoop
+ cmp #$08 ; left arrow = delete + cmp #$08 ; left arrow = delete
beq - beq -
cmp #$1B ; Esc clears the input buffer
bne +
ldx #kInputClear
bne InputDispatch ; always branches
cmp #$0D ; ENTER launches the current game (if any)
bne +
ldx #kInputLaunch
bne InputDispatch ; always branches
+
cmp #$30 ; control keys and punctuation ignored cmp #$30 ; control keys and punctuation ignored
bcc @badkey bcc @badkey
cmp #$3A ; numbers are good input cmp #$3A ; numbers are good input
@ -113,10 +108,12 @@ InputDispatch
OnClear OnClear
ldx InputLength ldx InputLength
bne + bne +
jsr SoftBell pla ; Esc with no input exits search mode
pla ; and switches to attract mode
rts rts
+ ldx #0 + ldx #0
stx InputLength stx InputLength
bit $c010
jmp OnInputChanged jmp OnInputChanged
OnBack OnBack
@ -125,11 +122,16 @@ OnBack
jsr SoftBell jsr SoftBell
rts rts
+ dec InputLength + dec InputLength
bit $c010
jmp OnInputChanged jmp OnInputChanged
OnLaunch OnLaunch
; TODO ldx SelectedIndex
rts cpx #$FF
beq +
pla ; Return exits search mode
pla ; and launches game
+ rts
OnSearch OnSearch
ldx InputLength ldx InputLength