diff --git a/src/constants.a b/src/constants.a index 7ce5a6248..7d02bd3fa 100644 --- a/src/constants.a +++ b/src/constants.a @@ -9,7 +9,7 @@ ; D000..E611 - persistent data structures (per-game cheat categories, ; gGlobalPrefsStore, gGamesListStore) ; ...unused... -; EC0C..FFF9 - main program code +; EC22..FFF9 - main program code ; FFFA..FFFF - NMI, reset, IRQ vectors ; ; LC RAM BANK 2 diff --git a/src/glue.launch.a b/src/glue.launch.a index b4e533898..d0c801ae9 100644 --- a/src/glue.launch.a +++ b/src/glue.launch.a @@ -4,6 +4,7 @@ ; Functions to launch games and self-running demos ; ; Public functions +; - GetGameToLaunch ; - GetGameInfo ; - GetGameInfoInActionSlideshow ; - PlayGame @@ -13,6 +14,14 @@ ; - gGameToLaunch - 0-based index into gGamesListStore ; +GetGameToLaunch +; in: gGameToLaunch = index into gGamesListStore +; out: A/Y points to game filename +gGameToLaunch=*+1 + ldx #$FF ; SMC + +LDADDR gGamesListStore + jmp okvs_nth + GetGameInfo ; in: A/Y points to game filename ; out: C clear if game exists in gGamesListStore, and @@ -73,10 +82,7 @@ GetGameInfoInActionSlideshow @exit rts PlayGame -gGameToLaunch=*+1 - ldx #$FF ; SMC - +LDADDR gGamesListStore - jsr okvs_nth + jsr GetGameToLaunch ; A/Y = address of game filename +STAY SAVE +STAY @pfile ; assume we're loading a game-specific prelaunch file diff --git a/src/ui.animation.a b/src/ui.animation.a index 381ca6a01..b9ef7708a 100644 --- a/src/ui.animation.a +++ b/src/ui.animation.a @@ -41,13 +41,12 @@ MaybeAnimateTitle dex bne @a - +LDADDR gGamesListStore ; if so, load the animation routine - ldx gGameToLaunch ; which is stored in a subdirectory - jsr okvs_nth ; and keyed off the current game's - +STAY @fname ; filename + jsr GetGameToLaunch ; load the animation routine, which is + ; stored in a subdirectory by filename + +STAY + jsr LoadFile !word kAnimatedTitleDirectory -@fname !word $FDFD ++ !word $FDFD !word 0 ldy kAnimatedTitleDirectory diff --git a/src/ui.attract.mode.a b/src/ui.attract.mode.a index 98688bddf..16b24d149 100644 --- a/src/ui.attract.mode.a +++ b/src/ui.attract.mode.a @@ -69,15 +69,13 @@ MegaAttractMode ; MiniAttractMode ; run attract modules related to one game ; -; in: X = index in gGamesListStore -; gGlobalPrefsStore must be initialized +; in: gGameToLaunch = index in gGamesListStore ; out: all flags and registers clobbered ; assume all of main memory has been clobbered ;------------------------------------------------------------------------------ MiniAttractMode - +LDADDR gGamesListStore - jsr okvs_nth - +STAY @fname + jsr GetGameToLaunch + +STAY + jsr BlankHGR @@ -86,7 +84,7 @@ MiniAttractMode @loop jsr LoadFile ; load mini attract mode configuration file into $8000 !word kMiniAttractDirectory -@fname !word $FDFD ; SMC ++ !word $FDFD ; SMC - !word $8000 jsr ParseKeyValueList ; parse configuration into OKVS data structure at $6000 diff --git a/src/ui.browse.mode.a b/src/ui.browse.mode.a index ef215db3b..d0dfe5169 100644 --- a/src/ui.browse.mode.a +++ b/src/ui.browse.mode.a @@ -99,7 +99,6 @@ OnBrowseCheat beq ForceBrowseChanged ; always branches because Z=1 on exit from ToggleCheat OnBrowseTab - ldx gGameToLaunch jsr MiniAttractMode cmp #$8D beq OnBrowseLaunch @@ -111,7 +110,6 @@ OnBrowseChanged ; in: gGameToLaunch = game index jsr SwitchToBank2 jsr EnableAcceleratorAndSwitchToBank1 - ldx gGameToLaunch jsr LoadGameTitleOffscreen jsr DrawUIWithoutDots jsr SwitchToBank2 diff --git a/src/ui.offscreen.a b/src/ui.offscreen.a index c6f106fd6..34f05d3ac 100644 --- a/src/ui.offscreen.a +++ b/src/ui.offscreen.a @@ -89,17 +89,16 @@ LoadOffscreenFromAY rts LoadGameTitleOffscreen -; in: X = game index - +LDADDR gGamesListStore - jsr okvs_nth - +STAY @fname +; in: gGameToLaunch = index into gGamesListStore + jsr GetGameToLaunch + +STAY + jsr GetOffscreenAddress - sta + + sta ++ jsr LoadFile !word kHGRTitleDirectory -@fname !word $FDFD ; SMC ++ !word $FDFD ; SMC !byte $00 -+ !byte $FD ; SMC +++ !byte $FD ; SMC rts ;------------------------------------------------------------------------------ diff --git a/src/ui.overlay.a b/src/ui.overlay.a index f3ece97a9..012ca69fe 100644 --- a/src/ui.overlay.a +++ b/src/ui.overlay.a @@ -95,8 +95,7 @@ DrawUI cpx #$FF ; if no game, nothing more to do on UI line 2 beq @doneWithLine2 - +LDADDR gGamesListStore - jsr okvs_nth + jsr GetGameToLaunch jsr okvs_get_current ; (PTR) -> game title ldy #0 ; copy game title into UI line 2