Source Code

These source code files are an attempted reconstruction of Sundance revision 306, 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
These dumps were then modified using memos, checklists, observed address changes, and the Sundance GSOPs to get the entire program to match Sundance revision 306 as closely as possible. Without more information, it is not possible to say how close it actually is; however, this code should be quite close. It is capable of flying the whole Apollo 9 mission using the original checklists and padload. 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.

027334,000002:                                                                                                  ## Copyright:   Public domain.
027335,000003:                                                                                                  ## Filename:    R31.agc
027336,000004:                                                                                                  ## Purpose:     A section of an attempt to reconstruct Sundance revision 306
027337,000005:                                                                                                  ##              as closely as possible with available information. Sundance
027338,000006:                                                                                                  ##              306 is the source code for the Lunar Module's (LM) Apollo
027339,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 9. This program was created
027340,000008:                                                                                                  ##              using the mixed-revision SundanceXXX as a starting point, and
027341,000009:                                                                                                  ##              pulling back features from Luminary 69 believed to have been
027342,000010:                                                                                                  ##              added based on memos, checklists, observed address changes,
027343,000011:                                                                                                  ##              or the Sundance GSOPs.
027344,000012:                                                                                                  ## Assembler:   yaYUL
027345,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
027346,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
027347,000015:                                                                                                  ## Mod history: 2020-07-24 MAS  Created from SundanceXXX.
027348,000016:                                                                                                  ##              2021-05-30 ABS  Aligned IAW to field boundary.
027349,000017: 
027350,000018: 
027351,000019: 
027352,000020: 34,3411                                           BANK     34                                    
027353,000021: 37,2000                                           SETLOC   R31                                   
027354,000022: 37,2000                                           BANK                                           
027355,000023: 
027356,000024: 37,3237                                           COUNT*   $$/R31                                
027357,000025: 
027358,000026: 37,3237           30105        DISPN5X            CA       FLAGWRD9                              #  TEST R31FLAG (IN SUNDANCE R31FLAG WILL
027359,000027: 37,3240           75023                           MASK     BIT4                                  #      ALWAYS BE SET AS R34 DOES NOT EXIST)
027360,000028: 37,3241           00006                           EXTEND                                         
027361,000029: 37,3242           13245                           BZF      +3                                    
027362,000030: 37,3243           33366                           CAF      V06N54                                #  R31    USE NOUN 54
027363,000031: 37,3244           03246                           TC       +2                                    
027364,000032: 37,3245           33367                           CAF      V06N53                                #  R34    USE NOUN 53
027365,000033: 37,3246           04655                           TC       BANKCALL                              
027366,000034: 37,3247           20245                           CADR     GOMARKFR                              
027367,000035: 37,3250           05645                           TC       B5OFF                                 
027368,000036: 37,3251           05645                           TC       B5OFF                                 
027369,000037: 37,3252           05225                           TC       ENDOFJOB                              
027370,000038: 
027371,000039: 37,3253           35013                           CAF      PRIO4                                 
027372,000040: 37,3254           05216                           TC       PRIOCHNG                              
027373,000041: 37,3255           35044                           CAF      .5SEC                                 
027374,000042: 37,3256           04655                           TC       BANKCALL                              
027375,000043: 37,3257           01732                           CADR     DELAYJOB                              
027376,000044: 
027377,000045: 37,3260           06014        V83                TC       INTPRET                               
027378,000046: 37,3261           77624                           CALL                                           
027379,000047: 37,3262           77504                                    REDOEXTP                              
027380,000048: 37,3263           77650                           GOTO                                           
027381,000049: 37,3264           77270                                    COMPDISP                              
027382,000050: 37,3265           06014        V83CALL            TC       INTPRET                               
027383,000051: 37,3266           77624                           CALL                                           
027384,000052: 37,3267           77370                                    STATEXTP                              #  EXTRAPOLATE STATE VECTORS
027385,000053: 37,3270           52375        COMPDISP           VLOAD    VSU                                   
027386,000054: 37,3271           00001                                    RATT                                  
027387,000055: 37,3272           02215                                    RONE                                  
027388,000056: 37,3273           51406                           PUSH     ABVAL                                 #  RATT-RONE TO 0D               PD = 6
027389,000057: 37,3274           02207                           STORE    RANGE                                 #  METERS B-29
027390,000058: 37,3275           77301                           NORM     VLOAD                                 
027391,000059: 37,3276           00047                                    X1                                    #  RATT-RONE                     PD = 0
027392,000060: 37,3277           53457                           VSL*     UNIT                                  
027393,000061: 37,3300           20201                                    0,1                                   
027394,000062: 37,3301           52315                           PDVL     VSU                                   #  UNIT(LOS) TO 0D              PD = 6
027395,000063: 37,3302           00007                                    VATT                                  
027396,000064: 37,3303           02223                                    VONE                                  
027397,000065: 37,3304           77641                           DOT                                            #  (VATT-VONE).UNIT(LOS)        PD = 0
027398,000066: 37,3305           77752                           SL1                                            
027399,000067: 37,3306           36211                           STCALL   RRATE                                 #  RANGE RATE M/CS B-7
027400,000068: 37,3307           47335                                    CDUTRIG                               #  TO INITIALIZE FOR *NBSM*
027401,000069: 37,3310           53575        R34ANG             VLOAD    UNIT                                  
027402,000070: 37,3311           02215                                    RONE                                  
027403,000071: 37,3312           77715                           PDVL                                           #  UR TO 0D                    PD= 6
027404,000072: 37,3313           06225                                    THISAXIS                              #  UNITX FOR CM, UNITZ FOR LM
027405,000073: 37,3314           77214                           BON      VLOAD                                 #  CHK R31FLAG. ON=R31 THETA, OFF=R34 PHI
027406,000074: 37,3315           04713                                    R31FLAG                               
027407,000075: 37,3316           77320                                    +2                                    #      R31-THETA
027408,000076: 37,3317           06225                                    THISAXIS                              
027409,000077: 37,3320           77624                           CALL                                           
027410,000078: 37,3321           47501                                    *NBSM*                                
027411,000079: 37,3322           41505                           VXM      PUSH                                  #  UXORZ TO 6D                  PD=12D
027412,000080: 37,3323           01736                                    REFSMMAT                              
027413,000081: 37,3324           72431                           VPROJ    VSL2                                  
027414,000082: 37,3325           00001                                    0D                                    
027415,000083: 37,3326           53445                           BVSU     UNIT                                  
027416,000084: 37,3327           00007                                    6D                                    
027417,000085: 37,3330           47315                           PDVL     VXV                                   #  UP/2 TO 12D                  PD=18D
027418,000086: 37,3331           02215                                    RONE                                  
027419,000087: 37,3332           02223                                    VONE                                  
027420,000088: 37,3333           47256                           UNIT     VXV                                   
027421,000089: 37,3334           02215                                    RONE                                  
027422,000090: 37,3335           63241                           DOT      PDVL                                  #  SIGN TO 12D, UP/2 TO MPAC    PD=18D
027423,000091: 37,3336           00015                                    12D                                   
027424,000092: 37,3337           50372                           VSL1     DOT                                   #  UP.UXORZ
027425,000093: 37,3340           00007                                    6D                                    
027426,000094: 37,3341           72565                           SIGN     SL1                                   
027427,000095: 37,3342           00015                                    12D                                   
027428,000096: 37,3343           77726                           ACOS                                           
027429,000097: 37,3344           26213                           STOVL    RTHETA                                
027430,000098: 37,3345           02215                                    RONE                                  
027431,000099: 37,3346           51041                           DOT      BPL                                   
027432,000100: 37,3347           00007                                    6D                                    
027433,000101: 37,3350           77355                                    +5                                    
027434,000102: 37,3351           44345                           DLOAD    BDSU                                  #  IF UXORZ.R NEG, RTHETA = 1 - RTHETA
027435,000103: 37,3352           02213                                    RTHETA                                
027436,000104: 37,3353           06241                                    DPPOSMAX                              
027437,000105: 37,3354           02213                           STORE    RTHETA                                #  RTHETA BETWEEN 0 AND 1 REV.
027438,000106: 37,3355           77776                           EXIT                                           
027439,000107: 37,3356           35022                           CAF      BIT5                                  #  HAVE WE BEEN ANSWERED
027440,000108: 37,3357           71045                           MASK     EXTVBACT                              
027441,000109: 37,3360           00006                           EXTEND                                         
027442,000110: 37,3361           15564                           BZF      ENDEXT                                #  YES, DIE
027443,000111: 
027444,000112: 37,3362           07766                           TC       SETXDSP                               
027445,000113: 37,3363           04655                           TC       BANKCALL                              
027446,000114: 37,3364           20271                           CADR     MARKBRAN                              
027447,000115: 
027448,000116: 37,3365           13237                           TCF      DISPN5X                               
027449,000117: 37,3366           01466        V06N54             VN       0654                                  
027450,000118: 37,3367           01465        V06N53             VN       0653                                  
027451,000119: 
027452,000120:                                                                                                  #  THE STATEXTP SUBROUTINE DOES A PRECISION EXTRAPOLATION OF BOTH VEHICLES
027453,000121:                                                                                                  #  STATE VECTORS TO PRESENT TIME AND SAVES THEM AS BASE VECTORS.
027454,000122:                                                                                                  #  IF SERVICER IS OFF ---
027455,000123:                                                                                                  #                  THIS VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED TO
027456,000124:                                                                                                  #                  PRESENT TIME AND SAVED AS RONE, VONE.
027457,000125:                                                                                                  #                  THE OTHER VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED
027458,000126:                                                                                                  #                  TO THE SAME TIME, THE OUTPUT BEING LEFT IN RATT, VATT.
027459,000127:                                                                                                  #  IF SERVICER IS ON ---
027460,000128:                                                                                                  #                  RONE, VONE ARE SET EQUAL TO RN, VN AND THE OTHER
027461,000129:                                                                                                  #                  VEHICLES STATE VECTOR IS PREC. EXTRAPOLATED TO PIPTIME.
027462,000130: 
027463,000131: 37,3370           47020        STATEXTP           STQ      RTB                                   
027464,000132: 37,3371           02120                                    STATEXIT                              
027465,000133: 37,3372           21454                                    LOADTIME                              
027466,000134: 37,3373           34041                           STCALL   TDEC1                                 
027467,000135: 37,3374           27014                                    OTHPREC                               #  GET BASE VECTORS
027468,000136: 37,3375           77775                           VLOAD                                          
027469,000137: 37,3376           00017                                    RATT1                                 
027470,000138: 37,3377           26142                           STOVL    BASEOTP                               #  OTHER POS.
027471,000139: 37,3400           00025                                    VATT1                                 
027472,000140: 37,3401           16122                           STODL    BASEOTV                               #  OTHER VEL.
027473,000141: 37,3402           00015                                    TAT                                   
027474,000142: 37,3403           02116                           STORE    BASETIME                              
027475,000143: 37,3404           34041                           STCALL   TDEC1                                 
027476,000144: 37,3405           27030                                    THISPREC                              
027477,000145: 37,3406           77775                           VLOAD                                          
027478,000146: 37,3407           00017                                    RATT1                                 
027479,000147: 37,3410           26172                           STOVL    BASETHP                               #  THIS POS.
027480,000148: 37,3411           00025                                    VATT1                                 
027481,000149: 37,3412           02107                           STORE    BASETHV                               #  THIS VEL
027482,000150: 37,3413           47014        HAVEBASE           BON      RTB                                   
027483,000151: 37,3414           03711                                    V37FLAG                               
027484,000152: 37,3415           77471                                    GETRVN                                #  IF AVG ON ,GET RN ETC.
027485,000153: 37,3416           21454                                    LOADTIME                              
027486,000154: 37,3417           34041                           STCALL   TDEC1                                 #  BEGIN SET UP FOR CONIC EXTRAP. FOR THIS.
027487,000155: 37,3420           27362                                    INTSTALL                              
027488,000156: 37,3421           43175                           VLOAD    CLEAR                                 
027489,000157: 37,3422           02172                                    BASETHP                               
027490,000158: 37,3423           00263                                    MOONFLAG                              
027491,000159: 37,3424           25535                           STOVL    RCV                                   
027492,000160: 37,3425           02107                                    BASETHV                               
027493,000161: 37,3426           15543                           STODL    VCV                                   
027494,000162: 37,3427           02116                                    BASETIME                              
027495,000163: 37,3430           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
027496,000164: 37,3431           04344                                    MOONTHIS                              
027497,000165: 37,3432           77434                                    +2                                    
027498,000166: 37,3433           00063                                    MOONFLAG                              
027499,000167: 37,3434           77614                           SET                                            
027500,000168: 37,3435           01473                                    INTYPFLG                              #  CONIC EXTRAP.
027501,000169: 37,3436           35517                           STCALL   TET                                   
027502,000170: 37,3437           27060                                    INTEGRVS                              #  INTEGRATION --- AT LAST---
027503,000171: 37,3440           77775        OTHCONIC           VLOAD                                          
027504,000172: 37,3441           00001                                    RATT                                  
027505,000173: 37,3442           26215                           STOVL    RONE                                  
027506,000174: 37,3443           00007                                    VATT                                  
027507,000175: 37,3444           36223                           STCALL   VONE                                  #  GET SET FOR CONIC EXTRAP.,OTHER.
027508,000176: 37,3445           27362                                    INTSTALL                              
027509,000177: 37,3446           71214                           SET      DLOAD                                 
027510,000178: 37,3447           01473                                    INTYPFLG                              
027511,000179: 37,3450           00015                                    TAT                                   
027512,000180: 37,3451           00041        OTHINT             STORE    TDEC1                                 
027513,000181: 37,3452           43175                           VLOAD    CLEAR                                 
027514,000182: 37,3453           02142                                    BASEOTP                               
027515,000183: 37,3454           00263                                    MOONFLAG                              
027516,000184: 37,3455           25535                           STOVL    RCV                                   
027517,000185: 37,3456           02122                                    BASEOTV                               
027518,000186: 37,3457           15543                           STODL    VCV                                   
027519,000187: 37,3460           02116                                    BASETIME                              
027520,000188: 37,3461           43014                           BOF      SET                                   
027521,000189: 37,3462           04344                                    MOONTHIS                              
027522,000190: 37,3463           77465                                    +2                                    
027523,000191: 37,3464           00063                                    MOONFLAG                              
027524,000192: 37,3465           35517                           STCALL   TET                                   
027525,000193: 37,3466           27060                                    INTEGRVS                              
027526,000194: 37,3467           77650                           GOTO                                           
027527,000195: 37,3470           02120                                    STATEXIT                              #  THIS VEHICLES POS.,VEL. IN PUSHLIST.
027528,000196: 37,3471           77775        GETRVN             VLOAD                                          
027529,000197: 37,3472           01220                                    RN                                    
027530,000198: 37,3473           26215                           STOVL    RONE                                  
027531,000199: 37,3474           01226                                    VN                                    
027532,000200: 37,3475           16223                           STODL    VONE                                  
027533,000201: 37,3476           01234                                    PIPTIME                               
027534,000202: 37,3477           77624                           CALL                                           
027535,000203: 37,3500           27362                                    INTSTALL                              
027536,000204: 37,3501           52014                           CLEAR    GOTO                                  
027537,000205: 37,3502           01673                                    INTYPFLG                              #  PREC EXTRAP FOR OTHER
027538,000206: 37,3503           77451                                    OTHINT                                
027539,000207: 37,3504           52020        REDOEXTP           STQ      GOTO                                  
027540,000208: 37,3505           02120                                    STATEXIT                              
027541,000209: 37,3506           77413                                    HAVEBASE                              
027542,000210: 

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