mirror of
https://github.com/cc65/cc65.git
synced 2024-11-19 21:32:19 +00:00
76a5a72403
Moving __cwd from BSS into INITBSS does of course ;-) not only impact the CBM targets but all targets with disk I/O support. Note: Code using `__cwd-1` may trigger an ld65 range error because __cwd may end up at the very begining of a segment. As far as I see this is an ld65 bug which I'm not try to fix - at least here.
42 lines
872 B
ArmAsm
42 lines
872 B
ArmAsm
;
|
|
; Oliver Schmidt, 18.04.2005
|
|
;
|
|
|
|
.export initcwd
|
|
.import __cwd
|
|
|
|
.include "zeropage.inc"
|
|
.include "mli.inc"
|
|
|
|
initcwd:
|
|
; Set static prefix 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 for null prefix
|
|
ldx __cwd
|
|
beq done
|
|
|
|
; Remove length byte and trailing slash
|
|
dex
|
|
stx tmp1
|
|
ldx #$00
|
|
: lda __cwd + 1,x
|
|
sta __cwd,x
|
|
inx
|
|
cpx tmp1
|
|
bcc :-
|
|
|
|
; Add terminating zero
|
|
lda #$00
|
|
sta __cwd,x
|
|
|
|
done: rts
|