From 2b9c727e540d360d0dd526865b6384bca99d2918 Mon Sep 17 00:00:00 2001 From: 4am Date: Tue, 17 Apr 2018 14:06:41 -0400 Subject: [PATCH] minor refactor --- src/glue.onbeyond.a | 32 ++++++++++++-------------------- src/ui.resume.a | 2 +- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/glue.onbeyond.a b/src/glue.onbeyond.a index 56f06c2..08bf3b5 100644 --- a/src/glue.onbeyond.a +++ b/src/glue.onbeyond.a @@ -43,26 +43,22 @@ ClearInterpreterOptions bpl - rts +LaunchInterpreterWithNewGame + lda #$FF + ; execution falls through here ;------------------------------------------------------------------------------ -; LaunchInterpreterWithNewGame -; load interpreter and launch it with a game based on global preferences store -; +; LaunchInterpreterWithGame +; load interpreter and launch it with a game based on global preferences store, +; and tell it to restore from a specific saved game slot +; in: A = saved game slot, or #$FF for none ; in: current ProDOS prefix is the same as the PITCH.DARK file ; out: returns with C set if interpreter could not be loaded or game ; directory could not be found ; otherwise does not return (calls ExitWeeGUI and jumps to interpreter) ; gPathname clobbered ;------------------------------------------------------------------------------ -LaunchInterpreterWithNewGame - lda #$FF - ; execution falls through here -;------------------------------------------------------------------------------ -; LaunchInterpreterWithSavedGame -; load interpreter and launch it with a game based on global preferences store, -; and tell it to restore from a specific saved game slot -; in: A = saved game slot, or #$FF for none -LaunchInterpreterWithSavedGame - sta iRestoreSlot +LaunchInterpreterWithGame + sta kOnBeyondAutoRestore jsr SaveGlobalPreferences jsr LoadInterpreter bcs .launchError @@ -85,7 +81,7 @@ LaunchInterpreterWithSavedGame ;------------------------------------------------------------------------------ LaunchInterpreterWithHints lda #$FF - sta iRestoreSlot ; no saved game to restore + sta kOnBeyondAutoRestore ; no saved game to restore jsr SaveGlobalPreferences jsr LoadInterpreter bcs .launchError @@ -115,7 +111,7 @@ LaunchInterpreterWithHints ; SetInterpreterOptions ; set options struct based on global preferences store ; -; in: none +; in: kOnBeyondAutoRestore already set (save slot 0-7, or #$FF if none) ; out: all registers and flags clobbered ;------------------------------------------------------------------------------ SetInterpreterOptions @@ -150,10 +146,6 @@ SetInterpreterOptionsExceptForce40 + lda #1 sta kOnBeyondCase -iRestoreSlot=*+1 - lda #$FD ; SMC - sta kOnBeyondAutoRestore - jsr okvs_get !word gGlobalPrefsStore !word kScriptToFile @@ -180,7 +172,7 @@ iRestoreSlot=*+1 lda #$A5 eor kOnBeyondColumns eor kOnBeyondCase - eor kOnBeyondAutoRestore + eor kOnBeyondAutoRestore ; caller must have set this already eor kOnBeyondScriptToFile eor kOnBeyondAutoScript eor kOnBeyondWarnMissing diff --git a/src/ui.resume.a b/src/ui.resume.a index 434e46f..d161dd4 100644 --- a/src/ui.resume.a +++ b/src/ui.resume.a @@ -227,7 +227,7 @@ callback_resume_ok bne + lda #0 + dec ; A = saved game slot (which is WeeGUI view ID - 1) or #$FF - jmp LaunchInterpreterWithSavedGame + jmp LaunchInterpreterWithGame callback_resume_cancel = MainScreen