Source Code

These source-code files are part of a reconstructed copy of Comanche 72, the first release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

They have been adapted from sources files created from a listing of Comanche 55. These source files were updated to match binary dumps of a set of Comanche 67 rope modules. They were then further modified by applying known changes between Comanche 67 and Comanche 72. A binary dump of module B2 of Comanche 72, part number 2010802-021, was also used to validate changes made to banks 05-13. 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 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.

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

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