Source Code

This is a reconstructed version of Luminary 130, the initial AGC program released in November 1969 for the Apollo 13 LM. Three more releases followed before the flown revision was finally manufactured in February 1970.

This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G.

In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'.

033389,000002:                                                                                                  ## Copyright:   Public domain.
033390,000003:                                                                                                  ## Filename:    THE_LUNAR_LANDING.agc
033391,000004:                                                                                                  ## Purpose:     A section of the reconstructed source code for Luminary 130.
033392,000005:                                                                                                  ##              This was the original program released for the Apollo 13 LM,
033393,000006:                                                                                                  ##              although several more revisions would follow. It has been
033394,000007:                                                                                                  ##              reconstructed from a listing of Luminary 131, from which it
033395,000008:                                                                                                  ##              differs on only two lines in P70-P71. The difference is
033396,000009:                                                                                                  ##              described in detail in Luminary memo #129, which was used
033397,000010:                                                                                                  ##              to perform the reconstruction. This file is intended to be a
033398,000011:                                                                                                  ##              faithful reconstruction, except that the code format has been
033399,000012:                                                                                                  ##              changed to conform to the requirements of the yaYUL assembler
033400,000013:                                                                                                  ##              rather than the original YUL assembler.
033401,000014:                                                                                                  ## Reference:   pp. 780-787
033402,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033403,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033404,000017:                                                                                                  ## Mod history: 05/25/03 RSB.   Began transcribing.
033405,000018:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
033406,000019:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
033407,000020:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
033408,000021:                                                                                                  ##                              numbers in 1701.pdf.
033409,000022:                                                                                                  ##              2017-02-25 RSB  Proofed comment text using octopus/ProoferComments.
033410,000023:                                                                                                  ##              2017-03-01 RSB  Fixed lingering typos.
033411,000024:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes noted in proofing Luminary 116.
033412,000025:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 5-way
033413,000026:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
033414,000027:                                                                                                  ##              2018-09-04 MAS  Copied from Luminary 131 for Luminary 130.
033415,000028: 

Page 780

033417,000030: 32,3000                                           BANK     32                                    
033418,000031: 32,2000                                           SETLOC   F2DPS*32                              
033419,000032: 32,2000                                           BANK                                           
033420,000033: 
033421,000034: 32,3000  E7,1621                                  EBANK=   E2DPS                                 
033422,000035: 
033423,000036:                                                                                                  #        ****************************************
033424,000037:                                                                                                  #        P63: THE LUNAR LANDING, BRAKING PHASE
033425,000038:                                                                                                  #        ****************************************
033426,000039: 
033427,000040: 32,3000                                           COUNT*   $$/P63                                
033428,000041: 
033429,000042: 32,3000           05353        P63LM              TC       PHASCHNG                              
033430,000043: 32,3001           04024                           OCT      04024                                 
033431,000044: 
033432,000045: 32,3002           04616                           TC       BANKCALL                              #  DO IMU STATUS CHECK ROUTINE R02
033433,000046: 32,3003           11233                           CADR     R02BOTH                               
033434,000047: 
033435,000048: 32,3004           33255                           CAF      P63ADRES                              #  INITIALIZE WHICH FOR BURNBABY
033436,000049: 32,3005           55455                           TS       WHICH                                 
033437,000050: 
033438,000051: 32,3006           32000                           CAF      DPSTHRSH                              #  INITIALIZE DVMON
033439,000052: 32,3007           55250                           TS       DVTHRUSH                              
033440,000053: 32,3010           34751                           CAF      FOUR                                  
033441,000054: 32,3011           55515                           TS       DVCNTR                                
033442,000055: 
033443,000056: 32,3012           44753                           CS       ONE                                   #  INITIALIZE WCHPHASE AND FLPASSO
033444,000057: 32,3013           55346                           TS       WCHPHASE                              
033445,000058: 
033446,000059: 32,3014           34755                           CA       ZERO                                  
033447,000060: 32,3015           55623                           TS       FLPASS0                               
033448,000061: 
033449,000062: 32,3016           44736                           CS       BIT14                                 
033450,000063: 32,3017           00006                           EXTEND                                         
033451,000064: 32,3020           03012                           WAND     CHAN12                                #  REMOVE TRACK-ENABLE DISCRETE.
033452,000065: 
033453,000066: 32,3021           06042        FLAGORGY           TC       INTPRET                               #  DIONYSIAN FLAG WAVING
033454,000067: 32,3022           43014                           CLEAR    CLEAR                                 
033455,000068: 32,3023           02663                                    NOTHROTL                              
033456,000069: 32,3024           03271                                    REDFLAG                               
033457,000070: 32,3025           43014                           CLEAR    SET                                   
033458,000071: 32,3026           05660                                    LRBYPASS                              
033459,000072: 32,3027           03067                                    MUNFLAG                               
033460,000073: 32,3030           43014                           CLEAR    CLEAR                                 
033461,000074: 32,3031           00266                                    P25FLAG                               #  TERMINATE P25 IF IT IS RUNNING.
033462,000075: 32,3032           00270                                    RNDVZFLG                              #  TERMINATE P20 IF IT IS RUNNING
033463,000076: 
033464,000077:                                                                                                  #  ****************************************
033465,000078: 
033466,000079: 32,3033           77201        IGNALG             SETPD    VLOAD                                 #  FIRST SET UP INPUTS FOR RP-TO-R:-

Page 781

033468,000081: 32,3034           00001                                    0                                     #        AT 0D LANDING SITE IN MOON FIXED FRAME
033469,000082: 32,3035           02023                                    RLS                                   #        AT 6D ESTIMATED TIME OF LANDING
033470,000083: 32,3036           41525                           PDDL     PUSH                                  #        MPAC NON-ZERO TO INDICATE LUNAR CASE
033471,000084: 32,3037           02401                                    TLAND                                 
033472,000085: 32,3040           37625                           STCALL   TPIP                                  #  ALSO SET TPIP FOR FIRST GUIDANCE PASS
033473,000086: 32,3041           55716                                    RP-TO-R                               
033474,000087: 32,3042           64312                           VSL4     MXV                                   
033475,000088: 32,3043           01734                                    REFSMMAT                              
033476,000089: 32,3044           37635                           STCALL   LAND                                  
033477,000090: 32,3045           71343                                    GUIDINIT                              #  GUIDINIT INITIALIZES WM AND /LAND/
033478,000091: 32,3046           45345                           DLOAD    DSU                                   
033479,000092: 32,3047           02401                                    TLAND                                 
033480,000093: 32,3050           25262                                    GUIDDURN                              
033481,000094: 32,3051           34041                           STCALL   TDEC1                                 #  INTEGRATE STATE FORWARD TO THAT TIME
033482,000095: 32,3052           27056                                    LEMPREC                               
033483,000096: 32,3053           77331                           SSP      VLOAD                                 
033484,000097: 32,3054           03647                                    NIGNLOOP                              
033485,000098: 32,3055           00050                                    40D                                   
033486,000099: 32,3056           06522                                    UNITX                                 
033487,000100: 32,3057           26575                           STOVL    CG                                    
033488,000101: 32,3060           06520                                    UNITY                                 
033489,000102: 32,3061           26603                           STOVL    CG         +6                         
033490,000103: 32,3062           06516                                    UNITZ                                 
033491,000104: 32,3063           16611                           STODL    CG         +14                        
033492,000105: 32,3064           25260                                    99999CON                              
033493,000106: 32,3065           27665                           STOVL    DELTAH                                #  INITIALIZE DELTAH FOR V16N68 DISPLAY
033494,000107: 32,3066           06524                                    ZEROVECS                              
033495,000108: 32,3067           17253                           STODL    UNFC/2                                #  INITIALIZE TRIM VELOCITY CORRECTION TERM
033496,000109: 32,3070           06524                                    HI6ZEROS                              
033497,000110: 32,3071           03643                           STORE    TTF/8                                 
033498,000111: 
033499,000112: 32,3072           77745        IGNALOOP           DLOAD                                          
033500,000113: 32,3073           00015                                    TAT                                   
033501,000114: 32,3074           27561                           STOVL    PIPTIME1                              
033502,000115: 32,3075           00017                                    RATT1                                 
033503,000116: 32,3076           64312                           VSL4     MXV                                   
033504,000117: 32,3077           01734                                    REFSMMAT                              
033505,000118: 32,3100           37521                           STCALL   R                                     
033506,000119: 32,3101           67067                                    MUNGRAV                               
033507,000120: 32,3102           35236                           STCALL   GDT/2                                 
033508,000121: 32,3103           62415                                    ?GUIDSUB                              #  WHICH DELIVERS N PASSES OF GUIDANCE
033509,000122: 
033510,000123:                                                                                                  #  DDUMCALC IS PROGRAMMED AS FOLLOWS:-
033511,000124:                                                                                                  #                                          2                                           -
033512,000125:                                                                                                  #               (RIGNZ - RGU )/16 + 16(RGU  )KIGNY/B8 + (RGU - RIGNX)KIGNX/B4 + (ABVAL(VGU) - VIGN)KIGNV/B4
033513,000126:                                                                                                  #                           2             1                 0
033514,000127:                                                                                                  #        DDUM = -------------------------------------------------------------------------------------------
033515,000128:                                                                                                  #                                                 10
033516,000129:                                                                                                  #                                                2   (VGU - 16 VGU KIGNX/B4)

Page 782

033518,000131:                                                                                                  #                                                        2        0
033519,000132:                                                                                                  #  THE NUMERATOR IS SCALED IN METERS AT 2(28).  THE DENOMINATOR IS A VELOCITY IN UNITS OF 2(10) M/CS.
033520,000133:                                                                                                  #  THE QUOTIENT IS THUS A TIME IN UNITS OF 2(18) CENTISECONDS.  THE FINAL SHIFT RESCALES TO UNITS OF 2(28) CS.
033521,000134:                                                                                                  #  THERE IS NO DAMPING FACTOR.  THE CONSTANTS KIGNX/B4, KIGNY/B8 AND KIGNV/B4 ARE ALL NEGATIVE IN SIGN.
033522,000135: 
033523,000136: 32,3104           55646        DDUMCALC           TS       NIGNLOOP                              
033524,000137: 32,3105           06042                           TC       INTPRET                               
033525,000138: 32,3106           57345                           DLOAD    DMPR                                  #  FORM DENOMINATOR FIRST
033526,000139: 32,3107           03627                                    VGU                                   
033527,000140: 32,3110           02501                                    KIGNX/B4                              
033528,000141: 32,3111           44232                           SL4R     BDSU                                  
033529,000142: 32,3112           03633                                    VGU        +4                         
033530,000143: 32,3113           45325                           PDDL     DSU                                   
033531,000144: 32,3114           02477                                    RIGNZ                                 
033532,000145: 32,3115           02633                                    RGU        +4                         
033533,000146: 32,3116           65222                           SR4R     PDDL                                  
033534,000147: 32,3117           02631                                    RGU        +2                         
033535,000148: 32,3120           57316                           DSQ      DMPR                                  
033536,000149: 32,3121           02503                                    KIGNY/B8                              
033537,000150: 32,3122           65232                           SL4R     PDDL                                  
033538,000151: 32,3123           02627                                    RGU                                   
033539,000152: 32,3124           57225                           DSU      DMPR                                  
033540,000153: 32,3125           02475                                    RIGNX                                 
033541,000154: 32,3126           02501                                    KIGNX/B4                              
033542,000155: 32,3127           51515                           PDVL     ABVAL                                 
033543,000156: 32,3130           03627                                    VGU                                   
033544,000157: 32,3131           57225                           DSU      DMPR                                  
033545,000158: 32,3132           02473                                    VIGN                                  
033546,000159: 32,3133           02505                                    KIGNV/B4                              
033547,000160: 32,3134           43215                           DAD      DAD                                   
033548,000161: 32,3135           56215                           DAD      DDV                                   
033549,000162: 32,3136           77661                           SRR                                            
033550,000163: 32,3137           21613                                    10D                                   
033551,000164: 
033552,000165: 32,3140           43206                           PUSH     DAD                                   
033553,000166: 32,3141           03561                                    PIPTIME1                              
033554,000167: 32,3142           14041                           STODL    TDEC1                                 #  STORE NEW GUESS FOR NEXT INTEGRATION
033555,000168: 32,3143           45246                           ABS      DSU                                   
033556,000169: 32,3144           25264                                    DDUMCRIT                              
033557,000170: 32,3145           45040                           BMN      CALL                                  
033558,000171: 32,3146           65165                                    DDUMGOOD                              
033559,000172: 32,3147           27410                                    INTSTALL                              
033560,000173: 32,3150           43014                           SET      SET                                   
033561,000174: 32,3151           01473                                    INTYPFLG                              
033562,000175: 32,3152           00063                                    MOONFLAG                              
033563,000176: 32,3153           77745                           DLOAD                                          
033564,000177: 32,3154           03561                                    PIPTIME1                              
033565,000178: 32,3155           25517                           STOVL    TET                                   #  HOPEFULLY ?GUIDSUB DID NOT
033566,000179: 32,3156           00017                                    RATT1                                 #        CLOBBER RATT1 AND VATT1

Page 783

033568,000181: 32,3157           25535                           STOVL    RCV                                   
033569,000182: 32,3160           00025                                    VATT1                                 
033570,000183: 32,3161           35543                           STCALL   VCV                                   
033571,000184: 32,3162           27106                                    INTEGRVS                              
033572,000185: 32,3163           77650                           GOTO                                           
033573,000186: 32,3164           65072                                    IGNALOOP                              
033574,000187: 
033575,000188: 32,3165           54335        DDUMGOOD           SLOAD    SR                                    
033576,000189: 32,3166           03423                                    ZOOMTIME                              
033577,000190: 32,3167           20617                                    14D                                   
033578,000191: 32,3170           77621                           BDSU                                           
033579,000192: 32,3171           00041                                    TDEC1                                 
033580,000193: 32,3172           27442                           STOVL    TIG                                   #  COMPUTE DISTANCE LANDING SITE WILL BE
033581,000194: 32,3173           03527                                    V                                     #    OUT OF LM'S ORBITAL PLANE AT IGNITION:
033582,000195: 32,3174           53435                           VXV      UNIT                                  #    SIGN IS + IF LANDING SITE IS TO THE
033583,000196: 32,3175           03521                                    R                                     #    RIGHT, NORTH; - IF TO THE LEFT, SOUTH.
033584,000197: 32,3176           72441                           DOT      SL1                                   
033585,000198: 32,3177           03635                                    LAND                                  
033586,000199: 32,3200           26617        R60INIT            STOVL    OUTOFPLN                              #  INITIALIZATION FOR CALCMANU
033587,000200: 32,3201           03253                                    UNFC/2                                
033588,000201: 32,3202           02621                           STORE    R60VSAVE                              #  STORE UNFC/2 TEMPORARILY IN R60SAVE
033589,000202: 32,3203           77776                           EXIT                                           
033590,000203:                                                                                                  #  ****************************************
033591,000204: 
033592,000205: 32,3204           05353        IGNALGRT           TC       PHASCHNG                              #  PREVENT REPEATING IGNALG
033593,000206: 32,3205           04024                           OCT      04024                                 
033594,000207: 
033595,000208: 32,3206           44362        ASTNCLOK           CS       ASTNDEX                               
033596,000209: 32,3207           04616                           TC       BANKCALL                              
033597,000210: 32,3210           74670                           CADR     STCLOK2                               
033598,000211: 32,3211           15155                           TCF      ENDOFJOB                              #  RETURN IN NEW JOB AND IN EBANK FIVE
033599,000212: 
033600,000213: 32,3212           06042        ASTNRET            TC       INTPRET                               
033601,000214: 32,3213           47131                           SSP      RTB                                   #  GO PICK UP DISPLAY AT END OF R51:
033602,000215: 32,3214           02747                                    QMAJ                                  #        "PROCEED" WILL DO A FINE ALIGNMENT
033603,000216: 32,3215           65217                           FCADR    P63SPOT2                              #        "ENTER" WILL RETURN TO P63SPOT2
033604,000217: 32,3216           31127                                    R51P63                                
033605,000218: 32,3217           53575        P63SPOT2           VLOAD    UNIT                                  #  INITIALIZE KALCMANU FOR BURN ATTITUDE
033606,000219: 32,3220           02621                                    R60VSAVE                              
033607,000220: 32,3221           27773                           STOVL    POINTVSM                              
033608,000221: 32,3222           06522                                    UNITX                                 
033609,000222: 32,3223           03765                           STORE    SCAXIS                                
033610,000223: 32,3224           77776                           EXIT                                           
033611,000224: 
033612,000225: 32,3225           35016                           CAF      EBANK7                                
033613,000226: 32,3226           54003                           TS       EBANK                                 
033614,000227: 
033615,000228: 32,3227           00004                           INHINT                                         
033616,000229: 32,3230           04674                           TC       IBNKCALL                              
033617,000230: 32,3231           40143                           CADR     PFLITEDB                              

Page 784

033619,000232: 32,3232           00003                           RELINT                                         
033620,000233: 
033621,000234: 32,3233           04616                           TC       BANKCALL                              
033622,000235: 32,3234           54123                           CADR     R60LEM                                
033623,000236: 
033624,000237: 32,3235           05353                           TC       PHASCHNG                              #  PREVENT RECALLING R60
033625,000238: 32,3236           04024                           OCT      04024                                 
033626,000239: 
033627,000240: 32,3237           34746        P63SPOT3           CA       BIT6                                  #  IS THE LR ANTENNA IN POSITION 1 YET
033628,000241: 32,3240           00006                           EXTEND                                         
033629,000242: 32,3241           02033                           RAND     CHAN33                                
033630,000243: 32,3242           00006                           EXTEND                                         
033631,000244: 32,3243           13251                           BZF      P63SPOT4                              #  BRANCH IF ANTENNA ALREADY IN POSITION 1
033632,000245: 
033633,000246: 32,3244           33256                           CAF      CODE500                               #  ASTRONAUT:    PLEASE CRANK THE
033634,000247: 32,3245           04616                           TC       BANKCALL                              #                SILLY THING AROUND
033635,000248: 32,3246           20624                           CADR     GOPERF1                               
033636,000249: 32,3247           16001                           TCF      GOTOPOOH                              #  TERMINATE
033637,000250: 32,3250           13237                           TCF      P63SPOT3                              #  PROCEED       SEE IF HE'S LYING
033638,000251: 
033639,000252: 32,3251           04616        P63SPOT4           TC       BANKCALL                              #  ENTER         INITIALIZE LANDING RADAR
033640,000253: 32,3252           67701                           CADR     SETPOS1                               
033641,000254: 
033642,000255: 32,3253           04635                           TC       POSTJUMP                              #  OFF TO SEE THE WIZARD ...
033643,000256: 32,3254           74130                           CADR     BURNBABY                              
033644,000257: 
033645,000258:                                                                                                  #        ----------------------------------------
033646,000259: 
033647,000260:                                                                                                  #  CONSTANTS FOR P63LM AND IGNALG
033648,000261: 
033649,000262: 32,3255           02100        P63ADRES           GENADR   P63TABLE                              
033650,000263: 
033651,000264: 32,3256     4362               ASTNDEX            =        MD1                                   #  OCT 25; INDEX FOR CLOKTASK
033652,000265: 
033653,000266: 32,3256           00500        CODE500            OCT      00500                                 
033654,000267: 
033655,000268: 32,3257           00035 30373  99999CON           2DEC     30479.7    B-24                       
033656,000269: 
033657,000270: 32,3261           00004 01610  GUIDDURN           2DEC     +66440     B-28                       #  GUIDDURN +6.64400314 E+2
033658,000271: 32,3263           00000 00010  DDUMCRIT           2DEC     +8         B-28                       #  CRITERION FOR IGNALG CONVERGENCE
033659,000272: 

Page 785

033661,000274:                                                                                                  #        ----------------------------------------
033662,000275: 

Page 786

033664,000277:                                                                                                  #        ****************************************
033665,000278:                                                                                                  #        P68: LANDING CONFIRMATION
033666,000279:                                                                                                  #        ****************************************
033667,000280: 
033668,000281: 34,3271                                           BANK     34                                    
033669,000282: 34,2000                                           SETLOC   F2DPS*34                              
033670,000283: 34,2000                                           BANK                                           
033671,000284: 
033672,000285: 34,3271                                           COUNT*   $$/P6567                              
033673,000286: 
033674,000287: 34,3271           05353        LANDJUNK           TC       PHASCHNG                              
033675,000288: 34,3272           04024                           OCT      04024                                 
033676,000289: 
033677,000290: 34,3273           00004                           INHINT                                         
033678,000291: 34,3274           04616                           TC       BANKCALL                              #  ZERO ATTITUDE ERROR
033679,000292: 34,3275           40154                           CADR     ZATTEROR                              
033680,000293: 
033681,000294: 34,3276           06042                           TC       INTPRET                               #  TO INTERPRETIVE AS TIME IS NOT CRITICAL
033682,000295: 34,3277           77614                           SET                                            #  PREVENT RCS JET FIRINGS IF MODE CONT IS
033683,000296: 34,3300           06460                                    PULSEFLG                              #  IN ATT HOLD
033684,000297: 34,3301           43014                           SET      CLEAR                                 
033685,000298: 34,3302           04067                                    SURFFLAG                              
033686,000299: 34,3303           04666                                    LETABORT                              
033687,000300: 34,3304           77214                           SET      VLOAD                                 
033688,000301: 34,3305           05062                                    APSFLAG                               
033689,000302: 34,3306           01220                                    RN                                    
033690,000303: 34,3307           16032                           STODL    ALPHAV                                
033691,000304: 34,3310           01234                                    PIPTIME                               
033692,000305: 34,3311           45014                           SET      CALL                                  
033693,000306: 34,3312           01463                                    LUNAFLAG                              
033694,000307: 34,3313           26347                                    LAT-LONG                              
033695,000308: 34,3314           77201                           SETPD    VLOAD                                 #  COMPUTE RLS AND STORE IT AWAY
033696,000309: 34,3315           00001                                    0                                     
033697,000310: 34,3316           01220                                    RN                                    
033698,000311: 34,3317           65352                           VSL2     PDDL                                  
033699,000312: 34,3320           01234                                    PIPTIME                               
033700,000313: 34,3321           45006                           PUSH     CALL                                  
033701,000314: 34,3322           51700                                    R-TO-RP                               
033702,000315: 34,3323           02023                           STORE    RLS                                   
033703,000316: 34,3324           77776                           EXIT                                           
033704,000317: 34,3325           33342                           CAF      V06N43*                               #  ASTRONAUT:  NOW LOOK WHERE YOU ENDED UP
033705,000318: 34,3326           04616                           TC       BANKCALL                              
033706,000319: 34,3327           20477                           CADR     GOFLASH                               
033707,000320: 34,3330           16001                           TCF      GOTOPOOH                              #  TERMINATE
033708,000321: 34,3331           13333                           TCF      +2                                    #  PROCEED
033709,000322: 34,3332           13325                           TCF      -5                                    #  RECYCLE
033710,000323: 
033711,000324: 34,3333           06042                           TC       INTPRET                               
033712,000325: 34,3334           77775                           VLOAD                                          #  INITIALIZE GSAV AND (USING REFMF)

Page 787

033714,000327: 34,3335           06522                                    UNITX                                 #  YNBSAV, ZNBSAV AND ATTFLAG FOR P57
033715,000328: 34,3336           36231                           STCALL   GSAV                                  
033716,000329: 34,3337           33471                                    REFMF                                 
033717,000330: 34,3340           77776                           EXIT                                           
033718,000331: 
033719,000332: 34,3341           16001                           TCF      GOTOPOOH                              #  ASTRONAUT:  PLEASE SELECT P57
033720,000333: 
033721,000334: 34,3342           01453        V06N43*            VN       0643                                  
033722,000335: 

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