mirror of
https://github.com/a2-4am/4cade.git
synced 2025-01-13 05:30:32 +00:00
refactor PlayGame
This commit is contained in:
parent
10e3d05f07
commit
8e19fc9c5b
@ -9,7 +9,7 @@
|
|||||||
; D000..E5F4 - persistent data structures (per-game cheat categories,
|
; D000..E5F4 - persistent data structures (per-game cheat categories,
|
||||||
; gGlobalPrefsStore, gGamesListStore)
|
; gGlobalPrefsStore, gGamesListStore)
|
||||||
; ...unused...
|
; ...unused...
|
||||||
; EAE5..FFF9 - main program code
|
; EB42..FFF9 - main program code
|
||||||
; FFFA..FFFF - NMI, reset, IRQ vectors
|
; FFFA..FFFF - NMI, reset, IRQ vectors
|
||||||
;
|
;
|
||||||
; LC RAM BANK 2
|
; LC RAM BANK 2
|
||||||
|
@ -5,15 +5,9 @@
|
|||||||
;
|
;
|
||||||
; Public functions
|
; Public functions
|
||||||
; - GetGameDisplayName
|
; - GetGameDisplayName
|
||||||
; - PlayGameFromSearch
|
; - PlayGame
|
||||||
; - PlayGameFromBrowse
|
|
||||||
; - PlayGameFromAttract
|
|
||||||
; - Launch
|
; - Launch
|
||||||
;
|
;
|
||||||
; Public variables
|
|
||||||
; - gCurrentAttractIndex ; [byte] numeric index in gAttractModeStore of current Mega-Attract Module
|
|
||||||
; - gCurrentlyVisibleSlideshowIndex ; [byte] numeric index in gSlideshowStore of currently visible slideshow picture
|
|
||||||
; (only valid during slideshows, not updated once a key is pressed)
|
|
||||||
|
|
||||||
!zone {
|
!zone {
|
||||||
|
|
||||||
@ -23,6 +17,9 @@ GetGameDisplayName
|
|||||||
; X = #$EA if we should also look in gSlideshowStore
|
; X = #$EA if we should also look in gSlideshowStore
|
||||||
; out: C clear if game exists in gGamesListStore, and
|
; out: C clear if game exists in gGamesListStore, and
|
||||||
; A/Y points to game display name (but see hack notes below)
|
; A/Y points to game display name (but see hack notes below)
|
||||||
|
; X = game index, or #$FF if the game doesn't really exist but
|
||||||
|
; we want to return a successful result anyway (really, read the
|
||||||
|
; hack notes, they're important)
|
||||||
; C set if game does not exist (this can happen because slideshows
|
; C set if game does not exist (this can happen because slideshows
|
||||||
; list games that require a joystick, but the games list parser
|
; list games that require a joystick, but the games list parser
|
||||||
; filters out joystick-only games if the machine doesn't have a
|
; filters out joystick-only games if the machine doesn't have a
|
||||||
@ -67,70 +64,16 @@ GetGameDisplayName
|
|||||||
rts
|
rts
|
||||||
@forceGoodResult
|
@forceGoodResult
|
||||||
+LDAY @key
|
+LDAY @key
|
||||||
|
ldx #$FF
|
||||||
clc
|
clc
|
||||||
@exit rts
|
@exit rts
|
||||||
|
|
||||||
PlayGameFromSearch
|
PlayGame
|
||||||
PlayGameFromBrowse
|
gGameToLaunch=*+1
|
||||||
; in: X = game index
|
ldx #$FF ; SMC
|
||||||
+LDADDR gGamesListStore
|
+LDADDR gGamesListStore
|
||||||
jsr okvs_nth
|
jsr okvs_nth
|
||||||
; A/Y = address of game filename
|
; A/Y = address of game filename
|
||||||
bne .Go ; always branches
|
|
||||||
|
|
||||||
PlayGameFromAttract
|
|
||||||
; in: none
|
|
||||||
jsr LoadAndParseAttractModeConf
|
|
||||||
|
|
||||||
+LDADDR gAttractModeStore
|
|
||||||
gCurrentAttractIndex=*+1
|
|
||||||
ldx #$FD ; set in MegaAttractMode
|
|
||||||
jsr okvs_nth ; get filename of current attract-mode module
|
|
||||||
+STAY @key
|
|
||||||
jsr okvs_get
|
|
||||||
!word gAttractModeStore
|
|
||||||
@key !word $FDFD ; SMC
|
|
||||||
; A/Y = address of attract mode value (module type)
|
|
||||||
+STAY PTR
|
|
||||||
ldy #1
|
|
||||||
lda (PTR),y
|
|
||||||
and #$0F
|
|
||||||
bne @playFromSlideshow
|
|
||||||
|
|
||||||
; we reached here by pressing <RETURN> during a self-running demo,
|
|
||||||
; which means that @key points to the filename of the game we want to play,
|
|
||||||
+LDAY @key
|
|
||||||
jmp .Go
|
|
||||||
|
|
||||||
@playFromSlideshow
|
|
||||||
; we reached here by pressing <RETURN> during a slideshow
|
|
||||||
; gSlideshowStore is still in memory, and gCurrentlyVisibleSlideshowIndex
|
|
||||||
; is the index into gSlideshowStore of the picture that is being displayed
|
|
||||||
+LDADDR gSlideshowStore
|
|
||||||
gCurrentlyVisibleSlideshowIndex=*+1
|
|
||||||
ldx #$FD ; set in HGRTitleCallback, HGRActionCallback, DHGRTitleCallback
|
|
||||||
jsr okvs_nth
|
|
||||||
!word gSlideshowStore
|
|
||||||
+STAY @sskey
|
|
||||||
+STAY @sskey2
|
|
||||||
jsr okvs_get
|
|
||||||
!word gGamesListStore
|
|
||||||
@sskey !word $FDFD ; SMC
|
|
||||||
bcs +
|
|
||||||
+LDAY @sskey ; the slideshow key was a game filename, so use that
|
|
||||||
jmp .Go
|
|
||||||
+
|
|
||||||
; if the key is not found, get the value of the current record
|
|
||||||
; from gSlideshowStore instead (some games have multiple action screenshots, so
|
|
||||||
; the key is just a unique filename for that screenshot and the value is the
|
|
||||||
; actual game filename)
|
|
||||||
jsr okvs_get
|
|
||||||
!word gSlideshowStore
|
|
||||||
@sskey2 !word $FDFD ; SMC
|
|
||||||
; execution falls through here
|
|
||||||
|
|
||||||
.Go
|
|
||||||
; in: A/Y = lo/hi address of filename
|
|
||||||
+STAY SAVE
|
+STAY SAVE
|
||||||
+STAY +
|
+STAY +
|
||||||
+STAY @pfile
|
+STAY @pfile
|
||||||
@ -141,7 +84,7 @@ gCurrentlyVisibleSlideshowIndex=*+1
|
|||||||
ldx #$40 ; to flash previous bits of the launcher UI)
|
ldx #$40 ; to flash previous bits of the launcher UI)
|
||||||
ldy #$00
|
ldy #$00
|
||||||
tya
|
tya
|
||||||
@clear sta $FD00,y
|
@clear sta $FD00,y ; SMC
|
||||||
iny
|
iny
|
||||||
bne @clear
|
bne @clear
|
||||||
inc @clear+2
|
inc @clear+2
|
||||||
|
@ -29,8 +29,6 @@ InputLength
|
|||||||
!byte 0
|
!byte 0
|
||||||
InputBuffer
|
InputBuffer
|
||||||
!text " "
|
!text " "
|
||||||
SelectedIndex
|
|
||||||
!byte $FF
|
|
||||||
MatchCount
|
MatchCount
|
||||||
!byte 0
|
!byte 0
|
||||||
BestMatchScore
|
BestMatchScore
|
||||||
|
@ -108,17 +108,15 @@ kDFXConfFile
|
|||||||
@exit rts
|
@exit rts
|
||||||
+
|
+
|
||||||
+STAY @tfname
|
+STAY @tfname
|
||||||
stx gCurrentlyVisibleSlideshowIndex
|
|
||||||
|
|
||||||
; try to get the human-readable name of this game from gGamesListStore
|
; find this game in gGamesListStore
|
||||||
ldx #$60
|
ldx #$60
|
||||||
jsr GetGameDisplayName
|
jsr GetGameDisplayName
|
||||||
; if game is not found (C will be set here), it means it can't be played on
|
; if game is not found (C will be set here), it means it can't be played on
|
||||||
; this machine due to memory or joystick requirements, so we don't display
|
; this machine due to memory or joystick requirements, so we don't display
|
||||||
; it in slideshows
|
; it in slideshows
|
||||||
bcs @exit
|
bcs @exit
|
||||||
; (we don't actually use the display name in the title slideshow, we just
|
stx gGameToLaunch
|
||||||
; reuse the function for convenience)
|
|
||||||
|
|
||||||
; load DHGR screenshot at $4000/main and $4000/aux
|
; load DHGR screenshot at $4000/main and $4000/aux
|
||||||
jsr LoadDHRFile
|
jsr LoadDHRFile
|
||||||
@ -147,18 +145,15 @@ kDFXConfFile
|
|||||||
rts
|
rts
|
||||||
+
|
+
|
||||||
+STAY @afname
|
+STAY @afname
|
||||||
stx gCurrentlyVisibleSlideshowIndex
|
|
||||||
|
|
||||||
; try to get the human-readable name of this game from gGamesListStore
|
; find this game in gGamesListStore or gSlideshowStore
|
||||||
; or gSlideshowStore
|
|
||||||
ldx #$EA
|
ldx #$EA
|
||||||
jsr GetGameDisplayName
|
jsr GetGameDisplayName
|
||||||
; if game is not found (C will be set here), it means it can't be played on
|
; if game name is not found (C will be set here), it means the game
|
||||||
; this machine due to memory or joystick requirements, so we don't display
|
; can't be played due to memory or joystick requirements, so we hide
|
||||||
; it in slideshows
|
; it from slideshows
|
||||||
bcs @actionExit
|
bcs @actionExit
|
||||||
; (we don't actually use the display name in the DHGR action slideshow, we
|
stx gGameToLaunch
|
||||||
; just reuse the function for convenience)
|
|
||||||
|
|
||||||
; load DHGR screenshot at $4000/main and $4000/aux
|
; load DHGR screenshot at $4000/main and $4000/aux
|
||||||
jsr LoadDHRFile
|
jsr LoadDHRFile
|
||||||
|
@ -91,18 +91,15 @@ kGRFizzleFile
|
|||||||
rts
|
rts
|
||||||
+
|
+
|
||||||
+STAY @fname
|
+STAY @fname
|
||||||
stx gCurrentlyVisibleSlideshowIndex
|
|
||||||
|
|
||||||
; try to get the human-readable name of this game from gGamesListStore
|
; find this game in gGamesListStore or gSlideshowStore
|
||||||
; or gSlideshowStore
|
|
||||||
ldx #$EA
|
ldx #$EA
|
||||||
jsr GetGameDisplayName
|
jsr GetGameDisplayName
|
||||||
; if game is not found (C will be set here), it means it can't be played on
|
; if game name is not found (C will be set here), it means the game
|
||||||
; this machine due to memory or joystick requirements, so we don't display
|
; can't be played due to memory or joystick requirements, so we hide
|
||||||
; it in slideshows
|
; it from slideshows
|
||||||
bcs @actionExit
|
bcs @actionExit
|
||||||
; (we don't actually use the display name in the GR action slideshow, we
|
stx gGameToLaunch
|
||||||
; just reuse the function for convenience)
|
|
||||||
|
|
||||||
jsr LoadFile ; load GR screenshot into $6000
|
jsr LoadFile ; load GR screenshot into $6000
|
||||||
!word kGRActionDirectory
|
!word kGRActionDirectory
|
||||||
|
@ -52,17 +52,15 @@ HGRSingle
|
|||||||
@exit rts
|
@exit rts
|
||||||
+
|
+
|
||||||
+STAY @tfname
|
+STAY @tfname
|
||||||
stx gCurrentlyVisibleSlideshowIndex
|
|
||||||
|
|
||||||
; try to get the human-readable name of this game from gGamesListStore
|
; find this game in gGamesListStore
|
||||||
ldx #$60
|
ldx #$60
|
||||||
jsr GetGameDisplayName
|
jsr GetGameDisplayName
|
||||||
; if game is not found (C will be set here), it means it can't be played on
|
; if game is not found (C will be set here), it means it can't be played on
|
||||||
; this machine due to memory or joystick requirements, so we don't display
|
; this machine due to memory or joystick requirements, so we don't display
|
||||||
; it in slideshows
|
; it in slideshows
|
||||||
bcs @exit
|
bcs @exit
|
||||||
; (we don't actually use the display name in the title slideshow, we just
|
stx gGameToLaunch
|
||||||
; reuse the function for convenience)
|
|
||||||
|
|
||||||
jsr LoadFile ; load HGR screenshot at $4000
|
jsr LoadFile ; load HGR screenshot at $4000
|
||||||
!word kHGRTitleDirectory
|
!word kHGRTitleDirectory
|
||||||
@ -91,10 +89,8 @@ HGRSingle
|
|||||||
rts
|
rts
|
||||||
+
|
+
|
||||||
+STAY @afname
|
+STAY @afname
|
||||||
stx gCurrentlyVisibleSlideshowIndex
|
|
||||||
|
|
||||||
; try to get the human-readable name of this game from gGamesListStore
|
; find this game in gGamesListStore or gSlideshowStore
|
||||||
; or gSlideshowStore
|
|
||||||
ldx #$EA
|
ldx #$EA
|
||||||
jsr GetGameDisplayName
|
jsr GetGameDisplayName
|
||||||
; if game name is not found (C will be set here), it means the game
|
; if game name is not found (C will be set here), it means the game
|
||||||
@ -104,6 +100,7 @@ HGRSingle
|
|||||||
|
|
||||||
; found the game
|
; found the game
|
||||||
+STAY SAVE
|
+STAY SAVE
|
||||||
|
stx gGameToLaunch
|
||||||
|
|
||||||
jsr LoadFile ; load HGR screenshot at $4000
|
jsr LoadFile ; load HGR screenshot at $4000
|
||||||
!word kHGRActionDirectory
|
!word kHGRActionDirectory
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
;license:MIT
|
;license:MIT
|
||||||
;(c) 2018-9 by 4am
|
;(c) 2018-9 by 4am
|
||||||
;
|
;
|
||||||
; Mega Attract Mode - cycle through slideshows and self-running demos
|
; Attract Mode - cycle through slideshows and self-running demos
|
||||||
;
|
;
|
||||||
; Public functions
|
; Public functions
|
||||||
; - MegaAttractMode
|
; - MegaAttractMode
|
||||||
|
; - MiniAttractMode
|
||||||
; - RunAttractModule
|
; - RunAttractModule
|
||||||
; - LoadAndParseAttractModeConf
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; MegaAttractMode
|
; MegaAttractMode
|
||||||
@ -24,7 +24,14 @@ MegaAttractMode
|
|||||||
|
|
||||||
jsr BlankHGR ; switch to HGR page 1 (once cleared)
|
jsr BlankHGR ; switch to HGR page 1 (once cleared)
|
||||||
|
|
||||||
jsr LoadAndParseAttractModeConf
|
jsr LoadFile ; load attract-mode configuration file into $8000
|
||||||
|
!word kRootDirectory
|
||||||
|
!word kAttractModeConfFile
|
||||||
|
- !word $8000
|
||||||
|
jsr ParseKeyValueList ; parse attract-mode configuration into OKVS data structure at $6000
|
||||||
|
!word gAttractModeStore
|
||||||
|
!word -
|
||||||
|
!byte 0
|
||||||
|
|
||||||
jsr pref_get ; get attract mode module from prefs
|
jsr pref_get ; get attract mode module from prefs
|
||||||
!word kNextAttract
|
!word kNextAttract
|
||||||
@ -52,7 +59,7 @@ MegaAttractMode
|
|||||||
bpl @jmpattract
|
bpl @jmpattract
|
||||||
cmp #$8D ; Enter plays the game shown on screen.
|
cmp #$8D ; Enter plays the game shown on screen.
|
||||||
bne @jmpsearch ; Any other key switches to Search Mode.
|
bne @jmpsearch ; Any other key switches to Search Mode.
|
||||||
jsr PlayGameFromAttract ; Might return if user hits Ctrl-Reset.
|
jsr PlayGame ; (might return if user hits Ctrl-Reset)
|
||||||
@jmpattract
|
@jmpattract
|
||||||
jmp MegaAttractMode
|
jmp MegaAttractMode
|
||||||
@jmpsearch
|
@jmpsearch
|
||||||
@ -146,6 +153,10 @@ RunAttractModule
|
|||||||
jsr GetGameDisplayName
|
jsr GetGameDisplayName
|
||||||
bcc + ; if game doesn't exist, skip the demo
|
bcc + ; if game doesn't exist, skip the demo
|
||||||
rts
|
rts
|
||||||
|
+
|
||||||
|
cpx #$FF
|
||||||
|
beq +
|
||||||
|
stx gGameToLaunch
|
||||||
+
|
+
|
||||||
jsr Home ; avoid seeing code load into the HGR page
|
jsr Home ; avoid seeing code load into the HGR page
|
||||||
|
|
||||||
@ -223,17 +234,6 @@ RunAttractModule
|
|||||||
!byte >SHRSingle
|
!byte >SHRSingle
|
||||||
!byte >GRSingle
|
!byte >GRSingle
|
||||||
|
|
||||||
LoadAndParseAttractModeConf
|
kAttractModeConfFile
|
||||||
; TODO refactor launch code then make this private
|
|
||||||
jsr LoadFile ; load attract-mode configuration file into $8000
|
|
||||||
!word kRootDirectory
|
|
||||||
!word @AttractModeConfFile
|
|
||||||
- !word $8000
|
|
||||||
jsr ParseKeyValueList ; parse attract-mode configuration into OKVS data structure at $6000
|
|
||||||
!word gAttractModeStore
|
|
||||||
!word -
|
|
||||||
!byte 0
|
|
||||||
rts
|
|
||||||
@AttractModeConfFile
|
|
||||||
!byte 12
|
!byte 12
|
||||||
!text "ATTRACT.CONF"
|
!text "ATTRACT.CONF"
|
||||||
|
@ -69,10 +69,18 @@ kSFXFizzleFile
|
|||||||
.SHRArtworkCallback
|
.SHRArtworkCallback
|
||||||
bit KBD
|
bit KBD
|
||||||
bpl +
|
bpl +
|
||||||
rts
|
@exit rts
|
||||||
+
|
+
|
||||||
+STAY @sfname
|
+STAY @sfname
|
||||||
stx gCurrentlyVisibleSlideshowIndex
|
|
||||||
|
; find this game in gGamesListStore
|
||||||
|
ldx #$60
|
||||||
|
jsr GetGameDisplayName
|
||||||
|
; if game is not found (C will be set here), it means it can't be played on
|
||||||
|
; this machine due to memory or joystick requirements, so we don't display
|
||||||
|
; it in slideshows
|
||||||
|
bcs @exit
|
||||||
|
stx gGameToLaunch
|
||||||
|
|
||||||
jsr .BlankSHR
|
jsr .BlankSHR
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
BrowseMode
|
BrowseMode
|
||||||
ldx #$FF
|
ldx #$FF
|
||||||
txs
|
txs
|
||||||
ldx SelectedIndex
|
|
||||||
stx BrowseSelectedIndex
|
|
||||||
|
|
||||||
.BrowseModeInputLoop
|
.BrowseModeInputLoop
|
||||||
jsr WaitForKeyFor30Seconds
|
jsr WaitForKeyFor30Seconds
|
||||||
@ -58,12 +56,12 @@ BrowseMode
|
|||||||
jmp SearchMode
|
jmp SearchMode
|
||||||
|
|
||||||
.OnPrevious
|
.OnPrevious
|
||||||
dec BrowseSelectedIndex
|
dec gGameToLaunch
|
||||||
jmp +
|
jmp +
|
||||||
.OnNext
|
.OnNext
|
||||||
inc BrowseSelectedIndex
|
inc gGameToLaunch
|
||||||
+
|
+
|
||||||
ldx BrowseSelectedIndex
|
ldx gGameToLaunch
|
||||||
cpx #$FF
|
cpx #$FF
|
||||||
bne @notTooSmall
|
bne @notTooSmall
|
||||||
GameCount = *+1
|
GameCount = *+1
|
||||||
@ -74,12 +72,11 @@ GameCount = *+1
|
|||||||
cpx GameCount
|
cpx GameCount
|
||||||
bcc @done
|
bcc @done
|
||||||
ldx #0
|
ldx #0
|
||||||
@done stx BrowseSelectedIndex
|
@done stx gGameToLaunch
|
||||||
jmp .OnBrowseChanged
|
jmp .OnBrowseChanged
|
||||||
|
|
||||||
.OnLaunch
|
.OnLaunch
|
||||||
ldx BrowseSelectedIndex
|
jsr PlayGame
|
||||||
jsr PlayGameFromBrowse
|
|
||||||
jsr BlankHGR
|
jsr BlankHGR
|
||||||
jmp .ForceBrowseChanged
|
jmp .ForceBrowseChanged
|
||||||
|
|
||||||
@ -88,13 +85,13 @@ GameCount = *+1
|
|||||||
beq .ForceBrowseChanged ; always branches because Z=1 on exit from ToggleCheat
|
beq .ForceBrowseChanged ; always branches because Z=1 on exit from ToggleCheat
|
||||||
|
|
||||||
.OnTab
|
.OnTab
|
||||||
ldx BrowseSelectedIndex
|
ldx gGameToLaunch
|
||||||
jsr MiniAttractMode
|
jsr MiniAttractMode
|
||||||
cmp #$8D
|
cmp #$8D
|
||||||
beq .OnLaunch
|
beq .OnLaunch
|
||||||
.ForceBrowseChanged
|
.ForceBrowseChanged
|
||||||
bit CLEARKBD
|
bit CLEARKBD
|
||||||
ldx BrowseSelectedIndex
|
ldx gGameToLaunch
|
||||||
; execution falls through here
|
; execution falls through here
|
||||||
.OnBrowseChanged
|
.OnBrowseChanged
|
||||||
+LDADDR gGamesListStore
|
+LDADDR gGamesListStore
|
||||||
@ -132,9 +129,9 @@ GameCount = *+1
|
|||||||
sta UI_ToPlay,x
|
sta UI_ToPlay,x
|
||||||
dex
|
dex
|
||||||
bpl -
|
bpl -
|
||||||
ldx BrowseSelectedIndex
|
ldx gGameToLaunch
|
||||||
jsr BuildUILine1WithNoDots; build UI line 1 with bars and other shapes
|
jsr BuildUILine1WithNoDots; build UI line 1 with bars and other shapes
|
||||||
ldx BrowseSelectedIndex
|
ldx gGameToLaunch
|
||||||
jsr DrawSearchBarOffscreen; actually draw the UI (offscreen)
|
jsr DrawSearchBarOffscreen; actually draw the UI (offscreen)
|
||||||
jmp ShowOtherPage ; now show everything at once
|
jmp ShowOtherPage ; now show everything at once
|
||||||
|
|
||||||
@ -194,8 +191,4 @@ kNumBrowseKeys = 11 ; number of entries in next 2 tables (each)
|
|||||||
!byte kBrowseNext
|
!byte kBrowseNext
|
||||||
!byte kBrowsePrevious
|
!byte kBrowsePrevious
|
||||||
!byte kBrowsePrevious
|
!byte kBrowsePrevious
|
||||||
|
|
||||||
BrowseSelectedIndex
|
|
||||||
!byte $FF
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
SearchMode
|
SearchMode
|
||||||
ldx #$FF
|
ldx #$FF
|
||||||
txs
|
txs
|
||||||
stx SelectedIndex ; $FF = no game selected
|
stx gGameToLaunch ; $FF = no game selected
|
||||||
inx
|
inx
|
||||||
stx OffscreenPage ; $00 = currently showing HGR page 2
|
stx OffscreenPage ; $00 = currently showing HGR page 2
|
||||||
jsr Home ; clear screen (switches to text mode)
|
jsr Home ; clear screen (switches to text mode)
|
||||||
@ -90,7 +90,7 @@ SearchMode
|
|||||||
jmp .OnInputChanged
|
jmp .OnInputChanged
|
||||||
|
|
||||||
.OnTab
|
.OnTab
|
||||||
ldx SelectedIndex
|
ldx gGameToLaunch
|
||||||
cpx #$FF
|
cpx #$FF
|
||||||
beq .OnError
|
beq .OnError
|
||||||
jsr MiniAttractMode
|
jsr MiniAttractMode
|
||||||
@ -100,15 +100,15 @@ SearchMode
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
.OnLaunch
|
.OnLaunch
|
||||||
ldx SelectedIndex
|
ldx gGameToLaunch
|
||||||
cpx #$FF
|
cpx #$FF
|
||||||
beq .OnError
|
beq .OnError
|
||||||
jsr PlayGameFromSearch
|
jsr PlayGame
|
||||||
sec ; tell caller to redraw UI
|
sec ; tell caller to redraw UI
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.OnCheat
|
.OnCheat
|
||||||
dec SelectedIndex ; force reload (will be reset to correct value in .OnInputChanged)
|
dec gGameToLaunch ; force reload (will be reset to correct value in .OnInputChanged)
|
||||||
jsr ToggleCheat
|
jsr ToggleCheat
|
||||||
beq .OnInputChanged ; always branches because Z=1 on exit from ToggleCheat
|
beq .OnInputChanged ; always branches because Z=1 on exit from ToggleCheat
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ SearchMode
|
|||||||
bne @findMatchingTitle
|
bne @findMatchingTitle
|
||||||
; no input, reset params and UI
|
; no input, reset params and UI
|
||||||
lda #$FF
|
lda #$FF
|
||||||
sta SelectedIndex ; no game selected
|
sta gGameToLaunch ; no game selected
|
||||||
ldx #39 ; copy instructions to line 2
|
ldx #39 ; copy instructions to line 2
|
||||||
- lda Instructions,x
|
- lda Instructions,x
|
||||||
sta UILine2,x
|
sta UILine2,x
|
||||||
@ -153,9 +153,9 @@ SearchMode
|
|||||||
jmp .OnError ; beep and return
|
jmp .OnError ; beep and return
|
||||||
+
|
+
|
||||||
ldx BestMatchIndex ; check if the new best match is the same
|
ldx BestMatchIndex ; check if the new best match is the same
|
||||||
cpx SelectedIndex ; as the current best match
|
cpx gGameToLaunch ; as the current best match
|
||||||
php ; (we'll use this later to skip reloading)
|
php ; (we'll use this later to skip reloading)
|
||||||
stx SelectedIndex
|
stx gGameToLaunch
|
||||||
+LDADDR gGamesListStore
|
+LDADDR gGamesListStore
|
||||||
jsr okvs_nth ; get the name of the new best match
|
jsr okvs_nth ; get the name of the new best match
|
||||||
+STAY @key
|
+STAY @key
|
||||||
@ -204,7 +204,7 @@ SearchMode
|
|||||||
dex
|
dex
|
||||||
bpl -
|
bpl -
|
||||||
|
|
||||||
ldx SelectedIndex
|
ldx gGameToLaunch
|
||||||
jsr BuildUILine1WithNoDots; build UI line 1 with bars and other shapes
|
jsr BuildUILine1WithNoDots; build UI line 1 with bars and other shapes
|
||||||
|
|
||||||
; now add dots to UI line 1 to highlight matched characters
|
; now add dots to UI line 1 to highlight matched characters
|
||||||
@ -225,7 +225,7 @@ SearchMode
|
|||||||
cpy SAVE ; if game name is exhausted, we're done
|
cpy SAVE ; if game name is exhausted, we're done
|
||||||
bne @dotloop
|
bne @dotloop
|
||||||
@doneHighlight
|
@doneHighlight
|
||||||
ldx SelectedIndex
|
ldx gGameToLaunch
|
||||||
jsr DrawSearchBarOffscreen; actually draw the search UI (offscreen)
|
jsr DrawSearchBarOffscreen; actually draw the search UI (offscreen)
|
||||||
jmp ShowOtherPage ; now show everything at once
|
jmp ShowOtherPage ; now show everything at once
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user