2 ; Fixed point sine function.
4 ; Returns the cosine for the given argument as angular degree.
5 ; Valid argument range is 0..360
8 ; Ullrich von Bassewitz, 2009-10-29
16 ; ---------------------------------------------------------------------------
23 ; If the high byte is non zero, argument is > 255
35 ; 90..179°. Value is identical to sin(180-val). Carry is set on entry.
37 ; 180-val := -val + 180.
39 ; -val := (val ^ $FF) + 1
41 ; 180-val = (val ^ $FF) + 1 + 180
42 ; Since carry is set, we can drop the "+ 1".
48 ; 0..89°. Values for 87..90° are actually 1.0. Since this format doesn't fit
49 ; into the table, we have to check for it manually.
60 ; 0..86°. Read the value from the table.
67 ; 180..360°. sin(x) = -sin(x-180). Since the argument is in range 0..180
68 ; after the subtraction, we don't need to handle the high byte.
76 ; 270..360°. Value is identical to -sin(180-val). Carry is set on entry.
78 ; 180-val := -val + 180.
80 ; -val := (val ^ $FF) + 1
82 ; 180-val = (val ^ $FF) + 1 + 180
83 ; Since carry is set, we can drop the "+ 1".
89 ; 180..269°. Values for 267..269° are actually -1.0. Since this format doesn't
90 ; fit into the table, we have to check for it manually.
101 ; 180..266°. Read the value from the table. Carry is clear on entry.