Prev: 3783 Up: Map Next: 37B5
37AA: THE 'COSINE' FUNCTION (offset +20)
The address of this routine is found in the table of addresses. It is called via the calculator literal +20 by the routines at DRAW and tan. It is also called indirectly via fp_calc_2.
This subroutine handles the function COS X and returns a 'last value' 'that is an approximation to COS X.
The subroutine uses the expression COS X=SIN (πW/2), where -1<=W<=1.
In deriving W for X the subroutine uses the test result obtained in the previous subroutine and stored for this purpose in mem-0. It then jumps to the sin subroutine, entering at C_ENT, to produce a 'last value' of COS X.
Input
Output
cos 37AA RST $28 X
37AB DEFB $39 get_argt: V
37AC DEFB $2A abs: ABS V
37AD DEFB $A1 stk_one: ABS V, 1
37AE DEFB $03 subtract: ABS V-1
37AF DEFB $E0 get_mem_0: ABS V-1, (1/0)
37B0 DEFB $00 jump_true to C_ENT: ABS V-1=W
37B1 DEFB $06
If the jump was not made then continue.
37B2 DEFB $1B negate: 1-ABS V
37B3 DEFB $33 jump to C_ENT: 1-ABS V=W
37B4 DEFB $03
Prev: 3783 Up: Map Next: 37B5