]> git.sur5r.net Git - cc65/commitdiff
Added '_' prefix to sin and cos.
authorOliver Schmidt <ol.sc@web.de>
Sat, 13 Apr 2019 09:25:54 +0000 (11:25 +0200)
committerOliver Schmidt <ol.sc@web.de>
Sat, 13 Apr 2019 09:25:54 +0000 (11:25 +0200)
Users complained that otherwise the names might clash with their functions.

doc/funcref.sgml
include/cc65.h
libsrc/common/sincos.s
libsrc/tgi/tgi_arc.c
libsrc/tgi/tgi_pieslice.c
samples/tgidemo.c

index 89a8eb13c8b6635cdd66a64aea94a18c01c33849..030c726cc46d16df10f1ebda16c64f3e277934f0 100644 (file)
@@ -244,11 +244,11 @@ function.
 
 <itemize>
 
 
 <itemize>
 
-<!-- <item><ref id="cos" name="cos"> -->
+<!-- <item><ref id="_cos" name="_cos"> -->
 <!-- <item><ref id="idiv32by16r16" name="idiv32by16r16"> -->
 <!-- <item><ref id="imul16x16r32" name="imul16x16r32"> -->
 <!-- <item><ref id="imul8x8r16" name="imul8x8r16"> -->
 <!-- <item><ref id="idiv32by16r16" name="idiv32by16r16"> -->
 <!-- <item><ref id="imul16x16r32" name="imul16x16r32"> -->
 <!-- <item><ref id="imul8x8r16" name="imul8x8r16"> -->
-<!-- <item><ref id="sin" name="sin"> -->
+<!-- <item><ref id="_sin" name="_sin"> -->
 <!-- <item><ref id="udiv32by16r16" name="udiv32by16r16"> -->
 <!-- <item><ref id="umul16x16r32" name="umul16x16r32"> -->
 <!-- <item><ref id="umul16x8r32" name="umul16x8r32"> -->
 <!-- <item><ref id="udiv32by16r16" name="udiv32by16r16"> -->
 <!-- <item><ref id="umul16x16r32" name="umul16x16r32"> -->
 <!-- <item><ref id="umul16x8r32" name="umul16x8r32"> -->
index a30bad24713c425f96b95a2e5ec3ed6fea7654d0..7e9c2cae2b39aa3a70e3dbe4c6653c1ad562426c 100644 (file)
@@ -85,12 +85,12 @@ unsigned int __fastcall__ mul40 (unsigned char value);
 ** result
 */
 
 ** result
 */
 
-int __fastcall__ sin (unsigned x);
+int __fastcall__ _sin (unsigned x);
 /* Return the sine of the argument, which must be in range 0..360. The result
 ** is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00.
 */
 
 /* Return the sine of the argument, which must be in range 0..360. The result
 ** is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00.
 */
 
-int __fastcall__ cos (unsigned x);
+int __fastcall__ _cos (unsigned x);
 /* Return the cosine of the argument, which must be in range 0..360. The result
 ** is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00.
 */
 /* Return the cosine of the argument, which must be in range 0..360. The result
 ** is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00.
 */
index 7cdcb716736f4f32987756a9a99de4301c68c17a..6bbc151f458ddac0bd9f46754d17c3c91cce923c 100644 (file)
@@ -1,8 +1,8 @@
 ;
 ; Fixed point cosine/sine functions.
 ;
 ;
 ; Fixed point cosine/sine functions.
 ;
-; int __fastcall__ cc65_sin (unsigned x);
-; int __fastcall__ cc65_cos (unsigned x);
+; int __fastcall__ _sin (unsigned x);
+; int __fastcall__ _cos (unsigned x);
 ;
 ; Returns the cosine/sine for the given argument as angular degree.
 ; Valid argument range is 0..360 for both functions. They will return
 ;
 ; Returns the cosine/sine for the given argument as angular degree.
 ; Valid argument range is 0..360 for both functions. They will return
@@ -13,7 +13,7 @@
 ; Ullrich von Bassewitz, 2009-10-29
 ;
 
 ; Ullrich von Bassewitz, 2009-10-29
 ;
 
-        .export         _cos, _sin
+        .export         __cos, __sin
 
 
 ; ---------------------------------------------------------------------------
 
 
 ; ---------------------------------------------------------------------------
@@ -37,13 +37,13 @@ _sintab:
 
 
 ; ---------------------------------------------------------------------------
 
 
 ; ---------------------------------------------------------------------------
-; Cosine function. Is actually implemented as cos(x) = sin(x+90)
+; Cosine function. Is actually implemented as _cos(x) = _sin(x+90)
 
 .code
 
 
 .code
 
-_cos:
+__cos:
 
 
-; cos(x) = sin(x+90)
+; _cos(x) = _sin(x+90)
 
         clc
         adc     #90
 
         clc
         adc     #90
@@ -55,7 +55,7 @@ _cos:
 @L1:    cpx     #>360
         bne     @L2
         cmp     #<360
 @L1:    cpx     #>360
         bne     @L2
         cmp     #<360
-@L2:    bcc     _sin
+@L2:    bcc     __sin
 
         sbc     #<360
         bcs     @L3
 
         sbc     #<360
         bcs     @L3
@@ -66,12 +66,12 @@ _cos:
 ; Sine function. Uses
 ;
 ;       table lookup            for 0..89°
 ; Sine function. Uses
 ;
 ;       table lookup            for 0..89°
-;       sin(x) = sin(180-x)     for 90°..179°
-;       sin(x) = -sin(x-180)    for 180..360°
+;       _sin(x) = _sin(180-x)   for 90°..179°
+;       _sin(x) = -_sin(x-180)  for 180..360°
 ;
 ; Plus special handling for the values missing in the table.
 
 ;
 ; Plus special handling for the values missing in the table.
 
-_sin:
+__sin:
 
 ; If the high byte is non zero, argument is > 255
 
 
 ; If the high byte is non zero, argument is > 255
 
@@ -85,7 +85,7 @@ _sin:
         cmp     #90
         bcc     L1
 
         cmp     #90
         bcc     L1
 
-; 90..179°. Value is identical to sin(180-val). Carry is set on entry.
+; 90..179°. Value is identical to _sin(180-val). Carry is set on entry.
 ;
 ;       180-val := -val + 180.
 ; With
 ;
 ;       180-val := -val + 180.
 ; With
@@ -117,7 +117,7 @@ L2:     tay
         lda     _sintab,y
         rts
 
         lda     _sintab,y
         rts
 
-; 180..360°. sin(x) = -sin(x-180). Since the argument is in range 0..180
+; 180..360°. _sin(x) = -_sin(x-180). Since the argument is in range 0..180
 ; after the subtraction, we don't need to handle the high byte.
 
 L3:     sec
 ; after the subtraction, we don't need to handle the high byte.
 
 L3:     sec
@@ -126,7 +126,7 @@ L4:     sbc     #180
         cmp     #90
         bcc     L5
 
         cmp     #90
         bcc     L5
 
-; 270..360°. Value is identical to -sin(180-val). Carry is set on entry.
+; 270..360°. Value is identical to -_sin(180-val). Carry is set on entry.
 ;
 ;       180-val := -val + 180.
 ; With
 ;
 ;       180-val := -val + 180.
 ; With
@@ -160,5 +160,3 @@ L6:     tay
         bcc     L7
         inx
 L7:     rts
         bcc     L7
         inx
 L7:     rts
-
-
index 94cc593cebd8f09d78da7afd5a6672c48d83256f..c0baabbde9c47daa0cdc62092a9f010052fd9d3b 100644 (file)
@@ -70,16 +70,16 @@ void __fastcall__ tgi_arc (int x, int y, unsigned char rx, unsigned char ry,
     }
 
     /* Calculate the start coords */
     }
 
     /* Calculate the start coords */
-    x1 = x + tgi_imulround (rx, cos (sa));
-    y1 = y - tgi_imulround (ry, sin (sa));
+    x1 = x + tgi_imulround (rx, _cos (sa));
+    y1 = y - tgi_imulround (ry, _sin (sa));
     do {
         sa += inc;
         if (sa >= ea) {
             sa = ea;
             done = 1;
         }
     do {
         sa += inc;
         if (sa >= ea) {
             sa = ea;
             done = 1;
         }
-        x2 = x + tgi_imulround (rx, cos (sa));
-        y2 = y - tgi_imulround (ry, sin (sa));
+        x2 = x + tgi_imulround (rx, _cos (sa));
+        y2 = y - tgi_imulround (ry, _sin (sa));
         tgi_line (x1, y1, x2, y2);
         x1 = x2;
         y1 = y2;
         tgi_line (x1, y1, x2, y2);
         x1 = x2;
         y1 = y2;
index b119b9b2de658e23a26d3d2751e30207b9e8f327..748d1819ad8153c6afad6b7f45042cf74a1168b4 100644 (file)
@@ -57,8 +57,8 @@ void __fastcall__ tgi_pieslice (int x, int y, unsigned char rx, unsigned char ry
     tgi_arc (x, y, rx, ry, sa, ea);
 
     /* ... and close it */
     tgi_arc (x, y, rx, ry, sa, ea);
 
     /* ... and close it */
-    tgi_line (x, y, x + tgi_imulround (rx, cos (sa)), y - tgi_imulround (ry, sin (sa)));
-    tgi_line (x, y, x + tgi_imulround (rx, cos (ea)), y - tgi_imulround (ry, sin (ea)));
+    tgi_line (x, y, x + tgi_imulround (rx, _cos (sa)), y - tgi_imulround (ry, _sin (sa)));
+    tgi_line (x, y, x + tgi_imulround (rx, _cos (ea)), y - tgi_imulround (ry, _sin (ea)));
 }
 
 
 }
 
 
index 1d76fee2e3974d6815e6f2fb60542127d6e7bef2..de743314e6ac86b12abf7d6f8e8ff287b749ec74 100644 (file)
@@ -151,7 +151,7 @@ static void DoDiagram (void)
 
         /* Calculate the next points */
         X = (int) (((long) (MaxX - 19) * I) / 360);
 
         /* Calculate the next points */
         X = (int) (((long) (MaxX - 19) * I) / 360);
-        Y = (int) (((long) Amp * -sin (I)) / 256);
+        Y = (int) (((long) Amp * -_sin (I)) / 256);
 
         /* Draw the line */
         tgi_lineto (XOrigin + X, YOrigin + Y);
 
         /* Draw the line */
         tgi_lineto (XOrigin + X, YOrigin + Y);