[net.micro.cbm] c64 floating point, part 4

miller@uiucdcs.UUCP (miller ) (02/12/84)

#N:uiucdcs:36100039:000:1672
uiucdcs!miller    Feb 12 00:17:00 1984


     This is the 4th and final note in the series of how to use the c64's Basic
floating point subroutines from assembly language.  The final 13 subroutines
are:

F1 = F2 / F1 $BB12 (47890)
Division.  The notes on addition apply here too.  But if you call $BB0F
instead, the loading of F2 from memory will be done automatically before the
division.

F1 = F2 ^ F1 $BF7B (49013)
Exponentiation.  The notes on addition apply here too.  The alternate entry
point here is $BF78 which will first load F1 from memory (but does not set the
sign compare flag properly).  When using the alternate entry points, keep in
mind you must use SF as with all of the "Memory to F" routines.

F1 = F1 / 10 $BAFE (47870)
Divide by 10.

Compare F1 and memory $BC5B (48219)
F1 is compared with some floating point number in a location specified in SF.
If the numbers are equal, A is set to 0; otherwise it is set to $FF.

F1 = ABS(F1) $BC58 (48216)
Absolute value.

F1 = INT(F1) $BCCC (48332)
Returns the integer portion of the number.

F1 = SGN(F1) $BC39 (48185)
F1 is replaced by: -1 if it was less than zero, 0 if it was zero, or 1 if it
was greater than zero.

F1 = SQR(F1) $BF71 (49009)
Square root.

F1 = EXP(F1) $BFED (49133)
e to the power F1.

F1 = COS(F1) $E264 (57956)
Cosine in radians.

F1 = SIN(F1) $E26B (57963)
Sine in radians.

F1 = TAN(F1) $E2B7 (58039)
Tangent in radians.

F1 = ATN(F1) $E30D (58125)
Arctangent in radians.

     Next week: the solution to the "c64 delete back past the 80th column at
the bottom of the screen bug" (CDBPT8CATBOTSB).  I consider that to be one of
the most important notes I've written.  Don't touch that dial...

A. Ray Miller
Univ Illinois