| Routines

37DA: THE 'TAN' FUNCTION (offset +21)

The address of this routine is found in the table of addresses. It is called indirectly via fp_calc_2. This subroutine handles the function TAN X. It simply returns SIN X/COS X, with arithmetic overflow if COS X=0.
tan | 37DA | RST $28 | X
| 37DB | DEFB $31 | duplicate: X, X
| 37DC | DEFB $1F | sin: X, SIN X
| 37DD | DEFB $01 | exchange: SIN X, X
| 37DE | DEFB $20 | cos: SIN X, COS X
| 37DF | DEFB $05 | division: SIN X/COS X=TAN X (report arithmetic overflow if needed)
| 37E0 | DEFB $38 | end_calc: TAN X
| 37E1 | RET | Finished: 'last value'=TAN X.