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.

052333,000002:                                                                                                  ## Copyright:   Public domain.
052334,000003:                                                                                                  ## Filename:    KEYRUPT,_UPRUPT.agc
052335,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
052336,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
052337,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
052338,000007:                                                                                                  ##              No original listings of this program are available;
052339,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
052340,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
052341,000010:                                                                                                  ## Assembler:   yaYUL
052342,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
052343,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
052344,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
052345,000014:                                                                                                  ##              2021-05-30 ABS  UPCK -> UPOK
052346,000015: 
052347,000016:                                                                                                  ## Sundance 292
052348,000017: 
052349,000018: 14,3734                                           BANK     14                                    
052350,000019: 04,2000                                           SETLOC   KEYRUPT                               
052351,000020: 04,2000                                           BANK                                           
052352,000021: 04,3104                                           COUNT*   $$/KEYUP                              
052353,000022: 
052354,000023: 04,3104           54016        KEYRUPT1           TS       BANKRUPT                              
052355,000024: 04,3105           56002                           XCH      Q                                     
052356,000025: 04,3106           54012                           TS       QRUPT                                 
052357,000026: 04,3107           04412                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
052358,000027: 04,3110           34360                           CAF      LOW5                                  
052359,000028: 04,3111           00006                           EXTEND                                         
052360,000029: 04,3112           02015                           RAND     MNKEYIN                               #  CHECK IF KEYS 5M-1M ON
052361,000030: 04,3113           54073        KEYCOM             TS       RUPTREG4                              
052362,000031: 04,3114           40101                           CS       FLAGWRD5                              
052363,000032: 04,3115           75010                           MASK     DSKYFBIT                              
052364,000033: 04,3116           26101                           ADS      FLAGWRD5                              
052365,000034: 
052366,000035: 04,3117           34367        ACCEPTUP           CAF      CHRPRIO                               #  (NOTE: RUPTREG4 = KEYTEMP1)
052367,000036: 04,3120           05142                           TC       NOVAC                                 
052368,000037: 04,3121     1000                                  EBANK=   DSPCOUNT                              
052369,000038: 04,3121           02212 60102                     2CADR    CHARIN                                
052370,000039: 
052371,000040: 04,3123           30073                           CA       RUPTREG4                              
052372,000041: 04,3124           50064                           INDEX    LOCCTR                                
052373,000042: 04,3125           54154                           TS       MPAC                                  #  LEAVE 5 BIT KEY CDE IN MPAC FOR CHARIN
052374,000043: 04,3126           05330                           TC       RESUME                                
052375,000044: 
052376,000045:                                                                                                  #  UPRUPT PROGRAM
052377,000046: 
052378,000047: 04,3127           54016        UPRUPT             TS       BANKRUPT                              
052379,000048: 04,3130           56002                           XCH      Q                                     
052380,000049: 04,3131           54012                           TS       QRUPT                                 
052381,000050: 04,3132           04412                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
052382,000051: 04,3133           35030                           CAF      ZERO                                  
052383,000052: 04,3134           56045                           XCH      INLINK                                
052384,000053: 04,3135           54073                           TS       KEYTEMP1                              
052385,000054: 04,3136           35024                           CAF      BIT3                                  #  TURN ON UPACT LIGHT
052386,000055: 04,3137           00006                           EXTEND                                         #  (BIT 3 OF CHANNEL 11)
052387,000056: 04,3140           05011                           WOR      DSALMOUT                              
052388,000057: 04,3141           34360        UPRPT1             CAF      LOW5                                  #  TEST FOR TRIPLE CHAR REDUNDANCY
052389,000058: 04,3142           70073                           MASK     KEYTEMP1                              #  LOW5 OF WORD
052390,000059: 04,3143           56073                           XCH      KEYTEMP1                              #  LOW5 INTO KEYTEMP1
052391,000060: 04,3144           00006                           EXTEND                                         
052392,000061: 04,3145           75015                           MP       BIT10                                 #  SHIFT RIGHT 5
052393,000062: 04,3146           54734                           TS       KEYTEMP2                              
052394,000063: 04,3147           74360                           MASK     LOW5                                  #  MID 5
052395,000064: 04,3150           63204                           AD       HI10                                  
052396,000065: 04,3151           03201                           TC       UPTEST                                
052397,000066: 04,3152           35015                           CAF      BIT10                                 
052398,000067: 04,3153           00006                           EXTEND                                         
052399,000068: 04,3154           70734                           MP       KEYTEMP2                              #  SHIFT RIGHT 5
052400,000069: 04,3155           74360                           MASK     LOW5                                  #  HIGH 5
052401,000070: 04,3156           40000                           COM                                            
052402,000071: 04,3157           03201                           TC       UPTEST                                
052403,000072: 
052404,000073: 04,3160           43207        UPOK               CS       ELRCODE                               #  CODE IS GOOD. IF CODE = 'ERROR RESET',
052405,000074: 04,3161           60073                           AD       KEYTEMP1                              #  CLEAR UPLOCKFL(SET BIT4 OF FLAGWRD7 = 0)
052406,000075: 04,3162           00006                           EXTEND                                         #  IF CODE DOES NOT = 'ERROR RESET', ACCEPT
052407,000076: 04,3163           13171                           BZF      CLUPLOCK                              #  CODE ONLY IF UPLOCKFL IS CLEAR (=0).
052408,000077: 
052409,000078: 04,3164           35023                           CAF      UPLOCBIT                              #  TEST UPLOCKFL FOR 0 OR 1
052410,000079: 04,3165           70103                           MASK     FLAGWRD7                              
052411,000080: 04,3166           10000                           CCS      A                                     
052412,000081: 04,3167           05330                           TC       RESUME                                #  UPLOCKFL = 1
052413,000082: 04,3170           03117                           TC       ACCEPTUP                              #  UPLOCKFL = 0
052414,000083: 
052415,000084: 04,3171           45023        CLUPLOCK           CS       UPLOCBIT                              #  CLEAR UPLOCKFL (I.E., SET BIT 4 OF )
052416,000085: 04,3172           70103                           MASK     FLAGWRD7                              #  FLAGWRD7 = 0)
052417,000086: 04,3173           54103                           TS       FLAGWRD7                              
052418,000087: 04,3174           03117                           TC       ACCEPTUP                              
052419,000088: 
052420,000089:                                                                                                  #  CODE IS BAD
052421,000090: 04,3175           40103        TMFAIL2            CS       FLAGWRD7                              #  LOCK OUT FURTHER UPLINK ACTIVITY
052422,000091: 04,3176           75023                           MASK     UPLOCBIT                              #  (BY SETTING UPLOCKFL = 1) UNTIL
052423,000092: 04,3177           26103                           ADS      FLAGWRD7                              #  'ERROR RESET' IS SENT VIA UPLINK.
052424,000093: 04,3200           05330                           TC       RESUME                                
052425,000094: 04,3201           60073        UPTEST             AD       KEYTEMP1                              
052426,000095: 04,3202           10000                           CCS      A                                     
052427,000096: 04,3203           03175                           TC       TMFAIL2                               
052428,000097: 04,3204           77740        HI10               OCT      77740                                 
052429,000098: 04,3205           03175                           TC       TMFAIL2                               
052430,000099: 04,3206           00002                           TC       Q                                     
052431,000100: 
052432,000101: 04,3207           00022        ELRCODE            OCT      22                                    
052433,000102: 
052434,000103:                                                                                                  #  'UPLINK ACTIVITY LIGHT' IS TURNED OFF BY .....
052435,000104:                                                                                                  #        1.      VBRELDSP
052436,000105:                                                                                                  #        2.      ERROR RESET
052437,000106:                                                                                                  #        3.      UPDATE PROGRAM (P27) ENTERED BY V70,V71,V72,AND V73.
052438,000107:                                                                                                  #                                     -
052439,000108:                                                                                                  #  THE RECEPTION OF A BAD CODE (I.E  CCC FAILURE) LOCKS OUT FURTHER UPLINK ACTIVITY BY SETTING BIT4 OF FLAGWRD7 = 1.
052440,000109:                                                                                                  #  THIS INDICATION WILL BE TRANSFERRED TO THE GROUND BY THE DOWNLINK WHICH DOWNLINKS ALL FLAGWORDS.
052441,000110:                                                                                                  #  WHEN UPLINK ACTIVITY IS LOCKED OUT, IT CAN BE ALLOWED WHEN THE GROUND UPLINKS AND 'ERROR RESET' CODE.
052442,000111:                                                                                                  #  (IT IS RECOMMENDED THAT THE 'ERROR LIGHT RESET' CODE IS PRECEEDED BY 16 BITS THE FIRST OF WHICH IS 1 FOLLOWED
052443,000112:                                                                                                  #  BY 15 ZEROES.  THIS WILL ELIMINATE EXTRANEOUS BITS FROM INLINK WHICH MAY HAVE BEEN LEFT OVER FROM THE ORIGINAL
052444,000113:                                                                                                  #  FAILURE)
052445,000114: 
052446,000115:                                                                                                  #  UPLINK ACTIVITY IS ALSO ALLOWED (UNLOCKED) DURING FRESH START WHEN FRESH START SETS BIT4 OF FLAGWRD7 = 0.

End of include-file KEYRUPT,_UPRUPT.agc.  Parent file is MAIN.agc