Program to convert a PDP-11 format octal floating number to decimal form Take out of USER mode and put into PROGRAM mode and clear program memory 001 f LBL A 42,21,11 Enter program with Y stack regester being the high order mantissa and exponent part. The X stack regester being the low order mantissa. 002 STO 0 44,0 Store the low order part for later processing 003 V 33 Roll down to the high order part 004 g X=0 43,40 Is the number a zero ? 005 g RTN 43,32 Yes-return a decimal zero 006 EEX 26 Set up to strip off sign bit 007 5 5 Rest of octal number to right of radix point 008 /(divide) 10 009 g CF 0 43,5,0 Clear sign flag 010 f FRAC 42,44 Strip off sign part of number 011 STO 1 44,1 Save it for later 012 g LST X 43,36 Get back high order 013 g INT 43,44 Leave only the sign bit (if present) 014 g X<>0 43,30 If sign bit present 015 g SF 0 43,4,0 Set sign flag-number is negative 016 RCL 1 45,1 Get back the high order mantissa and exponent 017 1 1 Strip off the high order exponent digit 018 0 0 019 X 20 020 g INT 43,44 021 STO 3 44,3 Save it 022 g LST X 43,36 Get back high order 023 f FRAC 42,44 Lop off digit already obtained 024 8 8 Scale last digit obtained 025 STO X 3 44,20,3 026 V 33 Get back high order part 027 1 1 Strip off next exponent digit 028 0 0 029 X 20 030 g INT 43,44 031 STO + 3 44,40,3 Add to digit already gotten 032 g LST X 43,36 Get rest of high order 033 f FRAC 42,44 Lopping off used digits 034 4 4 Scale up exponent for last digit 035 STO X 3 44,20,3 036 V 33 Get back remainder of high order 037 1 1 Strip off last exponent digit 038 0 0 039 X 20 040 f FRAC 42,44 Get fractional part 041 STO 1 44,1 And save for later processing as part of mantissa 042 g LST X 43,36 Get back high order 043 g INT 43,44 044 2 2 Lop off 1 mantissa bit present 045 /(divide) 10 046 f FRAC 42,44 047 STO 2 44,2 Store .5 (if set) of first (non hidden) bit 048 g LST X 43,36 Get back last of mantissa 049 g INT 43,44 Mantissa part only 050 STO + 3 44,40,3 Add to accumulation of exponent 051 1 1 Add in to mantissa accum- the hidden bit 052 STO+2 053 1 1 Remove bias from exponent 054 2 2 055 9 9 056 STO - 3 44,30,3 057 . 48 Power of 2 for mantissa 058 5 5 059 STO 4 44,4 060 RCL 1 45,1 Get rest of high order mantissa 061 GSB 9 32,9 Get high order digit 062 GSB 9 32,9 Get low order digit of high order part 063 RCL 0 45,0 Get low order mantissa 064 EEX 26 Strip off high order bit 065 5 5 066 /(divide) 10 067 f FRAC 42,44 Lop off low order part and save 068 STO 1 44,1 069 g LST X 43,36 Get back low order part 070 g INT 43,44 Get high order bit 071 2 2 Scale power for mantissa 072 STO / 4 44,10,4 073 V 33 Get digit back 074 RCL 4 45,4 Get power 075 X 20 Scale it 076 STO+2 44,40,2 Accumulate mantissa 077 RCL 1 45,1 Get back rest of low order mantissa 078 GSB 9 32,9 Get digit 079 GSB 9 32,9 Get digit 080 GSB 9 32,9 Get digit 081 GSB 9 32,9 Get digit 082 GSB 9 32,9 Get digit 083 2 2 Get exponent power 084 RCL 3 45,3 085 Y**X 14 086 STO X 2 44,20,2 Scale mantissa 087 RCL 2 45,2 Get number 088 g F? 0 43,6,0 Sign 089 CHS 16 Negative-change sign 090 g RTN 43,32 Done-return 091 f LBL 9 42,21,9 1 octal digit break out routine 092 8 8 Reset the mantissa power 093 STO/ 4 44,10,4 094 V 33 Get back mantissa 095 1 1 Strip off high order octal digit 096 0 0 097 X 20 098 f FRAC 42,44 Strip off low order part 099 STO 1 44,1 And save it for now 100 g LST X 43,36 Recover mantissa 101 g INT 43,44 Get high order octal digit 102 RCL 4 45,4 Get power 103 X 20 Scale digit 104 STO+2 44,40,2 Accumulate 105 RCL 1 45,1 Get back unused mantissa 106 g RTN 43,32 Done Program to convert a PDP-11 octal floating point number to decimal form Step Instruction Input Keystrokes Output 1 Set USERS mode 2 Enter exponent/high order mantissa 6 digit octal number 3 ENTER 4 Enter low order mantissa 6 digit octal number 5 Convert to decimal A Decimal value Program to convert a decimal floating point number to PDP-11 octal form Take out of USER mode, set PROGRAM mode and clear program memory. 001 f LBL A 42,21,11 X stack regester contains number to be converted. Regester useage Flag 0 Sign flag-negative if set. R0 N R1 Exponent R2 High part of octal representation R3 Low part of octal representation R4 Scratch 002 f FIX 0 42,7,0 Display only integer result 003 f CLR REG 42,34 Clear all working regesters 004 g CF 0 43,5,0 Clear sign flag 005 g X<0 43,10 Check sign 006 g SF 0 43,4,0 If negative-set sign flag 007 g ABS 43,16 Work with positive number only 008 g X=0 43,40 Is N zero ? 009 GTO 9 22,9 Yes-exit with zero results 010 f LBL 0 42,21,0 Exponent scaleing loop 011 1 1 Check if N is > 1.0 012 f X<=Y 42,10 If 1.<=N 013 GTO 1 22,1 Go check upper limit 014 STO -1 44,30,1 Decrement exponent 015 V 33 Get N 016 2 2 Scale N 017 X 20 018 GTO 0 22,0 And retry 019 f LBL 1 42,21,1 See if N<2 020 V 33 Get N 021 2 2 See if 2Y 42,20 023 GTO 2 22,2 1.<=N<2 N and exponent are properly scaled 024 /(divide) 10 Rescale N 025 1 1 Rescale exponent 026 STO +1 44,40,1 027 V 33 Get N 028 GTO 0 22,0 Retry scaleing N 029 f LBL 2 42,21,2 Final forming up of exponent part octal number 030 V 33 Get scaled N 031 STO 0 44,0 And save it 032 RCL 1 45,1 Get exponent 033 1 1 Add offset 034 2 2 035 9 9 036 + 40 037 g X>0 43,20 Check for underflow 038 GTO 4 22,4 No underflow 039 GTO 9 22,9 Underflow-answer is zero 040 f LBL 4 42,21,4 Check for overflow 041 2 2 042 5 5 043 6 6 044 f X<=Y 42,10 Exponent overflow 045 STO .9 44,.9 Yes-force error 3 046 2 2 Set pointer for storage regester 047 STO I 44,25 048 V 33 Get scaler number 049 /(divide) 10 Scale exponent 050 4 4 Get high order exponent octal digit and store 051 GSB 7 32,7 as the forth digit in the first word 052 3 3 Second digit in the 3rd place 053 GSB 7 32,7 054 2 2 Last exponent digit 055 GSB 7 32,7 056 EEX 26 Set up sign bit 057 5 5 058 g F? 0 43,6,0 N<0 059 STO+2 44,40,2 Yes-set sign bit 060 RCL 0 45,0 Get scaled 1.<=N<2 061 f FRAC 42,44 The leading one bit is hidden-so,lop off 062 2 2 Get octal digit and scale into high order 063 GSB 8 32,8 Octal word 064 1 1 Second high order digit 065 GSB 7 32,7 066 0 0 Last high order digit 067 GSB 7 068 3 3 Set up low order mantissa word pointer 069 STO I 44,25 070 V 33 Get rest of N 071 5 5 Get high order bit of low order word 072 GSB 8 32,8 073 4 4 Get next 5 octal digits 074 GSB 7 32,7 075 3 3 076 GSB 7 32,7 077 2 2 078 GSB 7 32,7 079 1 1 080 GSB 7 32,7 081 0 0 082 GSB 7 32,7 083 f LBL 9 42,21,9 Display results 084 RCL 3 45,3 Get low order 085 RCL 2 45,2 Get high order 086 g RTN 43,32 Done 087 f LBL 8 42,21,8 Strip off 1 bit as octal number 088 10**x 13 Get scale to place result digit in reg 089 X<>Y 34 Swap with N 090 2 2 Mult factor to strip off 1 bit 091 GTO 6 22,6 Go to common code 092 f LBL 7 42,21,7 Strip off 3 bits as octal number 093 10**X 13 Scale to place result digit in reg 094 X<>Y 34 Swap with N 095 8 8 Mult factor to strip off 3 bits 096 f LBL 6 42,21,6 Common code 097 X 20 get bit(s) wanted 098 f FRAC 42,44 Save low order unused bits 099 STO 4 44,4 Untill needed 100 V 33 Get placement scale 101 g LST X 43,36 Get N 102 g INT 43,44 Get bits wanted 103 X 20 Place in wanted loction 104 STO+(I) 44,40,24 Accumulate 105 RCL 4 45,4 Get remaining N and return Program to convert a decimal floating number to PDP-11 octal format Step Instructions Input Keystrokes Output 1 Enter number to be converted N A Hi order octal value 2 X<>Y Lo order octal value