2 ; Oliver Schmidt, 30.12.2004
4 ; File name handling for ProDOS 8 file I/O
7 .export pushname, popname
8 .import subysp, addysp, decsp1
10 .include "zeropage.inc"
17 ; Alloc pathname buffer
18 ldy #64+1 ; Max pathname length + zero
21 ; Check for full pathname
27 ; Check for system prefix
31 ; Use unit number of most recent accessed device
33 sta mliparam + MLI::ON_LINE::UNIT_NUM
35 ; Use allocated pathname buffer
38 sta mliparam + MLI::ON_LINE::DATA_BUFFER
39 stx mliparam + MLI::ON_LINE::DATA_BUFFER+1
47 ; Get volume name length
49 and #15 ; Max volume name length
51 ; Bracket volume name with slashes to form prefix
60 ; Adjust source pointer for copy
69 ; Copy source to allocated pathname buffer
74 cpy #64+1 ; Max pathname length + zero
78 lda #$40 ; "Invalid pathname syntax"
80 ; Free pathname buffer
82 bne addsp ; Branch always
84 ; Alloc and set length byte
86 jsr decsp1 ; Preserves A
96 ldy #1 + 64+1 ; Length byte + max pathname length + zero
97 addsp: jmp addysp ; Preserves A