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.

031290,000002:                                                                                                  ## Copyright:   Public domain.
031291,000003:                                                                                                  ## Filename:    R13.agc
031292,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
031293,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
031294,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
031295,000007:                                                                                                  ##              No original listings of this program are available;
031296,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
031297,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
031298,000010:                                                                                                  ## Assembler:   yaYUL
031299,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
031300,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
031301,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
031302,000014:                                                                                                  ##              2021-05-30 ABS  Removed DEC66 symbol not present in Luminary 69.
031303,000015: 
031304,000016:                                                                                                  ## Sundance 292
031305,000017: 
031306,000018: 31,2171  E7,1606                                  EBANK=   E2DPS                                 
031307,000019: 
031308,000020:                                                                                                  #  ****************************************************************************************************************
031309,000021:                                                                                                  #  GUILDENSTERN:  AUTO-MODES MONITOR (R13)
031310,000022:                                                                                                  #  ****************************************************************************************************************
031311,000023: 
031312,000024: 31,2171                                           COUNT*   $$/R13                                
031313,000025: 
031314,000026:                                                                                                  #     HERE IS THE PHILOSOPHY OF GUILDENSTERN:    ON EVERY APPEARANCE OR DISAPPEARANCE OF THE MANUAL THROTTLE
031315,000027:                                                                                                  #  DISCRETE TO SELECT P67 OR P66 RESPECTIVELY;   ON EVERY APPEARANCE OF THE ATTITUDE-HOLD DISCRETE TO SELECT P66
031316,000028:                                                                                                  #  UNLESS THE CURRENT PROGRAM IS P67 IN WHICH CASE THERE IS NO CHANGE.
031317,000029: 
031318,000030: 31,2171           00006        GUILDEN            EXTEND                                         #  IS UN-AUTO-THROTTLE DISCRETE PRESENT?
031319,000031: 31,2172           00030                           READ     CHAN30                                
031320,000032: 31,2173           75022                           MASK     BIT5                                  
031321,000033: 31,2174           10000                           CCS      A                                     
031322,000034: 31,2175           12217                           TCF      STARTP67                              #  YES
031323,000035: 31,2176           05365        P67NOW?            TC       CHECKMM                               #  NO:   ARE WE IN P67 NOW?
031324,000036: 31,2177           00103                           DEC      67         B-14                       
031325,000037: 31,2200           12223                           TCF      STABL?                                #  NO
031326,000038: 31,2201           03562        STARTP66           TC       FASTCHNG                              #  YES
031327,000039: 31,2202           05351                           TC       NEWMODEX                              
031328,000040: 31,2203           00102                           DEC      66         B-14                       
031329,000041: 31,2204           00006                           EXTEND                                         #  INITIALIZE VDGVERT USING
031330,000042: 31,2205           31614                           DCA      VGU                                   #    PRESENT DOWNWARD VELOCITY
031331,000043: 31,2206           53654                           DXCH     VDGVERT                               
031332,000044: 31,2207           35030                           CAF      ZERO                                  
031333,000045: 31,2210           55655                           TS       RODCOUNT                              
031334,000046: 31,2211           55656        VRTSTART           TS       WCHVERT                               
031335,000047: 31,2212           32234                           CAF      VERTADR                               #  WCHPHASE = VERTICAL: P65,P66,P67
031336,000048: 31,2213           55606                           TS       WCHPHASE                              
031337,000049: 31,2214           05575                           TC       DOWNFLAG                              #  PERMIT X-AXIS OVERRIDE
031338,000050: 31,2215           17140                           CADR     XOVINFLG                              
031339,000051: 31,2216           12505                           TCF      GUILDRET                              
031340,000052: 
031341,000053: 31,2217           05351        STARTP67           TC       NEWMODEX                              #  NO HARM IN "STARTING" P67 OVER AND OVER
031342,000054: 31,2220           00103                           DEC      67         B-14                       #    SO NO NEED FOR A FASTCHNG AND NO NEED
031343,000055: 
031344,000056: 31,2221           34375                           CAF      TEN                                   #    TO SEE IF ALREADY IN P67
031345,000057: 31,2222           12211                           TCF      VRTSTART                              
031346,000058: 
031347,000059: 31,2223           35011        STABL?             CAF      BIT14                                 #  IS AUTO MODE DISCRETE PRESENT?
031348,000060: 31,2224           00006                           EXTEND                                         
031349,000061: 31,2225           02031                           RAND     CHAN31                                
031350,000062: 31,2226           00006                           EXTEND                                         
031351,000063: 31,2227           12505                           BZF      GUILDRET                              #  YES: ALL'S WELL
031352,000064: 31,2230           05365        P66NOW?            TC       CHECKMM                               #  NO:  ARE WE IN P66 NOW?
031353,000065: 31,2231           00102                           DEC      66         B-14                       
031354,000066: 31,2232           12201                           TCF      STARTP66                              #  NO
031355,000067: 31,2233           12505                           TCF      GUILDRET                              #  YES
031356,000068: 
031357,000069: 31,2234           02467        VERTADR            ADRES    VERTICAL                              

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