1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-30 16:29:58 +00:00

initcwd will be called from the upcoming __syschdir so it has to be moved out of the INIT segment - and so it doesn't make sense anymore to keep devicestr as separate module anymore as the integration with initcwd allows to omit the jmp from the latter to the former.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5844 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
ol.sc 2012-10-10 19:32:30 +00:00
parent deb407ccb1
commit 300817702f
3 changed files with 27 additions and 44 deletions

View File

@ -70,7 +70,6 @@ S_OBJS = c_acptr.o \
ctype.o \
cvline.o \
devicedir.o \
devicestr.o \
dir.o \
diskcmd.o \
exehdr.o \

View File

@ -1,35 +0,0 @@
;
; Stefan Haubenthal, 2005-06-08
;
; CBM device to string
;
.export devicestr
.import pusha0, tosudiva0
.importzp sreg, ptr1, ptr2
.macpack generic
;------------------------------------------------------------------------------
; Convert unit number in A into string representation pointed to by ptr2.
.proc devicestr
jsr pusha0
lda #10
jsr tosudiva0
ldy #0
lda sreg
beq :+ ; >=10
add #'0'
sta (ptr2),y
iny
: lda ptr1 ; rem
add #'0'
sta (ptr2),y
iny
lda #0
sta (ptr2),y
rts
.endproc

View File

@ -4,19 +4,38 @@
; CBM _curunit to _cwd
;
.export initcwd
.import __curunit, __cwd, devicestr
.importzp ptr2
.export initcwd, devicestr
.import __curunit, __cwd
.import pusha0, tosudiva0
.importzp sreg, ptr1, ptr2
.segment "INIT"
.proc initcwd
.macpack generic
initcwd:
lda #<__cwd
ldx #>__cwd
sta ptr2
stx ptr2+1
lda __curunit
jmp devicestr
; Fall through
.endproc
;------------------------------------------------------------------------------
; Convert unit number in A into string representation pointed to by ptr2.
devicestr:
jsr pusha0
lda #10
jsr tosudiva0
ldy #0
lda sreg
beq :+ ; >=10
add #'0'
sta (ptr2),y
iny
: lda ptr1 ; rem
add #'0'
sta (ptr2),y
iny
lda #0
sta (ptr2),y
rts