Routines |
Prev: 3713 | Up: Map | Next: 37AA |
The address of this routine is found in the table of addresses. It is called via the calculator literal +39 by the routines at cos and sin.
This subroutine transforms the argument X of SIN X or COS X into a value V.
The subroutine first finds the value Y=X/2π-INT(X/2π+0.5), where -0.5<=Y<0.5.
The subroutine returns with:
In each case, -1<=V<=1 and SIN (πV/2)=SIN X.
|
||||
get_argt | 3783 | RST $28 | X | |
3784 | DEFB $3D | re_stack: X (in full floating-point form) | ||
3785 | DEFB $34 | stk_data: X, 1/2π | ||
3786 | DEFB $EE,$22,$F9,$83,$6E | |||
378B | DEFB $04 | multiply: X/2π | ||
378C | DEFB $31 | duplicate: X/2π, X/2π | ||
378D | DEFB $A2 | stk_half: X/2π, X/2π, 0.5 | ||
378E | DEFB $0F | addition: X/2π, X/2π+0.5 | ||
378F | DEFB $27 | int: X/2π, INT (X/2π+0.5) | ||
3790 | DEFB $03 | subtract: X/2π-INT (X/2π+0.5)=Y | ||
Note: adding 0.5 and taking INT rounds the result to the nearest integer.
|
||||
3791 | DEFB $31 | duplicate: Y, Y | ||
3792 | DEFB $0F | addition: 2*Y | ||
3793 | DEFB $31 | duplicate: 2*Y, 2*Y | ||
3794 | DEFB $0F | addition: 4*Y | ||
3795 | DEFB $31 | duplicate: 4*Y, 4*Y | ||
3796 | DEFB $2A | abs: 4*Y, ABS (4*Y) | ||
3797 | DEFB $A1 | stk_one: 4*Y, ABS (4*Y), 1 | ||
3798 | DEFB $03 | subtract: 4*Y, ABS (4*Y)-1=Z | ||
3799 | DEFB $31 | duplicate: 4*Y, Z, Z | ||
379A | DEFB $37 | greater_0: 4*Y, Z, (1/0) | ||
379B | DEFB $C0 | st_mem_0: (mem-0 holds the result of the test) | ||
379C | DEFB $00 | jump_true to ZPLUS: 4*Y, Z | ||
379D | DEFB $04 | |||
379E | DEFB $02 | delete: 4*Y | ||
379F | DEFB $38 | end_calc: 4*Y=V (case i) | ||
37A0 | RET | Finished. | ||
If the jump was made then continue.
|
||||
ZPLUS | 37A1 | DEFB $A1 | stk_one: 4*Y, Z, 1 | |
37A2 | DEFB $03 | subtract: 4*Y, Z-1 | ||
37A3 | DEFB $01 | exchange: Z-1, 4*Y | ||
37A4 | DEFB $36 | less_0: Z-1, (1/0) | ||
37A5 | DEFB $00 | jump_true to YNEG: Z-1 | ||
37A6 | DEFB $02 | |||
37A7 | DEFB $1B | negate: 1-Z | ||
YNEG | 37A8 | DEFB $38 | end_calc: 1-Z=V (case ii) or Z-1=V (case iii) | |
37A9 | RET | Finished. |
Prev: 3713 | Up: Map | Next: 37AA |