This commit is contained in:
4am 2018-03-26 20:05:34 -04:00
parent 92778d4d66
commit 4d3508a65f
4 changed files with 123 additions and 59 deletions

View File

@ -277,62 +277,5 @@ callback_clues
jmp SoftBell
}
!zone {
callback_play
LaunchInterpreter
jsr SaveGlobalPreferences
jsr LoadInterpreter
bcs .playError
; change prefix to folder of file we want the interpreter to open
jsr ResetPath
lda #<kGameRootDirectory
ldy #>kGameRootDirectory
jsr AddToPath
jsr okvs_get
!word gPrefsStore
!word kLastPlayed
jsr AddToPath
jsr SetPrefix
!word gPathname
bcs .playError
; put just the filename at $2006
ldy #0
lda addrVersions
sta $00
lda addrVersions+1
sta $01
- lda ($00),y
cmp #$BD ; '='
beq .doneBuildingFilename
iny
and #$7F
sta $2006,y
bra -
.doneBuildingFilename
sty $2006
; shut down WeeGUI and transfer control to interpreter
jsr ExitWeeGUI
jmp kSystemAddress
.playError
jmp SoftBell
LoadInterpreter
jsr ResetPath
lda #<.interpreterFilename
ldy #>.interpreterFilename
jsr AddToPath
jsr LoadFile
!word gPathname
!word kSystemAddress
!word $2000
!word kProDOSFileBuffer
rts
.interpreterFilename
!byte 15
!raw "ONBEYOND.SYSTEM"
}
jmp LaunchInterpreter

121
src/launch.a Normal file
View File

@ -0,0 +1,121 @@
;license:MIT
;(c) 2018 by 4am
;
; load and launch the On Beyond Z-Machine! interpreter
;
; Public functions
; - LaunchInterpreter
;
.playError
jmp SoftBell
LaunchInterpreter
jsr SaveGlobalPreferences
jsr LoadInterpreter
bcs .playError
; change prefix to folder of file we want the interpreter to open
jsr ResetPath
lda #<kGameRootDirectory
ldy #>kGameRootDirectory
jsr AddToPath
jsr okvs_get
!word gPrefsStore
!word kLastPlayed
jsr AddToPath
jsr SetPrefix
!word gPathname
bcs .playError
; put just the filename at $2006
ldy #0
lda addrVersions
sta $00
lda addrVersions+1
sta $01
- lda ($00),y
cmp #$BD ; '='
beq .doneBuildingFilename
iny
and #$7F
sta $2006,y
bra -
.doneBuildingFilename
sty $2006
; set options struct at $0300
jsr okvs_get
!word gPrefsStore
!word kForce40
jsr okvs_as_boolean
beq +
lda #$D9
!byte $2C
+ lda #$CE
sta $0300 ; 40/80 columns
jsr okvs_get
!word gPrefsStore
!word kForceUpper
jsr okvs_as_boolean
beq +
lda #1
!byte $2C
+ lda #0
sta $0301 ; case
lda #$FF
sta $0302 ; auto-restore
jsr okvs_get
!word gPrefsStore
!word kScriptToFile
jsr okvs_as_boolean
beq +
lda #0
!byte $2C
+ lda #1
sta $0303 ; script-to-file
jsr okvs_get
!word gPrefsStore
!word kAutoScript
jsr okvs_as_boolean
beq +
lda #0
!byte $2C
+ lda #1
sta $0304 ; auto-script
lda #1
sta $0305 ; warn on missing .sav files
lda #$A5
eor $0300
eor $0301
eor $0302
eor $0303
eor $0304
eor $0305
sta $0306
; shut down WeeGUI and transfer control to interpreter
jsr ExitWeeGUI
jmp kSystemAddress
LoadInterpreter
jsr ResetPath
lda #<.interpreterFilename
ldy #>.interpreterFilename
jsr AddToPath
jsr LoadFile
!word gPathname
!word kSystemAddress
!word $2000
!word kProDOSFileBuffer
rts
.interpreterFilename
!byte 15
!raw "ONBEYOND.SYSTEM"

View File

@ -9,7 +9,6 @@
; - RepaintSomeViews
;
; ROM routines
MAGICRTS = $FF58 ; used to set overflow bit
; View IDs (application-specific, acceptable range 0..15, no duplicates)

View File

@ -24,6 +24,7 @@
!source "src/mainscreen.a"
!source "src/settingsdialog.a"
!source "src/sound.a"
!source "src/launch.a"
.weeguiFilename
!byte 10