From 300817702fb454207a241a20c8d940b04b280ff8 Mon Sep 17 00:00:00 2001 From: "ol.sc" Date: Wed, 10 Oct 2012 19:32:30 +0000 Subject: [PATCH] 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 --- libsrc/cbm/Makefile | 1 - libsrc/cbm/devicestr.s | 35 ----------------------------------- libsrc/cbm/initcwd.s | 35 +++++++++++++++++++++++++++-------- 3 files changed, 27 insertions(+), 44 deletions(-) delete mode 100644 libsrc/cbm/devicestr.s diff --git a/libsrc/cbm/Makefile b/libsrc/cbm/Makefile index fbcaeeeed..5e3396e13 100644 --- a/libsrc/cbm/Makefile +++ b/libsrc/cbm/Makefile @@ -70,7 +70,6 @@ S_OBJS = c_acptr.o \ ctype.o \ cvline.o \ devicedir.o \ - devicestr.o \ dir.o \ diskcmd.o \ exehdr.o \ diff --git a/libsrc/cbm/devicestr.s b/libsrc/cbm/devicestr.s deleted file mode 100644 index 15b4b6c4a..000000000 --- a/libsrc/cbm/devicestr.s +++ /dev/null @@ -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 diff --git a/libsrc/cbm/initcwd.s b/libsrc/cbm/initcwd.s index 5f43bc867..d5eb7fb90 100644 --- a/libsrc/cbm/initcwd.s +++ b/libsrc/cbm/initcwd.s @@ -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 + +;------------------------------------------------------------------------------ +; Convert unit number in A into string representation pointed to by ptr2. -.endproc +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 -- 2.39.5