initcwd from Oliver Schmidt

git-svn-id: svn://svn.cc65.org/cc65/trunk@3466 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2005-04-19 11:31:00 +00:00
parent ee81f9a686
commit ccd4955384
4 changed files with 100 additions and 38 deletions

37
libsrc/apple2/initcwd.s Normal file
View File

@@ -0,0 +1,37 @@
;
; Oliver Schmidt, 18.04.2005
;
.export initcwd
.import __cwd
.include "zeropage.inc"
.include "mli.inc"
initcwd:
; Use imported buffer
lda #<__cwd
ldx #>__cwd
sta mliparam + MLI::PREFIX::PATHNAME
stx mliparam + MLI::PREFIX::PATHNAME+1
; Get current working directory
lda #GET_PREFIX_CALL
ldx #PREFIX_COUNT
jsr callmli
; Check length byte
ldx __cwd
beq done
; Replace trailing slash with zero
sta __cwd,x ; A = 0
; Remove length byte
tax
: inx
lda __cwd,x
sta __cwd-1,x
bne :-
done: rts