2005-04-19 11:31:00 +00:00
|
|
|
;
|
|
|
|
; Oliver Schmidt, 18.04.2005
|
|
|
|
;
|
|
|
|
|
|
|
|
.export initcwd
|
|
|
|
.import __cwd
|
2005-04-19 14:28:15 +00:00
|
|
|
.import subysp, addysp
|
2005-04-19 11:31:00 +00:00
|
|
|
|
|
|
|
.include "zeropage.inc"
|
|
|
|
.include "mli.inc"
|
|
|
|
|
2005-04-19 14:28:15 +00:00
|
|
|
.segment "INIT"
|
|
|
|
|
2005-04-19 11:31:00 +00:00
|
|
|
initcwd:
|
2005-04-19 14:28:15 +00:00
|
|
|
; 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
|
2005-04-19 11:31:00 +00:00
|
|
|
sta mliparam + MLI::PREFIX::PATHNAME
|
|
|
|
stx mliparam + MLI::PREFIX::PATHNAME+1
|
|
|
|
|
|
|
|
; Get current working directory
|
|
|
|
lda #GET_PREFIX_CALL
|
|
|
|
ldx #PREFIX_COUNT
|
|
|
|
jsr callmli
|
2005-04-19 14:28:15 +00:00
|
|
|
bcs done
|
2005-04-19 11:31:00 +00:00
|
|
|
|
2005-04-19 14:28:15 +00:00
|
|
|
; Check for null prefix
|
|
|
|
ldy #$00
|
|
|
|
lda (sp),y
|
2005-04-19 11:31:00 +00:00
|
|
|
beq done
|
|
|
|
|
2005-04-19 14:28:15 +00:00
|
|
|
; 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
|
2005-04-19 11:31:00 +00:00
|
|
|
bne :-
|
|
|
|
|
2005-04-19 14:28:15 +00:00
|
|
|
; Cleanup stack
|
|
|
|
done: ldy #1 + 64+1 ; Length byte + max pathname length+trailing slash
|
|
|
|
jmp addysp
|
|
|
|
|