Source Code

These source-code files are part of a reconstructed copy of Comanche 72/3 (AKA Manche72 revision 3), the final, flown mission release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

The starting point was the source code of Comanche 72 (itself previously reconstructed). Comanche 72 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 72 and 72/3. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments.

Since no contemporary listings of Comanche 72/3 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.

033779,000002:                                                                                                  ## Copyright:   Public domain.
033780,000003:                                                                                                  ## Filename:    LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
033781,000004:                                                                                                  ## Purpose:     A section of Manche72 revision 3.
033782,000005:                                                                                                  ##              It is part of the reconstructed source code for the final, flown
033783,000006:                                                                                                  ##              release of the software for the Command Module's (CM) Apollo
033784,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 13. No original listings
033785,000008:                                                                                                  ##              of this program are available; instead, this file was recreated
033786,000009:                                                                                                  ##              from a reconstructed copy of Comanche 072. It has been adapted
033787,000010:                                                                                                  ##              such that the resulting bugger words exactly match those
033788,000011:                                                                                                  ##              specified for Manche72 revision 3 in NASA drawing 2021153G,
033789,000012:                                                                                                  ##              which gives relatively high confidence that the reconstruction
033790,000013:                                                                                                  ##              is correct.
033791,000014:                                                                                                  ## Assembler:   yaYUL
033792,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033793,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033794,000017:                                                                                                  ## Mod history: 2024-05-19 MAS  Created from Comanche 072.
033795,000018: 
033796,000019:                                                                                                  #  LUNAR AND SOLAR EPHEMERIDES SUBROUTINES
033797,000020: 
033798,000021:                                                                                                  #  FUNCTIONAL DESCRIPTION
033799,000022: 
033800,000023:                                                                                                  #        THESE SUBROUTINES ARE USED TO DETERMINE THE POSITION AND VELOCITY
033801,000024:                                                                                                  #        VECTORS OF THE SUN AND THE MOON RELATIVE TO THE EARTH AT THE
033802,000025:                                                                                                  #        SPECIFIED GROUND ELAPSED TIME INPUT BY THE USER.
033803,000026: 
033804,000027:                                                                                                  #        THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF
033805,000028:                                                                                                  #        A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15
033806,000029:                                                                                                  #        DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH.  THEREFORE THE TIME
033807,000030:                                                                                                  #        INPUT BY THE USER SHOULD FALL WITHIN THIS 15 DAY INTERVAL.
033808,000031: 
033809,000032:                                                                                                  #        LSPOS COMPUTES THE POSITION VECTORS OF THE SUN AND THE MOON.
033810,000033: 
033811,000034:                                                                                                  #        LUNPOS COMPUTES THE POSITION VECTOR OF THE MOON.
033812,000035: 
033813,000036:                                                                                                  #        LUNVEL COMPUTES THE VELOCITY VECTOR OF THE MOON.
033814,000037: 
033815,000038:                                                                                                  #        SOLPOS COMPUTES THE POSITION VECTOR OF THE SUN.
033816,000039: 
033817,000040:                                                                                                  #  CALLING SEQUENCE
033818,000041: 
033819,000042:                                                                                                  #        DLOAD   CALL
033820,000043:                                                                                                  #                TIME            GROUND ELAPSED TIME
033821,000044:                                                                                                  #                SUBROUTINE      LSPOS OR LUNPOS OR LUNVEL OR SOLPOS
033822,000045: 
033823,000046:                                                                                                  #  INPUT
033824,000047: 
033825,000048:                                                                                                  #        1) SPECIFIED GROUND ELAPSED TIME IN CS X B-28 LOADED IN MPAC.
033826,000049: 
033827,000050:                                                                                                  #        2) TIMEMO - TIME AT THE CENTER OF THE RANGE OVER WHICH THE LUNAR
033828,000051:                                                                                                  #        POSITION POLYNOMIAL IS VALID IN CS X B-42.
033829,000052: 
033830,000053:                                                                                                  #        3) VECOEM - VECTOR COEFFICIENTS OF THE LUNAR POSITION POLYNOMIAL
033831,000054:                                                                                                  #        LOADED IN DESCENDING SEQUENCE IN METERS/CS**N X B-2
033832,000055: 
033833,000056:                                                                                                  #        4) RESO - POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH AT
033834,000057:                                                                                                  #        TIMEMO IN METERS X B-38.
033835,000058: 
033836,000059:                                                                                                  #        5) VESO - VELOCITY VECTOR OF THE SUN RELATIVE TO THE EARTH AT
033837,000060:                                                                                                  #        TIMEMO IN METERS/CS X B-9.
033838,000061:                                                                                                  #  
033839,000062:                                                                                                  #        6) OMEGAES - ANGULAR VELOCITY OF THE VECTOR RESO AT TIMEMO IN
033840,000063:                                                                                                  #        REV/CS X B+26.
033841,000064: 
033842,000065:                                                                                                  #        ALL EXCEPT THE FIRST INPUT ARE INCLUDED IN THE PRE-LAUNCH
033843,000066:                                                                                                  #        ERASABLE DATA LOAD.
033844,000067: 
033845,000068:                                                                                                  #  OUTPUT - LSPOS
033846,000069: 
033847,000070:                                                                                                  #        1) 2D OF VAC AREA CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE
033848,000071:                                                                                                  #        TO THE EARTH AT TIME INPUT BY THE USER IN METERS X B-38.
033849,000072: 
033850,000073:                                                                                                  #        2) MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
033851,000074:                                                                                                  #        EARTH AT TIME INPUT BY THE USER IN METERS X B-29.
033852,000075: 
033853,000076:                                                                                                  #  OUTPUT - LUNPOS
033854,000077: 
033855,000078:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
033856,000079:                                                                                                  #        EARTH AT THE TIME INPUT BY USER IN METERS X B-29.
033857,000080: 
033858,000081:                                                                                                  #  OUTPUT - LUNVEL
033859,000082: 
033860,000083:                                                                                                  #        MPAC CONTAINS THE VELOCITY VECTOR OF THE MOON RELATIVE TO THE
033861,000084:                                                                                                  #        EARTH AT TIME INPUT BY THE USER IN METERS/CS X B-7.
033862,000085: 
033863,000086:                                                                                                  #  OUTPUT - SOLPOS
033864,000087: 
033865,000088:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH
033866,000089:                                                                                                  #        AT TIME INPUT BY THE USER IN METERS X B-38.
033867,000090: 
033868,000091:                                                                                                  #  SUBROUTINES USED
033869,000092: 
033870,000093:                                                                                                  #        NONE
033871,000094: 
033872,000095:                                                                                                  #  REMARKS
033873,000096: 
033874,000097:                                                                                                  #        THE VAC AREA IS USED FOR STORAGE OF INTERMEDIATE AND FINAL RESULTS
033875,000098:                                                                                                  #        OF COMPUTATIONS.
033876,000099: 
033877,000100:                                                                                                  #        S1, X1 AND X2 ARE USED BY THESE SUBROUTINES.
033878,000101: 
033879,000102:                                                                                                  #        PRELAUNCH ERASABLE DATA LOAD ARE ONLY ERASABLE STORAGE USED BY
033880,000103:                                                                                                  #        THESE SUBROUTINES.
033881,000104: 
033882,000105:                                                                                                  #        RESTARTS DURING OPERATION OF THESE SUBROUTINES MUST BE HANDLED BY
033883,000106:                                                                                                  #        THE USER.
033884,000107: 
033885,000108: 36,2466                                           BANK     36                                    
033886,000109: 26,2000                                           SETLOC   EPHEM                                 
033887,000110: 26,2000                                           BANK                                           
033888,000111: 
033889,000112: 26,2110                                           COUNT*   $$/EPHEM                              
033890,000113: 26,2110  E7,1777                                  EBANK=   END-E7                                
033891,000114: 26,2110           77774        LSPOS              AXT,2                                          #  COMPUTES POSITION VECTORS OF BOTH THE
033892,000115: 26,2111           54161                                    RESA                                  #  SUN AND THE MOON.  THE POSITION VECTOR
033893,000116: 26,2112           52170                           AXT,1    GOTO                                  #  OF THE SUN IS STORED IN 2D OF THE VAC
033894,000117: 26,2113           54143                                    RES                                   #  AREA.  THE POSITION VECTOR OF THE MOON
033895,000118: 26,2114           54126                                    LSTIME                                #  IS STORED IN MPAC.
033896,000119: 26,2115           52170        LUNPOS             AXT,1    GOTO                                  #  COMPUTES THE POSITION VECTOR OF THE MOON
033897,000120: 26,2116           54162                                    REM                                   #  AND STORES IT IN MPAC.
033898,000121: 26,2117           54126                                    LSTIME                                
033899,000122: 26,2120           52170        LUNVEL             AXT,1    GOTO                                  #  COMPUTES THE VELOCITY VECTOR OF THE MOON
033900,000123: 26,2121           54173                                    VEM                                   #  AND STORES IT IN MPAC.
033901,000124: 26,2122           54126                                    LSTIME                                
033902,000125: 26,2123           76020        SOLPOS             STQ      AXT,1                                 #  COMPUTES THE POSITION VECTOR OF THE SUN
033903,000126: 26,2124           00047                                    X2                                    #  AND STORES IT IN MPAC.
033904,000127: 26,2125           54143                                    RES                                   
033905,000128: 26,2126           54201        LSTIME             SETPD    SR                                    
033906,000129: 26,2127           00001                                    0D                                    
033907,000130: 26,2130           20617                                    14D                                   
033908,000131: 26,2131           57571                           TAD      DCOMP                                 
033909,000132: 26,2132           01707                                    TEPHEM                                
033910,000133: 26,2133           57571                           TAD      DCOMP                                 
033911,000134: 26,2134           02034                                    TIMEMO                                
033912,000135: 26,2135           66261                           SL       SSP                                   
033913,000136: 26,2136           20221                                    16D                                   
033914,000137: 26,2137           00051                                    S1                                    
033915,000138: 26,2140           00006                                    6D                                    
033916,000139: 26,2141           77650                           GOTO                                           
033917,000140: 26,2142           00046                                    X1                                    
033918,000141: 26,2143           41206        RES                PUSH     DMP                                   #                                        PD- 2
033919,000142: 26,2144           02147                                    OMEGAES                               
033920,000143: 26,2145           71406                           PUSH     COS                                   #                                        PD- 4
033921,000144: 26,2146           65361                           VXSC     PDDL                                  #                                        PD- 8
033922,000145: 26,2147           02133                                    RESO                                  
033923,000146: 26,2150           63356                           SIN      PDVL                                  #                                        PD-10
033924,000147: 26,2151           02133                                    RESO                                  
033925,000148: 26,2152           53406                           PUSH     UNIT                                  #                                        PD-16
033926,000149: 26,2153           53435                           VXV      UNIT                                  
033927,000150: 26,2154           02141                                    VESO                                  
033928,000151: 26,2155           76435                           VXV      VSL1                                  #                                        PD-10
033929,000152: 26,2156           53361                           VXSC     VAD                                   #                                        PD-02
033930,000153: 26,2157           52172                           VSL1     GOTO                                  #  RES IN METERS X B-38 IN MPAC.
033931,000154: 26,2160           00047                                    X2                                    
033932,000155: 26,2161           14003        RESA               STODL    2D                                    #  RES IN METERS X B-38 IN 2D OF VAC.    PD- 0
033933,000156: 26,2162           63370        REM                AXT,1    PDVL                                  #                                        PD- 2
033934,000157: 26,2163           00066                                    54D                                   
033935,000158: 26,2164           02037                                    VECOEM                                
033936,000159: 26,2165           52761        REMA               VXSC     VAD*                                  
033937,000160: 26,2166           00001                                    0D                                    
033938,000161: 26,2167           02133                                    VECOEM     +60D,1                     
033939,000162: 26,2170           72500                           TIX,1    VSL2                                  #  REM IN METERS X B-29 IN MPAC.
033940,000163: 26,2171           54165                                    REMA                                  
033941,000164: 26,2172           77616                           RVQ                                            
033942,000165: 26,2173           65370        VEM                AXT,1    PDDL                                  #                                        PD- 2
033943,000166: 26,2174           00060                                    48D                                   
033944,000167: 26,2175           14214                                    NINEB4                                
033945,000168: 26,2176           74206                           PUSH     VXSC                                  #                                        PD- 4
033946,000169: 26,2177           02037                                    VECOEM                                
033947,000170: 26,2200           77761        VEMA               VXSC                                           
033948,000171: 26,2201           00001                                    0D                                    
033949,000172: 26,2202           14005                           STODL    4D                                    #                                        PD- 2
033950,000173: 26,2203           41425                           DSU      PUSH                                  #                                        PD- 4
033951,000174: 26,2204           14216                                    ONEB4                                 
033952,000175: 26,2205           53357                           VXSC*    VAD                                   
033953,000176: 26,2206           02125                                    VECOEM     +54D,1                     
033954,000177: 26,2207           00005                                    4D                                    
033955,000178: 26,2210           72500                           TIX,1    VSL2                                  #  VEM IN METERS/CS X B-7 IN MPAC.
033956,000179: 26,2211           54200                                    VEMA                                  
033957,000180: 26,2212           77616                           RVQ                                            
033958,000181: 26,2213           22000 00000  NINEB4             2DEC     9.0        B-4                        
033959,000182: 
033960,000183: 26,2215           02000 00000  ONEB4              2DEC     1.0        B-4                        
033961,000184: 
033962,000185: 
033963,000186: 

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