Source Code

These source-code files were transcribed from a printout in Don Eyles's personal collection, scanned by archive.org, and financially sponsored by Peter McDermott. A team of volunteers performed the transcription and proof-reading. The scanned page images are available at the Virtual AGC Project website, as well as higher-quality (but much larger) images at the Virtual AGC Project's collection in the Internet Archive. Report any problems by creating "issues" at the Virtual AGC Project's GitHub Repository.

Notations on the program listing read, in part:

	YUL SYSTEM FOR AGC: NEW PROGRAM SHEPATIN BY EYLES
	DEC 13, 1966

	THIS PROGRAM WAS ASSEMBLED AS A VERSION OF REVISION 37 
        OF PROGRAM SUNBURST BY LEM GROUP
Note that the date is the date of the printout, not the date of the program revision.

043823,000002:                                                                                                  ## Copyright:   Public domain.
043824,000003:                                                                                                  ## Filename:    SINGLE_PRECISION_SUBROUTINES.agc
043825,000004:                                                                                                  ## Purpose:     A section of Sunburst revision 37, or Shepatin revision 0.
043826,000005:                                                                                                  ##              It is part of an early development version of the software
043827,000006:                                                                                                  ##              for Apollo Guidance Computer (AGC) on the unmanned Lunar
043828,000007:                                                                                                  ##              Module (LM) flight Apollo 5. Sunburst 37 was the program
043829,000008:                                                                                                  ##              upon which Don Eyles's offline development program Shepatin
043830,000009:                                                                                                  ##              was based; the listing herein transcribed was actually for
043831,000010:                                                                                                  ##              the equivalent revision 0 of Shepatin.
043832,000011:                                                                                                  ##              This file is intended to be a faithful transcription, except
043833,000012:                                                                                                  ##              that the code format has been changed to conform to the
043834,000013:                                                                                                  ##              requirements of the yaYUL assembler rather than the
043835,000014:                                                                                                  ##              original YUL assembler.
043836,000015:                                                                                                  ## Reference:   pp. 985-987
043837,000016:                                                                                                  ## Assembler:   yaYUL
043838,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
043839,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
043840,000019:                                                                                                  ## Mod history: 2017-05-24 MAS  Created from Sunburst 120.
043841,000020:                                                                                                  ##              2017-06-17 NV   Updated for Sunburst 37
043842,000021:                                                                                                  ##              2017-06-23 RSB  Proofed comment text with
043843,000022:                                                                                                  ##                              octopus/ProoferComments.
043844,000023: 

Page 985

043846,000025:    5372                                           BLOCK    02                                    
043847,000026:                                                                                                  #  SINGLE PRECISION SINE AND COSINE
043848,000027: 
043849,000028:    5372           67740        SPCOS              AD       HALF                                  #  ARGUMENTS SCALED AT PI
043850,000029:    5373           55127        SPSIN              TS       TEMK                                  
043851,000030:    5374           15376                           TCF      SPT                                   
043852,000031:    5375           41127                           CS       TEMK                                  
043853,000032:    5376           60000        SPT                DOUBLE                                         
043854,000033:    5377           55127                           TS       TEMK                                  
043855,000034:    5400           15411                           TCF      POLLEY                                
043856,000035:    5401           57127                           XCH      TEMK                                  
043857,000036:    5402           51127                           INDEX    TEMK                                  
043858,000037:    5403           67736                           AD       LIMITS                                
043859,000038:    5404           40000                           COM                                            
043860,000039:    5405           61127                           AD       TEMK                                  
043861,000040:    5406           55127                           TS       TEMK                                  
043862,000041:    5407           15411                           TCF      POLLEY                                
043863,000042:    5410           15427                           TCF      ARG90                                 
043864,000043:    5411           00006        POLLEY             EXTEND                                         
043865,000044:    5412           71127                           MP       TEMK                                  
043866,000045:    5413           55130                           TS       SQ                                    
043867,000046:    5414           00006                           EXTEND                                         
043868,000047:    5415           75434                           MP       C5/2                                  
043869,000048:    5416           65433                           AD       C3/2                                  
043870,000049:    5417           00006                           EXTEND                                         
043871,000050:    5420           71130                           MP       SQ                                    
043872,000051:    5421           65432                           AD       C1/2                                  
043873,000052:    5422           00006                           EXTEND                                         
043874,000053:    5423           71127                           MP       TEMK                                  
043875,000054:    5424           20001                           DDOUBL                                         
043876,000055:    5425           55127                           TS       TEMK                                  
043877,000056:    5426           00002                           TC       Q                                     
043878,000057:    5427           50000        ARG90              INDEX    A                                     
043879,000058:    5430           47736                           CS       LIMITS                                
043880,000059:    5431           00002                           TC       Q                                     #  RESULT SCALED AT 1
043881,000060:    5432           31103        C1/2               DEC      .7853134                              
043882,000061:    5433           65552        C3/2               DEC      -.3216146                             
043883,000062:    5434           01124        C5/2               DEC      .0363551                              

Page 986

043885,000064:                                                                                                  #  ENTER WITH ARGUMENT IN A, EXIT WITH ROOT IN A.  IF GIVEN A NEGATIVE ARGUMENT, THE RETURN SKIPS WITH CCS RESULT.
043886,000065:                                                                                                  #  MINUS ZERO RETURNS LIKE PLUS ZERO.
043887,000066:                                                                                                  #  MAXIMUM ERROR IN ANSWER IS NO GREATER THAN 2 BITS.
043888,000067:                                                                                                  #  INTERRUPT PROGRAMS USING SPROOT MUST SAVE AND RESTORE SR.
043889,000068: 
043890,000069: 
043891,000070: 
043892,000071:    5435           55131        SPROOT             TS       SQRARG                                #  ENTER WITH C(A) = Y
043893,000072:    5436           10000                           CCS      A                                     
043894,000073:    5437           15443                           TCF      POSARG                                #  IF PNZ, CONTINUE
043895,000074:    5440           00002                           TC       Q                                     #  RETURN WITH 0 FOR +0
043896,000075:    5441           24002                           INCR     Q                                     
043897,000076:    5442           00002                           TC       Q                                     #  RETURN WITH 0 FOR -0
043898,000077: 
043899,000078:    5443           00006        POSARG             EXTEND                                         
043900,000079:    5444           23130                           QXCH     ROOTRET                               #  WILL BE CALLING SPROOT1
043901,000080:    5445           65522                           AD       63/64+1                               #  B(A) = Y - 1
043902,000081:    5446           54000                           OVSK                                           
043903,000082:    5447           15511                           TCF      SPROOT2                               
043904,000083:    5450           57131                           XCH      SQRARG                                #  ARG JUGGLING
043905,000084: 
043906,000085:    5451           55131        SPROOT3            TS       SQRARG                                
043907,000086:    5452           54021                           TS       SR                                    #  C(A) = Y
043908,000087:    5453           56021                           XCH      SR                                    #  (LOSE 1 BIT)
043909,000088:    5454           55127                           TS       HALFY                                 #  HALFY = Y/2
043910,000089:    5455           65520                           AD       -1/8                                  #  FORM Y/2 - 1/8
043911,000090:    5456           10000                           CCS      A                                     #  TEST FOR FIRST GUESS
043912,000091:    5457           65521                           AD       5/8+1                                 #  Y .G. 1/4, X = Y/2 + 1/2
043913,000092:    5460           05465                           TC       HIGUESS                               #  +0 IMPOSSIBLE FROM ADDITION
043914,000093:    5461           15462                           NOOP                                           #  Y .LE. 1/4, X/2 = Y + 1/16
043915,000094:    5462           37743                           CAF      BIT11                                 #  1/16
043916,000095:    5463           61131                           AD       SQRARG                                #  SQRARG = Y
043917,000096:    5464           60000                           DOUBLE                                         #  X FROM X/2
043918,000097:    5465           05500        HIGUESS            TC       SPROOT1                               
043919,000098:    5466           05500                           TC       SPROOT1                               #  ITERATE TWICE
043920,000099:    5467           57130                           XCH      ROOTRET                               #  SAVE ANSWER AND GET Q
043921,000100:    5470           10000                           CCS      A                                     
043922,000101:    5471           57130                           XCH      ROOTRET                               #  NO SHIFT NEEDED
043923,000102:    5472           05476                           TC       ROOTBCK                               
043924,000103:    5473           57130                           XCH      ROOTRET                               #  Q NEG, SHIFT RIGHT THREE
043925,000104:    5474           00006                           EXTEND                                         
043926,000105:    5475           77742                           MP       BIT12                                 #  EXP -3
043927,000106:    5476           51130        ROOTBCK            INDEX    ROOTRET                               #  ROOTRET = Q - 1
043928,000107:    5477           00001                           TC       1                                     #  RETURN, C(A) = SQRT(Y)
043929,000108: 
043930,000109:    5500           56021        SPROOT1            XCH      SR                                    #  SR = X/2
043931,000110:    5501           41127                           CS       HALFY                                 #  NEWTON ITER  X = X/2 + (Y/2 / X/2) / 2
043932,000111:    5502           22007                           ZL                                             
043933,000112:    5503           00006                           EXTEND                                         
043934,000113:    5504           10021                           DV       SR                                    #  C(SR) = X/2 DV DOES NOT EDIT

Page 987

043936,000115:    5505           56021                           XCH      SR                                    
043937,000116:    5506           00006                           EXTEND                                         
043938,000117:    5507           60021                           SU       SR                                    
043939,000118:    5510           00002                           TC       Q                                     #  C(A) = X (NEXT)
043940,000119: 
043941,000120:    5511           41130        SPROOT2            CS       ROOTRET                               #  SET RETURN Q NEG, AS FLAG
043942,000121:    5512           55130                           TS       ROOTRET                               
043943,000122:    5513           37747                           CAF      BIT7                                  #  SHIFT FOR SIGNIFCANCE
043944,000123:    5514           00006                           EXTEND                                         
043945,000124:    5515           71131                           MP       SQRARG                                
043946,000125:    5516           30001                           CA       L                                     #  B(A) = 0
043947,000126:    5517           05451                           TC       SPROOT3                               
043948,000127: 
043949,000128:    5520           73777        -1/8               OCTAL    73777                                 
043950,000129:    5521           24001        5/8+1              OCTAL    24001                                 
043951,000130:    5522           37401        63/64+1            OCTAL    37401                                 
043952,000131: 

End of include-file SINGLE_PRECISION_SUBROUTINES.agc.  Parent file is MAIN.agc