Adjusted current working directory initialization on Apple and Atari.
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.
This commit is contained in:
@@ -21,20 +21,21 @@ initcwd:
|
||||
jsr callmli
|
||||
|
||||
; Check for null prefix
|
||||
lda __cwd
|
||||
ldx __cwd
|
||||
beq done
|
||||
|
||||
; Remove length byte and trailing slash
|
||||
sta tmp1
|
||||
ldx #$01
|
||||
: lda __cwd,x
|
||||
sta __cwd - 1,x
|
||||
dex
|
||||
stx tmp1
|
||||
ldx #$00
|
||||
: lda __cwd + 1,x
|
||||
sta __cwd,x
|
||||
inx
|
||||
cpx tmp1
|
||||
bcc :-
|
||||
|
||||
; Add terminating zero
|
||||
lda #$00
|
||||
sta __cwd - 1,x
|
||||
sta __cwd,x
|
||||
|
||||
done: rts
|
||||
|
||||
Reference in New Issue
Block a user