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.

013441,000002:                                                                                                  ## Copyright:   Public domain.
013442,000003:                                                                                                  ## Filename:    KALCMANU_STEERING.agc
013443,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
013444,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
013445,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
013446,000007:                                                                                                  ##              No original listings of this program are available;
013447,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
013448,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
013449,000010:                                                                                                  ## Assembler:   yaYUL
013450,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
013451,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
013452,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
013453,000014: 
013454,000015:                                                                                                  ## Sundance 302
013455,000016: 
013456,000017:                                                                                                  #  GENERATION OF STEERING COMMANDS FOR DIGITAL AUTOPILOT FREE FALL MANEUVERS
013457,000018: 
013458,000019:                                                                                                  #  NEW COMMANDS WILL BE GENERATED EVERY ONE SECOND DURING THE MANEUVER
013459,000020: 
013460,000021: 22,2777  E6,1704                                  EBANK=   TTEMP                                 
013461,000022: 
013462,000023: 22,2777           04655        NEWDELHI           TC       BANKCALL                              #  CHECK FOR AUTO STABILIZATION
013463,000024: 22,3000           54276                           CADR     ISITAUTO                              #  ONLY
013464,000025: 22,3001           10000                           CCS      A                                     
013465,000026: 22,3002           12724                           TCF      NOGO       -2                         
013466,000027: 22,3003           06014        NEWANGL            TC       INTPRET                               
013467,000028: 22,3004           75160                           AXC,1    AXC,2                                 
013468,000029: 22,3005           03243                                    MIS                                   #  COMPUTE THE NEW MATRIX FROM S/C TO
013469,000030: 22,3006           02236                                    KEL                                   #  STABLE MEMBER AXES
013470,000031: 22,3007           77624                           CALL                                           
013471,000032: 22,3010           44306                                    MXM3                                  
013472,000033: 22,3011           45575                           VLOAD    STADR                                 
013473,000034: 22,3012           50517                           STOVL    MIS        +12D                       #  CALCULATE NEW DESIRED CDU ANGLES
013474,000035: 22,3013           77626                           STADR                                          
013475,000036: 22,3014           50525                           STOVL    MIS        +6D                        
013476,000037: 22,3015           77626                           STADR                                          
013477,000038: 22,3016           74533                           STORE    MIS                                   
013478,000039: 22,3017           45160                           AXC,1    CALL                                  
013479,000040: 22,3020           03243                                    MIS                                   
013480,000041: 22,3021           44650                                    DCMTOCDU                              #  PICK UP THE NEW CDU ANGLES FROM MATRIX
013481,000042: 22,3022           77634                           RTB                                            
013482,000043: 22,3023           21516                                    V1STO2S                               
013483,000044: 22,3024           03301                           STORE    NCDU                                  #  NEW CDU ANGLES
013484,000045: 22,3025           77414                           BONCLR   EXIT                                  
013485,000046: 22,3026           01215                                    CALCMAN2                              
013486,000047: 22,3027           45116                                    MANUSTAT                              #  TO START MANEUVER
013487,000048: 22,3030           35025                           CAF      TWO                                   #        +0 OTHERWISE
013488,000049: 22,3031           55274        INCRDCDU           TS       SPNDX                                 
013489,000050: 22,3032           51274                           INDEX    SPNDX                                 
013490,000051: 22,3033           31673                           CA       BCDU                                  #  INITIAL CDU ANGLES
013491,000052: 22,3034           00006                           EXTEND                                         #  OR PREVIOUS DESIRED CDU ANGLES
013492,000053: 22,3035           51274                           INDEX    SPNDX                                 
013493,000054: 22,3036           21700                           MSU      NCDU                                  
013494,000055: 22,3037           00006                           EXTEND                                         
013495,000056: 22,2000                                           SETLOC   KALCMON1                              
013496,000057: 22,2000                                           BANK                                           
013497,000058: 
013498,000059: 22,3040           73115                           MP       DT/TAU                                
013499,000060: 22,3041           10000                           CCS      A                                     #  CONVERT TO 2S COMPLEMENT
013500,000061: 22,3042           65026                           AD       ONE                                   
013501,000062: 22,3043           13045                           TCF      +2                                    
013502,000063: 22,3044           40000                           COM                                            
013503,000064: 22,3045           51274                           INDEX    SPNDX                                 
013504,000065: 22,3046           55635                           TS       DELDCDU                               #  ANGLE INCREMENTS TO BE ADDED TO
013505,000066: 22,3047           51274                           INDEX    SPNDX                                 #  CDUXD, CDUYD, CDUZD EVERY TENTH SECOND
013506,000067: 22,3050           31700                           CA       NCDU                                  #  BY LEM DAP
013507,000068: 22,3051           51274                           INDEX    SPNDX                                 
013508,000069: 22,3052           57673                           XCH      BCDU                                  
013509,000070: 22,3053           51274                           INDEX    SPNDX                                 
013510,000071: 22,3054           55632                           TS       CDUXD                                 
013511,000072: 22,3055           11274                           CCS      SPNDX                                 
013512,000073: 22,3056           13031                           TCF      INCRDCDU                              #  LOOP FOR THREE AXES
013513,000074: 
013514,000075: 22,3057           00003                           RELINT                                         
013515,000076: 
013516,000077:                                                                                                  #  COMPARE PRESENT TIME WITH TIME TO TERMINATE MANEUVER
013517,000078: 
013518,000079: 22,3060           03071        TMANUCHK           TC       TIMECHK                               
013519,000080: 22,3061           13164                           TCF      CONTMANU                              
013520,000081: 22,3062           35026                           CAF      ONE                                   
013521,000082: 22,3063           00004        MANUSTAL           INHINT                                         #  END MAJOR PART OF MANEUVER WITHIN 1 SEC
013522,000083: 22,3064           05252                           TC       WAITLIST                              #  UNDER WAITLIST CALL TO MANUSTOP
013523,000084: 22,3065  E6,1704                                  EBANK=   TTEMP                                 
013524,000085: 22,3065           03207 44066                     2CADR    MANUSTOP                              
013525,000086: 
013526,000087: 22,3067           00003                           RELINT                                         
013527,000088: 22,3070           15225                           TCF      ENDOFJOB                              
013528,000089: 
013529,000090: 22,3071           00006        TIMECHK            EXTEND                                         
013530,000091: 22,3072           40025                           DCS      TIME2                                 
013531,000092: 22,3073           53705                           DXCH     TTEMP                                 
013532,000093: 22,3074           00006                           EXTEND                                         
013533,000094: 22,3075           31731                           DCA      TM                                    
013534,000095: 22,3076           21705                           DAS      TTEMP                                 
013535,000096: 22,3077           11704                           CCS      TTEMP                                 
013536,000097: 22,3100           00002                           TC       Q                                     
013537,000098: 22,3101           13103                           TCF      +2                                    
013538,000099: 22,3102           13113                           TCF      2NDRETRN                              
013539,000100: 22,3103           11705                           CCS      TTEMP      +1                         
013540,000101: 22,3104           00002                           TC       Q                                     
013541,000102: 22,3105           13107                           TCF      MANUOFF                               
013542,000103: 22,3106           40000                           COM                                            
013543,000104: 22,3107           63162        MANUOFF            AD       ONESEK     +1                         
013544,000105: 22,3110           00006                           EXTEND                                         
013545,000106: 22,3111           63113                           BZMF     2NDRETRN                              
013546,000107: 22,3112           24002                           INCR     Q                                     
013547,000108: 22,3113           24002        2NDRETRN           INCR     Q                                     
013548,000109: 22,3114           00002                           TC       Q                                     
013549,000110: 
013550,000111: 22,3115           03146        DT/TAU             DEC      .1                                    
013551,000112: 
013552,000113: 22,3116           77776        MANUSTAT           EXIT                                           #  INITIALIZATION ROUTINE
013553,000114: 22,3117           00006                           EXTEND                                         #  FOR AUTOMATIC MANEUVERS
013554,000115: 22,3120           30025                           DCA      TIME2                                 
013555,000116: 22,3121           21731                           DAS      TM                                    #  TM+T0         MANEUVER COMPLETION TIME
013556,000117: 22,3122           00006                           EXTEND                                         
013557,000118: 22,3123           43162                           DCS      ONESEK                                
013558,000119: 22,3124           21731                           DAS      TM                                    #  (TM+T0)-1
013559,000120: 22,3125           00004                           INHINT                                         
013560,000121: 22,3126           35025                           CAF      TWO                                   
013561,000122: 22,3127           55676        RATEBIAS           TS       KSPNDX                                
013562,000123: 22,3130           60000                           DOUBLE                                         
013563,000124: 22,3131           55677                           TS       KDPNDX                                
013564,000125: 22,3132           50000                           INDEX    A                                     
013565,000126: 22,3133           31722                           CA       BRATE                                 
013566,000127: 22,3134           51676                           INDEX    KSPNDX                                #  STORE MANEUVER RATE IN
013567,000128: 22,3135           55640                           TS       OMEGAPD                               #  OMEGAPD, OMEGAQD, OMEGARD
013568,000129: 22,3136           00006                           EXTEND                                         
013569,000130: 22,3137           63141                           BZMF     +2                                    #  COMPUTE ATTITUDE ERROR
013570,000131: 22,3140           40000                           COM                                            #  OFFSET = (WX)ABS(WX)/2AJX
013571,000132: 22,3141           00006                           EXTEND                                         #  WHERE AJX= 2-JET ACCELERATION
013572,000133: 22,3142           73163                           MP       BIASCALE                              #  = -1/16
013573,000134: 22,3143           00006                           EXTEND                                         
013574,000135: 22,3144           51677                           INDEX    KDPNDX                                
013575,000136: 22,3145           71722                           MP       BRATE                                 
013576,000137: 22,3146           00006                           EXTEND                                         
013577,000138: 22,3147           51676                           INDEX    KSPNDX                                
013578,000139: 22,3150           11522                           DV       1JACC                                 #  = AJX         $ 90 DEG/SEC-SEC
013579,000140: 22,3151           51676                           INDEX    KSPNDX                                
013580,000141: 22,3152           55301                           TS       DELPEROR                              #                $ 180 DEG
013581,000142: 22,3153           11676                           CCS      KSPNDX                                
013582,000143: 22,3154           13127                           TCF      RATEBIAS                              
013583,000144: 
013584,000145: 22,3155           30025                           CA       TIME1                                 
013585,000146: 22,3156           63162                           AD       ONESEK     +1                         
013586,000147: 22,3157           57703                           XCH      NEXTIME                               
013587,000148: 22,3160           13030                           TCF      INCRDCDU   -1                         
013588,000149: 
013589,000150: 22,3161           00000        ONESEK             DEC      0          B-14                       
013590,000151: 22,3162           00144                           DEC      100        B-14                       
013591,000152: 
013592,000153: 22,3163           75777        BIASCALE           OCT      75777                                 #  = -1/16
013593,000154: 
013594,000155: 22,3164           40025        CONTMANU           CS       TIME1                                 #  RESET FOR NEXT DCDU UPDATE
013595,000156: 22,3165           61703                           AD       NEXTIME                               
013596,000157: 22,3166           10000                           CCS      A                                     
013597,000158: 22,3167           65026                           AD       ONE                                   
013598,000159: 22,3170           13173                           TCF      MANUCALL                              
013599,000160: 22,3171           65010                           AD       NEGMAX                                
013600,000161: 22,3172           40000                           COM                                            
013601,000162: 22,3173           00004        MANUCALL           INHINT                                         #  CALL FOR NEXT UPDATE VIA WAITLIST
013602,000163: 22,3174           05252                           TC       WAITLIST                              
013603,000164: 22,3175  E6,1704                                  EBANK=   TTEMP                                 
013604,000165: 22,3175           03202 44066                     2CADR    UPDTCALL                              
013605,000166: 22,3177           33162                           CAF      ONESEK     +1                         #  INCREMENT TIME FOR NEXT UPDATE
013606,000167: 22,3200           27703                           ADS      NEXTIME                               
013607,000168: 22,3201           15225                           TCF      ENDOFJOB                              
013608,000169: 
013609,000170: 22,3202           37666        UPDTCALL           CAF      PRIO26                                #  SATELLITE PROGRAM TO CALL FOR UPDATE
013610,000171: 22,3203           05155                           TC       FINDVAC                               #  OF STEERING COMMANDS
013611,000172: 22,3204  E6,1704                                  EBANK=   TTEMP                                 
013612,000173: 22,3204           02777 44066                     2CADR    NEWDELHI                              
013613,000174: 
013614,000175: 22,3206           05321                           TC       TASKOVER                              
013615,000176: 
013616,000177:                                                                                                  #  ROUTINE FOR TERMINATING AUTOMATIC MANEUVERS
013617,000178: 
013618,000179: 22,3207           35030        MANUSTOP           CAF      ZERO                                  #  ZERO MANEUVER RATES
013619,000180: 22,3210           55637                           TS       DELDCDU2                              
013620,000181: 22,3211           55642                           TS       OMEGARD                               
013621,000182: 22,3212           55303                           TS       DELREROR                              
013622,000183: 22,3213           55636                           TS       DELDCDU1                              
013623,000184: 22,3214           55641                           TS       OMEGAQD                               
013624,000185: 22,3215           55302                           TS       DELQEROR                              
013625,000186: 22,3216           31210                           CA       CPSI                                  #  SET DESIRED GIMBAL ANGLES TO
013626,000187: 22,3217           55634                           TS       CDUZD                                 #  DESIRED FINAL GIMBAL ANGLES
013627,000188: 22,3220           31207                           CA       CTHETA                                
013628,000189: 22,3221           55633                           TS       CDUYD                                 
013629,000190: 22,3222           31206        ENDROLL            CA       CPHI                                  #  NO FINAL YAW
013630,000191: 22,3223           55632                           TS       CDUXD                                 
013631,000192: 22,3224           35030                           CAF      ZERO                                  
013632,000193: 22,3225           55640                           TS       OMEGAPD                               #  I.E. MANEUVER DID NOT GO THRU
013633,000194: 22,3226           55635                           TS       DELDCDU                               #  GIMBAL LOCK ORIGINALLY
013634,000195: 22,3227           55301                           TS       DELPEROR                              
013635,000196: 22,3230           31313        GOODMANU           CA       ATTPRIO                               #  RESTORE USERS PRIO
013636,000197: 22,3231           54063                           TS       NEWPRIO                               
013637,000198: 
013638,000199: 22,3232           35030                           CA       ZERO                                  #  ZERO ATTCADR
013639,000200: 22,3233           53312                           DXCH     ATTCADR                               
013640,000201: 
013641,000202: 22,3234           05166                           TC       SPVAC                                 #  RETURN TO USER
013642,000203: 
013643,000204: 22,3235           05321                           TC       TASKOVER                              
013644,000205: 
013645,000206: 

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