1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

Update by Oliver Schmidt

git-svn-id: svn://svn.cc65.org/cc65/trunk@3742 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2006-05-29 16:27:39 +00:00
parent 4b8d90d2de
commit 13e0436336
2 changed files with 21 additions and 34 deletions

View File

@ -4,21 +4,14 @@
.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"
initcwd: initcwd:
; Alloc prefix buffer ; Set static prefix buffer
ldy #1 + 64+1 ; Length byte + max pathname length+trailing slash lda #<__cwd
jsr subysp ldx #>__cwd
; 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
@ -26,24 +19,22 @@ initcwd:
lda #GET_PREFIX_CALL lda #GET_PREFIX_CALL
ldx #PREFIX_COUNT ldx #PREFIX_COUNT
jsr callmli jsr callmli
bcs done
; Check for null prefix ; Check for null prefix
ldy #$00 lda __cwd
lda (sp),y beq done
beq done
; Set current working directory ; Remove length byte and trailing slash
; - omit trailing slash and length byte sta tmp1
; - terminating zero already in place ldx #$01
tay : lda __cwd,x
dey sta __cwd - 1,x
: lda (sp),y inx
sta __cwd-1,y cpx tmp1
dey bcc :-
bne :-
; Cleanup stack
done: ldy #1 + 64+1 ; Length byte + max pathname length+trailing slash
jmp addysp
; Add terminating zero
lda #$00
sta __cwd - 1,x
done: rts

View File

@ -6,7 +6,7 @@
.export __syschdir .export __syschdir
.import pushname, popname .import pushname, popname
.import __cwd .import initcwd
.include "zeropage.inc" .include "zeropage.inc"
.include "mli.inc" .include "mli.inc"
@ -28,12 +28,8 @@ __syschdir:
jsr callmli jsr callmli
bcs cleanup bcs cleanup
ldy #$01 ; Update current working directory
: lda (sp),y jsr initcwd ; Returns with A = 0
sta __cwd-1,y
beq cleanup
iny
bne :- ; Branch always
; Cleanup name ; Cleanup name
cleanup:jsr popname ; Preserves A cleanup:jsr popname ; Preserves A