From 62082c0f5ddc63ad3f36828cfab4da532c6efcf8 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Sun, 29 Dec 2024 15:18:30 -0800 Subject: [PATCH] Invoker: Populate $280 same as Bitsy Bye when launching BASIS.SYSTEM ProDOS 2.4's Bitsy Bye populates $280 with the containing path for the target file when invoking BASIS.SYSTEM as a fallback interpreter. The documented ProDOS convention is to set $280 to the path to the system file itself, but Bitsy Bye does its own thing. For better compatibility, do the same specifically when launching BASIS.SYSTEM, but not other interpreters. Updated behavior comparison: Bitsy DeskTop /VOL/FILE invoked: Prefix /VOL/ /VOL/ $2006 FILE FILE $280 /VOL /VOL $380 /VOL/BASIS.SYSTEM /VOL/BASIS.SYSTEM /VOL/SUBDIR/FILE invoked: Prefix /VOL/SUBDIR/ /VOL/SUBDIR/ $2006 FILE FILE $280 /VOL/SUBDIR /VOL/SUBDIR $380 /VOL/BASIS.SYSTEM /VOL/BASIS.SYSTEM Also note that Bitsy Bye has the high bits set for '/' characters in the $280 path (i.e. $AF not $2F) and *all* characters in the $380 path. DeskTop populates both paths with high bits clear. --- common.inc | 1 + desktop/main.s | 9 +++++++-- lib/invoker.s | 15 +++++++++++++++ selector/app.s | 6 +++++- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/common.inc b/common.inc index 1b15e519..7f73ab6d 100644 --- a/common.inc +++ b/common.inc @@ -331,6 +331,7 @@ INVOKER_PREFIX := $220 ; Prefix to set INVOKER := $290 ; Invoke other programs INVOKER_FILENAME := $280 ; File to invoke (PREFIX must be set) INVOKER_INTERPRETER := $380 ; If non-empty, use path as interpreter. +INVOKER_BITSY_COMPAT := $3C1 ; bit7 = set $280 like Bitsy does ;;; ============================================================ ;;; Default Font diff --git a/desktop/main.s b/desktop/main.s index ce77526c..d1de990c 100644 --- a/desktop/main.s +++ b/desktop/main.s @@ -890,7 +890,9 @@ sys_disk: jsr SetCursorWatch ; before invoking ;; Assume no interpreter to start - copy #0, INVOKER_INTERPRETER + lda #0 + sta INVOKER_INTERPRETER + sta INVOKER_BITSY_COMPAT ;; Easiest to assume absolute path later. param_call MakePathAbsolute, src_path_buf @@ -937,7 +939,10 @@ retry: jsr GetSrcFileInfo ;; Fallback - try BASIS.SYSTEM fallback: jsr CheckBasisSystem ; Is fallback BASIS.SYSTEM present? - bcc launch ; yes, continue below + IF_CC ; yes, continue below + copy #$80, INVOKER_BITSY_COMPAT + bmi launch ; always + END_IF param_jump ShowAlertParams, AlertButtonOptions::OK, aux::str_alert_cannot_open ;; -------------------------------------------------- diff --git a/lib/invoker.s b/lib/invoker.s index 1288fc28..8dcd5379 100644 --- a/lib/invoker.s +++ b/lib/invoker.s @@ -128,6 +128,19 @@ load_target: sta BITSY_SYS_PATH,x dex bpl :- + + ;; When launching BASIS.SYTEM, ProDOS 2.4's Bitsy Bye populates + ;; $280 with the path containing the target file. + BITSY_DIR_PATH := $280 + bit INVOKER_BITSY_COMPAT + IF_NS + ldy INVOKER_PREFIX +: lda INVOKER_PREFIX,y + sta BITSY_DIR_PATH,y + dey + bpl :- + END_IF + END_IF ;; Set return address to the QUIT call below @@ -149,6 +162,8 @@ exit: rts PAD_TO ::INVOKER_INTERPRETER .res ::kPathBufferSize, 0 + ASSERT_ADDRESS ::INVOKER_BITSY_COMPAT + .byte 0 ;;; ============================================================ diff --git a/selector/app.s b/selector/app.s index 451530ca..ece8a419 100644 --- a/selector/app.s +++ b/selector/app.s @@ -1572,6 +1572,7 @@ fail: jmp ClearSelectedIndex ;; Ensure it's BIN, SYS, S16 or BAS (if BS is present) check_type: + copy #0, INVOKER_BITSY_COMPAT lda file_info_params::file_type cmp #FT_BASIC bne not_basic @@ -1591,7 +1592,10 @@ not_basic: beq check_path jsr CheckBasisSystem ; Is fallback BASIS.SYSTEM present? - beq check_path + IF_EQ + copy #$80, INVOKER_BITSY_COMPAT + bmi check_path ; always + END_IF ;; Don't know how to invoke lda #AlertID::selector_unable_to_run