Digital PDFs
Documents
Guest
Register
Log In
DEC-08-FFAA-D
December 1968
96 pages
Original
4.7MB
view
download
Document:
dec-08-ffaa-d
Order Number:
DEC-08-FFAA-D
Revision:
Pages:
96
Original Filename:
https://svn.so-much-stuff.com/svn/trunk/pdp8/src/dec/dec-08-ffa/dec-08-ffaa-d.pdf
OCR Text
_U_nw_._->F NBC—BENZ... 003.003.94.07. 0 7>><Z>DU. EDWWPUICWmAIfim POP-8 PROGRAM LIBRARY MATH ROUTINES January, I968 Order No. DEC-08-FFAA-D from Program Library, Maynard, Mass.‘ Direct comments concerning this manual to Software Quality Control, DIGITAL EQUIPMENT CORPORATION o Price $ I.5O Maynard, Mass. MAYNARD. MASSACHUSETTS Reprinted September, 1967 COpyright 1968 by Digital Equipment Corporation CONTENTS Part 3393 Single-Precision Square Root 1-1 DEC-OB-FMAA-D Single-Precision Signed Multiply Subroutine 2-1 DEC-O8-FMBA-D Single-Precision Signed Divide Subroutine DEC-08-FMCA-D 3-1 Double-Precision Signed Multiply DEC-OB-FMDA-D 4-1 Double-Precision Signed Divide Subroutine DEC-O8-FMEA-D 5-1 Double-Precision Sine Subroutine DEC-08-FMFB-D 6-] Double-Precision Cosine Subroutine DEC-O8—FMGB-D 7-1 Four-Word Floating-Point Package DEC-08-FMHA-D 8-1 DEC-OB-FMlA-D 9-1 Logical Subroutines l0. Arithmetic Shift Subroutines DEC-08-FMJA-D ll. Logical Shift Subroutines DEC-OB-FMKA-D 000000000000 10-1 1. Single Precision Square Root, DEC-OB-FMAA-D 2. ABSTRACT will extract the square root of a single-precision integer. Given an integer K and a remainder R, such that N: K2 + R. This an subroutine input N (O_ N 212), it will produce < < 3. REQUIREMENTS 3 I Storage . This subroutine uses 23 (decimal) memory locations. 3.3 Equipment Standard PDP-8 4. USAGE 4.l Loading library tape that is supplied is a symbolic tape. It does not begin with an origin setting, although it does end with a dollar sign. The binary tape produced by assembling this tape, or the binary tape produced by assembling this tape with other tapes, is loaded with the Binary Loader. The 4.2 Calling Sequence This subroutine is called with an effective JMS SQRT with the argument in the accumulator. swer The subroutine returns control to the location following the JMS with the an- in the accumulator and with the remainder in the 6. DESCRIPTION 6.2 Examples and/or Applications register tagged SQRI . The following program will illustrate the use of this subroutine: 400 CLA TAD X JMS I SQRTPT HLT X, SQRTPT, 0145 (I IOI DEC IMAL) SQRT This sample program will halt at location 403 with OOI2 (octal) or ID (decimal) in the accumulator. Register SQRI (address 0222) will contain OOOI, the remainder. I-l 7. METHODS 7.2 Algorithm The algorithm makes use of the fact that the sum of the odd N Z(2K-1)=2 K==T N E K=i 9. EXECUTION TIME 9.4 Timing Equation N K— 21=2(—I;—l-)(N+1)-N=N2 K=l If the answer is N, the time for the subroutine is (30 + N (25.5)) usec TO. PROGRAM 10.4 Program Listing integers is a square: /DEU 08*FMAA-LA /SGUAHE R00! [00,000 tNIER w1[H SQUARt / tXLTb WIIH HUU] 0000 6222 5226 0205 1223 6225 1222 0226 /100 0207 1225 i420 5217 2226 6222 1225 1224 3204 @2z4 0210 0211 0212 0213 0214 0215 0216 {6217 f300 0220 1226 b600 0000 ///7 //76 0221 0222 0223 0224 0225 0226 SQR‘P SQX, lNlLbLH ODD / 0220 0201 0252 mzzs IN AU AC MEIHUU 0 BOA DCA SURl ROOF /5AVE /0 10 TAD DCA TAD CLL TAD SUR2 SURU SQRl /~1: INPUT ANSWER FIRST AIIEMPL /COMPARE lNPU] THIS IRY INIIH SURU SNL JMP 50?}, ISZ DCA TAD TAD JMP CLA TAD JMp 3991: 0 '1 000b 5092: $9969 SQRUu “Z 0 0000 RUOIo 0 SURF R001 /1tST)INPUT3 SURl SURU SQR6 SUX /1NPUT=INPU|-1EST R001 I SUR; IFE1CH IEXIT PAUS E THERE ARE IN NO LHHUHS SYMBOL iABLt RUOi 0226 SURU SUR+ SuRi 022b 021/ 0200 SURl SURZ SURé 0222 0220 SQX 0204 0224 /AUU *1 T0 ALL ANSWLR /ILST=TEST-2 /CUNT1NUE ANSNtR DONE 1. Signed Multiply Subroutine 2 ABSTRACT . - Single Precision, DEC-O8-FMBA-D. This subroutine forms a 22-bit signed product from 11-bit signed multiplier and multiplicand. 3. REQUIREMENTS 3 1 Storage . This subroutine uses 44 (decimal) memory locations. 4. USAGE 4.1 Loading It does not begin with an origin set- The library tape that is supplied is a symbolic tape. The binary tape produced by assembling this tape, or the binary tape produced by assembling this tape with other tapes, is loaded with the Binary Loader. ting, although it does end with a dollar sign. 4.2 Calling Sequence The subroutine is called by an effective JMS MULT. the subroutine, the multiplier must be in the accumulator (AC). contain the multiplicand. When the JMS is executed to enter The location following the JMS must The subroutine returns to the instruction immediately following the latter location with the most significant part of the product in the AC. The least significant part of the product is stored in location MP1. 6. DESCRIPTION 6 .1 Discussion Reference to the flow chart (11.1) will illustrate the following discussion. On entry, the sign of the multiplier is tested, and if negative, the multiplier is made 6.1.1 positive. 6.1.2 The multiplicand is obtained and tested for 0. If it equals 0, a iump to the exit is executed. Next the sign of the multiplicand is tested, and if it is negative, the multiplicand is made positive. 6.1.3 At this point, the content of the link is as follows: Sign of Multiplier Sign of Multiplicand Link 0 O O O 1 1 1 O 1 1 1 O and represents, therefore, the sign of the product. 6.1 .4 cant The multiplication loop proper (tagged MP4) is entered. During this loop, the least signifihalf of the product shifts into the most significant end of MP1, while the multiplier shifts out the least significant end of MP1 and is lost. 6.1 .5 Note that the sign of the product is retained in MP1. The sign of the product is tested. If positive, the subroutine exits. mentation of the product is performed before the exit. If negative, comple- 6.2 Examples or Applications Example (See 11.1 Flow Chart) The C(Y) are tested. If C(Y) 0, C(MPl) C(MP5) 0. If C(Y) 75 0, cleared and mulitplication is carried out as described below. = C(MP5) are If C(MPl)” contains a are then shifted right one bit. If right one bit. = = C(Y)” C(MP2), l, C(MP2) are added to C(MP5). The contents of MP5 and the MP1 0, the contents of MP5 and those of the MP1 are shifted C(MPl)1 1: For this example, assume that the registers MP1, MP5, and MP2 are five bits in length inThe following sequential steps occur in a multiply operation. The multiplicand is 9 and the multiplier is 4. stead of 11. MP5 MP1 i 00000 01001 00100 00100 01001 C(MP2) + C(MP5)» C(MP5) since C(MPl) is a 1. 00010 00100 C(MP5, MP1) rotated right one place. Comments Initial contents of the register MP1 ready to be tested. tested. 00001 00010 C(MPl)“ is No addition, because C(MPl)” is 0. C(MP5, MP2) AC” is tested. No addition, C(MPl)” 0, C(MP5, MP1) rotated is tested. bit. right C(MPl)“ + C(MP2) C(MP5) C(MP5) since C(MPl)“ is 1. rotated right one bit and 00000 10001 = one 00100 10001 00010 01000 C(MP5, MP1) rotated right. 00001 00100 No addition, —’ C(MPl)“ a = 0, C(MP5, MP1) rotated right one bit. Rotation counter indicates that the multiplication is complete since it has been reduced to 0. Scaling Upon entry the binary point is assumed to be located between bit positions 0 and l in both multiplier and multiplicand. Since there are 11 magnitude bits in each of the two factors, the product contains 22 magnitude bits. The product is double signed; i.e. , bit positions 0 and 1 of the most significant word of the product both contain the sign. The remaining ten bits of the most significant word of the product are magnitude bits. The least significant word of the product is devoted entirely to magnitude. If the binary points of the factors are as stated above, the binary point of the product will be located between bit positions 1 and 2 in the most significant position of the product. On entry, multiplier and multiplicand must be 25 complement binary. product is contained in two words in 25 complement form For more information on binary scaling for fixed-point computers, 2-2 After return, the . see Application Note 501 . 7. METHOD 7.l Algorithm The conventional algorithm is used. The least significant bit of the multiplier is tested. l, the multiplicand is added to the developing product and this quantity is shifted right. If the least significant bit of the multiplier is 0, no addition is made before the shift. The process is repeated until all bits of the multiplier in order from least significant to most significant have been processed. If it is equal to 9. EXECUTION TIME 9.] Minimum When the subroutine discovers that the multiplicand is 0, it bypasses the multiplication In this case, execution time is 25.5 psec if the multiplier is positive and 27.0 usec if the multi- loop. plier is negative. 9.2 Maximum Maximum execution time occurs when the sign of the product is negative and the multipl «consists (in binary) of all Is. IO. PROGRAM l0.4 Program Listing This time is approximately 350 psec. 2-3 /DEc-¢8~FMBA /TMU'b lfiifUHN COMPLEMENT SleLt PRtCISION MULTIPLY ROUTINE HIGH ORDER PRUUUCT 1N AC. LON IN MP1 0 Mzrfl DDDD 2201 M222 /1MM CLL 751D lwbl 3252 5251 1689 SPA 2227 /4bD SNA M210 5254 2211 2212 2213 /b10 /Db1 6252 JMP SPA CMA CML DCA MP2 M214 M215 2216 2217 1247 M223 M204 M2M5 Mazé 2220 MULI, CMA DUA DCA TAD 6255 12b6 /M12 52:2 2221 M222 12:1 2223 2224 12:2 M225 2226 @227 D260 M251 w2é2 6231 22b6 M263 3240 b264 5252 12:1 MP4. /11D 5216 12:2 /le MP1 ISTDRE /JMP MPSNéZ IAC MULTIPLIER MULTIPLILR JMP MP4 TAD MP1 /TES1 FOR ZERU MULTIPLICAND IF MULllPLICANU=w /TESI FDR NEGAT£VE MULTIPLICAND . ISTORE TAD THIR DCA MP3 TAD MP1 RAR DCA MP1 TAD MP9 /MULIIPLY MULTIPLICAND PROPER LOOP MULTIPLICAND /TE81 IF ITLSI FDR /EX1T T0 END OF SHOULD LOOP RAR MPSN. StL JMP 2242 /141 CMA M241 M242 M243 5252 DCA MP; 1251 /M42 TAD MP5 CMA M244 /452 2245 D246 /221 b2¢6 M247 DZDB 1/64 M222 TMIP. JMP MP2 7/54 MP1. 0 2251 Mwwv MP5, a D252 wwww MP2. 4 w2b3 MMMU MP3. @ 2267 22mm NEGATIVE MP5 I MUL. COMP MP1 M99 MUL‘ 1 NHL! CLL 1A0 D265 2256 FDR JAG 52L TAD MP2 CLL RAR DCA MP5 152 MP3 /4sD 745D /TEST CML DCA M92. :OMM COMP. TAD 182 JMP CALLING PROGRAM /COMPLEMENT PRODUCT SiL IAC /EL£VEN PAUSE 2-4 IN DECIMAL BE ADDED IABLL SYMBOL @24W @232 @256 025% 0252 @256 0216 @251 DZZO 924/ CUMP MPSN MP2 MP1 MP2 MP3 MP4 MP5 MULI THIR I I DIAG RAMS . Flow Chart 11.] IS CLEAR IS MULT| PLI CAND NEGATIVE YES COMPLEMENT MULTIPLIER MULTIPLIER NEGATIVE LINK ‘ SET LINK SAVE MULTIPLIER IS CIACI*C(MPI) MULTIPLICAND ZERO? LOAD MULTIPLICANO C((MULTII-‘CIACI IT WILL BE SIGN STATUS IS IN LINK SHIFTED ALONG WITH MULTIPLIER ANDEND UP IN LINK AT END OF LOOP. SAVE MULTIPLICAND C(ACI—‘UMPZI CLEAR MOST SIGNIFICANT HALF OF PRODUCT O —-’ C (M P5) COMPLEMENT MULTIPLICAND COMPLEMENT LINK I LOAD LEAST SIGNIFICANT HALF OF PRODUCT AND MULTIPLIER C(MPI) —O C(AC) IS LINK I I 7’ WAS LEAST SIGNIFICANT 8| 1 BEFORE OF MULTIPLIER I ROTATE ? I. N0 IS LOOP coum REDUCED T0 ZERO ROTATE RIGHT CILI —- C(MPII C(MPI)“—-’C(L? ADD MULTI PLICAND C(MPSI +C(MP2)—OC(AC) SHOULD PRODUCT 8E POSITIVE I. IS LINK -O ? STORE LEAST HALF OF PRODUCT AND MULTIPLIER C(AC)” C(MPI) CLEAR LINK AND ROTATE MOST SIGNIFICANT HALF OF PRODUCT RIGHT C(ACIH—.CIL) COM PLEMENT BOTH HALVES OF PRODUCT 2-5 LOAD MOST SIGNIFICANT HALF OF PRODUCT C(MPS) —-. C(AC) SAVE MOST SIGNIFICANT HALF OF PRODUCT C(AC) ——OC(MP5I RETURN TO CALLING PROGRAM I . 2. Single Precision Signed Divide Subroutine, DEC-08-FMCA-D ABSTRACT Single-Precision Divide Subroutine will divide a 12-bit signed divisor into a 24-bit signed dividend to produce a l2-bit signed quotient and a I2-bit signed remainder. The 3. REQUIREMENTS 3.I Storage This subroutine requires 62 (decimal) memory locations. It is provided in two binary tape assembled with an origin of 0200, and a symbolic tape with no origin setand ting ending with a dollar sign. forms: 4. USAGE 4.I Loading It is provided as a This subroutine requires 62 (decimal) memory locations. symbolic tape with no origin setting and ending with a dollar sign. 4.2 Calling Sequence The subroutine is called with an effective JMS DIVIDE . The accumulator contains the high-order bits of the dividend; the location following the JMS contains the low-order bits of the dividend; the location following this contains the divisor; and the subroutine returns to the following location with the quotient in the accumulator and the remainder in C(HDIVND). If a divide error has occurred, TAD HIGH D JMS | C(L) = I and the accumulator contains 0, otherwise C(L) = 0. /C(AC) HIGH DIVIDEND /CALL DIVIDE 2 DIVDP DIVSOR /LOW DIVIDEND /DIVISOR HLT /C(AC)=QUOTIENT IF L=0 DIVDP, HIGHD, DIVI DE /(0200) /H|GH DIVIDEND 4.5 Errors in Usage LOWD There are two types of errors that may be encountered in using the divide subroutine, the first of which is tested by the routine. The divide may be represented as: (High-Order Dividend) ' 212 + Low-Order Dividend Divisor = Quotient, Remainder Ol' (High-Dividend) ° 212+ Low-Dividend = 3-l (Quotient) (Divisor) + Remainder. Since (Quotient) < 3777(8), it is possible that a divisor and dividend are so specified that no quotient may be Found that satisities this identity. Z Quotient, then the divide will not take place and C(L) will be 1 that are not detected by this test. 1 777 It High-Order Dividend . There are cases, however, For example: 7777 2000 Since (3777) (2000) + 3777 = 1000 1777, there is no possible quotient that when multiplied by the divisor will yield the dividend. RESTRICTIONS 5. See Section 4.5 6. DESCRIPTION 6.1 Discussion . The algorithm works by shifting the dividend left and comparing it with the Dividend-Divisor, and a bit is set in the quotient. This is repeated the proper number of times. The remainder will have the same sign as the dividend, and the quotient will be signed properly: (Dividend Sign) XOR (Divisor Sign) divisor. If Dividend Z Divisor then Dividend = = (Quotient Sign). Scaling 6.3 Single-Precision Divide Subroutine is scaled analogous to the scaling of the Single-Precision Multiply Subroutine (DEC-08-FMBA, previously Digital-8-l l-F). It may be thought of as either an integer divide or a fractional divide The . 2-22 2.1 2"2 0 Dividend (2's 23 1:— Binary Point Dividend Sign 2 0 I -1 L- Binary Point Sign 2 -ll H . . , Diwsor (2 s Complement) Complement) 2—] 2—2 = 0 2-H i LBinary Quotient (2's Complement) H Point Sign High-Order Dividend It I_I Low-Order Dividend Quotient | U Divisor HD - 212 LD + D so thotQ . DUO 70 Remainder D+R=(HD) . :QIR 212+(LD) or 2 (HD i2 D ° 2 +ED1) —22 —Q-2-H,R 2-H 2 Examples: (0) 000 000 7 -3—— 2, _ (b) 000 000 000 000 000 000 000 000 000 0]] HT 2000 000 000 010 Remoinder=000 000 000 00] 000_ —010 000 000 000 Remainder: 000 000 000 000 T 100 000 000 000 000 000 010 000 000 000 l fl—J. T l 2 2 7. METHODS (See Above) 9. EXECUTION TIME 9.] Minimum 58.5 psec (Divide Check) 3-3 9.2 Maximum 478 .5 psec 9.3 Average 5:5 460 psec 10. PROGRAM 10.4 Program Listing 3-4 /QEU~08~FMCA-LA /SIUNLU bINGLt PRECISION /CALLINU SLQULNCt: L(AC) CONTAINS / JMb UIVIUE / ORDER / LOW / UIVISUR / RETURN: UIVIUE HIGH SUBROUTINE ORDER DIVIDEND DIVIDEND C(AU)=OUOTIENT: REMAINDER HUIVND IN HIGH DHDLR DIVIDEND IS EQUAL TO OR GREATER NO UIVISIDN TAKES PLACE AND /THAN THL UIVISOR; /1F /PAGE 620% C(L)=1 1 DIVIDL. fl @221 mafia Vlflw UZDZ Iblw :PA 6203 UMA UML wZDd 7D6v 3207 UCA HDIVNU lDIVIDEND<D7 /YES COMPLEMENT AND SET /HIGH ORDER DIVIDEND @205 7420 bNL dZDé @207 7w4u 6272 UMA UCA 021D 160% TAU SUVNU I DIVIDE /SLT DIVIDEND SIGN SWITCH /FETCH LON ORDER DIVIDEND 2211 7439 5tL $212 7141 527w UMA CLL UCA LUIVNU 6214 743M th D215 226/ ISt HUIVNU /YES @216 2200 ISt £217 lbflm IAU UIVIUE I DIVIDL IFETCH @220 71mm ULL 4221 ozzz 7bwn 7&61 UMA CML £223 3271 UCA UIVSDH 6224 7420 aNL D225 764$ UMA D226 0227 1272 3275 UCA UZJD 71WM ULL @213 DLL IAC /YES: lLON /CARRY? DIVISOR DMA IAU IAC SDVNU SNSWER INEGATE IT /SAVE DIVISOR wa3 IT <u? /YES: Ac=—1 /ANSWER 0261 1271 TAU UIVSOR 6262 1267 IAU /WITH M253 22mm ISt HDIVNU UIVIDE v2é4 70$n 5630 th ULA I DIVIUL /DVER @255 COMPLEMENT ORDER DIVIDEND JMP 3—5 SIGN SWITCH /COMPARE DIVISOR DIVIDEND /YES: FLOW? DIVISOR<DIVIDEND C(L) /PAGE 2 £256 1279 IAU M15 Z237 624% 3274 5251 UcA UIVCNT JMP /01v1ut @241 $242 0243 1267 0V3; /13 SHIFTS UV2 LDUP IAU HUIVNU 7264 3207 HAL UCA HUIVNU lDIVIDEND @244 $245 8246 w247 1267 1271 7430 3267 [AU TAU HDIVNU UIVSOR /COMPARE 5iL UCA HDIVND IREMAINDER @293 7200 LLA U2bl @292 6253 127m LDIVNU /0UOTIENT BITS IENTER HERE 2294 $255 @256 0V2: [AU LEFT DIVISORzDIVIDEND AFTER 7ww4 HAL 327M UCA 2274 15¢ 5241 JMP 1267 2272 TAU BPD7 mZbS 7241 UMA SUVNU LAC 2261 5267 UCA HDIVND £262 @263 @204 127w 2273 [AU LDIVNU /QUOTIENT 15t SNSwEH 7241 UMA LAC /ANSNER<@? /YES: NEGATE $205 71%” @266 Dbfifl ULL JMP I /EXIT £267 wwaw 227% wwwv $271 Evan @272 £273 amew @vww @274 wawv 7766 2275 SYMbOL TABLh DIVCNT $274 DiVIDh DIVSOR @266 UVZ 0V3 W291 @241 HUIVND @267 LUIVND 627% M13 SUVND @275 @272 SNSWEH @273 0271 [St HUIVNU: LDIVNU: DIVbOH: SUVND: SNSNEHv DIVCNT: M13: ISGESE LDIVNU UIVCNT UVS HUIVNU DIVlUt /DONE 12? CONTINUE /REMAINDER /DIVIDEND<0? /N03 /YES /*13(1@) SHIFT SUBTRACT I 2 Signed Double Precision MultipIy, DEC-O8-FMDA-D . ABSTRACT . This subroutine forms a 46-bit signed product from the 23-bit signed multiplier and multiplicand. 3. REQUIREMENTS 3 I Storage . This subroutine uses I25 (decimal) memory locations. 4. USAGE 4.2 Calling Sequence The signed double precision multiply routine is called by an effective JMS DMUL . The two locations following the JMS must contain the address of the high-order multiplicand and the address of the high-order multiplier respectively. The subroutine will return to the instruction immediately following the latter loca- tion, with the most significant portion of the answer in the accumulator. of the answer will be in registers (from high to low) B, C, and D. 6. DESCRIPTION 6.I Discussion The low order portions The double precision multiply routine calls a single precision multiply routine four times after the absolute values of the multiplier and multiplicand have been taken. Sign I Sign (4) \ 77 ® ® A Multiplicand (2's Complement) G) Multiplier (2's Complement) The results are added: Result of Multiply l Result of Multiply 2 Result of Multiply 3 Result of Multiply 4 Accumulator C B Answer D Sign 6.2 Examples To multiply two double precision numbers which are located in registers tagged X and Y: 0400 JMS I DMULTP X Y HLT X, 0 O Y, 0 0 DMULTP, DMUL If X and Y contained: X 0000 00l2 6000 0000 Y 0000 00l 2 3000 0000 0000 0000 0000 0144 7200 0000 0000 0000 AC B C D AC B C D The answers would be: For Further examples see the Double Precision Sine Routine, DEC—08—FMFA Formerly Digital-B-lo-F. Scaling 6.3 Since there are 23 magnitude bits in both the multiplier and the multiplicand, the product will contain 46 magnitude bits. D registers. These are right iustitied in the AC and B, C, and Since the answer is in 2's complement form, the two sign bits are equal (redundant). The multiply routine may be thought of as integer multiplication, as a fraction multiplication, or as any combination of these. When the double precision multiply routine is given two 23-bit numbers, it produces a 46-bit product that is right justified. If the scaling is (xxxx XXX.X) (xxxx an xxxx.) the scaling of the answer will be XXXX XXXX XXXX XXX.X The operands and the answer are in 2's complement form. product may be produced and since the answer is right-iustified, the two are Since only 46 bits of ”sign" bits (0 and l) redundant. METHODS 7. See the Single Precision Multiply Routine write-up, DEC-O8—FMBA Formerly Digital-8-l l-F. 7.l EXECUTION TIME 9. The execution time is a function of the number of 1's in the operands. The maximum execution time is l .605 msec i .4 msec lO. any page. Average time will be around PROGRAM The subroutine occupies approximately one memory page and may be located on The symbolic library tape does not start with an origin setting, but does end with a dollar sign. lO.4 . . Program Listing 4-3 /DEU~D8-FMDA-LA /SIUNEO DOUBLE PRECISION MULTIPLY ROUIlNE /CALL1NU SEQUENCE: JMS DMDL ADDRESS 0» MULIIPLIOAND(HIOH ORDER) ADDRESS Or MULIIPLIER(HIUH ORDER) RETURN. HIGH UNDER PRODUCI 1N AC NEXT HIGH TU LDw 1N 8,C.U \\ /RAOE 025% MODE O2U1 D2J2 /6WD 1663 ZZDS 6662 Z234 46D6 OZDS 1667 mars 6664 b2a7 1666 0210 6665 @211 46w6 @212 $216 66D1 6214 1666 D215 6216 4644 6646 u217 16/6 @226 6642 1664 $221 1665 w222 b226 66D1 6224 4644 1666 @245 1642 6226 6642 /DO4 D227 $260 D261 w262 @263 16/6 6641 /DD4 664% UMUL; 1 @ CLL TAD DCA CLA RES: JMS TAD DCA TSION TAD DCA JMS TAD DCA TAD JMS DCA TAD DCA TAD DCA TAD JMS TAD DUA RAL TAD DCA MLTH MULIH MULIL MP2 MLTL MP4 D MULIH MLTL MP4 TAD MLTH MP4 C 4644 D240 1642 JMS TAD @241 6642 DCA SWIICH AND 5E1 SIGN /RESULT IN MLIH.MLTL IHIGH ORDER MULTIPLICANU /LOW ORDER IFLTCH AND /LOH ORDER ILUW ORDER MULTIPLICAND SET SIGN MULTIPLICAND MULTIPLIER /MULTIPLY ILON ORDER /HlGH IHIGH ORDER ORDER MULIIPLICANO MP2 MULiL D267 SIGN lrthH MP5 C DCA TAD DCA 1665 66D1 1667 /-2 /SEI MLTL MULJL TSIUN RAL D265 v266 @264 SlGNSw /LOW ORDER /MULT1PLY /GET CARRY /GLI CARRY /LUW ORDER MULTIPLIER MULTIPLICAND MP2 ORDER /MULTIPLY /HIGH C /ADU MULTIPLIEH /PAGE RAL TAD @242 /mw4 @243 @244 £245 13/5 1&41 6641 £246 /@@4 RAL £247 1&40 TAD wZDD 6540 DCA 2251 1564 $252 @253 éévl 1657 M254 M295 4644 TAD DCA TAD JMS 1641 TAD MP4 B $256 6641 xnma TAD MPS 8 BOA B A A MULTH MLTH DCA B MP5 $269 $201 0262 10/3 164% 2532 182 SIGNSw @263 $264 mzos bbww JMP I 6540 1643 m266 @207 /141 6543 62/@ 1642 4601 DCA TAD CMA DCA TAD JMS ZZ/l w2/2 @213 DCA TAD 3642 DMUL CARRY IAUD /HIUH ORDER MULTIPLICAND IHIGH ORDER MULTIPLIEH A IANSNER (0?? IND: hXIT IYES D CLL 1A0 INLGATE D C thGAfL COM C a CUM /NtGAfE w2/4 @2/5 $041 JMS 00A 62/6 lé4u TAD A w2/7 v3o0 45ml wafl JMS JMP COM I DMUL E621 Z6k2 £503 v3w4 @UUD 7M4fl QSUS b/Wl 8 MP2: 7191 IGtT A 1541 45ml 7466 CARRY MP2 RAL TAO TAO @257 /GtT COM: CMA StL CLL IAC JMP I COM IEXIT /PAGE 6 M91: Wdflé ”5%7 w510 $311 $512 W513 £314 @615 @316 M317 @320 W321 M322 $323 DMBQ lbww 554w l/4E /1%E TSIGN. D TAD DCA TAD I AUDNS ADURLSS /TLTCH HIGH ORDER /18 IT (0? /YtS: CDMPLtMLNT. 7510 SPA 7wbb CMA CML 6337 2549 1/40 DCA ISZ TAD StL MLTH ISZ SIGNSW @325 @326 @327 743% SiL 2667 @550 @361 D/Wé 182 152 JMP @362 $363 mmww ///6 @364 wmmw REST: MULTH: 3355 @356 wmwz wmwn MULIL: MLTL: M567 wwma MLTHn ADDHSr 0340 @341 mwmw @342 @343 BMEQ WEWE A: B: C» U: SET LINK AUDHS I AUUHS IFLTCH LON ORDER /NAS 1T (9? /YLS; ADD 1 T0 SWITCH NOP StL CMA DEA 22MB EZMM IFLTCH CLL /43@ 2552 7WUW I450 7141 5536 $524 I DMUL AUDRS SIGNSW' GISEDQ GISEDG 4-6 CLL IAC lCUMPLEMENT. MLTL MLTH ICARRY? /YLS DMUL I TSIBN /tX1T ROUTINE CLEAR LINK /PAUE 4 mwmw 6060 DCA MP1 M546 55/5 DCA MP5 w547 15/4 55/2 TAD DCA M12 MP3 ICOUNI w5>1 IIDD bébZ 15w6 CLL TAD MP1 /CAHRY @595 /01w M554 55w6 RAR DCA @635 15/5 /4zw TAD SNL MPb JMP .*3 2550 55b2 /160 M301 15m1 Z602 M363 /m1v 55/5 RAR M554 152 @555 25/2 >552 JMP MP5 MP3 MP6+6 M556 15mo TAD MP1 £367 /vlv RAR w5/0 71mm w5/1 5/44 CLL 55/2 wwwfl MP5. 9 25/5 wwmu MP5. 6 w5/4 7/54 M12. -14 m5bo £696 5597 MP4: CLL TAD DCA JMP PAUSE SYMBOL {ABLL A 064% AUDHS B @541 C @542 CUM @5w1 054w D DMUL @546 MLTH 933/ MLTL Bééb MHl MP2 0500 @5m1 MP3 @672 MP4 @544 MP5 0575 MULIH @564 0633 MULIL M12 RtSt EZBM @574 SIGNSw @556 0652 TSIbN @600 MULIIPLY /UNSIGNED fl @544 M545 MP1 BITS 12 INTO GOES ILLFT 0F IILST MULTIPL1ER MP1 1? INO; DON'T HIT /A IYLS: ADO ADD MP2 1 MP4 /DONE 12 BIIS? /N0: CARRY 18 IN /YES: 00N£ /tXIT C(L) l. Double Precision Signed Divide Subroutine, DEC-08-FMEA-D. 2. ABSTRACT The Double-Precision Divide Subroutine will divide a 24-bit signed divisor into a 48-bit signed dividend to Produce a 24—bit signed quotient and an unsigned remainder. 3. REQUIREMENTS 3 1 Storage . This subroutine requires l05 (decimal) memory locations. forms: a It is provided in two binary tape assembled with an origin of 0200 and, a symbolic tape with no origin setting. 4. USAGE 4.l Loading Binary Loader (Digital-8-2-U). The symbolic is either assembled with the user program or separately with the proper origin setting. The subroutine is loaded with the 4.2 Calling Sequence The subroutine is called with an effective JMS DUBDIV with the address of the high-order word of the dividend (address of the dividend) in the accumulator, followed by the address of the high-order word of the divisor (address of the divisor). calling program at Control returns to the the address of the JMS plus 2. TAD HIGH JMS I DDIVP Low HLT DDIVP, HIGH, DUBDIV - o + I - /ADDRESS OF DIVIDEND /DIV|DEND o o 0 Low, 0 /DIVISOR o The high-order quotient is returned in the accumulator and the remaining bits of the answer are found as follows: C(DIVN D4) C(DlVNDl) C(DlVND2) = Low-order quotient High-order remainder H Low-order remainder The quotient is signed, while the remainder is left unsigned. 5-l Errors in Usage 4.5 Since the division process may be represented as: W DIVIsor = Dividend = Quotient, Remainder such that: (Quotient) (Divisor) + Remainder It is possible to specify a dividend and a divisor such that the quotient cannot be contained within the word size nonvalid. more (in this case, 23 bits). If this is true, the results will be This condition is not tested by the Double-Precision Divide Subroutine. (For a complete description, see DEC—08-FMCA, Formerly Digital-8—l2-F, Section 4.5.) RESTRICTIONS 5, See Section 4.5 6. DESCRIPTION 6.1 Discussion . See DEC-O8-FMCA, Section 6. l 6.3 . Scaling The Dobule-Precision Divide Subroutine is scaled analogous to the scaling of the Double-Precision Multiply Subroutine (DEC-08-FMDA, Formerly Digital-8-l3-F). It may be considered either an integer divide or a fractional divide. 2-.46 2—] O i i Sign 2-23 2-1 O i Complement) 47 L Binary Point Dividend Dividend (2's L Binary Point Divisor Sign 23 Divisor (2's Complement) 2—23 2-] : O i Quotient (2's 23 L Binary Point Quotient Sign or 245 0 21 2O 47 LSign 222 0 2] 2O 23 LSign 222 21 2O LSign 9. EXECUTION TIME 9.] Minimum 1 .424 msec 9.2 Maximum 1 .705 msec 9.3 Average 1 .65 msec 10. PROGRAM 10.4 Program Listing 5—3 Complement) .,L__r /oEc—w8~FMEA-LA /UOUBLE PRECISION DIVLUL SUURUUIINt /CALL1N0 SEQUENCE: C(AC)=AUDHESS 0+ HIGH ORDER / / DUBUIV ADDRESS 0r / RETURN; JMS / 6661 1646 6640 C(DIVNDZ)=LOW ORULR REMAINDLR DIVISOR<DIVIDLNUI HLSULIS UNSPhCIFIED 1 JUBUIVU D DCA ADDHS IDIVIDEND RhSr /-2 SIGNSN I AUDKS DIVNUl ISLT I AUUHS DIVNUZ AUDHS /DIVIDEND IDIVIDEND M226 2227 2661 TAD DCA TAD DCA 132 1/61 TAD 2210 6666 DCA 2211 2661 ISZ @212 1/61 TAD I @216 6664 DIVNU6 2214 2661 1/61 6665 DCA ISZ TAD DCA $2U6 2224 M205 M215 2216 2217 DZZQ @221 2222 $226 1/61 6662 1662 //@D 3267 2643 1665 2224 /l41 $225 2226 6665 2227 M269 2261 @262 @253 1664 4644 6664 1666 4644 6666 2254 1662 @265 4644 2256 6662 QUOTIhNT C(DIVN01)=HIGH QRUER REMAINDER /PAGE 2022 ORDER C(DLVND4):LUN / / 2201 @262 HIGH OHULR DIVISOR C(AU)=HlGH ORDER QUOTIENT / /IF @220 DIVIDLNU ADDRESS SIGN SWIICH /HIGH~ORDER DIVthND AUDHS ADUHS AUDRS I AUDHS DIVNU4 DlVNUl TAD SMA CLA JMP DlVGOl ISZ SIGNSw TAD DlVN04 CMA IAC CLL DCA DIVND4 TAD DIVNU6 JMS CUM DCA DlVNUé TAD DIVNUZ JMS COM DOA DIVNUK TAD DIVNUl JMS CUM DCA DIVNUl /D1VIDEND /UIVIDEND<0? /NO: /YtS: CONTINUE ADD 1 T0 INEGATE SWITCH DIVlDtND 2“ .___» '.‘ /PAUE 2 /FE|CH @237 $248 1626 zzwu @241 6631 m242 1/51 OIVbOl. UIVISOR TAD ISZ DCA TAD CLL 2243 /12@ M244 ZDME SMA $245 Inbw CMA $246 3556 DCA U247 2361 m2aa 1/61 i42b 182 TAD w291 2640 xmww 182 NUP 2294 22:5 /45@ /141 CMA @256 5557 /463 2550 1642 3641 DCA /1aw CLL 56v? JMP @261 @262 w263 @204 ADDRS I AUUKS CML HUIVSH AUDRS AUUHS IAUURESS OF [HIGH ORDLR DIVISUR DIVISUR /UIVISQR>M? /YtS:NEGATE AND StT /L0w ORDER SIGNSN IADU 1 IAC CLL LUIVSH /COMPLEMENT ILow ORDER UIVISOH I C(L) UIVISOH SNL w2b2 @253 @297 826% I DUBUIV DUBUIV TO SIGN SWITCH SiL SZL IS? TAD DCA /CARRY? HUIVSH /YLS M25 DIVUNI IStr Dlvz 5-5 DIVIDE COUNT=24 /PAbE DIV6: 5 TAD DIVNUZ RAL DCA TAD DlVNUc @265 1666 @266 /664 @267 6666 62/9 wZ/l 1662 7ww4 @2/2 6662 DCA DlVNUl w2/3 1666 1667 6661 TAD TAD DCA DlVNUd /ww4 RAL TAD TAD SNL m2/4 @2/5 w2/6 @2/7 W660 M691 @662 0616 /SH1FT /LtFT HIGH DIVthNU DlVNUl RAL 1662 1666 /426 LUIVSN AUDHS /GtT b666 JMP DIVZ-1 DlVNDl 0634 M665 1661 6666 U6m6 /2m6 CLA $667 @610 1665 /@@4 6665 DIVZ: TAD CARRY DIVNUl HUIVSA 6662 DCA TAD DCA /UOMPARE DIVISOR: /W1TH DIVISOR AUDHS DlVNDd DIVNU4 RAL /RUTATE LON INURDS LEFT OHDLR DCA 01VN04 6612 6616 W614 M615 1664 TAD DTVNU6 IQUTDIENT /mw4 RAL 6664 2641 DCA ISZ DIVND6 DIVUNI M616 9265 JMP DlV6 0617 6629 264% 562/ ISZ JMP SIGNSw OUT lfiNTER FROM C(L) /UONE 24? /NU: CONTINUE /ANSNtR<D? $621 @622 1665 TAD DlVND4 /141 6665 CMA @626 @624 1664 TAD @625 4644 JMS $626 5690 @627 666% 1664 beb 6611 DCA OUT: CLL lAC DIVNU4 DlVNU6 COM DUbulv JMP 1 TAD JMP DIVNU6 I DUBQIV 5-6 /NO: /YES EXIT BITS /PAbE 4 U551 £662 E563 Uflfld AJUHS! 0 ammu DIVNDl: 0 wawb UlVNUd! 0 fiéé4 UIVNUét E b665 mwnc 600E UIVNDQI G @666 wwwu v3¢7 WWME HJIVSHI LUIVSH: D $646 $080 slsNSw, 0 @641 UMML DIVUNI 9 0 0542 //47 "$1 0543 /7/6 M25: RES': 0544 vMMU COM: B U345 /fl4U $546 7460 SiL $547 /1Wl CLL wébz 9/44 JMP 0 l-25(10) '2 CMA IAC I COM PAUSE SYMBOL :ABLE AUDHS @531 CUM @644 UlVCNc @641 UlVbOl DlVNDl @662 DlvNDZ flééé DIVNUJ DIVND4 @654 DLVZ D1V6 @60/ 0269 DUBUIV @ZUW QJSO HUIVSH LUIVSH M25 @23/ @535 @éé/ 0642 OUT @62/ RtSI @646 064$ SlGNSw 12. REFERENCES See DEC—DS-FMDA, formerly Digital—8—13-F. 5-7 I Double—Precision Sine Subroutine, DEC-08-FMFB-D. . ABSTRACT 2. The Double-Precision Sine Subroutine will evaluate the function Sin(X) for 4 < X < 4 (X is in radians). The argument is a double-precision word, 2 bits representing — integer part and 2I bits representing the fractional part. the fraction — Sin(X) I < 3. REQUIREMENTS 3 I Storage . The result is a 23-bit signed < I. This subroutine uses 248 (decimal) memory locations. 3 2 . Subprograms and/or Subroutines Double-Precision Multiply Subroutine (DEC-08—FMDA, formerly Digital-8-I3-F) (Digital-8-23-F). The or EAE Version 4. USAGE 4.2 Calling Sequence The Double-Precision Sine Subroutine is called by an effective JMS DSIN followed by the address of the high-order word of the argument. Control returns to the calling program at the address of argument address + I with answer in registers ARG, ARG + I. For example: JMS ARGMNT C(AC) = 0, C(L) = 0 and with the DSINP I HLT bsuN DSINP, ARGMNT, I000 0000 6. DESCRIPTION 6.I Discussion input to the sine subroutine is considered to be in radians within the range The subroutine is able to call itself recursively and does so when reducing the the of range argument to the first quadrant. The following identities are used: The — 4 < X < 4. if X if X < 0, Sin(O) 0 Sin(—X) —Sin(X) (recursive call) if X <1T, Sin(X) = 0 = = = -Sin(X - 6—I 1T) (recursive call) if X > 1r/2 if X for O<X<1T/2, = Sin(X) Tr/Z F=—2;)r—< 6.3 — 1T) (recursive call) Sin(1r/2) :1 sothat O<F<l, _ _ I=(c1 then: 4 2 . mm —Sin(X = + + C3F C5F + 6 c7|= + 8 c9F ) Scaling The scaling for the argument is: t— Implied Binary Point (word is 2'5 complement) Sign The binary weightings of the argument may be represented as: l 22O 2 1222324i..{ __ _ _ _ _ 220221 L Binary Point Sign and Thus, 1.5 radians would be: 001 100 000 000 000 000 000 000 000 000 000 000 -l .5 radians would be: HO 100 000 000 The answer is a 23-bit signed fraction (2's complement) with the following binary weightings: g 2-I 2-2 2-3 2-4 fi— Implied E 2-2] 2-22 2-23 Binary Point Sign Thus if the answer were 0.75(IO), it would appear as follows: ARG OH 000 000 000 ARG+I 000 000 000 000 If the answer were -0.75(I 0), it would appear as: ARG IOI 000 000 000 AR (3+1 000 000 000 000 METHODS 7.2 Algorithm See Section 6.1 . EXECUTION TIME 9.I Minimum When the argument is a multiple of 1r: 9.2 Maximum Without EAE: With EAE: I0.6 msec 2.78 msec 9.3 Average Without EAE: With EAE: I0.4 msec I0. PROGRAM I0.I Core Map 70 psec 2.6 msec. The Double—Precision Sine Subroutine, listed, was assembled starting at 0400(8). It assumes that the Double-Precision Multiply Subroutine ( DEC-08-FMDA, formerly Digital-8—I3-F) is in core starting at 0200. If the multiply subroutine is placed elsewhere, the pointers on page I of the program should be changed. 6-3 as 10.4 Program Lis’ring /DEC’UBHFMFB-PA IDOUBLE PRECISION Sth /P01NIERS T0 DEC-DU'FMUA U341 @342 DMUL‘ZUU 8:341 5:542 040% uaaw @4UU @229 DSIN, U401 U402 1600 TAD I 0404 D405 3347 2351 DCA TAD DCA ThMP U403 3351 1751 U4E6 @407 1751 TAD 3350 DOA 0410 2200 1296 3763 TAD 0299 @411 @412 0413 0414 @415 0416 0417 042% $421 U422 U423 U424 7640 StA 5233 JMP NtG 1350 TAD SiA XZ¢1 CLA NtG INO BOA 7640 5233 72mm JMP PNTJ DCA 1 3755 DCA CLA I PNT6*1 CMA ILXIT PUSH XITl; TAD 'DCA TAD DCA 3365 770% 5261 1350 7141 3350 0441 1347 U442 U443 7040 7430 0444 7091 3347 IHIGH 0F ARGUMENT ORDER /LON ORDER /t1x EXIT /$AVE 0N PUSHDOWN FOR ZERO CLA 3754 1763 3351 5751 1347 @445 152 031 ISZ 0436 @435 0436 @437 U44@ I ThMP X2¢1 TAD 7240 @434 TLMP 1347 1363 @453 1 lADURhSS X2 TtMP 2363 0426 0427 @432 152 DSIN 08! I PUSH PUSH X2 ICHLCK CLA 0425 @431 0 NEG; pUsH I I TAD SMA X2 TAD CLL DCA TAD CMA ThMP /CHhCK CLA P05 XZ+1 CMA XZ¢1 x2 StL IAC DCA PUSH ThMP JMP JMP ISIN<U)=U x2 FOR NEGATIVE X /SIN<°X)=«SIN(X) IAC LIST /PAGE 2 0446 4200 JMS @447 0547 1755 x2 TAD 045% 0451 0452 0453 0454 @455 0456 XLTZ, 7141 3755 CLL DCA 1754 TAD CMA 7040 7430 7001 3754 5225 7100 DSIN IRECURSIVh CALL FOR SINE I PNT3‘1 CMA 140 I PNT3‘1 I PNT3 INEGATE sgL 1Ac 0462 0463 0464 0465 0466 0467 @479 1350 1360 3351 TAD I PNT3 XITl /IS XZ*1 TAD DCA MPI*l TEMP 7004 RAL 1347 TAD TAD @471 5300 3347 @457 0460 0461 $472 0473 0474 0475 0476 0477 wszv 1350 1362 0504 $505 0506 $507 JMP CLL ICARRY X2 MPI JMP PCHK DCA TAD x3 DCA J s X2*l x JMP PCHK, CLA TAD /SIN(X):-31N( x .pl ’ TEMP DSIN XITZ CLL IIS XZ*1 TAD DUA RAL MPIO*1 1347 1361 7510 TAD x2 TAD M910 5337 JMP 3351 7004 X<PI? SPA 3350 4200 0547 5 8583 PCS: 1351 w501 2 DCA 1357 7510 5250 7300 SPA ALG 7440 StA 5324 1351 JMP @514 7440 StA 5324 7140 7010 JMP PZNG CMA RAR CLL 3754 DCA I PNT3 7040 3755 5225 CMA DCA I PNTJ*1 JMP x:71 0522 0523 X<PI/Z? TtMP 0510 0511 0512 0513 0515 0516 @517 0520 $521 THE 7A0 6-5 PZNG TLMP /SIN(Pl/2)=1 ANSWER 0524 @525 @526 0527 0530 0531 @532 @533 @534 0535 0536 @537 0540 7300 135% 1360 3359 7004 1347 1357 3347 4203 @547 5250 72mm IDECPvBHFMFB-PA IPAUE 3 CLL CLA PZNBI TAD TAD DCA X2‘l MPI*1 X2*l RAL XZ TAD TAD DCA MPI JMS DSIN X2 JMP XITZ 1350 XZ*1 0541 7104 CLL RAL 0542 @543 3753 1347 DCA TAD X2 0544 0545 0546 7904 RAL 3752 5756 DCA @551 0552 @553 0554 9900 game game 0743 0744 0741 0555 @742 @556 0557 0560 060m 4667 @561 0562 @563 4023 6333 ALG; JMP IALIGN CALL FOR FOR SCALING ALGORITHM PNTZ*1 I PNTZ PNTA I ; ISYMBQLS AND D X2, CONSTANTS FOR THIS PAGE G TEMP: PNTZ: 0 X X‘l PNTS: PNTQt M910 ARG ARG* 1 DALG 4667 /e(PI) 4025 MPIUt 6912 0564 IRECURSIVL x2 CLA TAD 0547 0550 /SIN(X)=~SIN(X'PI) PUSH. 6533 6W12 PUSH t1 I'IPI/Z) / POINTER FOR PUSHUOWN LIST SINE /UECHW8-FMFB-PA lPAbE Dbbfl 0600 $601 $602 0603 0604 B605 0606 0607 061% 9611 @612 0613 0614 @615 @616 4736 @743 @755 ROUND 4736 0743 @743 4277 JMS DMTG SCAL XSQR TAD DCA TAD FYX PNT DCA DCA DCA CHK AHG 3345 7100 LOOP: CLL FOUR / / AHG‘; 7924 1341 RAL @641 4312 9741 ISE TAD TAD DCA 15% JMS XSQR 4277 JMS JMS @645 @646 1541 @647 7510 7U2E 7910 BIT /UET x«x IUET RID OF EXTRA SIGN BIT \r'3>\—4 lit ARG I PNT ARG PNT I /1NCRtMtNT POINTER FOR NEXT DMTG ARG 0737 2346 5223 7100 SIGN PNT I ARG*1 ARG‘l PNT 4736 0741 EXTRA NOW /IN1 TAD DCA 0635 @656 0657 064% 9 I TAD 2345 = ROUND 1745 1342 3342 2345 1745 3341 OF x 1353 3342 0652 @653 @654 @655 1 0737 @623 0624 @625 @626 @627 RID /SCALING X JMS JMS @622 (Z/PI)*ARG X 4312 3341 IkORM /GET JMS 0621 @651 7091 JMS sgAL 4312 @743 3346 065% DMTG SUAL 1354 @642 @643 0644 I X JMS B620 0633 @634 “USIN‘ZMfl JMS DALE, 4277 4277 0617 @650 @631 0632 4 SCAL /GET RID OF ROUND ARG ISZ JMP CLL TAD CHK LOOP ARG /SHIFT SPA CML RAR 3341 1342 701% DCA ARC TAD RAR ARG‘1 3342 DCA ARG*1 6-7 ARE 1 PLACE SIGN BIT $656 0657 @666 @661 $662 $663 @664 @665 @666 @667 @670 @671 @672 0673 @674 0675 @676 CLL 136% 1342 TAD Cl*l TAD AHG*1 ARG*1 1341 1357 3341 4736 0741 5676 @425 @715 @716 JMS JMS JMS S /UET R Y ALING 0 OF S “f ACK 6N TO BIT iERd OUT: SCAL: OUT JMP I XlTl lRDUTINt CLL RAL 1751 DCA TAD 1 1 7w04 RAL 3751 1350 7E04 DCA TAD I BTG TtMZ RAL JMP I 5677 ROUND; TO ADJUST SCALING are are SCAL 0 3347 1712 2312 BOA TAD 335a :82 @717 @720 1347 @721 1350 0722 7%01 3347 DCA @724 1751 TAD 0725 3747 DOA 0726 @727 1752 7710 5712 TAD TtMl I ROUND ROUND TLMZ IADDRESS OF HIGH TfiMl 1 TtMZ TLMZ IAC SPA @731 2747 $732 5712 0753 @734 @735 2750 JMP 132 JMP ISZ 7090 NOP 5712 JMP 073% S~AL 5 AL ROUND ARC BOA TAD DCA TAD @723 /PUT ARC I DMTG x 7104 3752 3750 CONSTANT Cl TtMZ I CTG 0090 LAST ARC 9 BOA TAD 1752 IN ARG 4312 @741 0701 0702 @710 @711 0712 @713 0714 JMS @743 4277 4277 0@@@ 3350 @704 0705 0706 0707 DCA RAL TAD TAD DCA 3342 7@@4 @677 @7@@ 0703 /Auu 7100 TLMl 1 ETC 1 ThMl 1 CTG LA 1811 Y ROUND “1-.“ 1 ThMl ROUND m=1?? /N03 EXIT /YES: ROUND TEN? [RETURN ROUND /~ARRY sk 1? 0R N072! ORDER /DEC-W8mFMFB-PA lPAUE 6 AND /SYMBULS @200 DMTG, 0090 0000 0990 0090 0000 000% XSQHa @747 @750 0090 000% 0900 EEEQ PNT: CHKI .EMI. @751 0341 @752 0753 0754 0755 @342 8T5; CTGa FYXa FOUR: 7091: B756 0757 @760 6303 @736 @737 @740 0741 D742 0743 0744 0745 @746 @761 @762 0763 69764 0765 @766 @767 0770 0761 7774 2427 3110 3755 2367 ARG: X0 $EM20 OWQQGQGGSG ICS~C9 C9: C7: 7766 1505 C5: 0243 042% /2/PI El: @000 3331 CONSTANTS DMUL 93: 5325 6-9 STORED IN BACKNARDS ORDER SYMBOL TABLE AL 0537 8 @741 0341 @751 BTG C CHK 0.6 6 Cs 6: C7 09 DALG DMTG DMUL DSIN FOUR FYX LOOP MP! MPIO @342 @746 @752 ‘fl757 0767 $765 @763 @761 @600 @736 @290 @409 0754 @753 0623 0557 @561 NEG our PCHK PNT PNTZ PNTS @433 @676 0500 @745 @552 pNTa POS @556 PUSH SUAL @563 @524 0712 0677 TEMP @551 TEMl TLMZ TUPI @747 0750 @755 X 0743 0425 045% @737 @547 PZNG ROUND X171 XITZ XSQR X2 @554 @461 6-10 I Double—Precision Cosine Subroutine, DEC-OB-FMGB-D . 2 ABSTRACT This subroutine will form the cosine of a double-precision argument (in radians). The input range is - 4 < X < 4. 3. REQUIREMENTS 3 I Storage . This subroutine requires 64 (decimal) memory locations. 3.2 Subprograms and/or Subroutines This subroutine requires the Double-Precision Sine Subroutine (DEC-O8-FMFB-D). The symbolic tape contains definitions that are used as intercommunication registers to the sine subroutine. 3.3 If the sine subroutine is moved, these "pointers" must be changed. Equipment Standard PDP-8. 4. USAGE 4.] Loading library tape that is supplied is a symbolic tape. It begins with an absolute The binary tape produced by assembling this tape, or the binary tape produced by assembling this tape with other tapes, is loaded with the Binary The origin setting and ends with a dollar sign. Loader. 4.2 Calling Sequence The Double-Precision Cosine Subroutine is called in a to the way in which the Double-Precision Sine Subroutine is called. manner that is identical For more complete in- formation, see DEC-08-FMF B-D 5. RESTRICTIONS See DEC-O8-FMFB-D 6. DESCRIPTION 6.] Discussion The Double-Precision Cosine Subroutine uses the following identities: If X<O; COS(—X) Then SIN(1T/2 — X) = = COS(X) COS(X) This insures that the argument presented to the sine subroutine is in the proper range. 6.3 Scaling See DEC-OS-FMFB—D 7. METHODS See DEC-O8—FMFB-D 8. FORMAT See DEC-08-FMFB-D 9. EXECUTION TIME 9.] Minimum The minimum time occurs when the argument is O. 9.3 In this case, time = 55.5 psec. Average In general, the Double—Precision Cosine Subroutine takes from 75 psec to 93 psec longer than the Double-Precision Sine Subroutine (see DEC-08—FMFB—D). TO. PROGRAM 10.4 Program Listing /OEC-OB-FMGB~PA @741 $420 1222 /DOUBLE PRECISION COSINE /CALLS OEC-OB-FMFA /POINTERS TO DEC-OB-FMFB ARG=741 OSIN=4OO §1000 DCQS: 2222 1622 3262 TAD 1003 1024 1225 1662 3256 TAD I DCOS ADDRSS I ADDRSS DCA EX 2262 1206 1207 121“ 1211 1012 1662 3257 ISZ TAD ADDRSS I ADDRSS EX+1 1213 1214 1915 1216 1257 TAD 7642 SZA 5224 7242 CMA 1217 1020 1021 1922 1223 DCA DCA TAD SZA JMP JMP 7212 RAR 3662 OCA 7242 CMA DCA 3661 5254 1024 1256 1025 7722 JMP TAD SMA 1026 5237 1257 TAO 1927 103m 7141 TSIGNN: FOLLOW Q 122M lflfll lag? 1256 7642 5224 SUBROUTINE JMP CLL DCA 1031 3257 1032 1033 1934 TAD 1935 1256 7242 7432 7221 1936 3256 DCA EX CLA TSIGNN FX+1 CLA TSIGNN I /FETCH ADDRESS OF /ARGUMENT /FETCH HIGH ORDER /ARGUMENT /INCREMENT ADDRESS POINTER /EETCH LON ORDER /ARGUMENT /IS ARGUMENT EQUAL /TO ZERO /NO: TEST THE SIGN /TEST LON ORDER BITS /FOR ZERO /NOT EQUAL TO ZERO ARGPNT I ARGPNT+1 EXIT /SET ANSWER EX /SEE IF TO X>g CLA ARGPOS EX+1 CMA IAC Ex+1 EX CMA SZL IAC EX /ARGUMENT IS /ARGUMENT IS /NEGATE IT >2 (O 1 ARGPOS: 1%37 73G® CLL CLA 1949 1257 7M41 1265 3257 TAD CMA TAD EX+1 IAC PIOT¢1 DCA EX+1 1256 794w 743G 7091 1264 3256 4663 TAD EX 1041 1G42 1Q43 l$44 1M45 1@46 1047 195$ 1351 1952 1953 1054 1055 1956 1057 1W60 1961 1962 1fl63 1Q64 1965 /SUBTRACT /PI/2 X FROM CMA 32L IAC TAD PIOT DCA EX JMS EX I DCOS I DCUS 1056 2209 5690 EXIT; 13? JMP @@@9 EX; 0 DSINPT /CALL SINE SUBROUTINE /ARGUMENT ADDRESS /RETURN TO CALL*1 /ANSNER IN ARG:ARG*1 0 @@@® @741 @742 BWQQ ARGPNT; ARG ADDRSS: B @400 DSINPT: PIOTn DSIN 1444 ARG*1 1444 1767 1767 PAUSE SYMBOL TABLE ADDRSS 1@62 ARG @741 1G6® ARGPNT ARGPOS DCOS DSIN DSINPT EX EXIT PIOT TSIGNN 1G37 1Mfi® @4Wfi 1963 1®56 1654 1®64 1W24 12. REFERENCES 12 1 Other Library Programs . ‘ See Digital-8-1I6-F For Further expianation of the calling sequence, timing, and algorithm. scaling, I 2 Four-Word Floating-Point Package, DEC-08—FMHA-D. . ABSTRACT . This program is almost identical to the 3-word Floating-Point Package (Digital-8-5-S) except that accuracy is carried to 35 bits, and 4 I2-bit words are used for storage. 3. REQUIREMENTS 3.I Storage This program occupies registers 7; 4. USAGE 4.I Loading 40-6l; 5600-7577 (octal). Binary Loader (Digital-8-2-U) or DECtape System. 4.2 Calling Sequence Identical to Digital—8-5-S. RESTRICTIONS 5. See Digital-8-5-S. DESCRIPTION 6. The floating accumulator resides in memory locations 44, 45, 46, and 47. The instructions FGET, FPUT use 4—word arguments (II-bit exponent + sign; 35—bit mantissa + sign). The 4-word package contains all operations except for square root (0002) and square (000i). METHODS 7. See Digital-8-5—S. 8. FORMAT 9. EXECUTION TIME 9.3 Average (Not Applicable) Execution times are very difficult to estimate as they greatly depend upon the data on which the floating-point package is operating. FADD = FSUB = FDIV = Generally speaking: 382 usec + 42(N) where N is the number of shifts to align binary points. FADD time + 42 psec 3.4 msec (approximately) 8—I FMPY = FGET = FPUT = FNOR = FEXT = 10. PROGRAM 10.4 Program Listing 3.3 msec (approximately) 156 psec 1721mec 168 + N(42) psec where N is number of shifts; +84 psec if argument <0. 140.5 psec WORD FLOATING POINT /ARITHMETIC INTERPRETER /PAGE 1 /4 *AE @640 0366 0041 DDAZ fivbfl 0646 Duflfl DDAA 0645 DEED flflflfl wnmw 0046 ADA? aDSD fldflfl 0651 DWDD DEED flflbfl EXI, HIGHI, MIDI, LOWI, EXP, HORDER, MIDDL, LORDER, OVERZ, OVERI, D D w 0 fl 6 D v v D *61 /ARITHMETIC D ouél Uflflfl FLAG, 5606 mama FPNT, 5661 7566 CLA CLL 5692 5605 56v4 SD51 3653 16DD DCA DCA 5605 56U6 5257 1257 56%? 5616 5611 6265 7655 5214 AND 5612 5616 5614 5615 5616 5617 1267 DZDD 6262 127m 0257 1262 OVERI 0V£R2 I FPNT JUMP JUMP PAGENO CLA .+5 MASKS FPNT ADDRS MASK7 JUMP ADDRS 562d 6262 TAD AND DCA TAD AND TAD DCA ADDRS ERROR FLAG *5600 m TAD DCA TAD SNA JMP /GET INSTKUCTION /PAGE 0?? /YES /N0 /GET GET - 7 PAGE BITS BIT ADDRESS 5621 5622 1266 0257 5626 5624 5625 765% 5227 1662 5626 6262 5627 566M 5661 5662 2200 5666 5664 6266 2266 1666 6641 2266 564m 1666 6U42 2266 1666 6046 1257 71W6 7066 U264 5644 5645 5646 5647 5656 5651 5652 5656 6260 1666 6269 466m 5261 5657 566d 0900 10131010 5661 $666 5662 5666 @200 dfiUB 5664 5665 5666 5667 @017 UZMB 5676 5674 5675 5676 5677 57b0 5761 MASK6 TABLE JUMP2 I JUMPZ JUMP2 I JUMPZ FPNT+1 1271 5654 5655 5656 5670 5671 5672 FPNT I ADDRS 3X1 ADDRS SAVE SAVE I SAVE HIGHI SAVE I SAVE MIDI SAVE I SAVi LOVl JUMP RTL 1262 5666 5667 0463 7696 @177 5672 5714 660% 6626 6667 666% 5702 5766 62am /BIT6=1?? /YES - DEFER ADDRS LOOPDI, 1662 604% 5665 5641 5642 5646 INDRCT JUMP CLA LOOPal 1 ADDRS JUMP, JUMPZ, 602, ADDRS, SAVE, mam, PAGENO, INORCT, MASK5, mam, TABLE, flfl17 $260 2460 7600 M177 0+1 EXIT FLAD FLSU FLMY FLDV FLGT FLPT FNOR M 8-3 /EXPONENT /HIGH ORDER IMIDDLE BITS /LOWER BITS /LOOK-UP ON /EXECUTE /GET NEXT TABLE 5702 57fi3 5724 5725 57fl6 5767 571m 5711 5712 5716 Dflfiv 1D4fl FLGT, E TAD DCA TAD DCA /FLOATING EXl EXP HIGHI HORDER TAD MlDl DCA MIDDL TAD LOdl DCA LORDER JMP FPNT+1 EXIT OR SUBROUTINEZEDXK EXIT, 0 1241 5645 1242 5046 1W45 5847 5231 flbflfi 5726 5724 5725 166B 526% 1236 5261 466% 5765 5754 5755 GET:5fiflw 5m44 5714 5715 5716 5717 5726 5721 5722 5726 5727 5750 5751 5752 /FLOATING fl264 TAD AND 745D SNA 1257 56Dfl 155D 626D 1261 5260 52D1 9006 JUMP MASK5 /BITS 8-11:D?? JMP I FPNT TAD TABLE6 DCA JUMPZ TAD I JUMPZ DCA JUMP2 TAD FPNT DCA 602 JMS I JUMPZ TAD 602 DCA FPNT JMP FPNT+1 /FLOATING Pur:smwm FLPT, 5766 5767 5740 1945 2262 TAD HORDER ISZ ADDRS DCA I ADDRS 5741 5742 1246 2262 5662 575a 5751 5752 5756 5754 5755 5756 /RESTORE PSEUDU PC /RETURN I ADDRS TAD MIDDL ISZ ADDRS DCA I ADDRS TAD LORDER ISZ ADDRS DCA I ADDRS JMP FPNT+1 1047 2262 5662 5201 575m 577m 577m 577w 577w 577m 5770 PC EXP TAD DCA 5745 5744 5745 5746 5747 /SAVE PSEUDO W 1644 5662 5662 /YES:FEXT /NO:LOOKUP BITS 8-11 /ON SUBROUTINE TABLE TABLE6, EXIT6 EXIT6 EXIT6 EXIT6 EXIT6 EX1T6 /SUBROUTINE TABLE /ABSOLUTE ADDRESSES /OF SUBROUTTNES /EXIT6=DUMMY OR NOP 5762 '5766 5764 577D 577D 577D 577D 577m 577D 5765 5766 5767 577D 577d 577$ 5776 5771 660$ 5757 5769 5761 EXITS EXITS EXITS EXITS EXITG EXIT6 EXIT6 EXITS EXITG EXITS, D JMP 577D /FLOAT1NG I EXIT6 ADD=1won *6DDD FLAD, 6dflfl dflflfl 6wfl1 4261 JMS ALIGN 66v2 6w06 5660 4612 JMP 6004 76mm 60b5 6&36 1051 Ins» 6056 7064 1m46 6Dv7 6&10 6v11 6w12 6616 6014 6015 6616 6u17 6020 6021 6w22 6v26 6624 6025 D JMS CLL OVERI OVERZ OVLRZ 1041 1m45 6045 CLA TAD TAD DOA HAL TAD TAD DCA RAL TAD TAD DCA HAL TAD TAD DCA 4705 56%” JMS JMP I I 1v47 6047 7mn4 1043 1w46 6v46 7604 6D26 JDDD 6627 Svév 47m6 52U1 6n61 SD62 UDJW /ALIGN WOKDS /NO ALIGNMENT I FLAD SCALE /TRIPLE ADDITION /CARRY LOdl LORDfiR LORDER MIDI MIDDL MIDDL HIGHI HORDER HORDER NORMAL FLAD /FLOATING SUBTRACTZZDDD FLSU, n Jms JMP /ALIGN BINARY ALIEN, I OPMINS FLSUX POINTS m TAD 6066 1045 764D SZA HORDER CLA 6v64 524D JMP .+4 8-5 /NEGAT£ /ADD OPhRAND 6655 6056 6057 1046 5644 5272 6D41 1641 765a 6642 6645 6544 5651 1640 7641 6645 6a46 6552 104 745% 5272 75ww 7fl4l 5564 6655 6w54 6655 1554 1557 771% 6656 6657 6666 5274 1m4w 7041 1644 7004 7620 151M 1511 5555 4765 2564 5267 2251 5651 104% 7541 1044 77mm 5651 5702 5765 6046 6547 6656 6651 6661 6562 6w65 6664 6D65 6666 6567 667D 6571 6372 -6575 6674 6675 6076 6077 6160 6141 6132 6165 6164 6155 6655 MODE 6250 6116 6566 0645 0525 6111 6116 6156 6167 TAD EXT DCA EXP JMP DONE TAD HIGHI SNA CLA JMP I ALIGN TAD 8X1 CMA IAC TAD EXP SNA JMP SMA CMA DCA TAD TAD SPA JMP TAD CMA TAD RAL SNL TAD TAD DCA JMS ISZ JMP DONE, NOGO, POINT, AMOUNT, NORMAL, OPNINS, TESTI, TCONI, TCONZ, /C(FAC):H /OPERAND=@ DONE /EXPONENTS EQUAL IAC AMOUNT /NUMBER PLACES OF - EXIT‘ AMOUNT TESTI CLA NOGO EXI IAC dXP CLA TCONI TCONZ POINT I POINT AMOUNT 0-2 ISZ ALIGN JMP I ALIGN TAD EXT CMA IAC TAD EXP SMA CLA JMP I ALIGN 5MP I .+l FLGT+1 d W FNORM OPNEG £645 SHFTOP-SHFTAC SHFTAC /NO SHIFTING /SHIFT /SHIFT POSSIBLE OPERAND RIGHT FAC RIGHT 6112 6666 6116 6114 4641 4616 6115 5712 6116 6117 6666 /SCALL BOTH SCALE, 6 SHFTAC, 6126 6124 6125 6645 1646 6126 7616 6127 6166 6161 6162 6166 6164 6165 6166 6167 6146 6646 1647 6 CLA CLL TAD HORDER SPA CML RAR DCA HORDER TAD MIDDL RAR 7666 1645 7516 7626 7616 6121 6122 SHFTOP SHFTAC JMP I SCALE FLOATING AC RIGHT JMS JMS /SCALE 6126 RIGHT 7616 6647 1656 7616 6656 2644 7666 5716 DCA TAD RAR MIDDL LORDER DCA TAD RAR LORDER OVERZ DCA OVERZ ISZ NOP JMP EXP /SCALE OPERAND 6141 6142 6146 6144 6145 6146 6147 6156 6666 7666 1641 7516 7626 7616 6641 7616 6152 6156 6642 1646 6154 7616 6155 6156 6646 1651 6157 7616 6166 6161 6651 2646 6162 6164 7666 5741 4200 6165 5626 SHFTAC RIGHT 6 CLA TAD SPA CML CLL HIGHI RAR DCA HIGHI TAD MIDI RAR 1642 6151 6166 SHFTOP, I DCA MIDI TAD L061 RAR DCA L061 TAD OVERI RAR DCA OVdfil ISZ EXl NOP JMP FLSUX, I SHFTDP JMS FLAD JMP I FLUX 8-7 /NORMALIZE FLOATING ACCUMULATOR *6200 6220 6201 6202 6205 6204 6205 6206 6207 6210 6211 6212 6215 6214 6215 6216 6217 622a 6221 6222 6225 0600 7500 5561 5565 1045 7510 2565 7640 5224 1046 764a 5600 6252 6255 5251 1656 6254 7104 5050 1547 6255 6256 6257 7004 6246 6241 6242 5047 1046 7004 6245 6244 5046 1045 6245 7024 6246 5045 2561 6247 6250 6251 6252 JMP 1047 7640 5224 1050 7640 5224 5044 6227 6250 6251 6225 6226 5227 1561 7041 0 CLA DCA DCA TAD SPA ISZ SZA 5224 1565 7640 4261 1545 7104 7710 6224 FNORM, 606, SHIFT, NOREXT, LORDER CLA 006 OVER2 CLA 606 EXP I FNOKM MP5 CLA ACNEG HOKDER JMP TAD CLL DCA TAD RAL DCA TAD RAL DCA TAD RAL DCA TSZ JMP TAD CMA 1644 TAD DCA TAD 4261 /NO TAD SZA JMP TAD SZA JMP DCA JMP TAD SZA JMS TAD CLL SPA 5044 1565 7642 5603 /INPUT<0 /YES‘5LT SWITCH /FAC:0? MP5 CLA 806 MIDDL CLA 6254 6255 6256 6257 # OF SHIFTS /R£SET SWITCn /v TAD SZA JMP 6255 6260 CLL MP1 MP5 HOKDER 606 /NO /NO /YES /EXIT /NA5 INPUT <0 /YES RAL CLA /TOO NOREXT OVER2 /YiS:LXIT ROUTINE FAK? /NO RAL /SHIFT OVLRZ LORDER LEFT LORDER MIDDL MIDDL HOKDER HORDER MP1 SHIFT MP1 IAC EXP LAP MP5 /ADD 1 TO /CONTINUE COUNT /SUBTRACT /EXPONLNT COUNT /NAS SZA CLA JMS ACNEG JMP I FNORM 8—8 /YES /EXIT INPUT<077 FROM /NEGATE FLOATING AC 0 6261 0000 6262 7500 CLA CLL 6265 1050 6264 6265 5050 TAD CMA DCA TAD CMA SZL CLL DCA TAD CMA OVERZ IAC OVERZ LORDER 6266 6267 6270 6271 6272 6275 6274 6275 6276 6277 7041 1047 7040 7450 7101 5047 1046 7040 ACNEG, IAC LORDER MIDDL 6500 6501 6502 6505 6504 6505 745a 7101 5046 1045 7040 7450 7101 5045 5661 SZL CLL IAC DCA MIDDL TAD HORDER CMA SZL CLL IAC DCA HORDER JMP I ACNEG /NEGATE OPERAND 6506 0000 0 6507 6512 7500 1051 7041 5051 6515 6514 6515 1045 7040 7450 CLA CLL TAD OVERI CMA IAC DCA OVERI TAD L001 CMA 6516 6517 6520 7101 5045 6510 6511 6521 6522 6525 6524 6525 6526 6527 6550 6551 6552 1042 7040 7450 7101 5042 1041 7040 7450 7101 5041 5706 SZL CLL IAC DCA LOW! TAD MIDI CMA SZL CLL IAC DCA MIDI TAD HIGHI CMA SZL CLL IAC DCA HIGHl JMP I OPNEG 8-9 6555 6554 6555 6556 6557 6540 6541 6542 6545 6544 6545 6546 6547 6553 6551 6552 6555 6554 6555 6556 6557 656M 6561 6562 6565 6564 6565 6566 6567 6570 6571 6572 6575 6574 6575 6576 6577 M003 MULTIP, D666 JEDM DEED DDDD 7764 6490 DDMD 4766 4259 5D5D 2777 5767 4261 5767 675W 10 DCA 5561 5564 1565 5565 71mm 1561 7D1D 5561 1564 742% 5551 715% 1562 791% 5564 2565 5541 1561 731% 7106 5755 DCA TAD DCA MP1 MPSCON THIR MP5 CLL TAD MP1 RAR DCA MP1 TAD MPSCON SNL JMP .+5 CLL TAD MP2CON MPSCON MP5 MULTIP+6 MP1 I MP1, MP2 cow, MP5, MPSCON, THIR, FMULTI, FLMY, MULTIP ~14 EMULT U JMS I FMULTl JMS FNORM DCA OVERZ ISZ I SIGNI JMP I FLMY JMS ACNEG SIGNl, JMP I FLMY SGNTST *64DD /FLOATING MULTIPLY /(A*2?24+B*2T12+C)*(D*2124+E*2T12+F) 640% 64v1 6402 6435 6464 6465 6406 6467 @206 7261 164% 1344 5M44 1577 5772 4775 FMULT, D CLA IAC TAD EXI TAD EXP DCA EXP TAD SMACLA DCA I SGNSW JMS I SIGNP /ADD EXPONENTS /SET UP SIGN ROUTINd /GO THERE 6414 6411 1040 6775 6412 6416 1447 4774 7244 1776 6671 1446 6775 1446 4774 1671 6671 7444 1776 6674 7444 6667 1442 6775 1447 4774 TAD L041 DCA I MP2 TAD LORDER JMS I DMULT CLA TAD I MP5 DCA MUL5 TAD MIDDL DCA I MP2 TAD LOWI JMS I DMULT TAD MUL5 DCA MULS RAL TAD I MP5 DCA MUL4 RAL DCA MUL5 TAD MIDI DCA I MP2 TAD LORDER JMS I DMULT 1671 6671 7444 1674 1776 6674 TAD DCA RAL TAD TAD DCA 7444 1667 RAL 6414 6415 6416 6417 6424 6421 6422 6426 6424 6425 6426 6427 6464 6461 6462 6466 6464 6465 6466 6467 6444 6441 6442 6446 6444 6445 6667 1445 6775 1446 6452 4774 6456- 1674 6454 6674 6455 7444 6456 1667 6457 1776 6464 6667 6461 7444 6462 6666 6466 1441 6464 6775 6446 6447 6454 6451 6465 6466 6467 6474 6471 1447 4774 1674 6674 7444 TAD DCA TAD DCA TAD JMS TAD DCA RAL TAD TAD DCA RAL DCA TAD /C*F /B*F /C*E MUL5 MUL5 MUL4 I MP5 MUL4 MULS MUL5 HORDER I MP2 LOWI I DMULT MUL4 MUL4 /A*F MUL5 I MP5 MUL5 MUL2 HIGHI DCA I MP2 TAD LORDER JMS I DMULT TAD MUL4 DCA MUL4 RAL /D*C 6472 6475 6474 6475 6476 6477 6542 6541 6542 1567 1776 5567 7DM4 1566 5566 1D46 5775 1542 6545 6544 6565 6546 6547 6514 6511 6512 6515 6514 6515 4774 157m 557% 7594 1567 1776 5567 7Mfl4 6516 5775 1942 4774 1567 5567 7084 6517 6522 6521 6522 6525 6524 6525 6526 6527 6552 6551 6552 6555 6554 6555 6556 6557 654a 6541 6542 6545 6544 6545 6546 6547 6556 6551 6552 1566 5566 1M45 1566 1776 5566 7054 5565 1841 5775 1046 4774 1567 5567 7364 1566 1776 5566 7224 1565 5565 1645 5775 1fl4l 4774 1566 TAD MUL5 TAD I MP5 DCA MUL5 RAL TAD MULZ DCA MULZ TAD MIDDL DCA I MP2 TAD MID1 JMS I DMULT TAD MUL4 DCA MUL4 RAL TAD MUL5 TAD I MP5 DCA MUL5 RAL TAD MULZ DCA MULZ TAD HORDER DCA I MP2 TAD MIDl JMS I DMULT TAD MUL5 DCA MUL5 RAL TAD MULZ TAD I MP5 DCA MULZ RAL DCA MUL1 TAD HIGHl DCA I MP2 TAD MIDDL JMS I DMULT TAD MUL5 DCA MUL5 RAL TAD MULZ TAD I’MPS DCA MULZ RAL TAD MUL1 DCA MUL1 TAD HORDER DCA I MP2 TAD HIGHl JMS I DMULT TAD MULZ /B*D /A*E /B*D /A*D 6555 5D46 6554 6555 7DD4 1565 1776 5645 1567 5047 157D 535% 6556 6557 656d 6561 6562 6565 6564 6565 6566 6567 657% 6571 6572 6575 6574 6575 6576 6577 DCA RAL TAD TAD DCA TAD DCA TAD DCA JMP 5680 WEED DEED DEED 0060 @090 674% 6727 6555 6562 6564 77flfi MIDDL MULI I MP5 HORDER MUL5 LORDER MUL4 OVERZ I FMULT MULl, MUL2, MULs, MUL4, MULS, SGNsw, SIGNP, DMULT, MP2, MP5, SMACLA, SGNSWT SIGNCL MULTIP MPZCON MPSCON SMA CLA /FLOATING DIVIDEz4flflfl *66DD 6600 DDDD ‘6601 1D4D 7fl41 1944 7b01 66fl2 66D5 6664 6605 66D6 6667 6616 6611 6612 6615 6614 6615 6616 6617 6626 6621 6622 6625 6624 6625 6626 FLDV, 5fi44 1526 554M 5047 1346 7DD4 TAD EXl CMA IAC TAD EXP IAC DCA EXP TAD SPACLA DCA SGNSWT /SUBTRACT SIGNCL HIGHI SNA CLA JMP DVER CLA CLL DCA QUOL DCA QUOH TAD MIF DCA DIVCNT JMP DVX TAD LORDER RAL /SET JMS TAD 4527 1D41 765% 5595 759% 552% 5521 1525 5524 5255 1647 7E®4 D DV5, DCA LORDER TAD MIDDL RAL EXPONfiNTS UP SIGNS /DIVISOR=D? ERROR /YES - 6627 5046 6656 6651 1D45 7934 6652 6655 6654 5045 1345 1547 6655 6656 5522 7DD4 1042 1646 5525 7694 1W4l 1045 7428 5254 5645 1525 5846 1522 5D47 720% 1523 7064 5520 1521 7Dfl4 5521 1D5D 7DD4 565% 2524 5222 1529 5D47 6657 6640 6641 6642 6645 6644 6645 6646 6647 665% 6651 6652 6655 6654 6655 6656 6657 6668 6661 6662 6665 6664 6665 6666 6667 667M 6671 6672 6675 6674 6675 6676 6677 676% 6761 67D2 DVX, SNL JMP DCA TAD DCA TAD sz, DCA CLA TAD RAL DC TAD RAL DC TAD RAL DCA ISZ JMP TAD DCA TAD 1521 HORDER LOWI LORDER DTEMI /PARTIAL SUBTRACT /DIVISOK<DIVIDEND7 DV2-1 HORDER DTEMZ MIDDL DTEMI /NO /YES:C(L)=QUOTIENT BIT LORDER /SHIFT BIT QUOL /QUOTIENT QUOL QUOH QUOH OVERZ OVERZ DIVCNT DV5 QUOL LORDER /DONE? /N0 QUOH DCA MIDDL TAD OViRZ DCA HDRDER 5w45 DCA JMS 5D59 4717 4746 5690 MIDDL HORDER RAL TAD MIDI TAD MIDDL DCA DTEMZ RAL TAD HIGHI TAD HORDER 5646 155% 2550 DCA TAD RAL DCA TAD TAD DCA DEXIT, ISZ JMS JMP OVERZ I NORMIT SGNTST l I FACNEG FLDV 8-14 INTO 6706 6704 67d5 7240 6347 724% 6706 67a7 6719 6711 6712 6716 6714 6715 6716 6%46 7&43 6717 672% 6721 6722 6726 6724 6725 6726 6260 U960 7119 6345 1045 6244 2661 70d0 5696 @flflfl @039 EMQD 006% 7765 771% 6746 6747 675% 6751 mama 1651 665% 1245 7730 5667 4746 2658 1041 7760 5727 4747 265M 766% 5727 6261 66%6 @992 7776 CMA LORDER CMA MIDDL /DIVIDE ERROR CLA DCA CMA CLL RAR DCA HORDER TAD HORDER DCA EXP ISZ FLAG NOP JMP DEXIT NORMIT, QUOL, QUOH, DTEMI, DTEMZ, DIVCNT, MIF, SPACLA, /TEST 6727 676% 6761 6762 6766 6764 6765 6766 6767 6740 6741 6742 6746 6744 6745 CLA DCA DViR, FNORM E 0 U 3 2 ~46 SPA SUBROUTINE SIGN SIGNCL, SGNSWT, FACNEG, OPNEGS, SGNTST, RESTOR, /ST£P COUNT CLA fl TAD RESTOR DCA SGNTST TAD HORDER SMA CLA JMP .+6 JMS I FACNEG ISZ SGNTST TAD HIGHI SMA CLA JMP I SIGNCL JMS I OPNEGS ISZ SGNTST NOP JMP I SIGNCL ACNEG OPNEG U ‘2 /OR SPA CLA ACNEG 6261 MPSCON 6564 ADDRS 5662 6m51 MP1 MP2 MPZCON MP5 MP5 MULTIP MULI NORfiIT 6561 6575 6562 6565 6576 6555 6565 6566 6567 6576 6571 6374 6251 6105 6717 OPMINS OPNEG OPNEGS OVERI OVERZ PAGENO POINT QUOH QUOL RESTOR SAVE SCALE sGNSW SGNSWT SGNTST SHFTAC SHFTOP SHIFT SIGNCL SI GNP 31 GM SMACLA SPACLA TABLE IABLE6 TCONI TCONZ TESTI THIR 6136 6556 6747 0251 @055 5665 6155 6721 6720 6751 5665 6112 6572 6749 675% 6116 6141 6227 6727 6575 6577 6577 6726 5671 575$ 611% 6111 6137 6565 ALIGN AMOUNT DEXIT DIVCNT DMULT DONE UTEMl DTEMZ DVER DVX DV2 5V5 EXIT EXIT6 LXP EXl FACNEG FLAD FLAG FLDV FLGT FLMY FLPT FLSU FMULT FMULTI FNORM FPNT 602 606 HIGHI HORDEK INDKCT JUMP JUMPZ LOOPfll LORDEK LOW1 MASK5 MASK5 MASK7 MIDDL MIDI MIF 6104 672% 6724 6574 6972 6722 6725 6725 6655 6655 MULZ MUL5 MUL4 MULS NOGO 6622 NOREXT 5714 5770 @244 mm4a 6746 6505 flm61 NORMAL 66mw 5702 6567 5755 6026 64mm 6566 seam 566% 5661 6224 @541 (M45 5666 5657 566% 5627 @047 @645 5664 5667 567m @246 6042 6725 8—16 /4/17/65-HB-OEC /4 WORD /FLOATING POINT I/O ROUTINES /REQUIRES FLOATING POINT INTERPRETER /ENTRY AT 0007 *7 0007 5600 0044 0000 0045 0046 0047 0000 0052 0000 0055 0054 0000 0000 0055 0000 0056 0057 7777 7777 FPNT, 5600 *44 0000 0000 EXPONT, HORDER, MIDDL, LORDER, 5.9616. *52 0060 0000 0061 0000 6767 6770 6771 0000 FPACl, SWITI, SWITZ, CHAR, OSWIT, 6.35.6» 7777 7777 /IF 2 0, NO CR-LF AFTER OUTPUT /IF : 0, NO LF AFTER CR IN INPUT /CONTAINS LAST CHAKACTER HEAD /= 0 IF NO CONVERSION TOOK PLACi 0 0 *6767 6770 6776 6774 6775 6776 6777 1057 7650 5767 1677 4776 5767 7645 0212 PRCHAR, 0 TAD SNA JMP TAD 005 JMP OUT LPED, 50172 CLA I PKCHAR LFED I OPUT I PKCHAR 0212 /DOU6L£ PKLCISION DiCIMAL-BINAKY /INPUT AND CONVERSION *7000 7000 7001 7002 6045 DCA HORDER 7006 7004 6046 6047 DCA DCA 7005 6266 DCA MIDDL LORDER SIGN 7006 6267 4650 DCA JMS DNUMBR INPUT 7007 0000 7200 DECONV, 0 CLA /INITIALIZE MANTISSA 7u1v 1546 TAD PLUS 7U11 7612 7616 7614 7u15 7U16 7017 7fl2v 7021 7456 SNA JMP TAD DECUN MINUS 7&22 7626 7024 7035 7026 7u27 7u6u 7u61 7v52 7066 7a54 7065 5220 1557 744a 5221 7246 5266 4356 72au 1969 1641 7594 7513 1645 D646 7440 5220 764v 4242 7U46 7047 7U5U 7951 7652 7056 7054 7w55 7456 7U57 766w 7U61 7662 7v65 7664 /IF-, SET .+4 SIGN SNITCH INPUT CdAR /IS 11 A DIGIT MIN9 SmA 5600 6265 2U61 FOR SIGN CMA JMP I DECONV TAD PLUfilZ SPA JMP I DECONV DC DIGIT TAD HOKDER 5650 1642 7066 7u67 7U41 7042 7u4s 7644 7645 DECON, SZA JMP CLA DCA JMS CLA TAD TAD /TEST 5220 /NO /YES AND MASK /OV¢RFLUw? SZA JMP DECUN /YzS-IGNOKL ISZ DSWIT ISZ DNUMBR JMS MULTlu JMP macaw 2267 /NO /INDEX NUMDLR OF 016115 /CONTINUL /ROUTIN£ TO MULIIPLY /DOUBLE PRECISION NOKD lfiY TEN (DECIMAL) 4 MM MULTlu, TAD DCA 1647 6046 LORDER 46 1U46 TAD MIDDL 5w42 1445 DCA TAD DCA 42 DCA JMS JHS 4D 5441 5646 427% 4667 4270 1265 6245 6&42 5641 45n7 1646 5642 Uwvfl 7u7w aaéu 0291010 DUDE /REMAIN=REMAINDER MULTZ MULTZ JMS DUBLAD JMS MULTZ TAD DIGIT DCA 46 DCA 42 DCA 41 JMS DUBLAD TAD 4D JMP I MULTlU 4274 7w65 7066 7w67 HORDER 41 DIGIT, SIGN, DNUMBR, MULTZ, /CALL SUBROUTINE /MULTIPLY BY TdO T0 /CALL DOUBLE ADD /ADD LAST DIGIT RECEIVED /EXIT WITH REMAINDER /IN AC /STOKAGE FOR DIGIT /=D IF PLUS: 27777 IF MINU: /:NUM5£R OF DIGITS /MULTIPLY LOKDEH, HOflan DY 2 6;: E}... E“ E; 8-18 7071 7072 7076 7074 7075 7076 7077 1047 7004 6047 6046 1045 7004 6045 7111 7112 7117 7120 7121 7122 7126 7124 7125 7126 7127 7160 7161 7162 7166 7164 7165 7166 TAD RAL DCA 1046 7004 7100 7101 7102 7106 7104 7105 7106 7107 7110 7116 7114 7115 7116 CLA CLL TAD LORDER RAL DCA LORDER 7600 TAD RAL DCA TAD RAL DCA 1040 7004 6040 5670 MIDDL MIDDL HORDER HORDER 40 40 MULTZ jMP I 7600 CLA CLL 1047 1046 6047 TAD TAD LORDER 0000 DUBLAD, /DOUBLE PRECISION ADDITION 45 DCA LORDER RAL TAD MIDDL TAD 42 DCA MIDDL RAL TAD HORDER 7004 1046 1042 6046 7004 1045 5707 TAD DCA RAL TAD DCA JMP 0000 0 1041 6045 7004 1040 6040 MSIGN, CLA 7600 2266 41 HORDER 40 40 1 DUBLAD /ROUTINE TO FORM /2'S COMPLEMENT /IF C(SIGN)=7777 CLL SIGN 5760 4766 5760 lSZ JmP JMS JMP 6261 6261 /"ACNEG" MINUS, PLUS, WINS, PLUSI2, MASK, 256-255 -256 -272 272-260 7600 /TEST FOR /TESI FUR D1611 /TEST FOR 0.10, 7775 7167 7140 7141 7142 7776 7146 7600 7144 7775 7145 6146 6146 7147 6147 6147 7525 7506 0012 I 1 1 MSIGN .+2 MSIGN 7146 6146 6146 IN INTERPADTEA 519“ OVERFLOJ /INPUT A CHARACTER, 1F Cm, TEST /INPUT SWITCH TO SEE IF LF SHOULD /BE 715d 7151 7152 7155 7154 7155 7156 7157 7166 7161 7162 7165 7164 7165 7166 7167 7170 7171 7172 7175 7174 7175 7176 7177 QUUU 6651 5552 6056 5U6U RUBOUT, KESTAKT INPUT /INPUT A U CLA KSF JMP 72v% 1U6U v-1 DCA CHAR TAD JMS TAD CHAR I OUTPUT CHAR SNA JMP TAD SNA JMP TAD SNA JMS TAD JMP 745D 5551 1576 7456 5775 1577 7656 4775 1U6U 5756 PRINT, OUTPUT, RESTRT, MRBOUT, MINOR, INPUT+1 MRBOUT /IGNORE BLANKS I RESTRT MINOR CLA I PRINT CHAR I INPUT /RUBOUT-RESTART UUUO 7201 7202 4217 1524 72w3 5U44 72U4 72%5 1545 4545 72%6 7207 721m 7211 4757 1056 7659 569$ 1541 4545 1542 4545 7212 7215 7214 7215 7216 56UU FLOUTP, /CR INPUT SEE IF TO BE /BY LF /EKIT ROUTINE - FOLLOWED PRCHAR OUT FLINTP+1 -577 577-215 /FLOATING OUTPUT "E" TSF /USES: JMP 0-1 / TLS / *72au 72ww CHARACTbfi KRB 1U66 4774 6767 7545 7481 74U1 U162 IF TYPED. INPUT, FORMAT O JMS TAD DCA TAD JMS JMS TAD SNA JMP TAD JMS TAD JMS JMP /CONV£RT FOUTCN MANTISSA AND OUTPUT BEXP LXPONT CHE OUT I FEXPPT SWITI CLA I FLOUTP CARRTN OUT LNFEED OUT I FLOUTP 8-20 /CONV£RT EXPONENT AND OUTPUT /PRINT CR-LF? /NO-EXIT /YES /EXIT /THIS WHOLE SUBROUIINE MAY BE ALIEKED /THE OUTPUT DIGITS : CHANGE JMS OUTDG 7217 7226 7221 7222 7226 7224 7225 7226 7227 7260 7261 7262 7266 7264 7265 7266 7267 7240 7241 7242 7246 7244 7245 7246 7247 725a 7251 7252 7256 7254 7255 7256 7257 7260 7261 7262 7266 7264 7265 7266 7267 160010 FOUICN, T0 BUFFER TO DCA I 10, 76v” CLA CLL 1045 7712 TAD SPA HORDER OLA /NUMBER>6?? CLA CML SPLUS /NO SMINUS OUT OUTDG PERIOD OUT CLL HORDER OLA FGOI /NO 7220 1627 7466 1660 4645 TAD SZL TAD JMS JMS TAD JMS CLA TAD 4656 1661 4645 76m6 1045 7700 5242 7040 SMA 6766 4762 7246 DCA Jms CLA JMP CMA F601, 6624 1w44 7526 5266 1626 7700 527m F002, 2624 5246 /OUTPUT ”0" /OUTPUT "." /NUMBER I SNPT I MSNPT CMA EXPONI EXPONT BEXP TAD EXPONI JMP TAD SMA JMP IS NEGATIVE /NEGATE /SUBTHACT 1 FSOM BINARY /COMPENSATE AT F004 LXPON /INITIALIZE DECIMAL EXPONLNI /IS -4<EXPONENI<-l F006 FOUR CLA F004 /TOO I FPNT FMPY I IENPT FEXI CLA CMA TAD BEXP DCA BEXP JMP F802 JMS I FPNT FMPY I PRC.10 FEXT ISZ BEXP JMP FGOZ Jms Baum 260% LINK SMA 4467 674a 7240 1624 6624 5246 4407 6744 SET /YES TAD DCA DCA 1044 6m44 LTC. D F606, 8-21 LARGE: MULTIPLY BY /IOO SMALL‘TIMdS /TEN /ONE TENTH ILN l/lu 7276 6764 7271 7272 7276 7274 7275 7276 7277 76mm 7621 7622 7626 7664 7665 7666 7627 4766 4765 7410 4666 F604, F005A, 2644 5274 745% 5611 4656 1625 F006, FGO6A, 4656 2644 5664 5617 7611 7612 7616 7614 7615 7616 7617 7626 7621 7622 7626 7246 1624 6624 1045 7640 5622 1647 7650 6624 7246 5662 F607, 7624 163101610 BEXP, MINUS7, FOUR, SPLUS, SMINUS, PERIOD, MSNPT, SNPT, DPT, MIWPI, MZPT, FEXPPT, TENPT, CARRTN, LNFEED, CHE, PRC.10, 7641 7642 7646 7644 7767 0664 6256 @662 @256 7166 7366 7665 7042 7670 7526 7564 2215 6212 M665 7144 DPT I I MZPT MlflPT DIVTNO /MULTIPLY BY TNO /IE.SHIFT LEFT /MULTIPLY BY TEN /COMPENSATE F02 /BINARY EXPONENT EXPONT FGO5A FIRST DIGIT A ZERO /YES, IGNORE /MULTIPLICATIONS YIELD /DECIMAL DIGITS AS HIGH /OHDER REMAINDERS /1£. .672x1w:6+.72.. ETC /IS JMP 7610 7625 7626 7627 7662 7661 7662 7666 7664 7665 7666 7667 7640 I JMS JMS SKP 6M3 ISZ JMP SNA 6044 4765 DCA F807 JMS OUTDG TAD MINUS7 DCA EXPONT JMS I MIEPT JMS OUTDG ISZ EXPONT JMP F3064 JMP I FOJTCN TAD LORDER CLA DIGITS OdTPdT?? /NO: CONTINUE /Y£S:£XIT /IGNORE FIRST DIGLT /SUBTRACT 1 FdOM /DECIMAL EXPONdNT CLA CMA TAD BEXP DCA BEXP TAD HORDER SZA CLA JMP .+4 SNA /7 /IS MARTISSA ZLHU? DCA BEXP CLA CMA 6MP F806+1 /YiS:iXP:w 10 /CONTAINS DECIMAL LKPONENI /NUMBER OF DIGITS OUTPUT ‘11 0664 256 255-256 256 MSIGN /P01NTERS SIGN DIGIT MULTIQ MULTZ FEXC TEN 0215 0212 665 0.10 8—22 OUT, 0060 7646 7647 7650 6641 5646 6646 7651 7652 726% 5745 7656 7654 7655 DUDE 7656 5756 7657 U260 0260, 0263 7666 7661 wwnw DIVTWO, v 7662 7666 7664 7665 7666 7667 767w 7671 7672 7676 7674 7675 7406 7461 7402 7406 7464 7465 7466 7467 7416 TSF JHP TLS CLA JMP OUTDG, 6645 1v46 7610 6w46 1647 761% 6047 1645 576m 5226 7415 7416 7417 6722 1614 7650 5222 6614 5726 .-1 I OUT /OUTPUT ONE DIGIT O /DIVIDE BY THO IE. /ROTATE RIGHT /TEMPORARY STORAGE CLL RAB DCA OUT TAD HORDER RAR DCA HORDER TAD MIDDL 7116 6645 1645 701% 7411 7412 7416 7414 CHARACTEH TAD C26fi JMS OUT JMP I OUTDG 1657 4645 6066 7240 6614 6661 4717 7266 1666 1616 764a /OUTPUT ONE ASCII W 7645 RAR DCA TAD MIDDL LORDER RAR DOA TAD JHP LORDEH OUT I DIVTUO /FLOATING *7400 POINT FLINTP, 6 INPUT CLA DCA CNA PRSN DCA DSNIT JMS CLA I /INITIALIZE "PERIOD SWITCH" DPCVPT TAD CHAR TAD PER SZA CLA JMP FIGOI TAD PRSN SNA CLA JMP F1802 /7777 2 NO PERIOD /PERIOD FOUND /SECOND PERIOD /YES,T£RMINATE DCA I DPN DCA PRSN JMP I DPCSPT 8-23 /NO SET NUMBER OF DIGITS /SET PERIOD SNITCH TO 6 CONVERT REST OF STRING - TO 7422 7421 7422 7425 7424 7425 7426 7427 7455 7451 7452 7455 7454 7455 7456 7457 744d 7441 7442 7445 7444 7445 7445 7447 7450 7451 1514 765% 1722 7w41 5515 4721 1512 F1601, F1605, 5&44 44fl7 703% 6052 TAD PRSN SNA CLA TAD I DPN CMA IAC DOA SEX? JMS I MSGNPT TAD C45 DCA EXPONT JMS I FPNT -FNOR FPUT FPACl FEXT TAD CHAR TAD MINUSE SZA CLA JMP ENDFI JMS I DPCVPT JNS I MSGNPT TAD HORDER SPA IAC SZA CLA JMP EXCESS TAD LORDER TAD SEX? DOA SEXP BOQD 1D6O 1511 764$ 5252 4717 4721 1545 7510 7OD1 764M 5277 1047 1515 5515 /PERIOD READ IN /Y£S:'NUMBER OF PREVIOOSLY? DIGITS /TE5T 7466 7467 44m? 5652 ENDFI, JMS FGET I FPNT FPACI 0096 1515 FEXT TAD SEXP 745D SNA 5663 77UO SMA 5276 4407 571M DOOM 2515 5255 5606 JMP /NOHMALIZ£ F.P. /SAVE /"E" NUMBER NUMBifi READ IN? /NO /YES CONVERT DECINAL /TEST SIGN /EXPONENT TOO LARGE77 - /YES /NO:DECIMAL POINT IS /C(SEXP)PLACES TO NIGHT /OF LAST DIGIT JMP /RESTORE I FPNT FMPY I PC.1v FEXT ISZ SEXP JMP JMP MANTISSA I FLINTP CLA FIGO4 JMS ENDFI+6 I FLINT? 8-24 éflR SIGN /END OF FLOATING POINT INPUT /COMPENSAT£ FOR DECIMAL EXPONENTS 7452 7455 7454 7455 7456 7457 746% 7461 7462 7465 7464 7465 IN /NO /. IS /TIMES TO THE LEFT: .luva bXPONE 747a 4407 7471 5504 7472 ovum 7475 7474 7475 7476 7477 724m 1515 5515 5255 1516 5044 1516 5u45 5695 75uu 7501 7502 7505 75m4 7555 7566 7507 7510 7511 7512 7515 7514 7515 7516 5554 TEN, www@ umwm DUDD $066 7144 7475 0545 7522 5505 BEEU 5777 7DDD 7029 7158 7567 Pc.1a, MINUSE, C45, PER, Pst, SEXP, cs777, DPCVPT, DPCSPT, NSGNPT, DPN, /0UTPUT 7526 7527 755a 7551 7552 7555 7554 7555 7556 7557 7540 7541 7542 2666 7555 1544 7512 7561 5544 1567 7456 1579 4775 5045 1544 2545 1571 755b 5557 FEXC, /. IS TO THE RIGHT: /MULTIPLY BY lb @504 24nd 7520 7525 7524 7525 I FPNT FMPY TEN FEXT CLA CMA TAD SEXP DOA SEXP JMP ENDF1+5 TAD 05777 DCA EXPONT TAD 05777 DCA HORDEH JMP I FLINTP JMS 2405 7517 7521 7522 F1604, 0.1% '505 @545 '256 D /00NTAINS D 5777 DECO NV DECON MSIG N DNUMBR THE EXPONENT D CLA CLL TAD SPA EXPONT CMA 1A0 DCA EXPONT CML TAD 0255 SZL TAD 0255 JMS I DGPT DCA HORDER TAD EXPONT ISZ HORDER TAD M144 SMA JMP .-5 8—25 DECIMAL EXPONENT 7545 7544 7545 7546 7547 755m 7551 7552 7555 7554 7555 7556 7557 756% 7561 7562 7565 7564 7565 7566 TAD 0144 DCA EXPONT 1572 5044 CMA TAD 7042 1fl45 744m HORDER SZA JMS I DGPT DCA HORDER TAD EXPONT ISZ HORDER TAD M12 4775 5545 1944 2945 1575 756d SMA JMP TAD DCA CLA TAD JMS TAD JMS 5555 1574 5547 7249 1545 4775 1047 4775 5725 7567 757% 7571 7572 7575 7574 7575 7775 WQBZ 7654 @144 7766 0212 7555 BEXP CARRTN 7524 7541 CHAR CHE 2669 7545 Cglfl C12 C144 C255 C255 026% C5777 C45 DECON DECONV DEPT 01617 DIVTWO UNUMBK DPCSPT 7144 7574 7572 7567 7576 7557 7516 7512 7323 756% 7575 7565 756w 7567 7520 0’6 C12 LORDER CMA HORDER I DGPT LORDER I DGPT JMP I FEXC 0255, 0255, M144, 0144, M12, 012, DGPT, @255 -260 255‘255 '7654 2144 7766 4412 OUTDG 8-26 UPUVPI 1)? N 0P1 05411 UUBLAU "ya-w 7517 7522 7554 MINUdi filNUS7 MlN9 MKBUUI NSGNPT 6516N MSNPT MULTIU MULTZ UIJPT M12 m144 MZPT OPUT OUT OUTDG OUTPUT PC.1U PER PERIOD PLUS 0661 7107 7452 7477 dAPONT 0044 FLAU FEXPPT F601 F602 F605 F604 F6054 F606 F606A F607 F1601 F1602 F1605 F1604 FLINTP FLOUTP FOUR FOUTCN FPACl FPNT 7525 7557 7242 7246 7265 727m 7274 7501 7504 7511 7420 7422 7426 747g 7422 720m 7526 7217 0052 0607 fiORUdn $045 SiGN INPUT LFEU LNFEdD LOKDEH 7150 6777 7542 SMLNUS 6047 swlTl PESK 7145 64112 MIDDL M1NCR MINUS ggqs PLUSIZ PRCHAR Pn0.16 PRINT Pnsw R¢STKT six? SNPT SPLUd {LN TdNPT 7177 7157 11. DIAGRAMS (Not Applicable) 12 REFERENCES See Digital-8—5-S. 8-27 7511 7525 7141 7176 7521 7156 7552 7642 7670 7555 7575 7571 7556 6776 7545 7555 7174 7516 7515 7551 7140 7142 6767 7544 7175 7514 7175 7515 7666 755a 7555 7527 mw56 @057 7504 7540 I. Logical Subroutines, DEC-O8-FMIA-D. 2 ABSTRACT . Subroutines for performing the logical operations of inclusive and exclusive OR are presented as a package . 3. REQUIREMENTS 3 I Storage . Inclusive OR requires I2 (decimal) core locations. I4 (decimal) locations. 3.3 Exclusive OR requires Equipment Basic PDP-8 4. USAGE 4.I Loading The subroutines may be placed in memory by means of the Binary Loader. Digital-8—2-U-Rim for a complete description of this loader and its use. 4.2 See Calling Sequence Both subroutines are called by a JMS instruction with one argument in the accumulator. The location following the calling JMS contains the address of the second argument. Both subroutines return to the location following that containing the latter address with the result in the AC. 6. DESCRIPTION 6 I Discussion . These subroutines in the performance of logical supplement the AND and CMA hardware instructions operations. Note that the result of the exclusive OR is the com- plement of the logical operation termed the "biconditional ." 6.2 Examples Truth tables for these functions are as follows. Depending on the values of corresponding bits in A and B, the associated bit of the result conforms to the following truth tables: —-—ao> Exclusive OR Inclusive OR AND Biconditional B Result A B Result A B Result A B Result 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 1 1 0 1 0 0 0 1 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 Or for complete data words Exclusive OR Inclusive OR A 011010111001 A 011010111001 B 010110101 100 B 010110101 101 Result 001 100 010 100 Result 011 110111 101 9. EXECUTION TIME 9.2 Maximum Execution time is actually fixed for these subroutines. precisely 32.0 microseconds. 10. PROGRAM 10.4 Program Listing Inclusive OR requires Exclusive OR requires exactly 46.0 microseconds. A listing of both subroutines with INCOR stored in 0200 is as follows: /LOGICAL SUBROUTINES /ENTER WITH A IN AC /ADDRESS OF B FOLLOWS CALLING JMS /RETURN WITH RESULT IN AC TO /LOCAT|ON FOLLOWING THAT HOLDING ADDRESS INCOR, /|NCLUSIVE OR 0 0200 0000 0201 3226 DCA 0202 1600 TAD 0203 3227 DCA 0204 1627 TAD 0205 7040 CMA 0206 0226 AND TEMPYI I INCOR TEMPY2 I TEMPY2 TEMPYI TEMPY2 0207 1627 TAD 0210 2200 ISZ 0211 5600 JMP 0212 0000 0 0213 3226 DCA 0214 1612 TAD 0215 3227 DCA TEMPY2 0216 1226 TAD TEMPY1 0217 0627 ANDI TEMPY2 0220 7041 CLA 0221 7104 CLL 0222 1226 TAD 0223 1627 TAD 0224 2212 ISZ 0225 5612 JMP 0226 0000 0 0227 0000 EXCOR, TEMPY1, TEMPY2, 0 9-3 | INCOR I INCOR /EXCLUS|VE OR | TEMPY1 EXCOR RAL TEMPY1 I TEMPY2 EXCOR I EXCOR l Arithmetic Shift Subroutines, DEC-OB-FMJA-D . . ABSTRACT 2. Four basic subroutines, shift right and shift left each at both single and double precision, are presented as a package. 3. REQUIREMENTS 3 l Storage . These are arithmetic shifts. Core storage required for these subroutines is as follows in decimal: Shift Left 3.3 Shift Right Single Precision l2 l5 Double Precision 24 27 Equipment Basic PDP-8 4. USAGE 4.l Loading These subroutines may be loaded using the Binary Loader. See Digital-8-2-U-Rim for a complete description of this loader. 4.2 Calling Sequence All four subroutines are called with -N accumulator. (the 2's complement form of N) in the N is a binary integer specifying the number of bit positions the data words are to be shifted. . case In the location following the calling JMS instruction is an address which in the of the single-precision subroutines is the address of the data to be shifted. In the case of the double-precision subroutines, this address is that of the most significant portion of the data. The least significant portion of the data must be located in the address following that of the most significant portion. These subroutines will return to the address following that of the calling JMS plus Upon exit, the AC will hold the shifted data in the case of single-precision shifts. In the case of double—precision shifts, the AC will hold the most significant portion of the result two. while the least significant portion of the result will be stored in location LSH. 4.5 Errors It is possible by specifying too large an N to shift data completely out of a com- puter word or words in the case of single-precision shifts or double-precision shifts, respectively. These subroutines do not test for this eventuallity. lO-l DESCRIPTION 6. 6 . Discussion I These subroutines are arithmetic shift subroutines. case of any shift, bits shifted "out" of the register are lost. By this is meant that in the In the case of left shifts, bits moving into the least significant bit position are always 0. In the case of right shifts, bits moving into the most significant bit position (the sign) bits are 0 if the original data was positive but are I if the original data was negative. 6 .2 - Examples The following examples illustrate the nature of the single-precision shift process. In each example, Positive Ne 9 afive 6.3 a shift of four bits is shown: Right 5ft Data 000 010 100 100 000 000 111 101 Result 000 000 001 010 001 111 010 000 Data 111111010100 111110000101 Result 111111111101 100001010000 Scaling Shift right and shift left operations are the fundamental means by which numerical data is scaled in fixed-point computers. Application For more information on numerical Note 801. 9. EXECUTION TIMES 9.3 Timing Equations binary scaling for fixed-point computers, see Time needed for a given shift may be calculated from the following equations. 9.3.I Single-Precision Shift Left 9.3.2 Single-Precision Shift Right Time in microseconds — For negative data, time in microseconds Double-Precision Shift Left 9.3.4 Double-Precision Shift Right - = 22.4 + = I 0—2 = 22.4 + 9.6N. 40.0 + 20.8N For positive data, time in microseconds For negative data, time in microseconds = II.2N. Time in microseconds - “ 22.4 + 6.4N For positive data, time in microseconds - 9.3.3 = 40.0 + 25.6N. = 40.0 + 24.0N. 10. PROGRAM 10.4 Progrom Listing A listing of all four subroutines with SPSL located at 0600 is as follows: /SHIFT RIGHT SHIFT LEFT SUBROUTINES /SINGLE AND DOUBLE PRECISION /SHIFTS ARE ARITHMETIC RATHER THAN LOGICAL /BITS SHIFTED OUT OF REGISTER ARE LOST /DURING LEFT SHIFTS ZEROS ENTER LEAST SIG. BIT /DURING POSITIVE RIGHT SHIFTS ZEROS ENTER MOST SIG. BIT /DURING NEGATIVE RIGHT SHIFTS SIGN IS PROPAGATED /ENTER WITH -N IN AC /CALL|NG SEQUENCE. JMS SPSL OR SPSR OR DPSL OR DPSR ADDRESS OF DATA / RETURN, RESULT IN AC FOR SINGLE / RESULT (MSB) IN AC FOR DOUBLE / RESULT (LSB) IN LSH FOR DOUBLE / 0600 0000 0601 3302 DCA CNTR 0602 1600 TAD I SPSL 0603 3303 DCA ADDR 0604 1703 TAD IADDR 0605 2200 ISZ SPSL 0606 7104 CLLRAL 0607 2302 ISZ CNTR 0610 5206 JMP .-2 SPSL, o 0611 5600 JMP I SPSL 0612 0000 o 0613 3302 DCA CNTR 0614 1612 TAD I SPSR 0615 3303 DCA ADDR SPSR, 0616 1703 TAD IADDR 0617 2212 ISZ SPSR 0620 7100 CLL 0621 7510 SPA 0622 7020 CML 0623 7010 RAR 0624 2302 ISZ CNTR 0625 5220 JMP .-5 0626 5612 JMP I SPSR 10-3 /SINGLE PRECISION SHIFT LEFT /SINGLE PRECISION SHIFT RIGHT 0627 0000 0630 3302 DCA CNTR 0631 1627 TAD I DPSL 0632 3303 DCA ADDR DPSL, 0 0633 1703 TAD | ADDR 0634 3304 DCA MSH 2303 ISZ ADDR 0635 /MOST SIGNIFICANT HALF 0636 1703 TAD I ADDR 0637 3305 DCA LSH 0640 2227 ISZ DPSL 0641 1305 TAD LSH /LEAST SIGNIFICANT HALF /SH|FT LEFT 0642 7104 CLL RAL 0643 3305 DCA LSH 0644 1304 TAD MSH 0645 7004 RAL 0646 3304 DCA MSH 0647 2302 ISZ CNTR 0650 5241 JMP .-7 0651 1304 TAD MSH 0652 5627 JMP I DPSL 0653 0000 0 0654 3302 DCA CNTR 0655 1653 0656 3303 TAD I DPSR DCA ADDR 0657 1703 TAD I ADDR 0660 3304 DCA MSH 0661 2303 ISZ ADDR 0662 1703 TAD I ADDR 0663 3305 DCA LSH 0664 2253 ISZ DPSR. DPSR, 0665 1304 TAD MSH 0666 7100 CLL /DOUBLE PRECISION SHIFT LEFT /DOUBLE PRECISION SHIFTRIGHT /MOST SIGNIFICANT HALF /LEAST SIGNIFICANT HALF /SH|FT RIGHT 0667 7510 SPA 0670 7020 CML 0671 7010 RAR 0672 3304 DCA MSH 0673 1305 0674 7010 TAD LSH RAR 0675 3305 DCA LSH 0676 2302 ISZ CNTR 0677 5265 JMP .-12 10-4 0700 1304 TAD MSH 070] 5653 JMP l DPSR 0702 0000 0703 0000 0704 0000 0705 0000 ADDR 0703 CNTR 0702 DPSL 0627 DPSR 0653 LSH 0705 AASH 0704 SPSL 0600 SPSR 0612 CNTR, ADDR, MSH, LSH, 0 0 0 0 10-5 l Logical Shift Subroutines, DEC—O8-FMKA-D . . ABSTRACT 2. Two basic subroutines, shift right at both single and double precision are presented as a package. The shifts are logical in nature. 3. REQUIREMENTS 3 .l Storage Core storage required for these subroutines is 12 (decimal) locations for single pre— cision and 24 (decimal) locations for double precision. 3.3 Equipment Basic PDP-8 4. USAGE 4.l Loading These subroutines may be loaded using the Binary Loader. for a complete description of this loader. 4.2 See Digital-8-2-U-Rim Calling Sequence Call with -N (the 2's complement form of N) in the accumulator. N is. a binary integer specifying the number of bit positions the data word is to be shifted In the location following the calling JMS is the address of the data in the case of single precision. For double precision this location contains the address of the most signi- ficant portion of the data which mustbe stored in two consecutive words. The subroutines return to the location following that containing the data address. For single precision the result is in the accumulator upon return. For double precision the most significant part of the result is in the accumulator on return while the balance of the result is in location LESTSG. 4.5 Errors It is quite possible by specifying too pletely out of a computer word or words. 6. DESCRIPTION 6 I Discussion . large an N effectively to shift data com- These subroutines are logical shift subroutines. is no difference between arithmetic and It is important to note that there IOgicaI shifts in the case of left shifts. Consequently only two new subroutines in addition to those described in Digital-8-8-U-Sym are required to supply all logical shifts. Logical right shifts are defined as those in which bits shifted ”out“ of the least significant bit position are lost. Bits moving into the most significant bit position are always 0. 6.3 Examples The following examples illustrate the nature of the single-precision logical right shift. In each example, a shift of four bits is shown. Result Data 000 111 010 010 111 000 000 000 000 001 011 000 000 011 101 000 9. EXECUTION TIMES 9.3 Timing Equations Time needed for a given shift may be calculated from the following equations. 9.3.1 Single-Precision Logical Right Shift 9.3.2 Double-Precision Logical Right Shift 10. PROGRAM 10.4 Program Listing - - Time in microseconds Time in microseconds = = 22.4 + 36.8 + 24.0N. A listing of both subroutines with LSRSP located in 0200 is as follows; 0200 /LOGICAL SHIFT RIGHT SUBROUTINES /SINGLE AND DOUBLE PRECISION /ENTER WITH -N IN AC /DATA ADDRESS FOLLOWS CALLING JMS /RETURN WITH DATA IN AC /MOST SIGNIFICANT PART FOR DOUBLE /LEAST SIG. PART FOR DOUBLE IN LESTSG 0 0000 /SINGLE PRECISION LSRSP, 0201 3236 DCA TIMES 0202 1600 TAD I LSRSP 0203 3237 DCA COMMUN 6.4N. 0204 1637 TAD I COMMUN 0205 7110 CLL RAR /SHIFT LOOP 0206 2236 ISZ TIMES 0207 5205 0210 2200 /EXIT 0211 5600 JMP .-2 ISZ LSRSP JMP I LSRSP 0212 0000 0 /DOUBLE PRECISION 0213 3236 DCA TIMES 0214 1612 TAD I LSRDP 0215 3237 DCA COMMUN 0216 1637 TAD I COMMUN 0217 3240 DCA MOSTSG 0220 2237 ISZ COMMUN 0221 1637 TAD I COMMUN 0222 3241 DCA LESTSG 0223 1240 0224 7110 0225 3240 DCA MOSTSG 0226 1241 TAD LESTSG 0227 7010 RAR 0230 3241 DCA LESTSG LSRDP, SHIFT, TAD MOSTSG CLL RAR 0231 2236 ISZ TIMES 0232 5223 0233 1240 JMP SHIFT TAD MOSTSG 0234 2212 ISZ LSRDP 0235 5612 JMP I LSRDP 0236 0237 0240 0241 /SHIFT LOOP 0 TIMES, COMMUN, 0 MOSTSG, 0 0 LESTSG, /EXIT DIGITAL EQUIPMENT CORPORATION O MAYNARD. MASSACHUSETTS
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies