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.

027465,000002:                                                                                                  ## Copyright:   Public domain.
027466,000003:                                                                                                  ## Filename:    R32.agc
027467,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
027468,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
027469,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
027470,000007:                                                                                                  ##              No original listings of this program are available;
027471,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
027472,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
027473,000010:                                                                                                  ## Assembler:   yaYUL
027474,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
027475,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
027476,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
027477,000014: 
027478,000015:                                                                                                  ## Sundance 302
027479,000016: 
027480,000017:                                                                                                  #  1)    ROUTINE NAME - TARGET DELTA V PROGRAM (R32).
027481,000018:                                                                                                  #  2)    FUNCTIONAL DESCRIPTION - UPON ENTRY BY ASTRONAUT ACTION, R32 FLASHES DSKY REQUESTS TO THE ASTRONAUT
027482,000019:                                                                                                  #        TO PROVIDE VIA DSKY (1) THE DELTA V TO BE APPLIED TO THE OTHER VEHICLE STATE VECTOR AND (2) THE
027483,000020:                                                                                                  #        TIME (TIG) AT WHICH THE OTHER VEHICLE VELOCITY WAS CHANGED BY  EXECUTION OF A THRUSTING MANEUVER. THE
027484,000021:                                                                                                  #        OTHER VEHICLE STATE VECTOR IS INTEGRATED TO TIG AND UPDATED BY THE ADDITION OF DELTA V (DELTA V HAVING
027485,000022:                                                                                                  #        BEEN TRANSFORMED FROM LV TO REF COSYS).  USING INTEGRVS, THE   PROGRAM THEN INTEGRATES THE OTHER
027486,000023:                                                                                                  #  VEHICLE STATE VECTOR TO THE STATE VECTOR OF THIS VEHICLE, THUS INSURING THAT THE W-MATRIX AND BOTH VEHICLE
027487,000024:                                                                                                  #  STATES CORRESPOND TO THE SAME TIME.
027488,000025:                                                                                                  #  3)    ERASABLE INITIALIZATION REQUIRED - NONE.
027489,000026:                                                                                                  #  4)    CALLING SEQUENCES AND EXIT MODES - CALLED BY ASTRONAUT REQUEST THRU DSKY V 84 E.
027490,000027:                                                                                                  #        EXITS BY TCF ENDOFJOB.
027491,000028:                                                                                                  #  5)    OUTPUT - OTHER VEHICLE STATE VECTOR INTEGRATED TO TIG AND INCREMENTED BY DELTA V IN REF COSYS.
027492,000029:                                                                                                  #        THE PUSHLIST CONTAINS THE MATRIX BY WHICH THE INPUT DELTA V MUST BE POST-MULTIPLIED TO CONVERT FROM LV
027493,000030:                                                                                                  #        TO REF COSYS.
027494,000031:                                                                                                  #  6)    DEBRIS - OTHER VEHICLE STATE VECTOR.
027495,000032:                                                                                                  #  7)    SUBROUTINES CALLED - BANKCALL, GOXDSPF, CSMPREC (OR LEMPREC), ATOPCSM (OR ATOPLEM), INTSTALL, INTWAKE, PHASCHNG
027496,000033:                                                                                                  #        INTPRET, INTEGRVS, AND MINIRECT.
027497,000034:                                                                                                  #  8)    FLAG USE - MOONFLAG, CMOONFLAG, INTYPFLG, RASFLAG, AND MARKCTR.
027498,000035: 
027499,000036: 30,2000                                           BANK     30                                    
027500,000037: 13,2000                                           SETLOC   R32LOC                                
027501,000038: 13,2000                                           BANK                                           
027502,000039: 
027503,000040: 13,2161                                           COUNT*   $$/R32                                
027504,000041: 
027505,000042: 13,2161  E7,1424                                  EBANK=   TIG                                   
027506,000043: 
027507,000044: 13,2161           06716        JOBR32             TC       UNK7766                               
027508,000045: 13,2162           06014                           TC       INTPRET                               
027509,000046: 13,2163           77414                           SET      EXIT                                  
027510,000047: 13,2164           04061                                    R32FLAG                               
027511,000048: 
027512,000049: 13,2165           32310                           CAF      V06N84                                #  FLASH LAST DELTA V,
027513,000050: 13,2166           04655                           TC       BANKCALL                              #  AND WAIT FOR KEYBOARD ACTION.
027514,000051: 13,2167           20226                           CADR     GOMARKF                               
027515,000052: 13,2170           02302                           TC       ENDR32                                
027516,000053: 13,2171           02173                           TC       +2                                    #  PROCEED
027517,000054: 13,2172           02165                           TC       -5                                    #  STORE DATA AND REPEAT FLASHING
027518,000055: 13,2173           32311                           CAF      V06N84     +1                         #  FLASH VERB 06 NOUN 33, DISPLAY LAST TIG,
027519,000056: 13,2174           04655                           TC       BANKCALL                              #  AND WAIT FOR KEYBOARD ACTION.
027520,000057: 13,2175           20226                           CADR     GOMARKF                               
027521,000058: 13,2176           02302                           TC       ENDR32                                
027522,000059: 13,2177           02201                           TC       +2                                    
027523,000060: 13,2200           02173                           TC       -5                                    
027524,000061: 13,2201           06014                           TC       INTPRET                               #  RETURN TO INTERPRETIVE CODE
027525,000062: 13,2202           77745                           DLOAD                                          #  SET D(MPAC)=TIG IN CSEC B28
027526,000063: 13,2203           03425                                    TIG                                   
027527,000064: 13,2204           34041                           STCALL   TDEC1                                 #  SET TDEC1=TIG FOR ORBITAL INTEGRATION
027528,000065: 13,2205           27014                                    OTHPREC                               
027529,000066: 13,2206           53575        COMPMAT            VLOAD    UNIT                                  
027530,000067: 13,2207           00001                                    RATT                                  
027531,000068: 13,2210           77676                           VCOMP                                          #  U(-R)
027532,000069: 13,2211           00031                           STORE    24D                                   #  U(-R) TO 24D
027533,000070: 13,2212           53435                           VXV      UNIT                                  #  U(-R) X V = U(V X R)
027534,000071: 13,2213           00007                                    VATT                                  
027535,000072: 13,2214           00023                           STORE    18D                                   
027536,000073: 13,2215           53435                           VXV      UNIT                                  #  U(V X R) X U(-R) = U((R X V) X R)
027537,000074: 13,2216           00031                                    24D                                   
027538,000075: 13,2217           24015                           STOVL    12D                                   
027539,000076: 13,2220           02231                                    DELVOV                                
027540,000077: 13,2221           76505                           VXM      VSL1                                  #  V(MPAC)=DELTA V IN REFCOSYS
027541,000078: 13,2222           00015                                    12D                                   
027542,000079: 13,2223           77655                           VAD                                            
027543,000080: 13,2224           00007                                    VATT                                  
027544,000081: 13,2225           00007                           STORE    6                                     #  V(PD6)=VATT + DELTA V
027545,000082: 13,2226           77624                           CALL                                           #  PREVENT WOULD-BE USER OF ORBITAL
027546,000083: 13,2227           27362                                    INTSTALL                              #  INTEG FROM INTERFERING WITH UPDATING
027547,000084: 13,2230           77624                           CALL                                           
027548,000085: 13,2231           26312                                    R32SUB1                               
027549,000086: 13,2232           53775                           VLOAD    VSR*                                  
027550,000087: 13,2233           00007                                    6                                     
027551,000088: 13,2234           57176                                    0,2                                   
027552,000089: 13,2235           25543                           STOVL    VCV                                   
027553,000090: 13,2236           00001                                    RATT                                  
027554,000091: 13,2237           77657                           VSR*                                           
027555,000092: 13,2240           57176                                    0,2                                   
027556,000093: 13,2241           15535                           STODL    RCV                                   
027557,000094: 13,2242           03425                                    TIG                                   
027558,000095: 13,2243           01517                           STORE    TET                                   
027559,000096: 13,2244           71214                           CLEAR    DLOAD                                 
027560,000097: 13,2245           01673                                    INTYPFLG                              
027561,000098: 13,2246           01643                                    TETTHIS                               
027562,000099: 13,2247           34041        INTOTHIS           STCALL   TDEC1                                 
027563,000100: 13,2250           27060                                    INTEGRVS                              
027564,000101: 13,2251           45014                           SET      CALL                                  
027565,000102: 13,2252           00471                                    NOUPFLAG                              
027566,000103: 13,2253           27362                                    INTSTALL                              
027567,000104: 13,2254           77775                           VLOAD                                          
027568,000105: 13,2255           00017                                    RATT1                                 
027569,000106: 13,2256           01503                           STORE    RRECT                                 
027570,000107: 13,2257           15535                           STODL    RCV                                   
027571,000108: 13,2260           00015                                    TAT                                   
027572,000109: 13,2261           25517                           STOVL    TET                                   
027573,000110: 13,2262           00025                                    VATT1                                 
027574,000111: 13,2263           77624                           CALL                                           
027575,000112: 13,2264           23354                                    MINIRECT                              
027576,000113: 13,2265           77776                           EXIT                                           
027577,000114: 
027578,000115: 13,2266           40774                           CS       RASFLAG                               
027579,000116: 13,2267           75025                           MASK     BIT2                                  
027580,000117: 13,2270           26774                           ADS      RASFLAG                               
027581,000118: 
027582,000119: 13,2271           06014                           TC       INTPRET                               
027583,000120: 13,2272           77624                           CALL                                           
027584,000121: 13,2273           26631                                    ATOPOTH                               
027585,000122: 13,2274           77531                           SSP      EXIT                                  
027586,000123: 13,2275           00053                                    QPRET                                 
027587,000124: 13,2276           26301                                    OUT                                   
027588,000125: 13,2277           04655                           TC       BANKCALL                              #  PERMIT USE OF ORBITAL INTEGRATION
027589,000126: 13,2300           27400                           CADR     INTWAKE                               
027590,000127: 13,2301           77776        OUT                EXIT                                           
027591,000128: 13,2302           06014        ENDR32             TC       INTPRET                               
027592,000129: 13,2303           77414                           CLEAR    EXIT                                  
027593,000130: 13,2304           04261                                    R32FLAG                               
027594,000131: 13,2305           35030                           CAF      ZERO                                  
027595,000132: 13,2306           55447                           TS       MARKCTR                               #  CLEAR RR TRACKING MARK COUNTER
027596,000133: 13,2307           15561                           TCF      ENDEXT                                
027597,000134: 
027598,000135: 13,2310           01524        V06N84             NV       0684                                  
027599,000136: 13,2311           01441                           NV       0633                                  
027600,000137: 13,2312           43174        R32SUB1            AXT,2    SET                                   
027601,000138: 13,2313           00002                                    2                                     
027602,000139: 13,2314           00063                                    MOONFLAG                              #  SET MEANS MOON IS SPHERE OF INFLUENCE.
027603,000140: 13,2315           77014                           BON      AXT,2                                 
027604,000141: 13,2316           04303                                    CMOONFLG                              #  SET MEANS PERM CM STATE IN LUNAR SPHERE.
027605,000142: 13,2317           00052                                    QPRET                                 
027606,000143: 13,2320           00000                                    0                                     
027607,000144: 13,2321           43414                           CLEAR    RVQ                                   
027608,000145: 13,2322           00263                                    MOONFLAG                              
027609,000146: 
027610,000147: 
027611,000148: 

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