Trailing-Edge
-
PDP-10 Archives
-
ap-c800d-sb
-
fix.mac
There are 7 other files named fix.mac in the archive. Click here to see a list.
; UPD ID= 1912 on 5/23/79 at 2:48 PM by N:<NIXON>
TITLE FIX FOR LIBOL V12
SUBTTL CONVERT FLOATING-POINT TO 2-WORD COMPUTATIONAL AL BLACKINGTON/CAM/DMN
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1974, 1979 BY DIGITAL EQUIPMENT CORPORATION
SEARCH LBLPRM
HISEG
; EDIT HISTORY
;V12**************
;NAME DATE COMMENTS
;EHM 27-APR-78 [527] TEST FOR OVERFLOW AND UNDERFLOW
EXTERNAL OVFLO.
ENTRY FIX.,FIX.2
;CALLING SEQUENCE:
; MOVE AC,<FLOATING-POINT NUMBER>
; MOVE PA,[Z AC,<RESULT>]
; PUSHJ PP,FIX./FIX.2
FIX.: LDB IN,[POINT 4,PA,12]
MOVE IN,0(IN)
TDNN IN,[XWD 777,-1] ;IS IT ZERO?
JRST CC3C2D ;YES
MOVM TA,IN ;NO--GET
CAMLE TA,[DEC 9.9999999E+18] ;[527] IS IT TOO LARGE?
JRST FIXTL ;[527] YES
CAMGE TA,[DEC 1.0E-18] ;[527] IS IT TOO SMALL?
JRST FIXTS ;[527] YES
MULI TA,400 ; GET EXPONENT
MOVEI TC,0
ASHC TB,-306(TA) ;SHIFT TO GET INTEGER
CC3C2B: JUMPGE IN,CC3C2C ;WAS INPUT POSITIVE?
IFE BIS,<
SETCA TB, ;NO--NEGATE THE 2-WORD RESULT
MOVNS TC
SKIPN TC
ADDI TB,1
SKIPGE TB
TLO TC,1B18
CC3C2C: MOVEM TB,0(PA) ;STASH RESULT
MOVEM TC,1(PA)
POPJ PP,
>
IFN BIS,<
DMOVN TB,TB ;MAKE RESULT NEGATIVE
TLO TB,(1B0) ;FIX 2ND WORD SIGN BIT
CC3C2C: DMOVEM TB,0(PA) ;STASH RESULT
POPJ PP,
>
FIXTS: SETOM OVFLO. ;[527] TURN ON OVERFLOW
CC3C2D: SETZM 0(PA) ;INPUT IS ZERO--ZERO THE RESULT
SETZM 1(PA)
POPJ PP,
FIXTL: SETOM OVFLO. ;[527] TURN ON OVERFLOW
HRLOI TB,377777 ;[527] GIVE USER A LARGE NUMBER
HRLOI TC,377777 ;[527] IN CASE NO ON SIZE ERROR
JRST CC3C2B ;[527] STASH RESULT & EXIT
;D.P. FLOATING POINT TO 2-WORD COMP
FIX.2: LDB IN,[POINT 4,PA,12]
DMOVE TA,(IN) ;GET SOURCE
HLRE TC,TA ;ISOLATE EXPONENT
ASH TC,-9 ;...
JUMPGE TA,.+3 ;IF NEGATIVE
DMOVN TA,TA ;MAKE POSITIVE
TRC TC,-1 ;BUT REMEMBER NEGATIVE SIGN
TLZ TA,777000 ;CLEAR EXPONENT FIELD
ASHC TA,-276(TC) ;SHIFT INTEGER INTO POSITION
JUMPGE TC,FIX.2R ;IF ORIGINAL NUMBER WAS POSITIVE STORE RESULT
DMOVN TA,TA ;OTHERWISE MAKE RESULT NEGATIVE
TLO TB,(1B0) ;FIX 2ND WORD SIGN BIT
FIX.2R: DMOVEM TA,0(PA) ;AND STORE
POPJ PP,
IN=11 ;INPUT ACCUMULATOR
TA=13 ;SCRATCH
TB=TA+1 ;SCRATCH
TC=TA+2 ;SCRATCH
PA=16 ;ADDRESS OF RESULT
PP=17 ;PUSH-DOWN POINTER
END