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:
Oliver Schmidt
2015-10-15 00:15:38 +02:00
parent 0ee9b2e446
commit 76a5a72403
16 changed files with 40 additions and 32 deletions

View File

@@ -11,7 +11,7 @@
.import callmain
.import __LC_START__, __LC_LAST__ ; Linker generated
.import __INIT_RUN__, __INIT_SIZE__ ; Linker generated
.import __ZPSAVE_RUN__ ; Linker generated
.import __INITBSS_RUN__ ; Linker generated
.include "zeropage.inc"
.include "apple2.inc"
@@ -29,14 +29,14 @@
bit $C081
; Set the source start address.
lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__)
ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__)
lda #<(__INITBSS_RUN__ + __INIT_SIZE__)
ldy #>(__INITBSS_RUN__ + __INIT_SIZE__)
sta $9B
sty $9C
; Set the source last address.
lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
lda #<(__INITBSS_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
ldy #>(__INITBSS_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
sta $96
sty $97
@@ -51,14 +51,14 @@
jsr $D39A ; BLTU2
; Set the source start address.
lda #<__ZPSAVE_RUN__
ldy #>__ZPSAVE_RUN__
lda #<__INITBSS_RUN__
ldy #>__INITBSS_RUN__
sta $9B
sty $9C
; Set the source last address.
lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__)
ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__)
lda #<(__INITBSS_RUN__ + __INIT_SIZE__)
ldy #>(__INITBSS_RUN__ + __INIT_SIZE__)
sta $96
sty $97
@@ -201,7 +201,7 @@ q_param:.byte $04 ; param_count
; Final jump when we're done
done: jmp DOSWARM ; Potentially patched at runtime
.segment "ZPSAVE"
.segment "INITBSS"
zpsave: .res zpspace

View File

@@ -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

View File

@@ -21,13 +21,13 @@
sta ICBLH,x
jsr CIOV
bmi oserr
ldx #0 ; ATEOL -> \0
: lda __cwd,x
inx
ldx #$FF ; ATEOL -> \0
: inx
lda __cwd,x
cmp #ATEOL
bne :-
lda #0
sta __cwd-1,x
sta __cwd,x
oserr: rts
.endproc