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.

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

Page 781

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

Page 782

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

Page 783

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

Page 784

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

Page 785

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

Page 786

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

Page 787

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

Page 788

034628,000328: 34,3335           01220                                    RN                                    #  YNBSAV, ZNBSAV AND ATTFLAG FOR P57
034629,000329: 34,3336           01732                                    REFSMMAT                              
034630,000330: 34,3337           45056                           UNIT     CALL                                  
034631,000331: 34,3340           47640                                    CDU*SMNB                              
034632,000332: 34,3341           36222                           STCALL   GSAV                                  
034633,000333: 34,3342           33470                                    REFMF                                 
034634,000334: 34,3343           77776                           EXIT                                           
034635,000335: 
034636,000336: 34,3344           16001                           TCF      GOTOPOOH                              #  ASTRONAUT:  PLEASE SELECT P57
034637,000337: 
034638,000338: 
034639,000339: 34,3345           01453        V06N43*            VN       0643                                  

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