Source Code

These source code files are an attempted reconstruction of Sundance revision 306, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
These dumps were then modified using memos, checklists, observed address changes, and the Sundance GSOPs to get the entire program to match Sundance revision 306 as closely as possible. Without more information, it is not possible to say how close it actually is; however, this code should be quite close. It is capable of flying the whole Apollo 9 mission using the original checklists and padload. Since only binary dumps (rather than listings) of Sundance 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.

033396,000002:                                                                                                  ## Copyright:   Public domain.
033397,000003:                                                                                                  ## Filename:    P12.agc
033398,000004:                                                                                                  ## Purpose:     A section of an attempt to reconstruct Sundance revision 306
033399,000005:                                                                                                  ##              as closely as possible with available information. Sundance
033400,000006:                                                                                                  ##              306 is the source code for the Lunar Module's (LM) Apollo
033401,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 9. This program was created
033402,000008:                                                                                                  ##              using the mixed-revision SundanceXXX as a starting point, and
033403,000009:                                                                                                  ##              pulling back features from Luminary 69 believed to have been
033404,000010:                                                                                                  ##              added based on memos, checklists, observed address changes,
033405,000011:                                                                                                  ##              or the Sundance GSOPs.
033406,000012:                                                                                                  ## Assembler:   yaYUL
033407,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033408,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033409,000015:                                                                                                  ## Mod history: 2020-07-24 MAS  Created from SundanceXXX.
033410,000016: 
033411,000017: 
033412,000018: 
033413,000019: 24,3222                                           BANK     24                                    
033414,000020: 30,2000                                           SETLOC   P12                                   
033415,000021: 30,2000                                           BANK                                           
033416,000022: 
033417,000023: 30,2000  E7,1472                                  EBANK=   DVCNTR                                
033418,000024: 30,2000                                           COUNT*   $$/P12                                
033419,000025: 
033420,000026: 30,2000           04655        P12LM              TC       BANKCALL                              
033421,000027: 30,2001           11067                           CADR     R02BOTH                               #  CHECK THE STATUS OF THE IMU.
033422,000028: 
033423,000029: 30,2002           05566                           TC       UPFLAG                                
033424,000030: 30,2003           00141                           ADRES    MUNFLAG                               
033425,000031: 
033426,000032: 30,2004           05566                           TC       UPFLAG                                
033427,000033: 30,2005           00211                           ADRES    FLP70                                 
033428,000034: 
033429,000035: 30,2006           05566                           TC       UPFLAG                                
033430,000036: 30,2007           00177                           ADRES    SURFFLAG                              
033431,000037: 
033432,000038: 30,2010           00006                           EXTEND                                         
033433,000039: 30,2011           31423                           DCA      TIG(AS)                               
033434,000040: 30,2012           53425                           DXCH     TIG                                   
033435,000041: 
033436,000042: 30,2013           33202                           CAF      V06N33A                               
033437,000043: 30,2014           04655                           TC       BANKCALL                              #  FLASH TIG
033438,000044: 30,2015           20406                           CADR     GOFLASH                               
033439,000045: 30,2016           14106                           TCF      GOTOPOOH                              
033440,000046: 30,2017           12021                           TCF      +2                                    #  PROCEED
033441,000047: 30,2020           12013                           TCF      -5                                    #  ENTER
033442,000048: 
033443,000049: 30,2021           06014                           TC       INTPRET                               
033444,000050: 30,2022           51575                           VLOAD    ABVAL                                 
033445,000051: 30,2023           02025                                    RLS                                   
033446,000052: 30,2024           77652                           SL3                                            
033447,000053: 30,2025           02023                           STORE    /LAND/                                
033448,000054: 30,2026           77731                           SSP                                            
033449,000055: 30,2027           00053                                    QPRET                                 
033450,000056: 30,2030           60070                                    P12LMB                                
033451,000057: 
033452,000058: 30,2031           77745        P12INIT            DLOAD                                          #  INITIALIZE ENGINE DATA.  USED FOR P12 AND
033453,000059: 30,2032           25657                                    (1/DV)A                               #  P71.
033454,000060: 30,2033           03650                           STORE    1/DV3                                 
033455,000061: 30,2034           03646                           STORE    1/DV2                                 
033456,000062: 30,2035           17644                           STODL    1/DV1                                 
033457,000063: 30,2036           25663                                    (AT)A                                 
033458,000064: 30,2037           17634                           STODL    AT                                    
033459,000065: 30,2040           25667                                    (TBUP)A                               
033460,000066: 30,2041           17642                           STODL    TBUP                                  
033461,000067: 30,2042           25677                                    ATDECAY*                              
033462,000068: 30,2043           17640                           STODL    TTO                                   
033463,000069: 30,2044           25673                                    APSVEX                                
033464,000070: 30,2045           03636                           STORE    VE                                    
033465,000071: 30,2046           43345        COMMINIT           DLOAD    DAD                                   #  INITIALIZE TARGET DATA. USED BY P12, P70
033466,000072: 30,2047           25651                                    HINJECT                               #  AND P71 IF IT DOES NOT FOLLOW P70.
033467,000073: 30,2050           02023                                    /LAND/                                
033468,000074: 30,2051           17616                           STODL    RCO                                   
033469,000075: 30,2052           06233                                    HI6ZEROS                              
033470,000076: 30,2053           03753                           STORE    TXO                                   
033471,000077: 30,2054           03620                           STORE    YCO                                   
033472,000078: 30,2055           03622                           STORE    RDOTD                                 
033473,000079: 30,2056           17624                           STODL    YDOTD                                 
033474,000080: 30,2057           25653                                    ABTVINJ2                              #  TENTATIVELY STORE LOW INJECTION VELOCITY
033475,000081: 30,2060           27626                           STOVL    ZDOTD                                 
033476,000082: 30,2061           01730                                    V-OTHER                               
033477,000083: 30,2062           64235                           VXV      MXV                                   
033478,000084: 30,2063           01722                                    R-OTHER                               
033479,000085: 30,2064           01736                                    REFSMMAT                              
033480,000086: 30,2065           77656                           UNIT                                           
033481,000087: 30,2066           03652                           STORE    QAXIS                                 
033482,000088: 
033483,000089: 30,2067           77616                           RVQ                                            
033484,000090: 
033485,000091: 30,2070           77745        P12LMB             DLOAD                                          
033486,000092: 30,2071           25701                                    (TGO)A                                #  SET TGO TO AN INITIAL NOMINAL VALUE.
033487,000093: 30,2072           17474                           STODL    TGO                                   
033488,000094: 30,2073           03425                                    TIG                                   
033489,000095: 30,2074           34041                           STCALL   TDEC1                                 
033490,000096: 30,2075           27030                                    LEMPREC                               #  ROTATE THE STATE VECTORS TO THE
033491,000097: 30,2076           64375                           VLOAD    MXV                                   #  IGNITION TIME.
033492,000098: 30,2077           00007                                    VATT                                  
033493,000099: 30,2100           01736                                    REFSMMAT                              
033494,000100: 30,2101           77772                           VSL1                                           
033495,000101: 30,2102           27566                           STOVL    V1S                                   #  COMPUTE V1S = VEL(TIG)*2(-7) M/CS.
033496,000102: 30,2103           00001                                    RATT                                  
033497,000103: 30,2104           52521                           MXV      VSL6                                  
033498,000104: 30,2105           01736                                    REFSMMAT                              
033499,000105: 30,2106           37476                           STCALL   R                                     #  COMPUTE R = POS(TIG)*2(-24) M.
033500,000106: 30,2107           67203                                    MUNGRAV                               #  COMPUTE GDT1/2(TIG)*2(-7)M/CS.
033501,000107: 30,2110           53575                           VLOAD    UNIT                                  
033502,000108: 30,2111           03476                                    R                                     
033503,000109: 30,2112           37524                           STCALL   UNIT/R/                               #  COMPUTE UNIT/R/ FOR YCOMP.
033504,000110: 30,2113           61101                                    YCOMP                                 
033505,000111: 30,2114           57461                           SR       DCOMP                                 
033506,000112: 30,2115           20606                                    5D                                    
033507,000113: 30,2116           17630                           STODL    XRANGE                                #  INITIALIZE XRANGE FOR NOUN 76.
033508,000114: 30,2117           20212                                    (APO)                                 
033509,000115: 30,2120           03632                           STORE    APO                                   #  INITIALIZE APO FOR NOUN 76.
033510,000116: 30,2121           77776                           EXIT                                           
033511,000117: 
033512,000118: 30,2122           05423                           TC       PHASCHNG                              
033513,000119: 30,2123           04024                           OCT      04024                                 
033514,000120: 
033515,000121: 30,2124           33201        NEWLOAD            CAF      V06N76                                #  FLASH CROSS-RANGE AND APOLUNE VALUES.
033516,000122: 30,2125           04655                           TC       BANKCALL                              
033517,000123: 30,2126           20406                           CADR     GOFLASH                               
033518,000124: 30,2127           14106                           TCF      GOTOPOOH                              
033519,000125: 30,2130           12132                           TCF      +2                                    #  PROCEED
033520,000126: 30,2131           12124                           TCF      NEWLOAD                               #  ENTER NEW DATA.
033521,000127: 
033522,000128: 30,2132           32204                           CAF      P12ADRES                              
033523,000129: 30,2133           55430                           TS       WHICH                                 
033524,000130: 
033525,000131: 30,2134           06014                           TC       INTPRET                               
033526,000132: 30,2135           54345                           DLOAD    SL                                    
033527,000133: 30,2136           03630                                    XRANGE                                
033528,000134: 30,2137           20206                                    5D                                    
033529,000135: 30,2140           77615                           DAD                                            
033530,000136: 30,2141           03706                                    Y                                     
033531,000137: 30,2142           17620                           STODL    YCO                                   
033532,000138: 30,2143           03632                                    APO                                   #  RA = APO + /LAND/
033533,000139: 30,2144           77661                           SL                                             
033534,000140: 30,2145           20206                                    5D                                    
033535,000141: 30,2146           41415                           DAD      PUSH                                  #  RA*2(-24) IN MPAC AND PDL
033536,000142: 30,2147           02023                                    /LAND/                                
033537,000143: 30,2150           65205                           DMP      PDDL                                  #  2 RA MU*2(-62) IN PDL, LOAD RA
033538,000144: 30,2151           20210                                    MUM(-37)                              
033539,000145: 30,2152           41215                           DAD      DMP                                   #  (RA+RP)*2(-24)
033540,000146: 30,2153           03616                                    RCO                                   #  RP(RA+RP)*2(-48)
033541,000147: 30,2154           03616                                    RCO                                   
033542,000148: 30,2155           75465                           BDDV     SQRT                                  #  2 MU RA/RP(RA+RP)*2(-14)=ZDOTD(2)
033543,000149: 30,2156           77626                           STADR                                          
033544,000150: 30,2157           50151                           STOVL    ZDOTD                                 
033545,000151: 30,2160           03524                                    UNIT/R/                               
033546,000152: 30,2161           53361                           VXSC     VAD                                   
033547,000153: 30,2162           20206                                    28.5FPS                               
033548,000154: 30,2163           03566                                    V1S                                   
033549,000155: 30,2164           03504                           STORE    V                                     #  V(TIPOVER) = V(IGN) + 57FPS (UNIT/R/)
033550,000156: 30,2165           43014                           SET      SETGO                                 
033551,000157: 30,2166           04464                                    FLPI                                  
033552,000158: 30,2167           04421                                    FLVR                                  
033553,000159: 30,2170           60266                                    ASCENT                                
033554,000160: 30,2171           77776        P12RET             EXIT                                           
033555,000161: 30,2172           05423                           TC       PHASCHNG                              
033556,000162: 30,2173           04024                           OCT      04024                                 
033557,000163: 
033558,000164: 30,2174           05600                           TC       DOWNFLAG                              
033559,000165: 30,2175           00213                           ADRES    FLPI                                  
033560,000166: 
033561,000167: 30,2176           00004                           INHINT                                         
033562,000168: 30,2177           04737                           TC       IBNKCALL                              
033563,000169: 30,2200           40223                           CADR     PFLITEDB                              
033564,000170: 30,2201           00003                           RELINT                                         
033565,000171: 
033566,000172: 30,2202           04674                           TC       POSTJUMP                              
033567,000173: 30,2203           74133                           CADR     BURNBABY                              
033568,000174: 
033569,000175: 
033570,000176: 30,2204           02000        P12ADRES           REMADR   P12TABLE                              #  NOT IN SAME BANK.
033571,000177: 30,2205           00026 07363  28.5FPS            2DEC     .08685     B-6                        #  EXPECTED RDOT AT TIPOVER
033572,000178: 
033573,000179: 30,2207           00072 16206  MUM(-37)           2DEC*    4.9027780  E8         B-37*           
033574,000180: 
033575,000181: 30,2211           00001 26227  (APO)              2DEC     55597.5    B-29                       #  30 N.M. EXPRESSED IN METERS.

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