use gGamesListStore less

This commit is contained in:
4am 2021-10-28 01:28:20 -04:00
parent 1cbbb972fc
commit f96b71ffc2
7 changed files with 14 additions and 16 deletions

View File

@ -10,7 +10,7 @@
; ...unused... ; ...unused...
; E000..E3FF - HGR font data ; E000..E3FF - HGR font data
; ...unused... ; ...unused...
; E962..FFEE - main program code ; E978..FFEE - main program code
; FFEF..FFF9 - API functions and global constants available for main program ; FFEF..FFF9 - API functions and global constants available for main program
; code, prelaunchers, transition effects, &c. ; code, prelaunchers, transition effects, &c.
; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus) ; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)

View File

@ -4,10 +4,10 @@
; Functions to launch games and self-running demos ; Functions to launch games and self-running demos
; ;
; Public functions ; Public functions
; - AnyGameSelected
; - GetGameToLaunch ; - GetGameToLaunch
; - FindGame ; - FindGame
; - FindGameInActionSlideshow ; - FindGameInActionSlideshow
; - GetGameDisplayName
; - PlayGame ; - PlayGame
; - Launch ; - Launch
; ;
@ -37,7 +37,8 @@ AnyGameSelected
; GetGameToLaunch ; GetGameToLaunch
; get filename of game that is currently selected in the UI (if any) ; get filename of game that is currently selected in the UI (if any)
; ;
; in: gGameToLaunch = index into gGamesListStore (word) or #$FFFF if no game selected ; in: gGameToLaunch = index into gSearchStore (word) or #$FFFF if no game selected
; gSearchStore populated
; out: C clear if a game is selected, and ; out: C clear if a game is selected, and
; A/Y points to game filename ; A/Y points to game filename
; C set if no game is selected ; C set if no game is selected
@ -46,7 +47,7 @@ GetGameToLaunch
jsr AnyGameSelected jsr AnyGameSelected
bcs _gameToLaunchExit bcs _gameToLaunchExit
+ST16 WINDEX +ST16 WINDEX
+LDADDR gGamesListStore +LDADDR gSearchStore
jsr okvs_nth jsr okvs_nth
ForceGoodResult ForceGoodResult
clc clc

View File

@ -13,7 +13,7 @@
; slow down to 1 Mhz (always), then check if there is an animation for the ; slow down to 1 Mhz (always), then check if there is an animation for the
; title screenshot we just displayed, and if so, load it and call it ; title screenshot we just displayed, and if so, load it and call it
; ;
; in: none ; in: gSearchStore is populated
; out: C clear ; out: C clear
; all other flags clobbered ; all other flags clobbered
; all registers clobbered ; all registers clobbered
@ -61,7 +61,7 @@ MaybeAnimateTitle
bit $c050 ; turn on graphics mode (Home set text mode) bit $c050 ; turn on graphics mode (Home set text mode)
jsr Launch ; execute the animation jsr Launch ; execute the animation
jsr BuildSearchStore jsr ReloadSearchIndex
jsr ResyncPage ; we don't know which HGR page is showing jsr ResyncPage ; we don't know which HGR page is showing
; when the animation returns, so resync ; when the animation returns, so resync
; the current one with our OffscreenPage ; the current one with our OffscreenPage

View File

@ -54,6 +54,7 @@ MegaAttractMode
bpl MegaAttractMode bpl MegaAttractMode
cmp #$8D ; Enter plays the game shown on screen. cmp #$8D ; Enter plays the game shown on screen.
bne + ; Any other key switches to Search Mode. bne + ; Any other key switches to Search Mode.
jsr ReloadSearchIndex
jsr PlayGame ; (might return if user hits Ctrl-Reset) jsr PlayGame ; (might return if user hits Ctrl-Reset)
+ jmp SearchMode + jmp SearchMode
@ -61,7 +62,8 @@ MegaAttractMode
; MiniAttractMode ; MiniAttractMode
; run attract modules related to one game ; run attract modules related to one game
; ;
; in: gGameToLaunch = index in gGamesListStore (word) ; in: gGameToLaunch = index in gSearchStore (word)
; gSearchStore populated
; out: all flags and registers clobbered ; out: all flags and registers clobbered
; assume all of main memory has been clobbered ; assume all of main memory has been clobbered
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -84,10 +84,7 @@ LoadOffscreenFromAY
LoadGameTitleOffscreen LoadGameTitleOffscreen
; in: gGameToLaunch = index into gSearchStore (word) ; in: gGameToLaunch = index into gSearchStore (word)
+LD16 gGameToLaunch jsr GetGameToLaunch
+ST16 WINDEX
+LDADDR gSearchStore
jsr okvs_nth ; A/Y -> key (game filename) in gSearchStore
+ST16 @fname +ST16 @fname
bit MachineStatus ; if < 128K, don't bother checking for DHGR title bit MachineStatus ; if < 128K, don't bother checking for DHGR title
bvc @hgr bvc @hgr

View File

@ -122,11 +122,9 @@ DrawUI
sta gPathname ; hack, used by first RedrawForDHGR which follows sta gPathname ; hack, used by first RedrawForDHGR which follows
; Draw40Chars which doesn't set gPathname ; Draw40Chars which doesn't set gPathname
jsr AnyGameSelected ; get index number of current game, if any jsr GetGameToLaunch ; get current game, if any
bcs @doneWithLine2 ; if no game, nothing more to do on UI line 2 bcs @doneWithLine2 ; if no game, nothing more to do on UI line 2
+ST16 WINDEX ; A/Y -> key of current game (in gSearchStore)
+LDADDR gSearchStore
jsr okvs_nth ; A/Y -> key of current game (in gSearchStore)
jsr okvs_get_current ; (PTR) -> display name of current game jsr okvs_get_current ; (PTR) -> display name of current game
; Y = 0 ; Y = 0
lda (PTR), y lda (PTR), y

View File

@ -112,7 +112,7 @@ SearchMode
txs txs
stx gGameToLaunch ; $FFFF = no game selected stx gGameToLaunch ; $FFFF = no game selected
stx gGameToLaunch+1 stx gGameToLaunch+1
jsr BuildSearchStore jsr ReloadSearchIndex
jsr Home ; clear screen (switches to text mode) jsr Home ; clear screen (switches to text mode)
stx OffscreenPage ; don't show text page 2 by accident stx OffscreenPage ; don't show text page 2 by accident
jsr OnInputChanged ; draw UI offscreen jsr OnInputChanged ; draw UI offscreen