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.

021168,000002:                                                                                                  ## Copyright:   Public domain.
021169,000003:                                                                                                  ## Filename:    R31.agc
021170,000004:                                                                                                  ## Purpose:     A section of Comanche revision 072.
021171,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
021172,000006:                                                                                                  ##              release of the software for the Command Module's (CM) Apollo
021173,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 13. No original listings
021174,000008:                                                                                                  ##              of this program are available; instead, this file was recreated
021175,000009:                                                                                                  ##              from a printout of Comanche 055, binary dumps of a set of
021176,000010:                                                                                                  ##              Comanche 067 rope modules, and changelogs between Comanche 067
021177,000011:                                                                                                  ##              and 072. It has been adapted such that the resulting bugger words
021178,000012:                                                                                                  ##              exactly match those specified for Comanche 072 in NASA drawing
021179,000013:                                                                                                  ##              2021153G, which gives relatively high confidence that the
021180,000014:                                                                                                  ##              reconstruction is correct.
021181,000015:                                                                                                  ## Assembler:   yaYUL
021182,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
021183,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
021184,000018:                                                                                                  ## Mod history: 2024-05-13 MAS  Created from Comanche 067.
021185,000019: 
021186,000020: 34,2002                                           BANK     34                                    
021187,000021: 31,2000                                           SETLOC   R31                                   
021188,000022: 31,2000                                           BANK                                           
021189,000023: 
021190,000024: 31,2000                                           COUNT*   $$/R31                                
021191,000025: 
021192,000026: 31,2000           35073        R31CALL            CAF      PRIO3                                 
021193,000027: 31,2001           05163                           TC       FINDVAC                               
021194,000028: 31,2002  E4,1770                                  EBANK=   SUBEXIT                               
021195,000029: 31,2002           02032 62064                     2CADR    V83CALL                               
021196,000030: 
021197,000031: 31,2004           35055        DSPDELAY           CAF      1SEC                                  
021198,000032: 31,2005           04676                           TC       BANKCALL                              
021199,000033: 31,2006           01732                           CADR     DELAYJOB                              
021200,000034: 31,2007           31044                           CA       EXTVBACT                              
021201,000035: 31,2010           75020                           MASK     BIT12                                 
021202,000036: 31,2011           00006                           EXTEND                                         
021203,000037: 31,2012           12004                           BZF      DSPDELAY                              
021204,000038: 
021205,000039: 31,2013           30105        DISPN5X            CA       FLAGWRD9                              #  TEST R31FLAG (IN SUNDANCE R31FLAG WILL
021206,000040: 31,2014           75030                           MASK     BIT4                                  #        ALWAYS BE SET AS R34 DOES NOT EXIST)
021207,000041: 31,2015           00006                           EXTEND                                         
021208,000042: 31,2016           12021                           BZF      +3                                    
021209,000043: 31,2017           32136                           CAF      V16N54                                #  R31   USE NOUN 54
021210,000044: 31,2020           02022                           TC       +2                                    
021211,000045: 31,2021           32137                           CAF      V16N53                                #  R34   USE NOUN 53
021212,000046: 31,2022           04676                           TC       BANKCALL                              
021213,000047: 31,2023           20561                           CADR     GOMARKF                               
021214,000048: 31,2024           05641                           TC       B5OFF                                 
021215,000049: 31,2025           05641                           TC       B5OFF                                 
021216,000050: 31,2026           12013                           TCF      DISPN5X                               
021217,000051: 
021218,000052: 31,2027           06006        V83                TC       INTPRET                               
021219,000053: 31,2030           77650                           GOTO                                           
021220,000054: 31,2031           62171                                    HAVEBASE                              #  INTEG STATE VECTORS
021221,000055: 31,2032           06006        V83CALL            TC       INTPRET                               
021222,000056: 31,2033           77650                           GOTO                                           
021223,000057: 31,2034           62140                                    STATEXTP                              #  EXTRAPOLATE STATE VECTORS
021224,000058: 31,2035           52375        COMPDISP           VLOAD    VSU                                   
021225,000059: 31,2036           00001                                    RATT                                  
021226,000060: 31,2037           02327                                    RONE                                  
021227,000061: 31,2040           51406                           PUSH     ABVAL                                 #  RATT-RONE TO 0D       PD= 6
021228,000062: 31,2041           02321                           STORE    RANGE                                 #  METERS B-29
021229,000063: 31,2042           77301                           NORM     VLOAD                                 
021230,000064: 31,2043           00047                                    X1                                    #  RATT-RONE             PD= 0
021231,000065: 31,2044           77762                           VSR1                                           
021232,000066: 31,2045           53457                           VSL*     UNIT                                  
021233,000067: 31,2046           20201                                    0,1                                   
021234,000068: 31,2047           52315                           PDVL     VSU                                   #  UNIT(LOS) TO 0D       PD= 6
021235,000069: 31,2050           00007                                    VATT                                  
021236,000070: 31,2051           02335                                    VONE                                  
021237,000071: 31,2052           77641                           DOT                                            #  (VATT-VONE).UNIT(LOS) PD= 0
021238,000072: 31,2053           77752                           SL1                                            
021239,000073: 31,2054           36323                           STCALL   RRATE                                 #  RANGE RATE M/CS B-7
021240,000074: 31,2055           47501                                    CDUTRIG                               #  TO INITIALIZE FOR *NBSM*
021241,000075: 31,2056           77624                           CALL                                           
021242,000076: 31,2057           62311                                    R34LOS                                #  NOTE.  PDL MUST = 0.
021243,000077: 31,2060           53575        R34ANG             VLOAD    UNIT                                  
021244,000078: 31,2061           02327                                    RONE                                  
021245,000079: 31,2062           77715                           PDVL                                           #  UR TO 0D              PD= 6
021246,000080: 31,2063           15332                                    THISAXIS                              #  UNITX FOR CM, UNITZ FOR LM
021247,000081: 31,2064           77214                           BON      VLOAD                                 #  CHK R31FLAG.  ON=R31 THETA, OFF=R34 PHI
021248,000082: 31,2065           04713                                    R31FLAG                               
021249,000083: 31,2066           62070                                    +2                                    #  R31-THETA
021250,000084: 31,2067           00015                                    12D                                   
021251,000085: 31,2070           77624                           CALL                                           
021252,000086: 31,2071           47650                                    *NBSM*                                
021253,000087: 31,2072           41505                           VXM      PUSH                                  #  UXORZ TO 6D           PD=12D
021254,000088: 31,2073           01736                                    REFSMMAT                              
021255,000089: 31,2074           72431                           VPROJ    VSL2                                  
021256,000090: 31,2075           00001                                    0D                                    
021257,000091: 31,2076           53445                           BVSU     UNIT                                  
021258,000092: 31,2077           00007                                    6D                                    
021259,000093: 31,2100           47315                           PDVL     VXV                                   #  UP/2 TO 12D           PD=18D
021260,000094: 31,2101           02327                                    RONE                                  
021261,000095: 31,2102           02335                                    VONE                                  
021262,000096: 31,2103           47256                           UNIT     VXV                                   
021263,000097: 31,2104           02327                                    RONE                                  
021264,000098: 31,2105           63241                           DOT      PDVL                                  #  SIGN TO 12D, UP/2 TO MPAC     PD=18D
021265,000099: 31,2106           00015                                    12D                                   
021266,000100: 31,2107           50372                           VSL1     DOT                                   #  UP.UXORZ
021267,000101: 31,2110           00007                                    6D                                    
021268,000102: 31,2111           72565                           SIGN     SL1                                   
021269,000103: 31,2112           00015                                    12D                                   
021270,000104: 31,2113           77726                           ACOS                                           
021271,000105: 31,2114           26325                           STOVL    RTHETA                                
021272,000106: 31,2115           02327                                    RONE                                  
021273,000107: 31,2116           51041                           DOT      BPL                                   
021274,000108: 31,2117           00007                                    6D                                    
021275,000109: 31,2120           62125                                    +5                                    
021276,000110: 31,2121           44345                           DLOAD    BDSU                                  #  IF UXORZ.R NEG, RTHETA = 1 - RTHETA
021277,000111: 31,2122           02325                                    RTHETA                                
021278,000112: 31,2123           15342                                    DPPOSMAX                              
021279,000113: 31,2124           02325                           STORE    RTHETA                                #  RTHETA BETWEEN 0 AND 1 REV.
021280,000114: 31,2125           77776                           EXIT                                           
021281,000115: 31,2126           35027                           CAF      BIT5                                  #  HAVE WE BEEN ANSWERED
021282,000116: 31,2127           71044                           MASK     EXTVBACT                              
021283,000117: 31,2130           00006                           EXTEND                                         
021284,000118: 31,2131           15550                           BZF      ENDEXT                                #  YES, DIE
021285,000119: 31,2132           41044                           CS       EXTVBACT                              
021286,000120: 31,2133           75020                           MASK     BIT12                                 
021287,000121: 31,2134           27044                           ADS      EXTVBACT                              
021288,000122: 
021289,000123: 31,2135           12027                           TCF      V83                                   
021290,000124: 31,2136           04066        V16N54             VN       1654                                  
021291,000125: 31,2137           04065        V16N53             VN       1653                                  
021292,000126: 
021293,000127:                                                                                                  #  STATEXTP DOES AN INITIAL PRECISION EXTRAPOLATION OF THE
021294,000128:                                                                                                  #  LEM STATE VECTOR TO PRESENT TIME OR TO PIPTIME IF AV G
021295,000129:                                                                                                  #  IS ON AND SAVES AS BASE VECTOR. IF AV G IS ON RN + VN
021296,000130:                                                                                                  #  ARE USED AS THE CM STATE VECTOR AND THE INITIAL R RDOT
021297,000131:                                                                                                  #  RTHETA ARE COMPUTED WITH NO FURTHER INTEGRATION. IF AV
021298,000132:                                                                                                  #  G IS OFF A PRECISION EXTRAPOLATION IS MADE OF THE CM
021299,000133:                                                                                                  #  STATE VECTOR TO PRESENT TIME AND.....
021300,000134: 
021301,000135:                                                                                                  #    THE CM + LM STATE VECTORS ARE INTEGRATED TO PRES TIME
021302,000136:                                                                                                  #    USING PRECISION OR CONIC AS SURFFLAG IS SET OR CLEAR.
021303,000137: 
021304,000138:                                                                                                  #    IF AV G IS ON THEN SUBSEQUENT PASSES WILL PROVIDE
021305,000139:                                                                                                  #      USE OF RN + VN AS CM STATE VECTOR AND THE LM STATE
021306,000140:                                                                                                  #      VECTOR WILL BE PRECISION INTEGRATED USING LEMPREC
021307,000141: 
021308,000142:                                                                                                  #    IF SURFFLAG IS SET.
021309,000143:                                                                                                  #      CM STATE VECTOR RONE VONE + LM STATE VECTOR RATT
021310,000144:                                                                                                  #      VATT ARE USED IN COMPUTING R RDOT RTHETA.
021311,000145: 
021312,000146: 
021313,000147: 31,2140           43034        STATEXTP           RTB      BOF                                   #  INITIAL INTEGRATION
021314,000148: 31,2141           45510                                    LOADTIME                              
021315,000149: 31,2142           03751                                    V37FLAG                               
021316,000150: 31,2143           62146                                    +3                                    #  AV G OFF, USE PRES TIME
021317,000151: 31,2144           77624                           CALL                                           
021318,000152: 31,2145           62273                                    GETRVN                                #       ON,  USE RN VN PIPTIME
021319,000153: 31,2146           02343                           STORE    BASETIME                              #  PRES TIME OR PIPTIME
021320,000154: 31,2147           34041                           STCALL   TDEC1                                 
021321,000155: 31,2150           27114                                    LEMPREC                               
021322,000156: 31,2151           77775                           VLOAD                                          #  BASE VECTOR, LM
021323,000157: 31,2152           00017                                    RATT1                                 
021324,000158: 31,2153           26225                           STOVL    BASEOTP                               #    POS.
021325,000159: 31,2154           00025                                    VATT1                                 
021326,000160: 31,2155           02241                           STORE    BASEOTV                               #    VEL.
021327,000161: 31,2156           71214                           BON      DLOAD                                 
021328,000162: 31,2157           03711                                    V37FLAG                               
021329,000163: 31,2160           62035                                    COMPDISP                              #  COMPUTE R RDOT RTHETA FROM
021330,000164:                                                                                                  #  RONE(RN) VONE(VN) RATT+VATT(LEMPREC)
021331,000165: 31,2161           00015                                    TAT                                   
021332,000166: 31,2162           34041                           STCALL   TDEC1                                 
021333,000167: 31,2163           27100                                    CSMPREC                               
021334,000168: 31,2164           77775                           VLOAD                                          #  BASE VECTOR, CM
021335,000169: 31,2165           00017                                    RATT1                                 
021336,000170: 31,2166           26255                           STOVL    BASETHP                               #   POS.
021337,000171: 31,2167           00025                                    VATT1                                 
021338,000172: 31,2170           02263                           STORE    BASETHV                               #   VEL.
021339,000173: 31,2171           47014        HAVEBASE           BON      RTB                                   #  SUBSEQUENT INTEGRATIONS
021340,000174: 31,2172           03711                                    V37FLAG                               
021341,000175: 31,2173           62256                                    GETRVN5                               
021342,000176: 31,2174           45510                                    LOADTIME                              
021343,000177: 31,2175           34041                           STCALL   TDEC1                                 #  AV G OFF. SET INTEG. OF CM
021344,000178: 31,2176           27446                                    INTSTALL                              
021345,000179: 31,2177           43175                           VLOAD    CLEAR                                 
021346,000180: 31,2200           02255                                    BASETHP                               
021347,000181: 31,2201           00263                                    MOONFLAG                              
021348,000182: 31,2202           25535                           STOVL    RCV                                   
021349,000183: 31,2203           02263                                    BASETHV                               
021350,000184: 31,2204           15543                           STODL    VCV                                   
021351,000185: 31,2205           02343                                    BASETIME                              
021352,000186: 31,2206           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
021353,000187: 31,2207           04343                                    MOONTHIS                              
021354,000188: 31,2210           62212                                    +2                                    
021355,000189: 31,2211           00063                                    MOONFLAG                              
021356,000190: 31,2212           77614                           CLEAR                                          
021357,000191: 31,2213           01673                                    INTYPFLG                              
021358,000192: 31,2214           43014                           BON      SET                                   
021359,000193: 31,2215           04307                                    SURFFLAG                              
021360,000194: 31,2216           62220                                    +2                                    #  PREC. IF LM DOWN
021361,000195: 31,2217           01473                                    INTYPFLG                              #  CONIC IF LM NOT DOWN
021362,000196: 31,2220           35517                           STCALL   TET                                   
021363,000197: 31,2221           27144                                    INTEGRVS                              #  INTEGRATION --- AT LAST---
021364,000198: 31,2222           77775                           VLOAD                                          
021365,000199: 31,2223           00001                                    RATT                                  
021366,000200: 31,2224           26327                           STOVL    RONE                                  
021367,000201: 31,2225           00007                                    VATT                                  
021368,000202: 31,2226           16335                           STODL    VONE                                  #  GET SET FOR CONIC EXTRAP.,OTHER
021369,000203: 31,2227           00015                                    TAT                                   
021370,000204: 31,2230           45014                           BON      CALL                                  
021371,000205: 31,2231           04307                                    SURFFLAG                              
021372,000206: 31,2232           62267                                    GETRVN6                               #  LEMPREC IF LM DOWN
021373,000207: 31,2233           27446                                    INTSTALL                              #  ..CONIC IF NOT DOWN
021374,000208: 31,2234           77614                           SET                                            
021375,000209: 31,2235           01473                                    INTYPFLG                              
021376,000210: 31,2236           00041        OTHINT             STORE    TDEC1                                 #  ENTERED IF AV G ON TO INTEG LM
021377,000211: 31,2237           43175                           VLOAD    CLEAR                                 
021378,000212: 31,2240           02225                                    BASEOTP                               
021379,000213: 31,2241           00263                                    MOONFLAG                              
021380,000214: 31,2242           25535                           STOVL    RCV                                   
021381,000215: 31,2243           02241                                    BASEOTV                               
021382,000216: 31,2244           15543                           STODL    VCV                                   
021383,000217: 31,2245           02343                                    BASETIME                              
021384,000218: 31,2246           43014                           BOF      SET                                   
021385,000219: 31,2247           04343                                    MOONTHIS                              
021386,000220: 31,2250           62252                                    +2                                    
021387,000221: 31,2251           00063                                    MOONFLAG                              
021388,000222: 31,2252           35517                           STCALL   TET                                   
021389,000223: 31,2253           27144                                    INTEGRVS                              
021390,000224: 31,2254           77650                           GOTO                                           
021391,000225: 31,2255           62035                                    COMPDISP                              #  COMPUTE R RDOT RTHETA         
021392,000226: 31,2256           77624        GETRVN5            CALL                                           #  AV G ON
021393,000227: 31,2257           62273                                    GETRVN                                
021394,000228: 31,2260           45014                           BON      CALL                                  
021395,000229: 31,2261           04307                                    SURFFLAG                              
021396,000230: 31,2262           62267                                    GETRVN6                               #  LM DOWN, LMPREC
021397,000231: 31,2263           27446                                    INTSTALL                              
021398,000232: 31,2264           52014                           CLEAR    GOTO                                  
021399,000233: 31,2265           01673                                    INTYPFLG                              
021400,000234: 31,2266           62236                                    OTHINT                                
021401,000235: 31,2267           34041        GETRVN6            STCALL   TDEC1                                 
021402,000236: 31,2270           27114                                    LEMPREC                               
021403,000237: 31,2271           77650                           GOTO                                           
021404,000238: 31,2272           62035                                    COMPDISP                              #  COMPUTE R RDOT RTHETA
021405,000239: 31,2273           77620        GETRVN             STQ                                            
021406,000240: 31,2274           00000                                    0D                                    
021407,000241: 31,2275           52175                           VLOAD    GOTO                                  #  AV G ON, RONE = RN VONE = VN
021408,000242: 31,2276           01171                                    RN                                    #   AND USE PIPTIME
021409,000243: 31,2277           62300                                    +1                                    
021410,000244: 31,2300           36327                           STCALL   RONE                                  
021411,000245: 31,2301           62302                                    +1                                    
021412,000246: 31,2302           52175                           VLOAD    GOTO                                  
021413,000247: 31,2303           01177                                    VN                                    
021414,000248: 31,2304           62305                                    +1                                    
021415,000249: 31,2305           16335                           STODL    VONE                                  
021416,000250: 31,2306           01205                                    PIPTIME                               
021417,000251: 31,2307           77650                           GOTO                                           
021418,000252: 31,2310           00000                                    0D                                    
021419,000253: 31,2000                                           SETLOC   R34                                   
021420,000254: 31,2000                                           BANK                                           
021421,000255: 31,2311           77776        R34LOS             EXIT                                           
021422,000256: 31,2312           30036                           CA       CDUS                                  
021423,000257: 31,2313           50120                           INDEX    FIXLOC                                
021424,000258: 31,2314           54011                           TS       9D                                    
021425,000259: 31,2315           30035                           CA       CDUT                                  
021426,000260: 31,2316           50120                           INDEX    FIXLOC                                
021427,000261: 31,2317           54013                           TS       11D                                   
021428,000262: 31,2320           30120                           CA       FIXLOC                                
021429,000263: 31,2321           66211                           AD       SIX                                   
021430,000264: 31,2322           40000                           COM                                            
021431,000265: 31,2323           50120                           INDEX    FIXLOC                                
021432,000266: 31,2324           54046                           TS       X1                                    
021433,000267: 31,2325           06006                           TC       INTPRET                               
021434,000268: 31,2326           77624                           CALL                                           
021435,000269: 31,2327           46000                                    SXTNB                                 
021436,000270: 31,2330           34015                           STCALL   12D                                   
021437,000271: 31,2331           62060                                    R34ANG                                

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