Source Code

These source-code files are part of a reconstructed copy of Luminary 96, the original release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 96 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

033371,000002:                                                                                                  ## Copyright:   Public domain.
033372,000003:                                                                                                  ## Filename:    THE_LUNAR_LANDING.agc
033373,000004:                                                                                                  ## Purpose:     A section of Luminary revision 96.
033374,000005:                                                                                                  ##              It is part of the reconstructed source code for the
033375,000006:                                                                                                  ##              original release of the flight software for the Lunar 
033376,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
033377,000008:                                                                                                  ##              The code has been recreated from a previously reconstructed
033378,000009:                                                                                                  ##              copy of Luminary 97 by undoing changes described in anomaly
033379,000010:                                                                                                  ##              report LNY-59. The code has been adapted such that the
033380,000011:                                                                                                  ##              resulting bugger words exactly match those specified for
033381,000012:                                                                                                  ##              Luminary 96 in NASA drawing 2021152D, which gives relatively
033382,000013:                                                                                                  ##              high confidence that the reconstruction is correct.
033383,000014:                                                                                                  ## Reference:   pp. 785-792
033384,000015:                                                                                                  ## Assembler:   yaYUL
033385,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033386,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033387,000018:                                                                                                  ## Mod history: 2019-08-04 MAS  Created from Luminary 97.
033388,000019: 

Page 785

033390,000021: 32,2776                                           BANK     32                                    
033391,000022: 32,2000                                           SETLOC   F2DPS*32                              
033392,000023: 32,2000                                           BANK                                           
033393,000024: 
033394,000025: 32,2776  E7,1621                                  EBANK=   E2DPS                                 
033395,000026: 
033396,000027:                                                                                                  #        ****************************************
033397,000028:                                                                                                  #        P63: THE LUNAR LANDING, BRAKING PHASE
033398,000029:                                                                                                  #        ****************************************
033399,000030: 
033400,000031: 32,2776                                           COUNT*   $$/P63                                
033401,000032: 
033402,000033: 32,2776           05353        P63LM              TC       PHASCHNG                              
033403,000034: 32,2777           04024                           OCT      04024                                 
033404,000035: 
033405,000036: 32,3000           04616                           TC       BANKCALL                              #  DO IMU STATUS CHECK ROUTINE R02
033406,000037: 32,3001           11254                           CADR     R02BOTH                               
033407,000038: 
033408,000039: 32,3002           33253                           CAF      P63ADRES                              #  INITIALIZE WHICH FOR BURNBABY
033409,000040: 32,3003           55455                           TS       WHICH                                 
033410,000041: 
033411,000042: 32,3004           32000                           CAF      DPSTHRSH                              #  INITIALIZE DVMON
033412,000043: 32,3005           55251                           TS       DVTHRUSH                              
033413,000044: 32,3006           34751                           CAF      FOUR                                  
033414,000045: 32,3007           55515                           TS       DVCNTR                                
033415,000046: 
033416,000047: 32,3010           44753                           CS       ONE                                   #  INITIALIZE WCHPHASE AND FLPASSO
033417,000048: 32,3011           55351                           TS       WCHPHASE                              
033418,000049: 
033419,000050: 32,3012           34755                           CA       ZERO                                  
033420,000051: 32,3013           55623                           TS       FLPASS0                               
033421,000052: 
033422,000053: 32,3014           44736                           CS       BIT14                                 
033423,000054: 32,3015           00006                           EXTEND                                         
033424,000055: 32,3016           03012                           WAND     CHAN12                                #  REMOVE TRACK-ENABLE DISCRETE.
033425,000056: 
033426,000057: 32,3017           06037        FLAGORGY           TC       INTPRET                               #  DIONYSIAN FLAG WAVING
033427,000058: 32,3020           43014                           CLEAR    CLEAR                                 
033428,000059: 32,3021           02663                                    NOTHROTL                              
033429,000060: 32,3022           03271                                    REDFLAG                               
033430,000061: 32,3023           43014                           CLEAR    SET                                   
033431,000062: 32,3024           05660                                    LRBYPASS                              
033432,000063: 32,3025           03067                                    MUNFLAG                               
033433,000064: 32,3026           43014                           CLEAR    CLEAR                                 
033434,000065: 32,3027           00266                                    P25FLAG                               #  TERMINATE P25 IF IT IS RUNNING.
033435,000066: 32,3030           00270                                    RNDVZFLG                              #  TERMINATE P20 IF IT IS RUNNING
033436,000067: 
033437,000068:                                                                                                  #  ****************************************
033438,000069: 
033439,000070: 32,3031           77201        IGNALG             SETPD    VLOAD                                 #  FIRST SET UP INPUTS FOR RP-TO-R:-

Page 786

033441,000072: 32,3032           00001                                    0                                     #        AT 0D LANDING SITE IN MOON FIXED FRAME
033442,000073: 32,3033           02023                                    RLS                                   #        AT 6D ESTIMATED TIME OF LANDING
033443,000074: 32,3034           41525                           PDDL     PUSH                                  #        MPAC NON-ZERO TO INDICATE LUNAR CASE
033444,000075: 32,3035           02401                                    TLAND                                 
033445,000076: 32,3036           37625                           STCALL   TPIP                                  #  ALSO SET TPIP FOR FIRST GUIDANCE PASS
033446,000077: 32,3037           55716                                    RP-TO-R                               
033447,000078: 32,3040           64312                           VSL4     MXV                                   
033448,000079: 32,3041           01734                                    REFSMMAT                              
033449,000080: 32,3042           37635                           STCALL   LAND                                  
033450,000081: 32,3043           46432                                    GUIDINIT                              #  GUIDINIT INITIALIZES WM AND /LAND/
033451,000082: 32,3044           45345                           DLOAD    DSU                                   
033452,000083: 32,3045           02401                                    TLAND                                 
033453,000084: 32,3046           25260                                    GUIDDURN                              
033454,000085: 32,3047           34041                           STCALL   TDEC1                                 #  INTEGRATE STATE FORWARD TO THAT TIME
033455,000086: 32,3050           27057                                    LEMPREC                               
033456,000087: 32,3051           77331                           SSP      VLOAD                                 
033457,000088: 32,3052           03647                                    NIGNLOOP                              
033458,000089: 32,3053           00050                                    40D                                   
033459,000090: 32,3054           06520                                    UNITX                                 
033460,000091: 32,3055           26603                           STOVL    CG                                    
033461,000092: 32,3056           06516                                    UNITY                                 
033462,000093: 32,3057           26611                           STOVL    CG         +6                         
033463,000094: 32,3060           06514                                    UNITZ                                 
033464,000095: 32,3061           16617                           STODL    CG         +14                        
033465,000096: 32,3062           25256                                    99999CON                              
033466,000097: 32,3063           27665                           STOVL    DELTAH                                #  INITIALIZE DELTAH FOR V16N68 DISPLAY
033467,000098: 32,3064           06522                                    ZEROVECS                              
033468,000099: 32,3065           17254                           STODL    UNFC/2                                #  INITIALIZE TRIM VELOCITY CORRECTION TERM
033469,000100: 32,3066           06522                                    HI6ZEROS                              
033470,000101: 32,3067           03643                           STORE    TTF/8                                 
033471,000102: 
033472,000103: 32,3070           77745        IGNALOOP           DLOAD                                          
033473,000104: 32,3071           00015                                    TAT                                   
033474,000105: 32,3072           27561                           STOVL    PIPTIME1                              
033475,000106: 32,3073           00017                                    RATT1                                 
033476,000107: 32,3074           64312                           VSL4     MXV                                   
033477,000108: 32,3075           01734                                    REFSMMAT                              
033478,000109: 32,3076           37521                           STCALL   R                                     
033479,000110: 32,3077           67130                                    MUNGRAV                               
033480,000111: 32,3100           35237                           STCALL   GDT/2                                 
033481,000112: 32,3101           62454                                    ?GUIDSUB                              #  WHICH DELIVERS N PASSES OF GUIDANCE
033482,000113: 
033483,000114:                                                                                                  #  DDUMCALC IS PROGRAMMED AS FOLLOWS:-
033484,000115:                                                                                                  #                                          2                                           -
033485,000116:                                                                                                  #               (RIGNZ - RGU )/16 + 16(RGU  )KIGNY/B8 + (RGU - RIGNX)KIGNX/B4 + (ABVAL(VGU) - VIGN)KIGNV/B4
033486,000117:                                                                                                  #                           2             1                 0
033487,000118:                                                                                                  #        DDUM = -------------------------------------------------------------------------------------------
033488,000119:                                                                                                  #                                                 10
033489,000120:                                                                                                  #                                                2   (VGU - 16 VGU KIGNX/B4)

Page 787

033491,000122:                                                                                                  #                                                        2        0
033492,000123:                                                                                                  #  THE NUMERATOR IS SCALED IN METERS AT 2(28).  THE DENOMINATOR IS A VELOCITY IN UNITS OF 2(10) M/CS.
033493,000124:                                                                                                  #  THE QUOTIENT IS THUS A TIME IN UNITS OF 2(18) CENTISECONDS.  THE FINAL SHIFT RESCALES TO UNITS OF 2(28) CS.
033494,000125:                                                                                                  #  THERE IS NO DAMPING FACTOR.  THE CONSTANTS KIGNX/B4, KIGNY/B8 AND KIGNV/B4 ARE ALL NEGATIVE IN SIGN.
033495,000126: 
033496,000127: 32,3102           55646        DDUMCALC           TS       NIGNLOOP                              
033497,000128: 32,3103           06037                           TC       INTPRET                               
033498,000129: 32,3104           57345                           DLOAD    DMPR                                  #  FORM DENOMINATOR FIRST
033499,000130: 32,3105           03627                                    VGU                                   
033500,000131: 32,3106           02501                                    KIGNX/B4                              
033501,000132: 32,3107           44232                           SL4R     BDSU                                  
033502,000133: 32,3110           03633                                    VGU        +4                         
033503,000134: 32,3111           45325                           PDDL     DSU                                   
033504,000135: 32,3112           02477                                    RIGNZ                                 
033505,000136: 32,3113           02643                                    RGU        +4                         
033506,000137: 32,3114           65222                           SR4R     PDDL                                  
033507,000138: 32,3115           02641                                    RGU        +2                         
033508,000139: 32,3116           57316                           DSQ      DMPR                                  
033509,000140: 32,3117           02503                                    KIGNY/B8                              
033510,000141: 32,3120           65232                           SL4R     PDDL                                  
033511,000142: 32,3121           02637                                    RGU                                   
033512,000143: 32,3122           57225                           DSU      DMPR                                  
033513,000144: 32,3123           02475                                    RIGNX                                 
033514,000145: 32,3124           02501                                    KIGNX/B4                              
033515,000146: 32,3125           51515                           PDVL     ABVAL                                 
033516,000147: 32,3126           03627                                    VGU                                   
033517,000148: 32,3127           57225                           DSU      DMPR                                  
033518,000149: 32,3130           02473                                    VIGN                                  
033519,000150: 32,3131           02505                                    KIGNV/B4                              
033520,000151: 32,3132           43215                           DAD      DAD                                   
033521,000152: 32,3133           56215                           DAD      DDV                                   
033522,000153: 32,3134           77661                           SRR                                            
033523,000154: 32,3135           21613                                    10D                                   
033524,000155: 
033525,000156: 32,3136           43206                           PUSH     DAD                                   
033526,000157: 32,3137           03561                                    PIPTIME1                              
033527,000158: 32,3140           14041                           STODL    TDEC1                                 #  STORE NEW GUESS FOR NEXT INTEGRATION
033528,000159: 32,3141           45246                           ABS      DSU                                   
033529,000160: 32,3142           25262                                    DDUMCRIT                              
033530,000161: 32,3143           45040                           BMN      CALL                                  
033531,000162: 32,3144           65163                                    DDUMGOOD                              
033532,000163: 32,3145           27414                                    INTSTALL                              
033533,000164: 32,3146           43014                           SET      SET                                   
033534,000165: 32,3147           01473                                    INTYPFLG                              
033535,000166: 32,3150           00063                                    MOONFLAG                              
033536,000167: 32,3151           77745                           DLOAD                                          
033537,000168: 32,3152           03561                                    PIPTIME1                              
033538,000169: 32,3153           25517                           STOVL    TET                                   #  HOPEFULLY ?GUIDSUB DID NOT
033539,000170: 32,3154           00017                                    RATT1                                 #        CLOBBER RATT1 AND VATT1

Page 788

033541,000172: 32,3155           25535                           STOVL    RCV                                   
033542,000173: 32,3156           00025                                    VATT1                                 
033543,000174: 32,3157           35543                           STCALL   VCV                                   
033544,000175: 32,3160           27107                                    INTEGRVS                              
033545,000176: 32,3161           77650                           GOTO                                           
033546,000177: 32,3162           65070                                    IGNALOOP                              
033547,000178: 
033548,000179: 32,3163           54335        DDUMGOOD           SLOAD    SR                                    
033549,000180: 32,3164           03423                                    ZOOMTIME                              
033550,000181: 32,3165           20617                                    14D                                   
033551,000182: 32,3166           77621                           BDSU                                           
033552,000183: 32,3167           00041                                    TDEC1                                 
033553,000184: 32,3170           27442                           STOVL    TIG                                   #  COMPUTE DISTANCE LANDING SITE WILL BE
033554,000185: 32,3171           03527                                    V                                     #        OUT OF LM'S ORBITAL PLANE AT IGNITION:
033555,000186: 32,3172           53435                           VXV      UNIT                                  #        SIGN IS + IF LANDING SITE IS TO THE
033556,000187: 32,3173           03521                                    R                                     #        RIGHT, NORTH; - IF TO THE LEFT, SOUTH.
033557,000188: 32,3174           72441                           DOT      SL1                                   
033558,000189: 32,3175           03635                                    LAND                                  
033559,000190: 32,3176           26627        R60INIT            STOVL    OUTOFPLN                              #  INITIALIZATION FOR CALCMANU
033560,000191: 32,3177           03254                                    UNFC/2                                
033561,000192: 32,3200           02631                           STORE    R60VSAVE                              #  STORE UNFC/2 TEMPORARILY IN R60SAVE
033562,000193: 32,3201           77776                           EXIT                                           
033563,000194:                                                                                                  #  ****************************************
033564,000195: 
033565,000196: 32,3202           05353        IGNALGRT           TC       PHASCHNG                              #  PREVENT REPEATING IGNALG
033566,000197: 32,3203           04024                           OCT      04024                                 
033567,000198: 
033568,000199: 32,3204           44362        ASTNCLOK           CS       ASTNDEX                               
033569,000200: 32,3205           04616                           TC       BANKCALL                              
033570,000201: 32,3206           74664                           CADR     STCLOK2                               
033571,000202: 32,3207           15155                           TCF      ENDOFJOB                              #  RETURN IN NEW JOB AND IN EBANK FIVE
033572,000203: 
033573,000204: 32,3210           06037        ASTNRET            TC       INTPRET                               
033574,000205: 32,3211           47131                           SSP      RTB                                   #  GO PICK UP DISPLAY AT END OF R51:
033575,000206: 32,3212           02747                                    QMAJ                                  #        "PROCEED" WILL DO A FINE ALIGNMENT
033576,000207: 32,3213           65215                           FCADR    P63SPOT2                              #        "ENTER" WILL RETURN TO P63SPOT2
033577,000208: 32,3214           31135                                    R51P63                                
033578,000209: 32,3215           53575        P63SPOT2           VLOAD    UNIT                                  #  INITIALIZE KALCMANU FOR BURN ATTITUDE
033579,000210: 32,3216           02631                                    R60VSAVE                              
033580,000211: 32,3217           27773                           STOVL    POINTVSM                              
033581,000212: 32,3220           06520                                    UNITX                                 
033582,000213: 32,3221           03765                           STORE    SCAXIS                                
033583,000214: 32,3222           77776                           EXIT                                           
033584,000215: 
033585,000216: 32,3223           35016                           CAF      EBANK7                                
033586,000217: 32,3224           54003                           TS       EBANK                                 
033587,000218: 
033588,000219: 32,3225           00004                           INHINT                                         
033589,000220: 32,3226           04674                           TC       IBNKCALL                              
033590,000221: 32,3227           40142                           CADR     PFLITEDB                              

Page 789

033592,000223: 32,3230           00003                           RELINT                                         
033593,000224: 
033594,000225: 32,3231           04616                           TC       BANKCALL                              
033595,000226: 32,3232           54123                           CADR     R60LEM                                
033596,000227: 
033597,000228: 32,3233           05353                           TC       PHASCHNG                              #  PREVENT RECALLING R60
033598,000229: 32,3234           04024                           OCT      04024                                 
033599,000230: 
033600,000231: 32,3235           34746        P63SPOT3           CA       BIT6                                  #  IS THE LR ANTENNA IN POSITION 1 YET
033601,000232: 32,3236           00006                           EXTEND                                         
033602,000233: 32,3237           02033                           RAND     CHAN33                                
033603,000234: 32,3240           00006                           EXTEND                                         
033604,000235: 32,3241           13247                           BZF      P63SPOT4                              #  BRANCH IF ANTENNA ALREADY IN POSITION 1
033605,000236: 
033606,000237: 32,3242           33254                           CAF      CODE500                               #  ASTRONAUT:    PLEASE CRANK THE
033607,000238: 32,3243           04616                           TC       BANKCALL                              #                SILLY THING AROUND
033608,000239: 32,3244           20623                           CADR     GOPERF1                               
033609,000240: 32,3245           16001                           TCF      GOTOPOOH                              #  TERMINATE
033610,000241: 32,3246           13235                           TCF      P63SPOT3                              #  PROCEED       SEE IF HE'S LYING
033611,000242: 
033612,000243: 32,3247           04616        P63SPOT4           TC       BANKCALL                              #  ENTER         INITIALIZE LANDING RADAR
033613,000244: 32,3250           67701                           CADR     SETPOS1                               
033614,000245: 
033615,000246: 32,3251           04635                           TC       POSTJUMP                              #  OFF TO SEE THE WIZARD ...
033616,000247: 32,3252           74126                           CADR     BURNBABY                              
033617,000248: 
033618,000249:                                                                                                  #        ----------------------------------------
033619,000250: 
033620,000251:                                                                                                  #  CONSTANTS FOR P63LM AND IGNALG
033621,000252: 
033622,000253: 32,3253           02076        P63ADRES           GENADR   P63TABLE                              
033623,000254: 
033624,000255: 32,3254     4362               ASTNDEX            =        MD1                                   #  OCT 25; INDEX FOR CLOKTASK
033625,000256: 
033626,000257: 32,3254           00500        CODE500            OCT      00500                                 
033627,000258: 
033628,000259: 32,3255           00035 30373  99999CON           2DEC     30479.7    B-24                       
033629,000260: 
033630,000261: 32,3257           00004 01610  GUIDDURN           2DEC     +66440     B-28                       #  GUIDDURN +6.64400314 E+2
033631,000262: 32,3261           00000 00010  DDUMCRIT           2DEC     +8         B-28                       #  CRITERION FOR IGNALG CONVERGENCE
033632,000263: 

Page 790

033634,000265:                                                                                                  #        ----------------------------------------
033635,000266: 

Page 791

033637,000268:                                                                                                  #        ****************************************
033638,000269:                                                                                                  #        P68: LANDING CONFIRMATION
033639,000270:                                                                                                  #        ****************************************
033640,000271: 
033641,000272: 31,2144                                           BANK     31                                    
033642,000273: 31,2000                                           SETLOC   F2DPS*31                              
033643,000274: 31,2000                                           BANK                                           
033644,000275: 
033645,000276: 31,2144                                           COUNT*   $$/P6567                              
033646,000277: 
033647,000278: 31,2144           05353        LANDJUNK           TC       PHASCHNG                              
033648,000279: 31,2145           04024                           OCT      04024                                 
033649,000280: 
033650,000281: 31,2146           00004                           INHINT                                         
033651,000282: 31,2147           04616                           TC       BANKCALL                              #  ZERO ATTITUDE ERROR
033652,000283: 31,2150           40153                           CADR     ZATTEROR                              
033653,000284: 
033654,000285: 31,2151           04616                           TC       BANKCALL                              #  SET 5 DEGREE DEADBAND
033655,000286: 31,2152           40127                           CADR     SETMAXDB                              
033656,000287: 
033657,000288: 31,2153           06037                           TC       INTPRET                               #  TO INTERPRETIVE AS TIME IS NOT CRITICAL
033658,000289: 31,2154           43014                           SET      CLEAR                                 
033659,000290: 31,2155           04067                                    SURFFLAG                              
033660,000291: 31,2156           04666                                    LETABORT                              
033661,000292: 31,2157           77214                           SET      VLOAD                                 
033662,000293: 31,2160           05062                                    APSFLAG                               
033663,000294: 31,2161           01221                                    RN                                    
033664,000295: 31,2162           16032                           STODL    ALPHAV                                
033665,000296: 31,2163           01235                                    PIPTIME                               
033666,000297: 31,2164           45014                           SET      CALL                                  
033667,000298: 31,2165           01463                                    LUNAFLAG                              
033668,000299: 31,2166           26351                                    LAT-LONG                              
033669,000300: 31,2167           77201                           SETPD    VLOAD                                 #  COMPUTE RLS AND STORE IT AWAY
033670,000301: 31,2170           00001                                    0                                     
033671,000302: 31,2171           01221                                    RN                                    
033672,000303: 31,2172           65352                           VSL2     PDDL                                  
033673,000304: 31,2173           01235                                    PIPTIME                               
033674,000305: 31,2174           45006                           PUSH     CALL                                  
033675,000306: 31,2175           51670                                    R-TO-RP                               
033676,000307: 31,2176           02023                           STORE    RLS                                   
033677,000308: 31,2177           77776                           EXIT                                           
033678,000309: 31,2200           32215                           CAF      V06N43*                               #  ASTRONAUT:  NOW LOOK WHERE YOU ENDED UP
033679,000310: 31,2201           04616                           TC       BANKCALL                              
033680,000311: 31,2202           20476                           CADR     GOFLASH                               
033681,000312: 31,2203           16001                           TCF      GOTOPOOH                              #  TERMINATE
033682,000313: 31,2204           12206                           TCF      +2                                    #  PROCEED
033683,000314: 31,2205           12200                           TCF      -5                                    #  RECYCLE
033684,000315: 
033685,000316: 31,2206           06037                           TC       INTPRET                               

Page 792

033687,000318: 31,2207           77775                           VLOAD                                          #  INITIALIZE GSAV AND (USING REFMF)
033688,000319: 31,2210           06520                                    UNITX                                 #  YNBSAV, ZNBSAV AND ATTFLAG FOR P57
033689,000320: 31,2211           36231                           STCALL   GSAV                                  
033690,000321: 31,2212           33506                                    REFMF                                 
033691,000322: 31,2213           77776                           EXIT                                           
033692,000323: 
033693,000324: 31,2214           16001                           TCF      GOTOPOOH                              #  ASTRONAUT:  PLEASE SELECT P57
033694,000325: 
033695,000326: 31,2215           01453        V06N43*            VN       0643                                  
033696,000327: 

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