Source Code

These source-code files are part of a reconstructed copy of Sundial E, the final release of the Block II Command Module (CM) Apollo Guidance Computer (AGC) system test software.

They have been created via disassembly of binary dumps of original core rope memory modules, part numbers 2003053-121, 2003053-151, and 2003972-211, belonging to the MIT Museum.

Since only binary dumps (rather than listings) of Sundial are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

004192,000002:                                                                                                  ## Copyright:   Public domain.
004193,000003:                                                                                                  ## Filename:    SINGLE_PRECISION_SUBROUTINES.agc
004194,000004:                                                                                                  ## Purpose:     A section of Sundial E.
004195,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
004196,000006:                                                                                                  ##              release of the Block II Command Module system test software. No
004197,000007:                                                                                                  ##              original listings of this program are available; instead, this
004198,000008:                                                                                                  ##              file was created via disassembly of dumps of Sundial core rope
004199,000009:                                                                                                  ##              modules and comparison with other AGC programs.
004200,000010:                                                                                                  ## Assembler:   yaYUL
004201,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
004202,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
004203,000013:                                                                                                  ## Mod history: 2023-06-22 MAS  Created from Aurora 12.
004204,000014:                                                                                                  ##              2023-06-30 MAS  Updated for Sundial E.
004205,000015: 
004206,000016: 
004207,000017:    4151                                           SETLOC   ENDIBNKF                              
004208,000018: 
004209,000019:                                                                                                  #  SINGLE PRECISION SINE AND COSINE
004210,000020: 
004211,000021:    4151           67635        SPCOS              AD       HALF                                  #  ARGUMENTS SCALED AT PI
004212,000022:    4152           55106        SPSIN              TS       TEMK                                  
004213,000023:    4153           14155                           TCF      SPT                                   
004214,000024:    4154           41106                           CS       TEMK                                  
004215,000025:    4155           60000        SPT                DOUBLE                                         
004216,000026:    4156           55106                           TS       TEMK                                  
004217,000027:    4157           14172                           TCF      POLLEY                                
004218,000028:    4160           57106                           XCH      TEMK                                  
004219,000029:    4161           51106                           INDEX    TEMK                                  
004220,000030:    4162           67633                           AD       LIMITS                                
004221,000031:    4163           40000                           COM                                            
004222,000032:    4164           61106                           AD       TEMK                                  
004223,000033:    4165           55106                           TS       TEMK                                  
004224,000034:    4166           14172                           TCF      POLLEY                                
004225,000035:    4167           50000                           INDEX    A                                     
004226,000036:    4170           37634                           CA       LIMITS     +1                         
004227,000037:    4171           00002                           TC       Q                                     
004228,000038:    4172           00006        POLLEY             EXTEND                                         
004229,000039:    4173           71106                           MP       TEMK                                  
004230,000040:    4174           55107                           TS       SQ                                    
004231,000041:    4175           00006                           EXTEND                                         
004232,000042:    4176           74210                           MP       C5/2                                  
004233,000043:    4177           64207                           AD       C3/2                                  
004234,000044:    4200           00006                           EXTEND                                         
004235,000045:    4201           71107                           MP       SQ                                    
004236,000046:    4202           64206                           AD       C1/2                                  
004237,000047:    4203           00006                           EXTEND                                         
004238,000048:    4204           71106                           MP       TEMK                                  
004239,000049:    4205           00002                           TC       Q                                     #  RESULT SCALED AT 1
004240,000050:    4206           31103        C1/2               DEC      .7853134                              
004241,000051:    4207           65552        C3/2               DEC      -.3216146                             
004242,000052:    4210           01124        C5/2               DEC      .0363551                              
004243,000053:                                                                                                  #  ENTER WITH ARGUMENT IN A, EXIT WITH ROOT IN A.  IF GIVEN A NEGATIVE ARGUMENT, THE RETURN SKIPS WITH CCS RESULT.
004244,000054:                                                                                                  #  MINUS ZERO RETURNS LIKE PLUS ZERO.
004245,000055:                                                                                                  #  MAXIMUM ERROR IN ANSWER IS NO GREATER THAN 2 BITS.
004246,000056:                                                                                                  #  INTERRUPT PROGRAMS USING SPROOT MUST SAVE AND RESTORE SR.
004247,000057: 
004248,000058: 
004249,000059: 
004250,000060:    4211           55110        SPROOT             TS       SQRARG                                #  ENTER WITH C(A) = Y
004251,000061:    4212           10000                           CCS      A                                     
004252,000062:    4213           14217                           TCF      POSARG                                #  IF PNZ, CONTINUE
004253,000063:    4214           00002                           TC       Q                                     #  RETURN WITH 0 FOR +0
004254,000064:    4215           24002                           INCR     Q                                     
004255,000065:    4216           00002                           TC       Q                                     #  RETURN WITH 0 FOR -0
004256,000066: 
004257,000067:    4217           00006        POSARG             EXTEND                                         
004258,000068:    4220           23107                           QXCH     ROOTRET                               #  WILL BE CALLING SPROOT1
004259,000069:    4221           64275                           AD       63/64+1                               #  B(A) = Y - 1
004260,000070:    4222           54000                           OVSK                                           
004261,000071:    4223           14264                           TCF      SPROOT2                               
004262,000072:    4224           57110                           XCH      SQRARG                                #  ARG JUGGLING
004263,000073: 
004264,000074:    4225           55110        SPROOT3            TS       SQRARG                                
004265,000075:    4226           54021                           TS       SR                                    #  C(A) = Y
004266,000076:    4227           56021                           XCH      SR                                    #  (LOSE 1 BIT)
004267,000077:    4230           55106                           TS       HALFY                                 #  HALFY = Y/2
004268,000078:    4231           64273                           AD       -1/8                                  #  FORM Y/2 - 1/8
004269,000079:    4232           10000                           CCS      A                                     #  TEST FOR FIRST GUESS
004270,000080:    4233           64274                           AD       5/8+1                                 #  Y .G. 1/4, X = Y/2 + 1/2
004271,000081:    4234           04241                           TC       HIGUESS                               #  +0 IMPOSSIBLE FROM ADDITION
004272,000082:    4235           14236                           NOOP                                           #  Y .LE. 1/4, X/2 = Y + 1/16
004273,000083:    4236           37640                           CAF      BIT11                                 #  1/16
004274,000084:    4237           61110                           AD       SQRARG                                #  SQRARG = Y
004275,000085:    4240           60000                           DOUBLE                                         #  X FROM X/2
004276,000086:    4241           04254        HIGUESS            TC       SPROOT1                               
004277,000087:    4242           04254                           TC       SPROOT1                               #  ITERATE TWICE
004278,000088:    4243           57107                           XCH      ROOTRET                               #  SAVE ANSWER AND GET Q
004279,000089:    4244           10000                           CCS      A                                     
004280,000090:    4245           57107                           XCH      ROOTRET                               #  NO SHIFT NEEDED
004281,000091:    4246           04252                           TC       ROOTBCK                               
004282,000092:    4247           57107                           XCH      ROOTRET                               #  Q NEG, SHIFT RIGHT THREE
004283,000093:    4250           00006                           EXTEND                                         
004284,000094:    4251           77637                           MP       BIT12                                 #  EXP -3
004285,000095:    4252           51107        ROOTBCK            INDEX    ROOTRET                               #  ROOTRET = Q - 1
004286,000096:    4253           00001                           TC       1                                     #  RETURN, C(A) = SQRT(Y)
004287,000097: 
004288,000098:    4254           56021        SPROOT1            XCH      SR                                    #  SR = X/2
004289,000099:    4255           41106                           CS       HALFY                                 #  NEWTON ITER  X = X/2 + (Y/2 / X/2) / 2
004290,000100:    4256           00006                           EXTEND                                         
004291,000101:    4257           10021                           DV       SR                                    #  C(SR) = X/2 DV DOES NOT EDIT
004292,000102:    4260           56021                           XCH      SR                                    
004293,000103:    4261           00006                           EXTEND                                         
004294,000104:    4262           60021                           SU       SR                                    
004295,000105:    4263           00002                           TC       Q                                     #  C(A) = X (NEXT)
004296,000106: 
004297,000107:    4264           41107        SPROOT2            CS       ROOTRET                               #  SET RETURN Q NEG, AS FLAG
004298,000108:    4265           55107                           TS       ROOTRET                               
004299,000109:    4266           37644                           CAF      BIT7                                  #  SHIFT FOR SIGNIFCANCE
004300,000110:    4267           00006                           EXTEND                                         
004301,000111:    4270           71110                           MP       SQRARG                                
004302,000112:    4271           30001                           CA       L                                     #  B(A) = 0
004303,000113:    4272           04225                           TC       SPROOT3                               
004304,000114: 
004305,000115:    4273           73777        -1/8               OCTAL    73777                                 
004306,000116:    4274           24001        5/8+1              OCTAL    24001                                 
004307,000117:    4275           37401        63/64+1            OCTAL    37401                                 
004308,000118: 
004309,000119: 
004310,000120: 
004311,000121:    4276                        ENDSUBSF           EQUALS                                         

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