From 2ae86337c56998afafe67f7cf8a5fd38d124ae5b Mon Sep 17 00:00:00 2001 From: 4am Date: Thu, 20 Jun 2019 14:18:23 -0400 Subject: [PATCH] launch from search mode --- src/glue.launch.a | 12 ++++++++++++ src/ui.search.mode.a | 38 ++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/glue.launch.a b/src/glue.launch.a index 34a8f6d0a..00b92d01f 100644 --- a/src/glue.launch.a +++ b/src/glue.launch.a @@ -12,6 +12,18 @@ ; (only valid during slideshows, not updated once a key is pressed) Play + lda Mode + bmi @playFromAttract +@playFromSearch + lda SelectedIndex + sta @selectedIndex + jsr okvs_nth + !word gGamesListStore +@selectedIndex + !byte $FD ; SMC + jmp Go + +@playFromAttract +LDADDR kAttractModeConfFile jsr SetPath jsr LoadFile ; load attract-mode configuration file at $8000 diff --git a/src/ui.search.mode.a b/src/ui.search.mode.a index 1c7d61448..f87b45070 100644 --- a/src/ui.search.mode.a +++ b/src/ui.search.mode.a @@ -46,14 +46,19 @@ InputLoop sta Mode ; switch to attract mode rts + - cmp #$9B ; Esc with no input returns to caller - bne + ; and switches to attract mode - ldx InputLength + jsr _ResetInputTimeout + + cmp #$9B ; Esc clears the input buffer 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 - jsr _ResetInputTimeout and #$7F cmp #$7F ; delete key @@ -64,16 +69,6 @@ InputLoop + cmp #$08 ; left arrow = delete 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 bcc @badkey cmp #$3A ; numbers are good input @@ -113,10 +108,12 @@ InputDispatch OnClear ldx InputLength bne + - jsr SoftBell + pla ; Esc with no input exits search mode + pla ; and switches to attract mode rts + ldx #0 stx InputLength + bit $c010 jmp OnInputChanged OnBack @@ -125,11 +122,16 @@ OnBack jsr SoftBell rts + dec InputLength + bit $c010 jmp OnInputChanged OnLaunch - ; TODO - rts + ldx SelectedIndex + cpx #$FF + beq + + pla ; Return exits search mode + pla ; and launches game ++ rts OnSearch ldx InputLength