mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2024-06-26 15:29:31 +00:00
.
This commit is contained in:
parent
26ca136cd6
commit
ec788a01f7
140
src/launch.a
140
src/launch.a
|
@ -7,30 +7,65 @@
|
||||||
; - ClearInterpreterOptions
|
; - ClearInterpreterOptions
|
||||||
; - SetInterpreterOptions
|
; - SetInterpreterOptions
|
||||||
; - SetInterpreterOptionsExceptForce40
|
; - SetInterpreterOptionsExceptForce40
|
||||||
; - LoadInterpreter
|
; - LaunchInterpreterWithGame
|
||||||
; - LaunchInterpreter
|
; - LaunchInterpreterWithHints
|
||||||
;
|
;
|
||||||
|
|
||||||
|
kOnBeyondOptionsStruct = $0300
|
||||||
|
kOnBeyondColumns = $0300
|
||||||
|
kOnBeyondCase = $0301
|
||||||
|
kOnBeyondAutoRestore = $0302
|
||||||
|
kOnBeyondScriptToFile = $0303
|
||||||
|
kOnBeyondAutoScript = $0304
|
||||||
|
kOnBeyondWarnMissing = $0305
|
||||||
|
kOnBeyondChecksum = $0306
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; ClearInterpreterOptions
|
||||||
|
; clear options script and make checksum invalid
|
||||||
|
;
|
||||||
|
; in: none
|
||||||
|
; out: A/Y clobbered
|
||||||
|
; X preserved
|
||||||
|
; all flags clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
ClearInterpreterOptions
|
ClearInterpreterOptions
|
||||||
ldy #6
|
ldy #6
|
||||||
lda #0
|
lda #0
|
||||||
- sta $0300,y
|
- sta kOnBeyondOptionsStruct,y
|
||||||
dey
|
dey
|
||||||
bpl -
|
bpl -
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; SetInterpreterOptions
|
||||||
|
; set options struct based on global preferences store
|
||||||
|
;
|
||||||
|
; in: none
|
||||||
|
; out: all registers and flags clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
SetInterpreterOptions
|
SetInterpreterOptions
|
||||||
jsr okvs_get
|
jsr okvs_get
|
||||||
!word gGlobalPrefsStore
|
!word gGlobalPrefsStore
|
||||||
!word kForce40
|
!word kForce40
|
||||||
jsr okvs_as_boolean
|
jsr okvs_as_boolean
|
||||||
beq +
|
beq SetInterpreterOptionsExceptForce40
|
||||||
lda #$CE
|
lda #$CE
|
||||||
!byte $2C
|
!byte $2C
|
||||||
+
|
; execution falls through here
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; SetInterpreterOptionsExceptForce40
|
||||||
|
; set options struct based on global preferences store, except always specify
|
||||||
|
; 80-column mode (used to launch PRIZM hint files)
|
||||||
|
;
|
||||||
|
; in: none
|
||||||
|
; out: all registers and flags clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
SetInterpreterOptionsExceptForce40
|
SetInterpreterOptionsExceptForce40
|
||||||
lda #$D9
|
lda #$D9
|
||||||
sta $0300 ; 40/80 columns
|
sta kOnBeyondColumns
|
||||||
|
|
||||||
jsr okvs_get
|
jsr okvs_get
|
||||||
!word gGlobalPrefsStore
|
!word gGlobalPrefsStore
|
||||||
!word kForceUpper
|
!word kForceUpper
|
||||||
|
@ -39,10 +74,10 @@ SetInterpreterOptionsExceptForce40
|
||||||
lda #0
|
lda #0
|
||||||
!byte $2C
|
!byte $2C
|
||||||
+ lda #1
|
+ lda #1
|
||||||
sta $0301 ; case
|
sta kOnBeyondCase
|
||||||
|
|
||||||
lda #$FF
|
lda #$FF ; TODO this will eventually be set based on 'Resume Game' screen
|
||||||
sta $0302 ; auto-restore
|
sta kOnBeyondAutoRestore
|
||||||
|
|
||||||
jsr okvs_get
|
jsr okvs_get
|
||||||
!word gGlobalPrefsStore
|
!word gGlobalPrefsStore
|
||||||
|
@ -52,7 +87,7 @@ SetInterpreterOptionsExceptForce40
|
||||||
lda #1
|
lda #1
|
||||||
!byte $2C
|
!byte $2C
|
||||||
+ lda #0
|
+ lda #0
|
||||||
sta $0303 ; script-to-file
|
sta kOnBeyondScriptToFile
|
||||||
|
|
||||||
jsr okvs_get
|
jsr okvs_get
|
||||||
!word gGlobalPrefsStore
|
!word gGlobalPrefsStore
|
||||||
|
@ -62,27 +97,35 @@ SetInterpreterOptionsExceptForce40
|
||||||
lda #1
|
lda #1
|
||||||
!byte $2C
|
!byte $2C
|
||||||
+ lda #0
|
+ lda #0
|
||||||
sta $0304 ; auto-script
|
sta kOnBeyondAutoScript
|
||||||
|
|
||||||
lda #1
|
lda #0 ; never warn, YOLO
|
||||||
sta $0305 ; warn on missing .sav files
|
sta kOnBeyondWarnMissing
|
||||||
|
|
||||||
lda #$A5
|
lda #$A5
|
||||||
eor $0300
|
eor kOnBeyondColumns
|
||||||
eor $0301
|
eor kOnBeyondCase
|
||||||
eor $0302
|
eor kOnBeyondAutoRestore
|
||||||
eor $0303
|
eor kOnBeyondScriptToFile
|
||||||
eor $0304
|
eor kOnBeyondAutoScript
|
||||||
eor $0305
|
eor kOnBeyondWarnMissing
|
||||||
sta $0306
|
sta kOnBeyondChecksum
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.playError
|
;------------------------------------------------------------------------------
|
||||||
jmp SoftBell
|
; LaunchInterpreterWithGame
|
||||||
LaunchInterpreter
|
; load interpreter and launch it with a game based on global preferences store
|
||||||
|
;
|
||||||
|
; 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
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
LaunchInterpreterWithGame
|
||||||
jsr SaveGlobalPreferences
|
jsr SaveGlobalPreferences
|
||||||
jsr LoadInterpreter
|
jsr LoadInterpreter
|
||||||
bcs .playError
|
bcs .launchError
|
||||||
|
|
||||||
jsr ResetPath
|
jsr ResetPath
|
||||||
+LDADDR kGameRootDirectory
|
+LDADDR kGameRootDirectory
|
||||||
|
@ -91,12 +134,12 @@ LaunchInterpreter
|
||||||
jsr okvs_get
|
jsr okvs_get
|
||||||
!word gGlobalPrefsStore
|
!word gGlobalPrefsStore
|
||||||
!word kLastPlayed
|
!word kLastPlayed
|
||||||
+STAY +
|
+STAY + ; A/Y contains address
|
||||||
jsr AddToPath
|
jsr AddToPath
|
||||||
|
|
||||||
jsr SetPrefix ; set ProDOS prefix to game directory
|
jsr SetPrefix ; set ProDOS prefix to game directory
|
||||||
!word gPathname
|
!word gPathname
|
||||||
bcs .playError
|
bcs .launchError
|
||||||
|
|
||||||
jsr okvs_get
|
jsr okvs_get
|
||||||
!word gGlobalPrefsStore
|
!word gGlobalPrefsStore
|
||||||
|
@ -106,7 +149,51 @@ LaunchInterpreter
|
||||||
jsr ExitWeeGUI ; shut down WeeGUI
|
jsr ExitWeeGUI ; shut down WeeGUI
|
||||||
jsr SetInterpreterOptions ; set options struct at $300
|
jsr SetInterpreterOptions ; set options struct at $300
|
||||||
jmp kSystemAddress ; exit via interpreter
|
jmp kSystemAddress ; exit via interpreter
|
||||||
|
.launchError
|
||||||
|
jmp SoftBell
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; LaunchInterpreterWithHints
|
||||||
|
; load interpreter and launch it with the hints file for the current game
|
||||||
|
;
|
||||||
|
; in: current ProDOS prefix is the same as the PITCH.DARK file
|
||||||
|
; out: returns with C set if interpreter could not be loaded or hints
|
||||||
|
; directory could not be found
|
||||||
|
; otherwise does not return (calls ExitWeeGUI and jumps to interpreter)
|
||||||
|
; gPathname clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
LaunchInterpreterWithHints
|
||||||
|
jsr SaveGlobalPreferences
|
||||||
|
jsr LoadInterpreter
|
||||||
|
bcs .launchError
|
||||||
|
|
||||||
|
jsr ResetPath
|
||||||
|
+LDADDR kHintsRootDirectory
|
||||||
|
jsr AddToPath
|
||||||
|
|
||||||
|
jsr SetPrefix
|
||||||
|
!word gPathname
|
||||||
|
bcs .launchError
|
||||||
|
|
||||||
|
jsr okvs_get
|
||||||
|
!word gGlobalPrefsStore
|
||||||
|
!word kLastPlayed
|
||||||
|
jsr SetStartupPath ; store hints filename at $2006
|
||||||
|
|
||||||
|
jsr ExitWeeGUI
|
||||||
|
jsr SetInterpreterOptionsExceptForce40
|
||||||
|
jmp kSystemAddress
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; LoadInterpreter
|
||||||
|
; load interpreter and launch it with the hints file for the current game
|
||||||
|
;
|
||||||
|
; in: current ProDOS prefix is the same as the ONBEYOND.SYSTEM file
|
||||||
|
; out: C clear if success
|
||||||
|
; C set if interpreter could not be loaded
|
||||||
|
; all other registers and flags clobbered
|
||||||
|
; gPathname clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
LoadInterpreter
|
LoadInterpreter
|
||||||
jsr ResetPath
|
jsr ResetPath
|
||||||
+LDADDR .interpreterFilename
|
+LDADDR .interpreterFilename
|
||||||
|
@ -117,6 +204,7 @@ LoadInterpreter
|
||||||
!word kSystemAddress
|
!word kSystemAddress
|
||||||
!word kProDOSFileBuffer
|
!word kProDOSFileBuffer
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.interpreterFilename
|
.interpreterFilename
|
||||||
!byte 15
|
!byte 15
|
||||||
!raw "ONBEYOND.SYSTEM"
|
!raw "ONBEYOND.SYSTEM"
|
||||||
|
|
|
@ -119,5 +119,15 @@ LoadGameInfo
|
||||||
!word addrOptions
|
!word addrOptions
|
||||||
!byte 0
|
!byte 0
|
||||||
|
|
||||||
|
jsr okvs_get ; get shortname of current game
|
||||||
|
!word gGlobalPrefsStore
|
||||||
|
!word kLastPlayed
|
||||||
|
+STAY + ; A/Y contains address
|
||||||
|
|
||||||
|
jsr okvs_get ; get selected version of this game
|
||||||
|
!word gGlobalPrefsStore
|
||||||
|
+ !word $FDFD ; SMC
|
||||||
|
; +STAY + ; A/Y contains address
|
||||||
|
|
||||||
rts
|
rts
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,31 +262,8 @@ callback_boxart
|
||||||
jmp SoftBell
|
jmp SoftBell
|
||||||
}
|
}
|
||||||
|
|
||||||
!zone {
|
|
||||||
callback_clues
|
callback_clues
|
||||||
jsr SaveGlobalPreferences
|
jmp LaunchInterpreterWithHints
|
||||||
jsr LoadInterpreter
|
|
||||||
bcs .cluesError
|
|
||||||
; change prefix to folder of file we want the interpreter to open
|
|
||||||
jsr ResetPath
|
|
||||||
+LDADDR kHintsRootDirectory
|
|
||||||
jsr AddToPath
|
|
||||||
jsr SetPrefix
|
|
||||||
!word gPathname
|
|
||||||
bcs .cluesError
|
|
||||||
|
|
||||||
; put just the filename at $2006
|
|
||||||
jsr okvs_get
|
|
||||||
!word gGlobalPrefsStore
|
|
||||||
!word kLastPlayed
|
|
||||||
jsr SetStartupPath
|
|
||||||
; shutdown WeeGUI and transfer control to interpreter
|
|
||||||
jsr ExitWeeGUI
|
|
||||||
jsr SetInterpreterOptionsExceptForce40
|
|
||||||
jmp kSystemAddress
|
|
||||||
.cluesError
|
|
||||||
jmp SoftBell
|
|
||||||
}
|
|
||||||
|
|
||||||
callback_play
|
callback_play
|
||||||
jmp LaunchInterpreter
|
jmp LaunchInterpreterWithGame
|
||||||
|
|
Loading…
Reference in New Issue
Block a user