
; Test fixed point RCS/C routines

; params for MathFixTest ROUTINE 
;   [/K, EK] -> initial value for D register
;   [@K, AK] -> initial value for AL register
;   [:K, SK] -> initial value for AM register 
;   [IK]     -> initial value for B5
;   [UK]     -> initial value for B6
;   [NK  FK] -> cue to call


; ********* Test DECOUTPUT

; call MathFixTest ROUTINE at Track 10L to echo ptr to printer input until $ char
K PS @ CA// R/@/
T CS
TEST:DECOUTPUT$

; set params to call DECOUPUT 

K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K @K : //// ///T $$$$ $$$$ ; AL and AM

K PS @ C/// R/@/           ; call cue preserving AM on call
T CS
; should print -.5

K @K : //// ///T //// //// ; AL and AM
K PS @ C/// R/@/ 
T CS
; should print +.5

K @K : //// ///: S$$$ $$$$ ; AL and AM
K PS @ C/// R/@/ 
T CS
; should print -26.875

K @K : //// ///M G/// //// ; AL and AM
K PS @ C/// R/@/ 
T CS
; should print +26.875

K @K : //// //// $$$$ $$$$ ; AL and AM
K PS @ C/// R/@/ 
T CS
; should print -1.

K @K : //// //// //// //// ; AL and AM
K PS @ C/// R/@/ 
T CS
; should print +.

; ********* Test DECINPUT

; call MathFixTest ROUTINE at Track 10L to echo ptr to printer input until $ char
K PS @ CA// R/@/
T CS
TEST:DECINPUT$

; set cue for DECINPUT to be used by MathFixTest ROUTINE 
K NK @ $E// L/@/

; call MathFixTest ROUTINE at Track 10L -> will call DECINPUT as subroutine
K PS @ //// R/@/
T CS

; the input number
; format:  +/- nnnnn.nnnn (space)
+123.456Z

K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K PS @ C/// R/@/           ; call cue preserving AM on call, AM/AL set by DECINPUT
T CS
; should print +123.4560000

; ********* Test DIVISION

; call MathFixTest ROUTINE at Track 10L to echo ptr to printer input until $ char
K PS @ CA// R/@/
T CS
TEST:DIVISION$

K NK @ $E// L/@/           ; cue for DECINPUT
K PS @ //// R/@/
T CS
; the input number
+0.3Z

K NK @ $E// Y/@/           ; cue for DIVISION, the routine to be called from MathFixTest 
K /K @ //// ///T           ; D=0.5, 
                           ; AL=value read on DECINPUT
K PS @ //// R/@/           ; call cue: calc D div AL 
T CS

K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K PS @ C/// R/@/           ; call cue preserving AM on call, AM/AL set by DIVISION
T CS
; should print +1.6666666  ; 0.5/0.3 = 1.66666

; ********* Test SQUAREROOT

; call MathFixTest ROUTINE at Track 10L to echo ptr to printer input until $ char
K PS @ CA// R/@/
T CS
TEST:SQUAREROOT$

K NK @ $E// L/@/           ; cue for DECINPUT
K PS @ //// R/@/
T CS
; the input number
+0.0625Z

K NK @ $E// P/@/           ; cue for SQUAREROOT the routine to be called from MathFixTest 
                           ; AL=value read on DECINPUT
K PS @ //// R/@/           ; call cue: calc sqrt(AL)
T CS

K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K PS @ //// R/@/           ; call cue 
T CS
; should print +.2500000   ; sqrt(0.0625) = 0.25

; ********* Test NATURALOG

; call MathFixTest ROUTINE at Track 10L to echo ptr to printer input until $ char
K PS @ CA// R/@/
T CS
TEST:NATURALOG$

K NK @ $E// L/@/           ; cue for DECINPUT
K PS @ //// R/@/
T CS
; the input number
+0.5Z

K NK @ $E// B/@/           ; cue for NATURALOGthe routine to be called from MathFixTest 
                           ; AL=value read on DECINPUT
K PS @ //// R/@/           ; call cue: calc ln(AL)
T CS

K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K PS @ C/// R/@/           ; call cue preserving AM on call, AM/AL set by DIVISION
T CS
; should print -.6931529   ; ln(0.5) = -0.6931471805

; ********* Test EXPONENT

; call MathFixTest ROUTINE at Track 10L to echo ptr to printer input until $ char
K PS @ CA// R/@/
T CS
TEST:EXPONENT$

K NK @ $E// L/@/           ; cue for DECINPUT
K PS @ //// R/@/
T CS
; the input number
+0.45Z

K NK @ E@// O/@/           ; cue for EXPONENT the routine to be called from MathFixTest 
                           ; AL=value read on DECINPUT
K PS @ //// R/@/           ; call cue: calc 0.5 * e ^ AL
T CS

K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K PS @ //// R/@/           ; call cue 
T CS
; should print +.7841560   ; 0.5 * e ^ (0.45) = 0.784156092745

; ********* Test COSINE

; call MathFixTest ROUTINE at Track 10L to echo ptr to printer input until $ char
K PS @ CA// R/@/
T CS
TEST:COSINE$

K NK @ $E// L/@/           ; cue for DECINPUT
K PS @ //// R/@/
T CS
; the input number
+0.0Z

K NK @ S@// Q/@/           ; cue for COS the routine to be called from MathFixTest 
                           ; AL=value read on DECINPUT
K PS @ //// R/@/           ; call cue: calc 0.5*cos(2*pi*AL)
T CS

K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K PS @ //// R/@/           ; call cue 
T CS
; should print +.4999999   ; 0.5*cos(0) = 0.5


K NK @ $E// L/@/           ; cue for DECINPUT
K PS @ //// R/@/
T CS
; the input number
+0.0833333Z                ; 1/12 = 0.833333

K NK @ S@// Q/@/           ; cue for COS the routine to be called from MathFixTest 
K PS @ //// R/@/           ; call cue: calc 0.5*cos(2*pi*AL)
T CS
K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K PS @ //// R/@/           ; call cue 
T CS
; should print +.4330127   ; 0.5*cos(2*pi*1/12) = 0.5*cos(pi/6) = 0.4330128124

K NK @ $E// L/@/           ; cue for DECINPUT
K PS @ //// R/@/
T CS
; the input number
+0.1666666Z                ; 1/6 = 0.16666

K NK @ S@// Q/@/           ; cue for COS the routine to be called from MathFixTest 
K PS @ //// R/@/           ; call cue: calc 0.5*cos(2*pi*AL)
T CS
K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K PS @ //// R/@/           ; call cue 
T CS
; should print +.2500001   ; 0.5*cos(2*pi*1/6) = 0.5*cos(pi/3) = 0.25

; ********* Test ARCTAN

; call MathFixTest ROUTINE at Track 10L to echo ptr to printer input until $ char
K PS @ CA// R/@/
T CS
TEST:ARCTANGENT$

K NK @ $E// L/@/           ; cue for DECINPUT
K PS @ //// R/@/
T CS
; the input number
+0.333333Z

K NK @ $E// G/@/           ; cue for ARCTANGENT the routine to be called from MathFixTest 
                           ; AL=value read on DECINPUT
K PS @ //// R/@/           ; call cue: calc arctan(2*AL) / pi
T CS

K NK @ $E// W/@/           ; cue for DECOUPUT, the routine to be called from MathFixTest 
K UK E I///                ; B6=6 -> 7 decimal places
K PS @ //// R/@/           ; call cue 
T CS
; should print +.1871668   ; arctan(2*0.333333) / pi = 0.1871670418



