]> git.sur5r.net Git - cc65/commitdiff
Moved the string that contains the ascii representation of LONG_MIN into its
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 26 Nov 2012 16:28:46 +0000 (16:28 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 26 Nov 2012 16:28:46 +0000 (16:28 +0000)
own file.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5941 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/common/Makefile
libsrc/common/_longminstr.c [new file with mode: 0644]
libsrc/common/ltoa.s

index 83966a0042bcc581ebd80117848fb48041578582..334521dafddd76729f0e7f8ced6719a182641fe2 100644 (file)
@@ -42,6 +42,7 @@ CFLAGS        = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
 # From C source-files
 C_OBJS =       _afailed.o              \
                _hextab.o               \
+                _longminstr.o           \
                 _poserror.o             \
                _scanf.o                \
                abort.o                 \
diff --git a/libsrc/common/_longminstr.c b/libsrc/common/_longminstr.c
new file mode 100644 (file)
index 0000000..290c7f1
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Ullrich von Bassewitz, 2012-11-26
+ *
+ * Minimum value of a long. Is used in ascii conversions, since this value 
+ * has no positive counterpart than can be represented in 32 bits. In C,
+ * since the compiler will convert to the correct character set for the 
+ * target platform.
+ */
+
+
+
+const unsigned char _longminstr[] = "-2147483648";
+
+
+
index c0a342056b6542fbbb3e613253f3a08edae63d5f..65d6ca4208c7f15e6ba0d92b50ea2491de74ee2b 100644 (file)
@@ -7,20 +7,17 @@
 
        .export         _ltoa, _ultoa
        .import         popax
-       .import         __hextab
+       .import         __hextab, __longminstr
        .importzp       sreg, ptr1, ptr2, ptr3, tmp1
 
 
 
-.rodata
-specval:
-               .byte   '-', '2', '1', '4', '7', '4', '8', '3', '6', '4', '8', 0
 .code
 
 ;
 ; Common subroutine to pop the parameters and put them into core
 ;
-                            
+
 dopop:         sta     tmp1            ; will loose high byte
        jsr     popax           ; get s
        sta     ptr1
@@ -56,12 +53,12 @@ _ltoa:      jsr     dopop           ; pop the arguments
        bne     L2
 
        ldy     #11
-L1:    lda     specval,y       ; copy -2147483648
+L1:    lda     __longminstr,y  ; copy -2147483648
        sta     (ptr1),y
        dey
        bpl     L1
        jmp     L10
-
+                  
 ; Check if the value is negative. If so, write a - sign and negate the
 ; number.