1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-19 21:32:19 +00:00
cc65/libsrc/apple2/initcwd.s
cuz 94b11e7a73 Update from Oliver Schmidt
git-svn-id: svn://svn.cc65.org/cc65/trunk@3470 b7a2c559-68d2-44c3-8de9-860c34a00d81
2005-04-19 14:28:15 +00:00

50 lines
1.1 KiB
ArmAsm

;
; Oliver Schmidt, 18.04.2005
;
.export initcwd
.import __cwd
.import subysp, addysp
.include "zeropage.inc"
.include "mli.inc"
.segment "INIT"
initcwd:
; Alloc prefix buffer
ldy #1 + 64+1 ; Length byte + max pathname length+trailing slash
jsr subysp
; Use allocated prefix buffer
lda sp
ldx sp+1
sta mliparam + MLI::PREFIX::PATHNAME
stx mliparam + MLI::PREFIX::PATHNAME+1
; Get current working directory
lda #GET_PREFIX_CALL
ldx #PREFIX_COUNT
jsr callmli
bcs done
; Check for null prefix
ldy #$00
lda (sp),y
beq done
; Set current working directory
; - omit trailing slash and length byte
; - terminating zero already in place
tay
dey
: lda (sp),y
sta __cwd-1,y
dey
bne :-
; Cleanup stack
done: ldy #1 + 64+1 ; Length byte + max pathname length+trailing slash
jmp addysp