Apple2: mutualize mli filename push (-0 to -18 bytes)

This commit is contained in:
Colin Leroy-Mira
2025-10-25 12:00:17 +02:00
committed by Oliver Schmidt
parent 3b8531a422
commit 280f296952
8 changed files with 19 additions and 23 deletions

View File

@@ -7,7 +7,7 @@
.export _exec .export _exec
.import mli_file_info_direct .import mli_file_info_direct
.import aux80col .import aux80col
.import pushname, popname, popax, done, _exit .import pushname_tos, popname, popax, done, _exit
.include "zeropage.inc" .include "zeropage.inc"
.include "errno.inc" .include "errno.inc"
@@ -28,8 +28,7 @@ _exec:
stx ptr4+1 stx ptr4+1
; Get and push name ; Get and push name
jsr popax jsr pushname_tos
jsr pushname
bne oserr bne oserr
jsr mli_file_info_direct jsr mli_file_info_direct

View File

@@ -6,13 +6,13 @@
; ;
.export _file_set_type, _file_set_auxtype .export _file_set_type, _file_set_auxtype
.import pushname, popname, mli_file_info_direct .import pushname_tos, popname, mli_file_info_direct
.import popa, popax .import popa, popax
.include "zeropage.inc" .include "zeropage.inc"
.include "errno.inc" .include "errno.inc"
.include "mli.inc" .include "mli.inc"
new_value = ptr2 ; ptr1 is used by pushname new_value = ptr2 ; ptr1 is used by pushname_tos
mod_flag = tmp1 mod_flag = tmp1
UPDATE_TYPE = $00 UPDATE_TYPE = $00
@@ -31,8 +31,7 @@ mli_update:
sty mod_flag sty mod_flag
; Get pathname ; Get pathname
jsr popax jsr pushname_tos
jsr pushname
bne oserr bne oserr
; ProDOS 8 TechRef, 4.4.4: You should use ; ProDOS 8 TechRef, 4.4.4: You should use

View File

@@ -4,13 +4,15 @@
; File name handling for ProDOS 8 file I/O ; File name handling for ProDOS 8 file I/O
; ;
.export pushname, popname .export pushname_tos, pushname, popname
.import subysp, addysp, decsp1 .import popax, subysp, addysp, decsp1
.include "zeropage.inc" .include "zeropage.inc"
.include "apple2.inc" .include "apple2.inc"
.include "mli.inc" .include "mli.inc"
pushname_tos:
jsr popax
pushname: pushname:
sta ptr1 sta ptr1
stx ptr1+1 stx ptr1+1

View File

@@ -3,7 +3,7 @@
; ;
.export mli_file_info .export mli_file_info
.import pushname, popname, mli_file_info_direct .import pushname_tos, popname, mli_file_info_direct
.import popax .import popax
.include "zeropage.inc" .include "zeropage.inc"
.include "errno.inc" .include "errno.inc"
@@ -13,9 +13,8 @@
; stored as C string in AX at top of stack ; stored as C string in AX at top of stack
; Returns with carry set on error, and sets errno ; Returns with carry set on error, and sets errno
mli_file_info: mli_file_info:
; Get pathname ; Get pathname from top of stack
jsr popax jsr pushname_tos
jsr pushname
bne oserr bne oserr
jsr mli_file_info_direct jsr mli_file_info_direct

View File

@@ -10,7 +10,7 @@
; filename stored on top of stack ; filename stored on top of stack
; Returns with carry set on error, and sets errno ; Returns with carry set on error, and sets errno
mli_file_info_direct: mli_file_info_direct:
; Set pushed name ; Set pushed name from TOS
lda c_sp lda c_sp
ldx c_sp+1 ldx c_sp+1
sta mliparam + MLI::INFO::PATHNAME sta mliparam + MLI::INFO::PATHNAME

View File

@@ -9,7 +9,7 @@
.constructor raisefilelevel .constructor raisefilelevel
.destructor closeallfiles, 5 .destructor closeallfiles, 5
.import pushname, popname, __dos_type .import pushname_tos, popname, __dos_type
.import iobuf_alloc, iobuf_free .import iobuf_alloc, iobuf_free
.import addysp, incsp4, incaxy, pushax, popax .import addysp, incsp4, incaxy, pushax, popax
@@ -87,8 +87,7 @@ found: sty tmp2
sta tmp3 sta tmp3
; Get and push name ; Get and push name
jsr popax jsr pushname_tos
jsr pushname
bne oserr1 bne oserr1
; Set pushed name ; Set pushed name

View File

@@ -5,7 +5,7 @@
; ;
.export __sysmkdir .export __sysmkdir
.import pushname, popname .import pushname_tos, popname
.import addysp, popax .import addysp, popax
.include "zeropage.inc" .include "zeropage.inc"
@@ -18,8 +18,7 @@ __sysmkdir:
jsr addysp jsr addysp
; Get and push name ; Get and push name
jsr popax jsr pushname_tos
jsr pushname
bne oserr bne oserr
; Set pushed name ; Set pushed name

View File

@@ -5,7 +5,7 @@
; ;
.export __sysrename .export __sysrename
.import pushname, popname .import pushname, pushname_tos, popname
.import popax .import popax
.include "zeropage.inc" .include "zeropage.inc"
@@ -17,8 +17,7 @@ __sysrename:
stx ptr2+1 stx ptr2+1
; Get and push oldname ; Get and push oldname
jsr popax jsr pushname_tos
jsr pushname
bne oserr1 bne oserr1
; Save pushed oldname ; Save pushed oldname