Source Code

These source-code files are part of a reconstructed copy of Artemis 071, the first release of the Apollo 15 through 17 Command Module (CM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Artemis 072 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes between the two versions. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021154-. Note that page numbers in the reconstructed code match those on the Artemis 072 printout, although the changed code would likely have changed page numbers for a real Artemis 071 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

022167,000002:                                                                                                  ## Copyright:   Public domain.
022168,000003:                                                                                                  ## Filename:    R31.agc
022169,000004:                                                                                                  ## Purpose:     A section of Artemis revision 071.
022170,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
022171,000006:                                                                                                  ##              release of the flight software for the Command Module's
022172,000007:                                                                                                  ##              (CM) Apollo Guidance Computer (AGC) for Apollo 15 through
022173,000008:                                                                                                  ##              17. The code has been recreated from a copy of Artemis 072.
022174,000009:                                                                                                  ##              It has been adapted such that the resulting bugger words
022175,000010:                                                                                                  ##              exactly match those specified for Artemis 071 in NASA
022176,000011:                                                                                                  ##              drawing 2021154-, which gives relatively high confidence
022177,000012:                                                                                                  ##              that the reconstruction is correct.
022178,000013:                                                                                                  ## Reference:   507
022179,000014:                                                                                                  ## Assembler:   yaYUL
022180,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
022181,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
022182,000017:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Artemis 072.
022183,000018: 

Page 507

022185,000020: 31,2000                                           SETLOC   R31                                   
022186,000021: 31,2000                                           BANK                                           
022187,000022: 
022188,000023: 31,2000                                           COUNT*   $$/R3134                              
022189,000024: 31,2000           35045        R31CALL            CAF      PRIO3                                 
022190,000025: 31,2001           05135                           TC       FINDVAC                               
022191,000026: 31,2002  E4,1760                                  EBANK=   SUBEXIT                               
022192,000027: 31,2002           02031 62064                     2CADR    V83CALL                               
022193,000028: 
022194,000029: 31,2004           04636        DSPDELAY           TC       BANKCALL                              
022195,000030: 31,2005           01730                           CADR     1SECDELY                              
022196,000031: 31,2006           31247                           CA       EXTVBACT                              
022197,000032: 31,2007           74755                           MASK     BIT12                                 
022198,000033: 31,2010           00006                           EXTEND                                         
022199,000034: 31,2011           12004                           BZF      DSPDELAY                              
022200,000035: 
022201,000036: 31,2012           30105        DISPN5X            CA       FLAGWRD9                              #  TEST R31FLAG (IN SUNDANCE R31FLAG WILL
022202,000037: 31,2013           74765                           MASK     R31FLBIT                              #  ALWAYS BE SET AS R34 DOES NOT EXIST
022203,000038: 31,2014           00006                           EXTEND                                         
022204,000039: 31,2015           12020                           BZF      +3                                    
022205,000040: 31,2016           32135                           CAF      V16N54                                #  R31    USE NOUN 54
022206,000041: 31,2017           02021                           TC       +2                                    
022207,000042: 31,2020           32136                           CAF      V16N53                                #  R34    USE NOUN 53
022208,000043: 31,2021           04636                           TC       BANKCALL                              
022209,000044: 31,2022           20576                           CADR     GOMARKF                               
022210,000045: 31,2023           05626                           TC       B5OFF                                 
022211,000046: 31,2024           05626                           TC       B5OFF                                 
022212,000047: 31,2025           12012                           TCF      DISPN5X                               
022213,000048: 
022214,000049: 31,2026           06006        V83                TC       INTPRET                               
022215,000050: 31,2027           77650                           GOTO                                           
022216,000051: 31,2030           62177                                    HAVEBASE                              #  INTEG STATE VECTORS
022217,000052: 31,2031           06006        V83CALL            TC       INTPRET                               
022218,000053: 31,2032           77650                           GOTO                                           
022219,000054: 31,2033           62146                                    STATEXTP                              #  EXTRAPOLATE STATE VECTORS
022220,000055: 31,2034           52375        COMPDISP           VLOAD    VSU                                   
022221,000056: 31,2035           00001                                    RATT                                  
022222,000057: 31,2036           02320                                    RONE                                  
022223,000058: 31,2037           51406                           PUSH     ABVAL                                 #  RATT-RONE TO 0D               PD= 6
022224,000059: 31,2040           02312                           STORE    RANGE                                 #  METERS B-29
022225,000060: 31,2041           77301                           NORM     VLOAD                                 
022226,000061: 31,2042           00047                                    X1                                    #  RATT-RONE                     PD= 0
022227,000062: 31,2043           77762                           VSR1                                           
022228,000063: 31,2044           53457                           VSL*     UNIT                                  
022229,000064: 31,2045           20201                                    0,1                                   
022230,000065: 31,2046           52315                           PDVL     VSU                                   #  UNIT(LOS) TO 0D               PD= 6
022231,000066: 31,2047           00007                                    VATT                                  
022232,000067: 31,2050           02326                                    VONE                                  
022233,000068: 31,2051           77641                           DOT                                            #  (VATT-VONE).UNIT(LOS)         PD= 0

Page 508

022235,000070: 31,2052           77752                           SL1                                            
022236,000071: 31,2053           36314                           STCALL   RRATE                                 #  RANGE RATE M/CS B-7
022237,000072: 31,2054           47530                                    CDUTRIG                               #  TO INITIALIZE FOR *NBSM*
022238,000073: 31,2055           77624                           CALL                                           
022239,000074: 31,2056           62317                                    R34LOS                                #  NOTE. PDL MUST = 0.
022240,000075: 31,2057           53575        R34ANG             VLOAD    UNIT                                  
022241,000076: 31,2060           02320                                    RONE                                  
022242,000077: 31,2061           77715                           PDVL                                           #  UR TO 0D                      PD= 6
022243,000078: 31,2062           15334                                    THISAXIS                              #  UNITX FOR CM, UNITZ FOR LM
022244,000079: 31,2063           77214                           BON      VLOAD                                 #  CHK R31FLAG. ON=R31 THETA, OFF=R34 PHI
022245,000080: 31,2064           04713                                    R31FLAG                               
022246,000081: 31,2065           62067                                    +2                                    #        R31-THETA
022247,000082: 31,2066           00015                                    12D                                   
022248,000083: 31,2067           77624                           CALL                                           
022249,000084: 31,2070           47647                                    *NBSM*                                
022250,000085: 31,2071           41505                           VXM      PUSH                                  #  UXORZ TO 6D                   PD=12D
022251,000086: 31,2072           01734                                    REFSMMAT                              
022252,000087: 31,2073           72431                           VPROJ    VSL2                                  
022253,000088: 31,2074           00001                                    0D                                    
022254,000089: 31,2075           53445                           BVSU     UNIT                                  
022255,000090: 31,2076           00007                                    6D                                    
022256,000091: 31,2077           47315                           PDVL     VXV                                   #  UP/2 TO 12D                   PD=18D
022257,000092: 31,2100           02320                                    RONE                                  
022258,000093: 31,2101           02326                                    VONE                                  
022259,000094: 31,2102           47256                           UNIT     VXV                                   
022260,000095: 31,2103           02320                                    RONE                                  
022261,000096: 31,2104           63241                           DOT      PDVL                                  #  SIGN TO 12D, UP/2 TO MPAC     PD=18D
022262,000097: 31,2105           00015                                    12D                                   
022263,000098: 31,2106           50372                           VSL1     DOT                                   #  UP.UXORZ
022264,000099: 31,2107           00007                                    6D                                    
022265,000100: 31,2110           72565                           SIGN     SL1                                   
022266,000101: 31,2111           00015                                    12D                                   
022267,000102: 31,2112           77726                           ACOS                                           
022268,000103: 31,2113           26316                           STOVL    RTHETA                                
022269,000104: 31,2114           02320                                    RONE                                  
022270,000105: 31,2115           51041                           DOT      BPL                                   
022271,000106: 31,2116           00007                                    6D                                    
022272,000107: 31,2117           62124                                    +5                                    
022273,000108: 31,2120           44345                           DLOAD    BDSU                                  #  IF UXORZ.R NEG, RTHETA = 1 - RTHETA
022274,000109: 31,2121           02316                                    RTHETA                                
022275,000110: 31,2122           15344                                    DPPOSMAX                              
022276,000111: 31,2123           02316                           STORE    RTHETA                                #  RTHETA BETWEEN 0 AND 1 REV.
022277,000112: 31,2124           77776                 +5        EXIT                                           
022278,000113: 31,2125           34764                           CAF      BIT5                                  #  HAVE WE BEEN ANSWERED
022279,000114: 31,2126           71247                           MASK     EXTVBACT                              
022280,000115: 31,2127           00006                           EXTEND                                         
022281,000116: 31,2130           12137                           BZF      ISITP79                               
022282,000117: 
022283,000118: 31,2131           41247                           CS       EXTVBACT                              
022284,000119: 31,2132           74755                           MASK     BIT12                                 

Page 509

022286,000121: 31,2133           27247                           ADS      EXTVBACT                              
022287,000122: 
022288,000123: 31,2134           12026                           TCF      V83                                   
022289,000124: 31,2135           04066        V16N54             VN       1654                                  
022290,000125: 31,2136           04065        V16N53             VN       1653                                  
022291,000126: 31,2137           05354        ISITP79            TC       CHECKMM                               
022292,000127: 31,2140           00117                           MM       79         B-14                       
022293,000128: 31,2141           15524                           TCF      ENDEXT                                #  NO, DIE
022294,000129: 
022295,000130: 31,2142           05527                           TC       CLEARMRK                              
022296,000131: 31,2143           05561                           TC       DOWNFLAG                              
022297,000132: 31,2144           00226                           ADRES    PCMANFLG                              
022298,000133: 31,2145           14103                           TCF      GOTOPOOH                              
022299,000134: 

Page 510

022301,000136:                                                                                                  #  STATEXTP DOES AN INITIAL PRECISION EXTRAPOLATION OF THE
022302,000137:                                                                                                  #  LEM STATE VECTOR TO PRESENT TIME OR TO PIPTIME IF AV G
022303,000138:                                                                                                  #  IS ON AND SAVES AS BASE VECTOR. IF AV G IS ON RN + VN
022304,000139:                                                                                                  #  ARE USED AS THE CM STATE VECTOR AND THE INITIAL R RDOT
022305,000140:                                                                                                  #  RTHETA ARE COMPUTED WITH NO FURTHER INTEGRATION. IF AV
022306,000141:                                                                                                  #  G IS OFF A PRECISION EXTRAPOLATION IS MADE OF THE CM
022307,000142:                                                                                                  #  STATE VECTOR TO PRESENT TIME AND.....
022308,000143:                                                                                                  #    THE CM + LM STATE VECTORS ARE INTEGRATED TO PRES TIME
022309,000144:                                                                                                  #    USING PRECISION OR CONIC AS SURFFLAG IS SET OR CLEAR.
022310,000145:                                                                                                  #    IF AV G IS ON THEN SUBSEQUENT PASSES WILL PROVIDE
022311,000146:                                                                                                  #    USE OF RN + VN AS CM STATE VECTOR AND THE LM STATE
022312,000147:                                                                                                  #    VECTOR WILL BE PRECISION INTEGRATED USING LEMPREC
022313,000148:                                                                                                  #    IF SURFFLAG IS SET.
022314,000149:                                                                                                  #      CM STATE VECTOR RONE VONE + LM STATE VECTOR RATT
022315,000150:                                                                                                  #      VATT ARE USED IN COMPUTING R RDOT RTHETA.
022316,000151: 
022317,000152: 31,2146           43034        STATEXTP           RTB      BOF                                   #  INITIAL INTEGRATION
022318,000153: 31,2147           51751                                    LOADTIME                              
022319,000154: 31,2150           03751                                    V37FLAG                               
022320,000155: 31,2151           62154                                    BOTHGO                                #  AV G OFF, USE PRESENT TIME
022321,000156: 31,2152           77624                           CALL                                           
022322,000157: 31,2153           62301                                    GETRVN                                #       ON,  USE RN, VN, PIPTIME
022323,000158: 31,2154           02334        BOTHGO             STORE    BASETIME                              
022324,000159: 31,2155           34041                           STCALL   TDEC1                                 
022325,000160: 31,2156           27161                                    LEMPREC                               
022326,000161: 31,2157           77775                           VLOAD                                          #  BASE VECTOR, LM
022327,000162: 31,2160           00017                                    RATT1                                 
022328,000163: 31,2161           26224                           STOVL    BASEOTP                               #    POS.
022329,000164: 31,2162           00025                                    VATT1                                 
022330,000165: 31,2163           02240                           STORE    BASEOTV                               #    VEL.
022331,000166: 31,2164           71214                           BON      DLOAD                                 
022332,000167: 31,2165           03711                                    V37FLAG                               
022333,000168: 31,2166           62034                                    COMPDISP                              #  COMPUTE R RDOT RTHETA FROM
022334,000169:                                                                                                  #  RONE(RN) VONE(VN) RATT+VATT(LEMPREC)
022335,000170: 31,2167           00015                                    TAT                                   
022336,000171: 31,2170           34041                           STCALL   TDEC1                                 
022337,000172: 31,2171           27145                                    CSMPREC                               
022338,000173: 31,2172           77775                           VLOAD                                          #  BASE VECTOR, CM
022339,000174: 31,2173           00017                                    RATT1                                 
022340,000175: 31,2174           26254                           STOVL    BASETHP                               #   POS.
022341,000176: 31,2175           00025                                    VATT1                                 
022342,000177: 31,2176           02262                           STORE    BASETHV                               #   VEL.
022343,000178: 31,2177           47014        HAVEBASE           BON      RTB                                   #  SUBSEQUENT INTEGRATIONS
022344,000179: 31,2200           03711                                    V37FLAG                               
022345,000180: 31,2201           62264                                    GETRVN5                               
022346,000181: 31,2202           51751                                    LOADTIME                              
022347,000182: 31,2203           34041                           STCALL   TDEC1                                 #  AV G OFF. SET INTEG. OF CM
022348,000183: 31,2204           27516                                    INTSTALL                              
022349,000184: 31,2205           43175                           VLOAD    CLEAR                                 
022350,000185: 31,2206           02254                                    BASETHP                               

Page 511

022352,000187: 31,2207           00263                                    MOONFLAG                              
022353,000188: 31,2210           25535                           STOVL    RCV                                   
022354,000189: 31,2211           02262                                    BASETHV                               
022355,000190: 31,2212           15543                           STODL    VCV                                   
022356,000191: 31,2213           02334                                    BASETIME                              
022357,000192: 31,2214           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
022358,000193: 31,2215           04343                                    MOONTHIS                              
022359,000194: 31,2216           62220                                    +2                                    
022360,000195: 31,2217           00063                                    MOONFLAG                              
022361,000196: 31,2220           77614                           CLEAR                                          
022362,000197: 31,2221           01673                                    INTYPFLG                              
022363,000198: 31,2222           43014                           BON      SET                                   
022364,000199: 31,2223           04307                                    SURFFLAG                              
022365,000200: 31,2224           62226                                    +2                                    #  PREC. IF LM DOWN
022366,000201: 31,2225           01473                                    INTYPFLG                              #  CONIC IF LM NOT DOWN
022367,000202: 31,2226           35517                           STCALL   TET                                   
022368,000203: 31,2227           27211                                    INTEGRVS                              #  INTEGRATION --- AT LAST---
022369,000204: 31,2230           77775                           VLOAD                                          
022370,000205: 31,2231           00001                                    RATT                                  
022371,000206: 31,2232           26320                           STOVL    RONE                                  
022372,000207: 31,2233           00007                                    VATT                                  
022373,000208: 31,2234           16326                           STODL    VONE                                  #  GET SET FOR CONIC EXTRAP.,OTHER
022374,000209: 31,2235           00015                                    TAT                                   
022375,000210: 31,2236           45014                           BON      CALL                                  
022376,000211: 31,2237           04307                                    SURFFLAG                              
022377,000212: 31,2240           62275                                    GETRVN6                               #  LEMPREC IF LM DOWN
022378,000213: 31,2241           27516                                    INTSTALL                              #  LEMCONIC IF NOT DOWN
022379,000214: 31,2242           77614                           SET                                            
022380,000215: 31,2243           01473                                    INTYPFLG                              
022381,000216: 31,2244           00041        OTHINT             STORE    TDEC1                                 #  ENTERED IF AV G ON TO INTEG LM
022382,000217: 31,2245           43175                           VLOAD    CLEAR                                 
022383,000218: 31,2246           02224                                    BASEOTP                               
022384,000219: 31,2247           00263                                    MOONFLAG                              
022385,000220: 31,2250           25535                           STOVL    RCV                                   
022386,000221: 31,2251           02240                                    BASEOTV                               
022387,000222: 31,2252           15543                           STODL    VCV                                   
022388,000223: 31,2253           02334                                    BASETIME                              
022389,000224: 31,2254           43014                           BOF      SET                                   
022390,000225: 31,2255           04343                                    MOONTHIS                              
022391,000226: 31,2256           62260                                    +2                                    
022392,000227: 31,2257           00063                                    MOONFLAG                              
022393,000228: 31,2260           35517                           STCALL   TET                                   
022394,000229: 31,2261           27211                                    INTEGRVS                              
022395,000230: 31,2262           77650                           GOTO                                           
022396,000231: 31,2263           62034                                    COMPDISP                              #  COMPUTE R RDOT RTHETA         
022397,000232: 31,2264           77624        GETRVN5            CALL                                           #  AV G ON
022398,000233: 31,2265           62301                                    GETRVN                                
022399,000234: 31,2266           45014                           BON      CALL                                  
022400,000235: 31,2267           04307                                    SURFFLAG                              
022401,000236: 31,2270           62275                                    GETRVN6                               #  LM DOWN, LMPREC

Page 512

022403,000238: 31,2271           27516                                    INTSTALL                              
022404,000239: 31,2272           52014                           CLEAR    GOTO                                  #  INTEGRVS (PREC) IF LM NOT DOWN
022405,000240: 31,2273           01673                                    INTYPFLG                              
022406,000241: 31,2274           62244                                    OTHINT                                
022407,000242: 31,2275           34041        GETRVN6            STCALL   TDEC1                                 
022408,000243: 31,2276           27161                                    LEMPREC                               
022409,000244: 31,2277           77650                           GOTO                                           
022410,000245: 31,2300           62034                                    COMPDISP                              #  COMPUTE R RDOT RTHETA
022411,000246: 31,2301           77620        GETRVN             STQ                                            
022412,000247: 31,2302           00000                                    0D                                    
022413,000248: 31,2303           52175                           VLOAD    GOTO                                  #  AV G ON, RONE = RN  VONE = VN
022414,000249: 31,2304           01030                                    RN                                    #   AND USE PIPTIME
022415,000250: 31,2305           62306                                    +1                                    
022416,000251: 31,2306           36320                           STCALL   RONE                                  
022417,000252: 31,2307           62310                                    +1                                    
022418,000253: 31,2310           52175                           VLOAD    GOTO                                  
022419,000254: 31,2311           01036                                    VN                                    
022420,000255: 31,2312           62313                                    +1                                    
022421,000256: 31,2313           16326                           STODL    VONE                                  
022422,000257: 31,2314           01044                                    PIPTIME                               
022423,000258: 31,2315           77650                           GOTO                                           
022424,000259: 31,2316           00000                                    0D                                    
022425,000260: 31,2000                                           SETLOC   R34                                   
022426,000261: 31,2000                                           BANK                                           
022427,000262: 31,2317                                           COUNT*   $$/R3134                              
022428,000263: 31,2317           77776        R34LOS             EXIT                                           
022429,000264: 31,2320           30036                           CA       CDUS                                  
022430,000265: 31,2321           50120                           INDEX    FIXLOC                                
022431,000266: 31,2322           54011                           TS       9D                                    
022432,000267: 31,2323           30035                           CA       CDUT                                  
022433,000268: 31,2324           50120                           INDEX    FIXLOC                                
022434,000269: 31,2325           54013                           TS       11D                                   
022435,000270: 31,2326           30120                           CA       FIXLOC                                
022436,000271: 31,2327           66211                           AD       SIX                                   
022437,000272: 31,2330           40000                           COM                                            
022438,000273: 31,2331           50120                           INDEX    FIXLOC                                
022439,000274: 31,2332           54046                           TS       X1                                    
022440,000275: 31,2333           06006                           TC       INTPRET                               
022441,000276: 31,2334           77624                           CALL                                           
022442,000277: 31,2335           46000                                    SXTNB                                 
022443,000278: 31,2336           34015                           STCALL   12D                                   
022444,000279: 31,2337           62057                                    R34ANG                                

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