Source Code

These source code files are a reconstruction of Sundance, 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
This means that source code does not represent a specific historical revision of Sundance, but rather a mixture of the three released versions. Nonetheless, it is capable of flying the whole Apollo 9 mission. This source code matches the binary dumps, as closely as feasible, but 100% match is not possible, due mostly to changes in memory addresses at which code and variables were allocated in different revisions of Sundance. Refer to this list of explanations for each binary mismatch.

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.

033264,000002:                                                                                                  ## Copyright:   Public domain.
033265,000003:                                                                                                  ## Filename:    P12.agc
033266,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
033267,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
033268,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
033269,000007:                                                                                                  ##              No original listings of this program are available;
033270,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
033271,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
033272,000010:                                                                                                  ## Assembler:   yaYUL
033273,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033274,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033275,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
033276,000014: 
033277,000015:                                                                                                  ## Sundance 292
033278,000016: 
033279,000017: 24,3220                                           BANK     24                                    
033280,000018: 30,2000                                           SETLOC   P12                                   
033281,000019: 30,2000                                           BANK                                           
033282,000020: 
033283,000021: 30,2000  E7,1472                                  EBANK=   DVCNTR                                
033284,000022: 30,2000                                           COUNT*   $$/P12                                
033285,000023: 
033286,000024: 30,2000           04655        P12LM              TC       BANKCALL                              
033287,000025: 30,2001           11064                           CADR     R02BOTH                               #  CHECK THE STATUS OF THE IMU.
033288,000026: 
033289,000027: 30,2002           05563                           TC       UPFLAG                                
033290,000028: 30,2003           00141                           ADRES    MUNFLAG                               
033291,000029: 
033292,000030: 30,2004           05563                           TC       UPFLAG                                
033293,000031: 30,2005           00211                           ADRES    FLP70                                 
033294,000032: 
033295,000033: 30,2006           05563                           TC       UPFLAG                                
033296,000034: 30,2007           00177                           ADRES    SURFFLAG                              
033297,000035: 
033298,000036: 30,2010           00006                           EXTEND                                         
033299,000037: 30,2011           31423                           DCA      TIG(AS)                               
033300,000038: 30,2012           53425                           DXCH     TIG                                   
033301,000039: 
033302,000040: 30,2013           33202                           CAF      V06N33A                               
033303,000041: 30,2014           04655                           TC       BANKCALL                              #  FLASH TIG
033304,000042: 30,2015           20406                           CADR     GOFLASH                               
033305,000043: 30,2016           14106                           TCF      GOTOPOOH                              
033306,000044: 30,2017           12021                           TCF      +2                                    #  PROCEED
033307,000045: 30,2020           12013                           TCF      -5                                    #  ENTER
033308,000046: 
033309,000047: 30,2021           06014                           TC       INTPRET                               
033310,000048: 30,2022           51575                           VLOAD    ABVAL                                 
033311,000049: 30,2023           02025                                    RLS                                   
033312,000050: 30,2024           77652                           SL3                                            
033313,000051: 30,2025           02023                           STORE    /LAND/                                
033314,000052: 30,2026           77731                           SSP                                            
033315,000053: 30,2027           00053                                    QPRET                                 
033316,000054: 30,2030           60070                                    P12LMB                                
033317,000055: 
033318,000056: 30,2031           77745        P12INIT            DLOAD                                          #  INITIALIZE ENGINE DATA.  USED FOR P12 AND
033319,000057: 30,2032           25637                                    (1/DV)A                               #  P71.
033320,000058: 30,2033           03650                           STORE    1/DV3                                 
033321,000059: 30,2034           03646                           STORE    1/DV2                                 
033322,000060: 30,2035           17644                           STODL    1/DV1                                 
033323,000061: 30,2036           25643                                    (AT)A                                 
033324,000062: 30,2037           17634                           STODL    AT                                    
033325,000063: 30,2040           25647                                    (TBUP)A                               
033326,000064: 30,2041           17642                           STODL    TBUP                                  
033327,000065: 30,2042           25657                                    ATDECAY*                              
033328,000066: 30,2043           17640                           STODL    TTO                                   
033329,000067: 30,2044           25653                                    APSVEX                                
033330,000068: 30,2045           03636                           STORE    VE                                    
033331,000069: 30,2046           43345        COMMINIT           DLOAD    DAD                                   #  INITIALIZE TARGET DATA. USED BY P12, P70
033332,000070: 30,2047           25631                                    HINJECT                               #  AND P71 IF IT DOES NOT FOLLOW P70.
033333,000071: 30,2050           02023                                    /LAND/                                
033334,000072: 30,2051           17616                           STODL    RCO                                   
033335,000073: 30,2052           06233                                    HI6ZEROS                              
033336,000074: 30,2053           03753                           STORE    TXO                                   
033337,000075: 30,2054           03620                           STORE    YCO                                   
033338,000076: 30,2055           03622                           STORE    RDOTD                                 
033339,000077: 30,2056           17624                           STODL    YDOTD                                 
033340,000078: 30,2057           25633                                    ABTVINJ2                              #  TENTATIVELY STORE LOW INJECTION VELOCITY
033341,000079: 30,2060           27626                           STOVL    ZDOTD                                 
033342,000080: 30,2061           01730                                    V-OTHER                               
033343,000081: 30,2062           64235                           VXV      MXV                                   
033344,000082: 30,2063           01722                                    R-OTHER                               
033345,000083: 30,2064           01736                                    REFSMMAT                              
033346,000084: 30,2065           77656                           UNIT                                           
033347,000085: 30,2066           03652                           STORE    QAXIS                                 
033348,000086: 
033349,000087: 30,2067           77616                           RVQ                                            
033350,000088: 
033351,000089: 30,2070           77745        P12LMB             DLOAD                                          
033352,000090: 30,2071           25661                                    (TGO)A                                #  SET TGO TO AN INITIAL NOMINAL VALUE.
033353,000091: 30,2072           17474                           STODL    TGO                                   
033354,000092: 30,2073           03425                                    TIG                                   
033355,000093: 30,2074           34041                           STCALL   TDEC1                                 
033356,000094: 30,2075           27030                                    LEMPREC                               #  ROTATE THE STATE VECTORS TO THE
033357,000095: 30,2076           64375                           VLOAD    MXV                                   #  IGNITION TIME.
033358,000096: 30,2077           00007                                    VATT                                  
033359,000097: 30,2100           01736                                    REFSMMAT                              
033360,000098: 30,2101           77772                           VSL1                                           
033361,000099: 30,2102           27566                           STOVL    V1S                                   #  COMPUTE V1S = VEL(TIG)*2(-7) M/CS.
033362,000100: 30,2103           00001                                    RATT                                  
033363,000101: 30,2104           52521                           MXV      VSL6                                  
033364,000102: 30,2105           01736                                    REFSMMAT                              
033365,000103: 30,2106           37476                           STCALL   R                                     #  COMPUTE R = POS(TIG)*2(-24) M.
033366,000104: 30,2107           67200                                    MUNGRAV                               #  COMPUTE GDT1/2(TIG)*2(-7)M/CS.
033367,000105: 30,2110           53575                           VLOAD    UNIT                                  
033368,000106: 30,2111           03476                                    R                                     
033369,000107: 30,2112           37524                           STCALL   UNIT/R/                               #  COMPUTE UNIT/R/ FOR YCOMP.
033370,000108: 30,2113           61101                                    YCOMP                                 
033371,000109: 30,2114           57461                           SR       DCOMP                                 
033372,000110: 30,2115           20606                                    5D                                    
033373,000111: 30,2116           17630                           STODL    XRANGE                                #  INITIALIZE XRANGE FOR NOUN 76.
033374,000112: 30,2117           20212                                    (APO)                                 
033375,000113: 30,2120           03632                           STORE    APO                                   #  INITIALIZE APO FOR NOUN 76.
033376,000114: 30,2121           77776                           EXIT                                           
033377,000115: 
033378,000116: 30,2122           05413                           TC       PHASCHNG                              
033379,000117: 30,2123           04024                           OCT      04024                                 
033380,000118: 
033381,000119: 30,2124           33201        NEWLOAD            CAF      V06N76                                #  FLASH CROSS-RANGE AND APOLUNE VALUES.
033382,000120: 30,2125           04655                           TC       BANKCALL                              
033383,000121: 30,2126           20406                           CADR     GOFLASH                               
033384,000122: 30,2127           14106                           TCF      GOTOPOOH                              
033385,000123: 30,2130           12132                           TCF      +2                                    #  PROCEED
033386,000124: 30,2131           12124                           TCF      NEWLOAD                               #  ENTER NEW DATA.
033387,000125: 
033388,000126: 30,2132           32204                           CAF      P12ADRES                              
033389,000127: 30,2133           55430                           TS       WHICH                                 
033390,000128: 
033391,000129: 30,2134           06014                           TC       INTPRET                               
033392,000130: 30,2135           54345                           DLOAD    SL                                    
033393,000131: 30,2136           03630                                    XRANGE                                
033394,000132: 30,2137           20206                                    5D                                    
033395,000133: 30,2140           77615                           DAD                                            
033396,000134: 30,2141           03706                                    Y                                     
033397,000135: 30,2142           17620                           STODL    YCO                                   
033398,000136: 30,2143           03632                                    APO                                   #  RA = APO + /LAND/
033399,000137: 30,2144           77661                           SL                                             
033400,000138: 30,2145           20206                                    5D                                    
033401,000139: 30,2146           41415                           DAD      PUSH                                  #  RA*2(-24) IN MPAC AND PDL
033402,000140: 30,2147           02023                                    /LAND/                                
033403,000141: 30,2150           65205                           DMP      PDDL                                  #  2 RA MU*2(-62) IN PDL, LOAD RA
033404,000142: 30,2151           20210                                    MUM(-37)                              
033405,000143: 30,2152           41215                           DAD      DMP                                   #  (RA+RP)*2(-24)
033406,000144: 30,2153           03616                                    RCO                                   #  RP(RA+RP)*2(-48)
033407,000145: 30,2154           03616                                    RCO                                   
033408,000146: 30,2155           75465                           BDDV     SQRT                                  #  2 MU RA/RP(RA+RP)*2(-14)=ZDOTD(2)
033409,000147: 30,2156           77626                           STADR                                          
033410,000148: 30,2157           50151                           STOVL    ZDOTD                                 
033411,000149: 30,2160           03524                                    UNIT/R/                               
033412,000150: 30,2161           53361                           VXSC     VAD                                   
033413,000151: 30,2162           20206                                    28.5FPS                               
033414,000152: 30,2163           03566                                    V1S                                   
033415,000153: 30,2164           03504                           STORE    V                                     #  V(TIPOVER) = V(IGN) + 57FPS (UNIT/R/)
033416,000154: 30,2165           43014                           SET      SETGO                                 
033417,000155: 30,2166           04464                                    FLPI                                  
033418,000156: 30,2167           04421                                    FLVR                                  
033419,000157: 30,2170           60266                                    ASCENT                                
033420,000158: 30,2171           77776        P12RET             EXIT                                           
033421,000159: 30,2172           05413                           TC       PHASCHNG                              
033422,000160: 30,2173           04024                           OCT      04024                                 
033423,000161: 
033424,000162: 30,2174           05575                           TC       DOWNFLAG                              
033425,000163: 30,2175           00213                           ADRES    FLPI                                  
033426,000164: 
033427,000165: 30,2176           00004                           INHINT                                         
033428,000166: 30,2177           04737                           TC       IBNKCALL                              
033429,000167: 30,2200           40223                           CADR     PFLITEDB                              
033430,000168: 30,2201           00003                           RELINT                                         
033431,000169: 
033432,000170: 30,2202           04674                           TC       POSTJUMP                              
033433,000171: 30,2203           74133                           CADR     BURNBABY                              
033434,000172: 
033435,000173: 
033436,000174: 30,2204           02000        P12ADRES           REMADR   P12TABLE                              #  NOT IN SAME BANK.
033437,000175: 30,2205           00026 07363  28.5FPS            2DEC     .08685     B-6                        #  EXPECTED RDOT AT TIPOVER
033438,000176: 
033439,000177: 30,2207           00072 16206  MUM(-37)           2DEC*    4.9027780  E8         B-37*           
033440,000178: 
033441,000179: 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