Users complained that otherwise the names might clash with their functions.
-<!-- <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"> -->
-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.
*/
;
; 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
; Ullrich von Bassewitz, 2009-10-29
;
; Ullrich von Bassewitz, 2009-10-29
;
; ---------------------------------------------------------------------------
; ---------------------------------------------------------------------------
; ---------------------------------------------------------------------------
; ---------------------------------------------------------------------------
-; Cosine function. Is actually implemented as cos(x) = sin(x+90)
+; Cosine function. Is actually implemented as _cos(x) = _sin(x+90)
@L1: cpx #>360
bne @L2
cmp #<360
@L1: cpx #>360
bne @L2
cmp #<360
; 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.
; If the high byte is non zero, argument is > 255
; If the high byte is non zero, argument is > 255
-; 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
-; 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
-; 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
}
/* 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;
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)));
/* 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);