diff --git a/src/action.a b/src/action.a index 6e12aeb..d0fdb01 100644 --- a/src/action.a +++ b/src/action.a @@ -272,6 +272,7 @@ callback_clues jsr SetStartupPath ; shutdown WeeGUI and transfer control to interpreter jsr ExitWeeGUI + jsr SetInterpreterOptionsExceptForce40 jmp kSystemAddress .cluesError jmp SoftBell diff --git a/src/launch.a b/src/launch.a index 257f489..9a15819 100644 --- a/src/launch.a +++ b/src/launch.a @@ -4,47 +4,22 @@ ; load and launch the On Beyond Z-Machine! interpreter ; ; Public functions +; - ClearInterpreterOptions +; - SetInterpreterOptions +; - SetInterpreterOptionsExceptForce40 +; - LoadInterpreter ; - 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 - jsr AddToPath +ClearInterpreterOptions + ldy #6 + lda #0 +- sta $0300,y + dey + bpl - + rts - 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 +SetInterpreterOptions jsr okvs_get !word gPrefsStore !word kForce40 @@ -52,9 +27,10 @@ LaunchInterpreter beq + lda #$CE !byte $2C -+ lda #$D9 ++ +SetInterpreterOptionsExceptForce40 + lda #$D9 sta $0300 ; 40/80 columns - jsr okvs_get !word gPrefsStore !word kForceUpper @@ -99,9 +75,49 @@ LaunchInterpreter eor $0304 eor $0305 sta $0306 + rts + +.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 + 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 + jsr SetInterpreterOptions jmp kSystemAddress LoadInterpreter diff --git a/src/pitchdark.a b/src/pitchdark.a index dbc1876..f43a004 100644 --- a/src/pitchdark.a +++ b/src/pitchdark.a @@ -39,23 +39,19 @@ Start + inc ; 65C02-only INC instruction will clear Z flag beq - ; if Z flag is still set, this is not a 65C02 - jsr DisconnectRAM32 ; disconnect /RAM in S3,D2 so we can use DHGR - bit $C010 ; clear keyboard strobe - jsr LoadFile ; load WEEGUI binary at $4000 !word .weeguiFilename !word WGInit !word $2000 !word kProDOSFileBuffer + jsr DisconnectRAM32 ; disconnect /RAM in S3,D2 + jsr ClearInterpreterOptions ; clear options struct at $300 jsr WGInit ; initialize WeeGUI - jsr LoadGlobalPreferences ; get current game jsr LoadGameInfo ; load and parse game description text - ldx #WGEnableMouse ; enable mouse support jsr WeeGUI - MainScreen ldx #$FF txs @@ -65,6 +61,7 @@ MainScreen ldx #WGClearScreen ; clear screen jsr WeeGUI jsr PaintAllViews ; draw all UI elements + bit $C010 ; clear keyboard strobe .runLoop ldx #WGPendingViewAction jsr WeeGUI