From a25d9bdf4b01291e196decae6086bb09c3bc550c Mon Sep 17 00:00:00 2001
From: "ol.sc"
Date: Fri, 11 Feb 2011 23:22:26 +0000
Subject: [PATCH] Improved exec(): - Copy the pathname to $280 for SYS programs
- Make sure 80 column firmware is off (which btw. switches to the normal
character set) which should increase program compatibility Now "only" cmdline
support should be left to do.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4976 b7a2c559-68d2-44c3-8de9-860c34a00d81
---
libsrc/apple2/exec.s | 35 +++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/libsrc/apple2/exec.s b/libsrc/apple2/exec.s
index aeb9657f2..f34c4e362 100644
--- a/libsrc/apple2/exec.s
+++ b/libsrc/apple2/exec.s
@@ -38,7 +38,7 @@ _exec:
lda #GET_INFO_CALL
ldx #GET_INFO_COUNT
jsr callmli
-oserr2: bcs oserr
+ bcs oserr
; If we get here the program file at least exists so we copy
; the loader stub right now and patch it later to set params
@@ -47,12 +47,23 @@ oserr2: bcs oserr
sta target,x
dex
bpl :-
-
+
; Check program file type
lda mliparam + MLI::INFO::FILE_TYPE
cmp #$FF ; SYS file?
bne binary ; No, check for BIN file
+ ; ProDOS TechRefMan, chapter 5.1.5.1:
+ ; "The complete or partial pathname of the system program
+ ; is stored at $280, starting with a length byte."
+ ldy #$00
+ lda (sp),y
+ tay
+: lda (sp),y
+ sta $0280,y
+ dey
+ bpl :-
+
; SYS programs replace BASIC.SYSTEM so set in the ProDOS system bit map
; protection for pages $80 - $BF just in case BASIC.SYSTEM is there now
ldx #$0F ; Start with protection for pages $B8 - $BF
@@ -124,13 +135,29 @@ setbuf: lda #$00 ; Low byte
; Restore file level
ldx level
stx LEVEL
- bcs oserr2
+ bcc :+
+ jmp oserr
; Get and save fd
- lda mliparam + MLI::OPEN::REF_NUM
+: lda mliparam + MLI::OPEN::REF_NUM
sta read_ref
sta close_ref
+ .ifdef __APPLE2ENH__
+ ; Calling the 80 column firmware needs the ROM switched
+ ; in, otherwise it copies the F8 ROM to the LC (@ $CEF4)
+ bit $C082
+
+ ; ProDOS TechRefMan, chapter 5.3.1.3:
+ ; "80-column text cards -- and other Apple IIe features -- can
+ ; be turned off using the following sequence of instructions:"
+ lda #$15
+ jsr $C300
+
+ ; Switch in LC bank 2 for R/O
+ bit $C080
+ .endif
+
; Call loader stub after C libary shutdown
lda #target
--
2.39.5