| Routines

2627: THE 'SCANNING PI' ROUTINE

The address of this routine is derived from an offset found in the scanning function table. Unless syntax is being checked the value of 'PI' is calculated and forms the 'last value' on the calculator stack.
S_PI | 2627 | CALL SYNTAX_Z | Test for syntax checking.
| 262A | JR Z,S_PI_END | Jump if required.
| 262C | RST $28 | Now use the calculator.
| 262D | DEFB $A3 | stk_pi_2: The value of π/2 is put on the calculator stack as the 'last value'.
| 262E | DEFB $38 | end_calc
| 262F | INC (HL) | The exponent is incremented thereby doubling the 'last value' giving π.
This entry point is used by the routine at S_RND.
S_PI_END | 2630 | RST $20 | Move on to the next character.
| 2631 | JP S_NUMERIC | Jump forward.