Update from Oliver Schmidt
git-svn-id: svn://svn.cc65.org/cc65/trunk@3470 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
6448e4cf51
commit
94b11e7a73
1 changed files with 26 additions and 16 deletions
|
@ -4,16 +4,21 @@
|
||||||
|
|
||||||
.export initcwd
|
.export initcwd
|
||||||
.import __cwd
|
.import __cwd
|
||||||
|
.import subysp, addysp
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "mli.inc"
|
.include "mli.inc"
|
||||||
|
|
||||||
.segment "INIT"
|
.segment "INIT"
|
||||||
|
|
||||||
initcwd:
|
initcwd:
|
||||||
; Use imported buffer
|
; Alloc prefix buffer
|
||||||
lda #<__cwd
|
ldy #1 + 64+1 ; Length byte + max pathname length+trailing slash
|
||||||
ldx #>__cwd
|
jsr subysp
|
||||||
|
|
||||||
|
; Use allocated prefix buffer
|
||||||
|
lda sp
|
||||||
|
ldx sp+1
|
||||||
sta mliparam + MLI::PREFIX::PATHNAME
|
sta mliparam + MLI::PREFIX::PATHNAME
|
||||||
stx mliparam + MLI::PREFIX::PATHNAME+1
|
stx mliparam + MLI::PREFIX::PATHNAME+1
|
||||||
|
|
||||||
|
@ -21,19 +26,24 @@ initcwd:
|
||||||
lda #GET_PREFIX_CALL
|
lda #GET_PREFIX_CALL
|
||||||
ldx #PREFIX_COUNT
|
ldx #PREFIX_COUNT
|
||||||
jsr callmli
|
jsr callmli
|
||||||
|
bcs done
|
||||||
|
|
||||||
; Check length byte
|
; Check for null prefix
|
||||||
ldx __cwd
|
ldy #$00
|
||||||
|
lda (sp),y
|
||||||
beq done
|
beq done
|
||||||
|
|
||||||
; Replace trailing slash with zero
|
; Set current working directory
|
||||||
sta __cwd,x ; A = 0
|
; - omit trailing slash and length byte
|
||||||
|
; - terminating zero already in place
|
||||||
; Remove length byte
|
tay
|
||||||
tax
|
dey
|
||||||
: inx
|
: lda (sp),y
|
||||||
lda __cwd,x
|
sta __cwd-1,y
|
||||||
sta __cwd-1,x
|
dey
|
||||||
bne :-
|
bne :-
|
||||||
|
|
||||||
done: rts
|
; Cleanup stack
|
||||||
|
done: ldy #1 + 64+1 ; Length byte + max pathname length+trailing slash
|
||||||
|
jmp addysp
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue