Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

034310,000002:                                                                                                  ## Copyright:   Public domain.
034311,000003:                                                                                                  ## Filename:    THE_LUNAR_LANDING.agc
034312,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
034313,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
034314,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
034315,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
034316,000008:                                                                                                  ##              that the code format has been changed to conform to the
034317,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
034318,000010:                                                                                                  ##              original YUL assembler.
034319,000011:                                                                                                  ## Reference:   pp. 781-788
034320,000012:                                                                                                  ## Assembler:   yaYUL
034321,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
034322,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
034323,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
034324,000016:                                                                                                  ##              2016-11-29 HG   Transcribed
034325,000017:                                                                                                  ##              2016-12-07 HG   Fix P00 -> POO
034326,000018:                                                                                                  ##              2016-12-25 RSB  Comment-text proofed using ProoferComments
034327,000019:                                                                                                  ##                              and corrected errors found.
034328,000020:                                                                                                  ##              2017-03-13 RSB  Comment-text fixes noted in proofing Luminary 116.
034329,000021: 

Page 781

034331,000023: 32,2602                                           BANK     32                                    
034332,000024: 32,2000                                           SETLOC   F2DPS*32                              
034333,000025: 32,2000                                           BANK                                           
034334,000026: 
034335,000027: 32,2602  E7,1621                                  EBANK=   E2DPS                                 
034336,000028: 
034337,000029:                                                                                                  #        ****************************************
034338,000030:                                                                                                  #        P63: THE LUNAR LANDING, BRAKING PHASE
034339,000031:                                                                                                  #        ****************************************
034340,000032: 
034341,000033: 32,2602                                           COUNT*   $$/P63                                
034342,000034: 
034343,000035: 32,2602           05355        P63LM              TC       PHASCHNG                              
034344,000036: 32,2603           04024                           OCT      04024                                 
034345,000037: 
034346,000038: 32,2604           04607                           TC       BANKCALL                              #  DO IMU STATUS CHECK ROUTINE R02
034347,000039: 32,2605           33757                           CADR     R02BOTH                               
034348,000040: 
034349,000041: 32,2606           33063                           CAF      P63ADRES                              #  INITIALIZE WHICH FOR BURNBABY
034350,000042: 32,2607           55455                           TS       WHICH                                 
034351,000043: 
034352,000044: 32,2610           32000                           CAF      DPSTHRSH                              #  INITIALIZE DVMON
034353,000045: 32,2611           55250                           TS       DVTHRUSH                              
034354,000046: 32,2612           34742                           CAF      FOUR                                  
034355,000047: 32,2613           55515                           TS       DVCNTR                                
034356,000048: 
034357,000049: 32,2614           44744                           CS       ONE                                   #  INITIALIZE WCHPHASE AND FLPASSO
034358,000050: 32,2615           55346                           TS       WCHPHASE                              
034359,000051: 
034360,000052: 32,2616           34746                           CA       ZERO                                  
034361,000053: 32,2617           55623                           TS       FLPASS0                               
034362,000054: 
034363,000055: 32,2620           44727                           CS       BIT14                                 
034364,000056: 32,2621           00006                           EXTEND                                         
034365,000057: 32,2622           03012                           WAND     CHAN12                                #  REMOVE TRACK-ENABLE DISCRETE.
034366,000058: 
034367,000059: 32,2623           06060        FLAGORGY           TC       INTPRET                               #  DIONYSIAN FLAG WAVING
034368,000060: 32,2624           77614                           CLEAR                                          
034369,000061: 32,2625           00664                                    NOTERFLG                              #  PERMIT TERRAIN MODEL
034370,000062: 32,2626           43014                           CLEAR    CLEAR                                 
034371,000063: 32,2627           02663                                    NOTHROTL                              
034372,000064: 32,2630           03271                                    REDFLAG                               
034373,000065: 32,2631           43014                           CLEAR    SET                                   
034374,000066: 32,2632           05660                                    LRBYPASS                              
034375,000067: 32,2633           03067                                    MUNFLAG                               
034376,000068: 32,2634           43014                           CLEAR    CLEAR                                 
034377,000069: 32,2635           00266                                    P25FLAG                               #  TERMINATE P25 IF IT IS RUNNING.
034378,000070: 32,2636           00270                                    RNDVZFLG                              #  TERMINATE P20 IF IT IS RUNNING
034379,000071: 
034380,000072:                                                                                                  #  ****************************************
034381,000073: 

Page 782

034383,000075: 32,2637           77201        IGNALG             SETPD    VLOAD                                 #  FIRST SET UP INPUTS FOR RP-TO-R:-
034384,000076: 32,2640           00001                                    0                                     #    AT 0D LANDING SITE IN MOON FIXED FRAME
034385,000077: 32,2641           02021                                    RLS                                   #    AT 6D ESTIMATED TIME OF LANDING
034386,000078: 32,2642           41525                           PDDL     PUSH                                  #    MPAC NON-ZERO TO INDICATE LUNAR CASE
034387,000079: 32,2643           02027                                    TLAND                                 
034388,000080: 32,2644           37625                           STCALL   TPIP                                  #  ALSO SET TPIP FOR FIRST GUIDANCE PASS
034389,000081: 32,2645           55716                                    RP-TO-R                               
034390,000082: 32,2646           64312                           VSL4     MXV                                   
034391,000083: 32,2647           01732                                    REFSMMAT                              
034392,000084: 32,2650           37635                           STCALL   LAND                                  
034393,000085: 32,2651           71346                                    GUIDINIT                              #  GUIDINIT INITIALIZES WM AND /LAND/
034394,000086: 32,2652           45345                           DLOAD    DSU                                   
034395,000087: 32,2653           02027                                    TLAND                                 
034396,000088: 32,2654           25070                                    GUIDDURN                              
034397,000089: 32,2655           34041                           STCALL   TDEC1                                 #  INTEGRATE STATE FORWARD TO THAT TIME
034398,000090: 32,2656           27115                                    LEMPREC                               
034399,000091: 32,2657           77331                           SSP      VLOAD                                 
034400,000092: 32,2660           03647                                    NIGNLOOP                              
034401,000093: 32,2661           00050                                    40D                                   
034402,000094: 32,2662           06503                                    UNITX                                 
034403,000095: 32,2663           26572                           STOVL    CG                                    
034404,000096: 32,2664           06501                                    UNITY                                 
034405,000097: 32,2665           26600                           STOVL    CG         +6                         
034406,000098: 32,2666           06477                                    UNITZ                                 
034407,000099: 32,2667           16606                           STODL    CG         +14                        
034408,000100: 32,2670           25066                                    99999CON                              
034409,000101: 32,2671           27665                           STOVL    DELTAH                                #  INITIALIZE DELTAH FOR V16N68 DISPLAY
034410,000102: 32,2672           06505                                    ZEROVECS                              
034411,000103: 32,2673           17252                           STODL    UNFC/2                                #  INITIALIZE TRIM VELOCITY CORRECTION TERM
034412,000104: 32,2674           06505                                    HI6ZEROS                              
034413,000105: 32,2675           17643                           STODL    TTF/8                                 
034414,000106: 32,2676           25074                                    HLROFFF                               
034415,000107: 32,2677           03452                           STORE    HLROFF                                #  LR CUTOFF ALTITUDE.
034416,000108: 32,2700           77745        IGNALOOP           DLOAD                                          
034417,000109: 32,2701           00015                                    TAT                                   
034418,000110: 32,2702           27561                           STOVL    PIPTIME1                              
034419,000111: 32,2703           00017                                    RATT1                                 
034420,000112: 32,2704           64312                           VSL4     MXV                                   
034421,000113: 32,2705           01732                                    REFSMMAT                              
034422,000114: 32,2706           37521                           STCALL   R                                     
034423,000115: 32,2707           67037                                    MUNGRAV                               
034424,000116: 32,2710           35236                           STCALL   GDT/2                                 
034425,000117: 32,2711           62417                                    ?GUIDSUB                              #  WHICH DELIVERS N PASSES OF GUIDANCE
034426,000118: 
034427,000119:                                                                                                  #  DDUMCALC IS PROGRAMMED AS FOLLOWS:-
034428,000120:                                                                                                  #                                          2                                           -
034429,000121:                                                                                                  #               (RIGNZ - RGU )/16 + 16(RGU  )KIGNY/B8 + (RGU - RIGNX)KIGNX/B4 + (ABVAL(VGU) - VIGN)KIGNV/B4
034430,000122:                                                                                                  #                           2             1                 0
034431,000123:                                                                                                  #        DDUM = -------------------------------------------------------------------------------------------
034432,000124: 

Page 783

034434,000126:                                                                                                  #                                                 10
034435,000127:                                                                                                  #                                                2   (VGU - 16 VGU KIGNX/B4)
034436,000128:                                                                                                  #                                                        2        0
034437,000129: 
034438,000130:                                                                                                  #  THE NUMERATOR IS SCALED IN METERS AT 2(28).   THE DENOMINATOR IS A VELOCITY IN UNITS OF 2(10) M/CS.
034439,000131:                                                                                                  #  THE QUOTIENT IS THUS A TIME IN UNITS OF 2(18) CENTISECONDS.   THE FINAL SHIFT RESCALES TO UNITS OF 2(28) CS.
034440,000132:                                                                                                  #  THERE IS NO DAMPING FACTOR.   THE CONSTANTS KIGNX/B4, KIGNY/B8 AND KIGNV/B4 ARE ALL NEGATIVE IN SIGN.
034441,000133: 
034442,000134: 32,2712           55646        DDUMCALC           TS       NIGNLOOP                              
034443,000135: 32,2713           06060                           TC       INTPRET                               
034444,000136: 32,2714           57345                           DLOAD    DMPR                                  #  FORM DENOMINATOR FIRST
034445,000137: 32,2715           03627                                    VGU                                   
034446,000138: 32,2716           02465                                    KIGNX/B4                              
034447,000139: 32,2717           44232                           SL4R     BDSU                                  
034448,000140: 32,2720           03633                                    VGU        +4                         
034449,000141: 32,2721           45325                           PDDL     DSU                                   
034450,000142: 32,2722           02463                                    RIGNZ                                 
034451,000143: 32,2723           02630                                    RGU        +4                         
034452,000144: 32,2724           65222                           SR4R     PDDL                                  
034453,000145: 32,2725           02626                                    RGU        +2                         
034454,000146: 32,2726           57316                           DSQ      DMPR                                  
034455,000147: 32,2727           02467                                    KIGNY/B8                              
034456,000148: 32,2730           65232                           SL4R     PDDL                                  
034457,000149: 32,2731           02624                                    RGU                                   
034458,000150: 32,2732           57225                           DSU      DMPR                                  
034459,000151: 32,2733           02461                                    RIGNX                                 
034460,000152: 32,2734           02465                                    KIGNX/B4                              
034461,000153: 32,2735           51515                           PDVL     ABVAL                                 
034462,000154: 32,2736           03627                                    VGU                                   
034463,000155: 32,2737           57225                           DSU      DMPR                                  
034464,000156: 32,2740           02457                                    VIGN                                  
034465,000157: 32,2741           02471                                    KIGNV/B4                              
034466,000158: 32,2742           43215                           DAD      DAD                                   
034467,000159: 32,2743           56215                           DAD      DDV                                   
034468,000160: 32,2744           77661                           SRR                                            
034469,000161: 32,2745           21613                                    10D                                   
034470,000162: 
034471,000163: 32,2746           43206                           PUSH     DAD                                   
034472,000164: 32,2747           03561                                    PIPTIME1                              
034473,000165: 32,2750           14041                           STODL    TDEC1                                 #  STORE NEW GUESS FOR NEXT INTEGRATION
034474,000166: 32,2751           45246                           ABS      DSU                                   
034475,000167: 32,2752           25072                                    DDUMCRIT                              
034476,000168: 32,2753           45040                           BMN      CALL                                  
034477,000169: 32,2754           64773                                    DDUMGOOD                              
034478,000170: 32,2755           27447                                    INTSTALL                              
034479,000171: 32,2756           43014                           SET      SET                                   
034480,000172: 32,2757           01473                                    INTYPFLG                              
034481,000173: 32,2760           00063                                    MOONFLAG                              
034482,000174: 32,2761           77745                           DLOAD                                          
034483,000175: 32,2762           03561                                    PIPTIME1                              
034484,000176: 

Page 784

034486,000178: 32,2763           25517                           STOVL    TET                                   #  HOPEFULLY ?GUIDSUB DID NOT
034487,000179: 32,2764           00017                                    RATT1                                 #    CLOBBER RATT1 AND VATT1
034488,000180: 32,2765           25535                           STOVL    RCV                                   
034489,000181: 32,2766           00025                                    VATT1                                 
034490,000182: 32,2767           35543                           STCALL   VCV                                   
034491,000183: 32,2770           27145                                    INTEGRVS                              
034492,000184: 32,2771           77650                           GOTO                                           
034493,000185: 32,2772           64700                                    IGNALOOP                              
034494,000186: 
034495,000187: 32,2773           53575        DDUMGOOD           VLOAD    UNIT                                  #  INITIALIZE KALCMANU
034496,000188: 32,2774           03252                                    UNFC/2                                
034497,000189: 32,2775           27773                           STOVL    POINTVSM                              
034498,000190: 32,2776           06503                                    UNITX                                 
034499,000191: 32,2777           27765                           STOVL    SCAXIS                                #  NEXT COMPUTE DISTANCE LANDING SITE IS
034500,000192: 32,3000           03527                                    V                                     #    OUT OF LM'S ORBITAL PLANE AT IGNITION:
034501,000193: 32,3001           53435                           VXV      UNIT                                  #    SIGN IS + IF LANDING SITE IS TO THE
034502,000194: 32,3002           03521                                    R                                     #    RIGHT, NORTH; - IF TO THE LEFT, SOUTH.
034503,000195: 32,3003           72441                           DOT      SL1                                   
034504,000196: 32,3004           03635                                    LAND                                  
034505,000197: 32,3005           16614                           STODL    OUTOFPLN                              #  NEXT COMPUTE TIG
034506,000198: 32,3006           03423                                    ZOOMTIME                              
034507,000199: 32,3007           44261                           SR       BDSU                                  
034508,000200: 32,3010           20617                                    14D                                   
034509,000201: 32,3011           00041                                    TDEC1                                 
034510,000202: 32,3012           03442                           STORE    TIG                                   
034511,000203: 32,3013           77776                           EXIT                                           
034512,000204:                                                                                                  #  ****************************************
034513,000205: 
034514,000206: 32,3014           05355        IGNALGRT           TC       PHASCHNG                              #  PREVENT REPEATING IGNALG
034515,000207: 32,3015           04024                           OCT      04024                                 
034516,000208: 
034517,000209: 32,3016           44353        ASTNCLOK           CS       ASTNDEX                               
034518,000210: 32,3017           04607                           TC       BANKCALL                              
034519,000211: 32,3020           74663                           CADR     STCLOK2                               
034520,000212: 32,3021           15146                           TCF      ENDOFJOB                              #  RETURN IN NEW JOB AND IN EBANK FIVE
034521,000213: 
034522,000214: 32,3022           35007        ASTNRET            CAF      EBANK7                                
034523,000215: 32,3023           54003                           TS       EBANK                                 
034524,000216: 
034525,000217: 32,3024           00004                           INHINT                                         
034526,000218: 32,3025           04665                           TC       IBNKCALL                              
034527,000219: 32,3026           40143                           CADR     PFLITEDB                              
034528,000220: 32,3027           00003                           RELINT                                         
034529,000221: 
034530,000222: 32,3030           04607                           TC       BANKCALL                              
034531,000223: 32,3031           54125                           CADR     R60LEM                                
034532,000224: 
034533,000225: 32,3032           05355                           TC       PHASCHNG                              #  PREVENT RECALLING R60
034534,000226: 32,3033           04024                           OCT      04024                                 
034535,000227: 

Page 785

034537,000229: 32,3034           34737        P63SPOT3           CA       BIT6                                  #  IS THE LR ANTENNA IN POSITION 1 YET
034538,000230: 32,3035           00006                           EXTEND                                         
034539,000231: 32,3036           02033                           RAND     CHAN33                                
034540,000232: 32,3037           00006                           EXTEND                                         
034541,000233: 32,3040           13046                           BZF      P63SPOT4                              #  BRANCH IF ANTENNA ALREADY IN POSITION 1
034542,000234: 
034543,000235: 32,3041           33064                           CAF      CODE500                               #  ASTRONAUT: PLEASE CRANK THE
034544,000236: 32,3042           04607                           TC       BANKCALL                              #             SILLY THING AROUND
034545,000237: 32,3043           20635                           CADR     GOPERF1                               
034546,000238: 32,3044           16001                           TCF      GOTOPOOH                              #  TERMINATE
034547,000239: 32,3045           13034                           TCF      P63SPOT3                              #  PROCEED    SEE IF HE'S LYING
034548,000240: 
034549,000241: 32,3046           34743        P63SPOT4           CAF      TWO                                   #  ENTER      INITIALIZE LANDING RADAR
034550,000242: 32,3047           55674                           TS       STILBADH                              
034551,000243: 32,3050           55675                           TS       STILBADV                              
034552,000244: 32,3051           34746                           CAF      ZERO                                  
034553,000245: 32,3052           55670                           TS       LRLCTR                                
034554,000246: 32,3053           55672                           TS       LRMCTR                                
034555,000247: 32,3054           55671                           TS       LRRCTR                                
034556,000248: 32,3055           55673                           TS       LRSCTR                                
034557,000249: 32,3056           55462                           TS       VSELECT                               
034558,000250: 
034559,000251: 32,3057           34742                           CA       FOUR                                  #  INITIALIZE COUNTER TO ISSUE 511
034560,000252: 32,3060           55622                           TS       511CTR                                #  ALARM AFTER 10 SECONDS
034561,000253: 
034562,000254: 32,3061           04626                           TC       POSTJUMP                              #  OFF TO SEE THE WIZARD...
034563,000255: 32,3062           74130                           CADR     BURNBABY                              
034564,000256: 
034565,000257:                                                                                                  #        ----------------------------------------
034566,000258: 
034567,000259:                                                                                                  #              CONSTANTS FOR P63LM AND IGNALG
034568,000260: 
034569,000261: 32,3063           02100        P63ADRES           GENADR   P63TABLE                              
034570,000262: 
034571,000263: 32,3064     4353               ASTNDEX            =        MD1                                   #  OCT 25; INDEX FOR CLOKTASK
034572,000264: 
034573,000265: 32,3064           00500        CODE500            OCT      00500                                 
034574,000266: 
034575,000267: 32,3065           00035 30373  99999CON           2DEC     30479.7    B-24                       
034576,000268: 
034577,000269: 32,3067           00004 01610  GUIDDURN           2DEC     +66440     B-28                       #          GUIDDURN +6.64400314E+ 2
034578,000270: 32,3071           00000 00010  DDUMCRIT           2DEC     +8         B-28                       #  CRITERION FOR IGNALG CONVERGENCE
034579,000271: 

Page 786

034581,000273: 32,3073           00364        HLROFFF            DEC      15.24      B-10                       #  LOADED DP, BUT LOW ORDER DOESN'T MATTER
034582,000274:                                                                                                  #        ----------------------------------------
034583,000275: 

Page 787

034585,000277:                                                                                                  #        ****************************************
034586,000278:                                                                                                  #        P68: LANDING CONFIRMATION
034587,000279:                                                                                                  #        ****************************************
034588,000280: 
034589,000281: 34,3271                                           BANK     34                                    
034590,000282: 34,2000                                           SETLOC   F2DPS*34                              
034591,000283: 34,2000                                           BANK                                           
034592,000284: 
034593,000285: 34,3271                                           COUNT*   $$/P6567                              
034594,000286: 
034595,000287: 34,3271           05355        LANDJUNK           TC       PHASCHNG                              
034596,000288: 34,3272           04024                           OCT      04024                                 
034597,000289: 
034598,000290: 34,3273           00004                           INHINT                                         
034599,000291: 34,3274           04607                           TC       BANKCALL                              #  ZERO ATTITUDE ERROR
034600,000292: 34,3275           40154                           CADR     ZATTEROR                              
034601,000293: 
034602,000294: 34,3276           06060                           TC       INTPRET                               #  TO INTERPRETIVE AS TIME IS NOT CRITICAL
034603,000295: 34,3277           77614                           SET                                            #  PREVENT RCS JET FIRINGS IF MODE CONT IS
034604,000296: 34,3300           06460                                    PULSEFLG                              #  IN ATT HOLD
034605,000297: 34,3301           43014                           SET      CLEAR                                 
034606,000298: 34,3302           04067                                    SURFFLAG                              
034607,000299: 34,3303           04666                                    LETABORT                              
034608,000300: 34,3304           77214                           SET      VLOAD                                 
034609,000301: 34,3305           05062                                    APSFLAG                               
034610,000302: 34,3306           01220                                    RN                                    
034611,000303: 34,3307           16032                           STODL    ALPHAV                                
034612,000304: 34,3310           01234                                    PIPTIME                               
034613,000305: 34,3311           45014                           SET      CALL                                  
034614,000306: 34,3312           01463                                    LUNAFLAG                              
034615,000307: 34,3313           26406                                    LAT-LONG                              
034616,000308: 34,3314           77201                           SETPD    VLOAD                                 #  COMPUTE RLS AND STORE IT AWAY
034617,000309: 34,3315           00001                                    0                                     
034618,000310: 34,3316           01220                                    RN                                    
034619,000311: 34,3317           65352                           VSL2     PDDL                                  
034620,000312: 34,3320           01234                                    PIPTIME                               
034621,000313: 34,3321           45006                           PUSH     CALL                                  
034622,000314: 34,3322           51644                                    R-TO-RP                               
034623,000315: 34,3323           02021                           STORE    RLS                                   
034624,000316: 34,3324           77776                           EXIT                                           
034625,000317: 34,3325           33345                           CAF      V06N43*                               #  ASTRONAUT:  NOW LOOK WHERE YOU ENDED UP
034626,000318: 34,3326           04607                           TC       BANKCALL                              
034627,000319: 34,3327           20471                           CADR     GOFLASH                               
034628,000320: 34,3330           16001                           TCF      GOTOPOOH                              #  TERMINATE
034629,000321: 34,3331           13333                           TCF      +2                                    #  PROCEED
034630,000322: 34,3332           13325                           TCF      -5                                    #  RECYCLE
034631,000323: 
034632,000324: 34,3333           06060                           TC       INTPRET                               
034633,000325: 34,3334           64375                           VLOAD    MXV                                   #  INITIALIZE GSAV AND (USING REFMF)
034634,000326: 

Page 788

034636,000328: 34,3335           01220                                    RN                                    #  YNBSAV, ZNBSAV AND ATTFLAG FOR P57
034637,000329: 34,3336           01732                                    REFSMMAT                              
034638,000330: 34,3337           45056                           UNIT     CALL                                  
034639,000331: 34,3340           47640                                    CDU*SMNB                              
034640,000332: 34,3341           36222                           STCALL   GSAV                                  
034641,000333: 34,3342           33470                                    REFMF                                 
034642,000334: 34,3343           77776                           EXIT                                           
034643,000335: 
034644,000336: 34,3344           16001                           TCF      GOTOPOOH                              #  ASTRONAUT:  PLEASE SELECT P57
034645,000337: 
034646,000338: 
034647,000339: 34,3345           01453        V06N43*            VN       0643                                  

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