minor refactor

This commit is contained in:
4am 2018-04-17 14:06:41 -04:00
parent fc73f51afe
commit 2b9c727e54
2 changed files with 13 additions and 21 deletions

View File

@ -43,26 +43,22 @@ ClearInterpreterOptions
bpl - bpl -
rts rts
LaunchInterpreterWithNewGame
lda #$FF
; execution falls through here
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; LaunchInterpreterWithNewGame ; LaunchInterpreterWithGame
; load interpreter and launch it with a game based on global preferences store ; 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 ; 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 ; out: returns with C set if interpreter could not be loaded or game
; directory could not be found ; directory could not be found
; otherwise does not return (calls ExitWeeGUI and jumps to interpreter) ; otherwise does not return (calls ExitWeeGUI and jumps to interpreter)
; gPathname clobbered ; gPathname clobbered
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
LaunchInterpreterWithNewGame LaunchInterpreterWithGame
lda #$FF sta kOnBeyondAutoRestore
; 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
jsr SaveGlobalPreferences jsr SaveGlobalPreferences
jsr LoadInterpreter jsr LoadInterpreter
bcs .launchError bcs .launchError
@ -85,7 +81,7 @@ LaunchInterpreterWithSavedGame
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
LaunchInterpreterWithHints LaunchInterpreterWithHints
lda #$FF lda #$FF
sta iRestoreSlot ; no saved game to restore sta kOnBeyondAutoRestore ; no saved game to restore
jsr SaveGlobalPreferences jsr SaveGlobalPreferences
jsr LoadInterpreter jsr LoadInterpreter
bcs .launchError bcs .launchError
@ -115,7 +111,7 @@ LaunchInterpreterWithHints
; SetInterpreterOptions ; SetInterpreterOptions
; set options struct based on global preferences store ; 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 ; out: all registers and flags clobbered
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
SetInterpreterOptions SetInterpreterOptions
@ -150,10 +146,6 @@ SetInterpreterOptionsExceptForce40
+ lda #1 + lda #1
sta kOnBeyondCase sta kOnBeyondCase
iRestoreSlot=*+1
lda #$FD ; SMC
sta kOnBeyondAutoRestore
jsr okvs_get jsr okvs_get
!word gGlobalPrefsStore !word gGlobalPrefsStore
!word kScriptToFile !word kScriptToFile
@ -180,7 +172,7 @@ iRestoreSlot=*+1
lda #$A5 lda #$A5
eor kOnBeyondColumns eor kOnBeyondColumns
eor kOnBeyondCase eor kOnBeyondCase
eor kOnBeyondAutoRestore eor kOnBeyondAutoRestore ; caller must have set this already
eor kOnBeyondScriptToFile eor kOnBeyondScriptToFile
eor kOnBeyondAutoScript eor kOnBeyondAutoScript
eor kOnBeyondWarnMissing eor kOnBeyondWarnMissing

View File

@ -227,7 +227,7 @@ callback_resume_ok
bne + bne +
lda #0 lda #0
+ dec ; A = saved game slot (which is WeeGUI view ID - 1) or #$FF + dec ; A = saved game slot (which is WeeGUI view ID - 1) or #$FF
jmp LaunchInterpreterWithSavedGame jmp LaunchInterpreterWithGame
callback_resume_cancel = MainScreen callback_resume_cancel = MainScreen