Trailing-Edge
-
PDP-10 Archives
-
AP-D480B-SB_1978
-
fltgen.mac
There are 12 other files named fltgen.mac in the archive. Click here to see a list.
TITLE FLTGEN - FLOATING POINT CONSTANT GENERATOR
SUBTTL GENERATE FLOATING POINT CONSTANTS
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;COPYRIGHT (C) 1976,1977 BY DIGITAL EQUIPMENT CORPORATION
INTERN FLTGV
INTERNAL FLTGV
FLTGV=2_^D24+2 ;VERSION DATE: 18-SEP-1973
;FLOATING POINT CONSTANT GENERATOR
;CONVERTS AN INTEGER CONSTANT TO A DOUBLE PRECISION
;FLOATING POINT CONSTANT FOR PDP6, KA10, AND KI10.
EXTERNAL LOAC,HIAC,DECEXP
ENTRY FCMML
TWOSEG
RELOC 400000
FLG=0
%01=01
%06=06
%07=07
%10=10
%11=11
%12=12
%17=17
FCMML:
PUSH %17,%01 ;SAVE 1
ADD %17,[1,,1] ;UP FOR EXPSAV LOCAL
; MOVEM %06,AC6SAV
; MOVEM %07,AC7SAV
; MOVEM %10,AC10SA
; MOVEM %11,AC11SA
; MOVEM %12,AC12SA
MOVEI %12,306 ;PICKUP MAX BINARY EXPONENT
MOVE %06,HIAC ;GET HI WORD
MOVE %10,LOAC ;GET LO WORD
JFFO %06,FCMML0 ;DOES HI WORD HAVE ONES?
EXCH %06,%10 ;NO, LO WORD TO HI, 0 TO LO
MOVEI %12,243 ;SET BIN POINT BETWEEN HALVES
JFFO %06,FCMML0 ;DOES HI WORD HAVE ONES NOW?
JRST FCMML9 ;NO, AND JFFO LEAVES %07 ZEROED
FCMML0: EXCH %07,%10 ;LO WORD TO %07, SHIFT COUNT TO %10
ASHC %06,-1(%10) ;LEFT NORMALIZE AND
SUBI %12,-1(%10) ; SUB SHIFT COUNT FROM EXPONENT
FCMML2: MOVM %01,DECEXP ;GET MAGNITUDE OF DECIMAL EXP
CAILE %01,^D100 ;GREATER THAN MAX
JRST FCMOVR ;YES OVERFLOW ERROR
JUMPE %01,FCMML6 ;EXP = 0?
FCMML3:
SETZM 0(%17) ;ZERO EXPSAV
CAIG %01,^D38 ;EXP GREATER 38
JRST FCMML4 ;NO
SUBI %01,^D38 ;REDUCE EXP BY 38
MOVEM %01,0(%17) ;SAV DIFFERENCE
MOVEI %01,^D38 ;SET FOR FIRST MULT OR DIV
FCMML4: LSH %01,1
SKIPGE DECEXP ;IS EXPONENT SIGN NEGATIVE?
MOVNS %01 ;MAKE THE TENS TABLE INDEX NEGATIVE
;START DOUBLE PRECISION INTEGER MULTIPLY
MUL %07,TENS(%01) ;AC7_(7*H)H
MOVE %11,%07 ; SAVE RESULT IN %11
MOVE %07,%06 ;GET HI FRACTION INTO %07
MUL %07,TENS+1(%01) ; AND MUL BY LO POWER OF TEN
ADD %11,%07 ;ADD THE HI PARTS OF CROSS PRODUCTS
MUL %06,TENS(%01) ;FORM THE PRODUCT OF 2 HI PARTS
TLZE %11,(1B0) ;ADDITION OF 2 CROSS PRODS CAUSE CRY?
ADDI %06,1 ;YES, PROPOGATE CARRY
ADD %07,%11 ;ADD CROSS PRODS TO RESULT
TLZE %07,(1B0) ; AND PROPOGATE A
ADDI %06,1 ; CARRY, IF ANY
TLNE %06,(1B1) ;IS RESULT NORMALIZED?
JRST .+3 ;YES
ASHC %06,1 ;NO, SHIFT LEFT ONE PLACE
SUBI %12,1 ; AND ADJUST THE EXPONENT
FCMML5: MOVE %10,%01 ;MOVE DECIMAL EXP TO DOUBLE AC
ASH %10,-1 ;GET SIGNED EXP BACK
IDIVI %10,4 ;BYTAB HAS 4 ENTRIES/WORD
LDB %10,BYTAB(%11) ;GET BINARY EXP OF POWER OF 10
ADD %12,%10 ; AND ADD INTO FINAL BINARY EXP
SUBI %12,200 ;GET RID OF AN EXCESS 200
SKIPE %01,0(17)
JRST FCMML3
FCMML6:
TRNN FLG,4000 ;GENERATING A KA-10 DP CONST?
ADDI %07,200 ;KI-10 DP ROUND IN LOW WORD
FCMML7:
TLZE %07,(1B0) ;DID ROUND CAUSE LOW WORD OVERFLOW?
ADDI %06,1 ;YES, PROPOGATE CARRY
JUMPGE %06,FCMML8 ;DID THIS OVERFLOW HI WORD?
ASHC %06,-1 ;YES, RENORMALIZE TO RIGHT
ADDI %12,1 ; AND ADJUST THE EXPONENT
TLZ %06,(1B0) ;CLEAR SIGN BIT
FCMML8:
TRNE %12,777400
JRST FCMOV1
ASHC %06,-8 ;MAKE ROOM FOR EXPONENT
DPB %12,[POINT 9,%06,8] ;INSERT EXPONENT
; TRNE FLG,2000 ;IS THIS CODE FOR KA10
; JRST FCMML9 ;NO, PDP-6, OR KI10
; ASH %07,-8 ;YES, MAKE ROOM FOR LO EXPONENT
; HRREI %01,-^D27(%12) ;GET LO EXP AND PUT IN %01
; DPB %01,[POINT 9,%07,8] ;NO, INSERT EXP IN LO WORD
FCMML9: MOVEM %06,HIAC ;SAVE HI PART OF ANSWER
MOVEM %07,LOAC ;DITTO LO PART
FCFML:
SUB %17,[1,,1] ;DUMP LOCAL EXPSAV
POP %17,%01 ;RESTORE AC1
; MOVE %06,AC6SAV
; MOVE %07,AC7SAV
; MOVE %10,AC10SA
; MOVE %11,AC11SA
; MOVE %12,AC12SA
POPJ %17,
FCMOVR:
MOVE %12,DECEXP
FCMOV1:
SKIPGE %12
TDZA %06,%06 ;YES ZERO ON UNDERFLOW
HRLOI %06,377777 ;NO MAX NUMBER ON OVERFLOW
MOVEM %06,HIAC ;SAVE PATCHED RESULT AS ANSWER
MOVEM %06,LOAC
PUSH %17,[E64##]
PUSHJ %17,WARNLEX##
SUB %17,[1,,1]
JRST FCFML
SUBTTL POWERS OF TEN TABLE
LIT
;POWER OF TEN TABLE IN DOUBLE PRECISION
;INTEGER FORMAT. EACH ENTRY CONSISTS OF TWO WORDS,
;EACH WITH 35 BITS OF FRACTION (SIGNS ARE EXCLUDED).
;THE BINARY POINT IS BETWEEN BITS 0 AND 1 OF THE
;HI ORDER WORD. THE EXPONENT (EXCESS 200) FOR THE 70 BIT
;FRACTION IS STORED IN THE SHORT TABLE CALLED "EXPTEN".
DEFINE .TAB. (A)<
REPEAT 0,<
NUMBER 732,357347511265,056017357445 ;D-50
NUMBER 736,225520615661,074611525567
NUMBER 741,273044761235,213754053125
NUMBER 744,351656155504,356747065752
NUMBER 750,222114704413,025260341562
NUMBER 753,266540065515,332534432117
NUMBER 756,344270103041,121263540543
NUMBER 762,216563051724,322660234335
NUMBER 765,262317664312,007434303425
NUMBER 770,337003641374,211343364332
NUMBER 774,213302304735,325716130610 ;D-40
NUMBER 777,256162766125,113301556752
>
NUMBER 002,331617563552,236162112545 ;D-38
NUMBER 006,210071650242,242707256537
NUMBER 011,252110222313,113471132267
NUMBER 014,324532266776,036407360745
NUMBER 020,204730362276,323044526457
NUMBER 023,246116456756,207655654173
NUMBER 026,317542172552,051631227231
NUMBER 032,201635314542,132077636440
NUMBER 035,242204577672,360517606150 ;D-30
NUMBER 040,312645737651,254643547602
NUMBER 043,375417327624,030014501542
NUMBER 047,236351506674,217007711035
NUMBER 052,306044030453,262611673245
NUMBER 055,367455036566,237354252116
NUMBER 061,232574123152,043523552261
NUMBER 064,301333150004,254450504735
NUMBER 067,361622002005,327562626124
NUMBER 073,227073201203,246647575664
NUMBER 076,274712041444,220421535242 ;D-20
NUMBER 101,354074451755,264526064512
NUMBER 105,223445672164,220725640716
NUMBER 110,270357250621,265113211102
NUMBER 113,346453122766,042336053323
NUMBER 117,220072763671,325412633103
NUMBER 122,264111560650,112715401724
NUMBER 125,341134115022,135500702312
NUMBER 131,214571460113,172410431376
NUMBER 134,257727774136,131112537675
NUMBER 137,333715773165,357335267655 ;D-10
NUMBER 143,211340575011,265512262714
NUMBER 146,253630734214,043034737477
NUMBER 151,326577123257,053644127417
NUMBER 155,206157364055,173306466551
NUMBER 160,247613261070,332170204303
NUMBER 163,321556135307,020626245364
NUMBER 167,203044672274,152375747331
NUMBER 172,243656050753,205075341217
NUMBER 175,314631463146,146314631463 ;D-01
A: NUMBER 201,200000000000,0 ;D00
NUMBER 204,240000000000,0
NUMBER 207,310000000000,0
NUMBER 212,372000000000,0
NUMBER 216,234200000000,0
NUMBER 221,303240000000,0
NUMBER 224,364110000000,0
NUMBER 230,230455000000,0
NUMBER 233,276570200000,0
NUMBER 236,356326240000,0
NUMBER 242,225005744000,0 ;D+10
NUMBER 245,272207335000,0
NUMBER 250,350651224200,0
NUMBER 254,221411634520,0
NUMBER 257,265714203644,0
NUMBER 262,343277244615,0
NUMBER 266,216067446770,040000000000
NUMBER 271,261505360566,050000000000
NUMBER 274,336026654723,262000000000
NUMBER 300,212616214044,117200000000
NUMBER 303,255361657055,143040000000 ;D+20
NUMBER 306,330656232670,273650000000
NUMBER 312,207414740623,165311000000
NUMBER 315,251320130770,122573200000
NUMBER 320,323604157166,147332040000
NUMBER 324,204262505412,000510224000
NUMBER 327,245337226714,200632271000
NUMBER 332,316627074477,241000747200
NUMBER 336,201176345707,304500460420
NUMBER 341,241436037271,265620574524
NUMBER 344,311745447150,043164733651 ;D+30
NUMBER 347,374336761002,054022122623
NUMBER 353,235613266501,133413263573
NUMBER 356,305156144221,262316140531
NUMBER 361,366411575266,037001570657
NUMBER 365,232046056261,323301053415
NUMBER 370,300457471736,110161266320
NUMBER 373,360573410325,332215544004
NUMBER 377,226355145205,250330436402 ;D+38
REPEAT 0,<
NUMBER 402,274050376447,022416546102
NUMBER 405,353062476160,327122277522 ;D+40
NUMBER 411,222737506706,206363367623
NUMBER 414,267527430470,050060265567
NUMBER 417,345455336606,062074343124
NUMBER 423,217374313163,337245615764
NUMBER 426,263273376020,327117161361
NUMBER 431,340152275425,014743015655
NUMBER 435,214102366355,050055710514
NUMBER 440,257123064050,162071272637
NUMBER 443,332747701062,216507551406
NUMBER 447,210660730537,231114641743 ;D+50
NUMBER 452,253035116667,177340012333
>
>
DEFINE NUMBER (A,B,C)
< EXP B,C>
TENTAB: .TAB. TENS
XX=<TENS-TENTAB>/2 ;CALCULATE NUMBER OF TABLE ENTRIES BEFORE "TENS"
XX=XX-XX/4*4 ;CALC XX=XX MOD 4
BINR1=<BINR2=<BINR3=0>> ;INIT THE BINARY
DEFINE NUMBER (A,B,C)<
IFE XX-1,< BYTE (9) BINR1,BINR2,BINR3,<A>
BINR1=<BINR2=<BINR3=0>> >
IFE XX-2,<BINR3=A>
IFE XX-3,<BINR2=A>
IFE XX,<BINR1=A
XX=4>
XX=XX-1>
POINT 9,EXPTEN-1(%10),17
POINT 9,EXPTEN-1(%10),26
POINT 9,EXPTEN-1(%10),35
BYTAB: POINT 9,EXPTEN(%10),8
POINT 9,EXPTEN(%10),17
POINT 9,EXPTEN(%10),26
POINT 9,EXPTEN(%10),35
.TAB. EXPTEN
IFN BINR1!BINR2!BINR3,< BYTE (9) BINR1,BINR2,BINR3,0>
RELOC 0
;AC1SAV: BLOCK 1
;AC6SAV: BLOCK 1
;AC7SAV: BLOCK 1
;AC10SA: BLOCK 1
;AC11SA: BLOCK 1
;AC12SA: BLOCK 1
;EXPSAV: BLOCK 1
END FCMML