Web pdp-10.trailing-edge.com

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/rts/ma.mac
There are 2 other files named ma.mac in the archive. Click here to see a list.
```	SUBTTL	Mathematical subroutines not covered by FORLIB

; Author:	Lars Enderin Mar 1974

SEARCH	SIMMAC,SIMRPA
SALL
RTITLE	MA
ERRMAC	MA
MACINIT

ENTRY	.MACI, .MACL
Comment;

Purpose:	To convert an arithmetic value from long real to integer
(.MACI) or vice versa (.MACL).

Input:		Value to be converted in Xtop (and Xtop+1).
XTAC=Xtop.

Output:		Converted value in Xtop (& Xtop+1).

Function:	Load input by EXCH instructions to XWAC1-XWAC2.
Convert in XWAC1-XWAC2 and place result by EXCH.

;
```
```.MACL:	PROC	;Conversion from integer to long real
EXCH	XWAC1,(XTAC)
EXCH	XWAC2,1(XTAC)
L	X0,XWAC1
MOVM	XWAC2,XWAC1
MOVSI	XWAC1,(<200+^D62>B8)
JUMPGE	X0,.+2
DMOVN	XWAC1,XWAC1
EXCH	XWAC2,1(XTAC)
EXCH	XWAC1,(XTAC)
RETURN
EPROC

.MACI:	PROC	;Conversion from long real to integer
EXCH	XWAC1,(XTAC)
EXCH	XWAC2,1(XTAC)
L	X0,XWAC1
JUMPGE	X0,.+2
DMOVN	XWAC1,XWAC1
IF
CAML	XWAC1,[233B8]
GOTO	FALSE
THEN
FIXR	XWAC1,XWAC1
ELSE
LDB	X1,[POINT 9,XWAC1,8]
TLZ	XWAC1,777000
ASHC	XWAC1,-233(X1)
FI
JUMPGE	X0,.+2
MOVN	XWAC1,XWAC1
EXCH	XWAC2,1(XTAC)
EXCH	XWAC1,(XTAC)
RETURN
EPROC
LIT
END
```
```
```