Spectrum ROM | Routines |
Prev: 14403 | Up: Map |
The address of this routine is found in the table of addresses. It is called via the calculator literal 28 by the routines at CD_PRMS1 and asn. It is also called indirectly via fp_calc_2.
This subroutine handles the function SQR X and returns the positive square root of the real number X if X is positive, and zero if X is zero. A negative value of X gives rise to report A - invalid argument (via to_power).
This subroutine treats the square root operation as being X**0.5 and therefore stacks the value 0.5 and proceeds directly into to_power.
|
|||||||
sqr | 14410 | RST 40 | X | ||||
14411 | DEFB 49 | duplicate: X, X | |||||
14412 | DEFB 48 | f_not: X, (1/0) | |||||
14413 | DEFB 0 | jump_true to LAST: X | |||||
14414 | DEFB 30 | ||||||
The jump is made if X=0; otherwise continue with:
|
|||||||
14415 | DEFB 162 | stk_half: X, 0.5 | |||||
14416 | DEFB 56 | end_calc | |||||
Continue into to_power to find the result of X**0.5.
|
Prev: 14403 | Up: Map |