Source Code

These source-code files are part of a reconstructed copy of LM131 revision 1, the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 listing.

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

032988,000002:                                                                                                  ## Copyright:   Public domain.
032989,000003:                                                                                                  ## Filename:    THE_LUNAR_LANDING.agc
032990,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
032991,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
032992,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
032993,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
032994,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
032995,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
032996,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
032997,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
032998,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
032999,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
033000,000014:                                                                                                  ##              resulting binary is.
033001,000015:                                                                                                  ## Reference:   pp. 780-787
033002,000016:                                                                                                  ## Assembler:   yaYUL
033003,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033004,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033005,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
033006,000020: 

Page 780

033008,000022: 32,3000                                           BANK     32                                    
033009,000023: 32,2000                                           SETLOC   F2DPS*32                              
033010,000024: 32,2000                                           BANK                                           
033011,000025: 
033012,000026: 32,3000  E7,1621                                  EBANK=   E2DPS                                 
033013,000027: 
033014,000028:                                                                                                  #        ****************************************
033015,000029:                                                                                                  #        P63: THE LUNAR LANDING, BRAKING PHASE
033016,000030:                                                                                                  #        ****************************************
033017,000031: 
033018,000032: 32,3000                                           COUNT*   $$/P63                                
033019,000033: 
033020,000034: 32,3000           05353        P63LM              TC       PHASCHNG                              
033021,000035: 32,3001           04024                           OCT      04024                                 
033022,000036: 
033023,000037: 32,3002           04616                           TC       BANKCALL                              #  DO IMU STATUS CHECK ROUTINE R02
033024,000038: 32,3003           11233                           CADR     R02BOTH                               
033025,000039: 
033026,000040: 32,3004           33255                           CAF      P63ADRES                              #  INITIALIZE WHICH FOR BURNBABY
033027,000041: 32,3005           55455                           TS       WHICH                                 
033028,000042: 
033029,000043: 32,3006           32000                           CAF      DPSTHRSH                              #  INITIALIZE DVMON
033030,000044: 32,3007           55250                           TS       DVTHRUSH                              
033031,000045: 32,3010           34751                           CAF      FOUR                                  
033032,000046: 32,3011           55515                           TS       DVCNTR                                
033033,000047: 
033034,000048: 32,3012           44753                           CS       ONE                                   #  INITIALIZE WCHPHASE AND FLPASSO
033035,000049: 32,3013           55346                           TS       WCHPHASE                              
033036,000050: 
033037,000051: 32,3014           34755                           CA       ZERO                                  
033038,000052: 32,3015           55623                           TS       FLPASS0                               
033039,000053: 
033040,000054: 32,3016           44736                           CS       BIT14                                 
033041,000055: 32,3017           00006                           EXTEND                                         
033042,000056: 32,3020           03012                           WAND     CHAN12                                #  REMOVE TRACK-ENABLE DISCRETE.
033043,000057: 
033044,000058: 32,3021           06042        FLAGORGY           TC       INTPRET                               #  DIONYSIAN FLAG WAVING
033045,000059: 32,3022           43014                           CLEAR    CLEAR                                 
033046,000060: 32,3023           02663                                    NOTHROTL                              
033047,000061: 32,3024           03271                                    REDFLAG                               
033048,000062: 32,3025           43014                           CLEAR    SET                                   
033049,000063: 32,3026           05660                                    LRBYPASS                              
033050,000064: 32,3027           03067                                    MUNFLAG                               
033051,000065: 32,3030           43014                           CLEAR    CLEAR                                 
033052,000066: 32,3031           00266                                    P25FLAG                               #  TERMINATE P25 IF IT IS RUNNING.
033053,000067: 32,3032           00270                                    RNDVZFLG                              #  TERMINATE P20 IF IT IS RUNNING
033054,000068: 
033055,000069:                                                                                                  #  ****************************************
033056,000070: 
033057,000071: 32,3033           77201        IGNALG             SETPD    VLOAD                                 #  FIRST SET UP INPUTS FOR RP-TO-R:-

Page 781

033059,000073: 32,3034           00001                                    0                                     #        AT 0D LANDING SITE IN MOON FIXED FRAME
033060,000074: 32,3035           02023                                    RLS                                   #        AT 6D ESTIMATED TIME OF LANDING
033061,000075: 32,3036           41525                           PDDL     PUSH                                  #        MPAC NON-ZERO TO INDICATE LUNAR CASE
033062,000076: 32,3037           02401                                    TLAND                                 
033063,000077: 32,3040           37625                           STCALL   TPIP                                  #  ALSO SET TPIP FOR FIRST GUIDANCE PASS
033064,000078: 32,3041           55716                                    RP-TO-R                               
033065,000079: 32,3042           64312                           VSL4     MXV                                   
033066,000080: 32,3043           01734                                    REFSMMAT                              
033067,000081: 32,3044           37635                           STCALL   LAND                                  
033068,000082: 32,3045           71343                                    GUIDINIT                              #  GUIDINIT INITIALIZES WM AND /LAND/
033069,000083: 32,3046           45345                           DLOAD    DSU                                   
033070,000084: 32,3047           02401                                    TLAND                                 
033071,000085: 32,3050           25262                                    GUIDDURN                              
033072,000086: 32,3051           34041                           STCALL   TDEC1                                 #  INTEGRATE STATE FORWARD TO THAT TIME
033073,000087: 32,3052           27056                                    LEMPREC                               
033074,000088: 32,3053           77331                           SSP      VLOAD                                 
033075,000089: 32,3054           03647                                    NIGNLOOP                              
033076,000090: 32,3055           00050                                    40D                                   
033077,000091: 32,3056           06522                                    UNITX                                 
033078,000092: 32,3057           26575                           STOVL    CG                                    
033079,000093: 32,3060           06520                                    UNITY                                 
033080,000094: 32,3061           26603                           STOVL    CG         +6                         
033081,000095: 32,3062           06516                                    UNITZ                                 
033082,000096: 32,3063           16611                           STODL    CG         +14                        
033083,000097: 32,3064           25260                                    99999CON                              
033084,000098: 32,3065           27665                           STOVL    DELTAH                                #  INITIALIZE DELTAH FOR V16N68 DISPLAY
033085,000099: 32,3066           06524                                    ZEROVECS                              
033086,000100: 32,3067           17253                           STODL    UNFC/2                                #  INITIALIZE TRIM VELOCITY CORRECTION TERM
033087,000101: 32,3070           06524                                    HI6ZEROS                              
033088,000102: 32,3071           03643                           STORE    TTF/8                                 
033089,000103: 
033090,000104: 32,3072           77745        IGNALOOP           DLOAD                                          
033091,000105: 32,3073           00015                                    TAT                                   
033092,000106: 32,3074           27561                           STOVL    PIPTIME1                              
033093,000107: 32,3075           00017                                    RATT1                                 
033094,000108: 32,3076           64312                           VSL4     MXV                                   
033095,000109: 32,3077           01734                                    REFSMMAT                              
033096,000110: 32,3100           37521                           STCALL   R                                     
033097,000111: 32,3101           67067                                    MUNGRAV                               
033098,000112: 32,3102           35236                           STCALL   GDT/2                                 
033099,000113: 32,3103           62415                                    ?GUIDSUB                              #  WHICH DELIVERS N PASSES OF GUIDANCE
033100,000114: 
033101,000115:                                                                                                  #  DDUMCALC IS PROGRAMMED AS FOLLOWS:-
033102,000116:                                                                                                  #                                          2                                           -
033103,000117:                                                                                                  #               (RIGNZ - RGU )/16 + 16(RGU  )KIGNY/B8 + (RGU - RIGNX)KIGNX/B4 + (ABVAL(VGU) - VIGN)KIGNV/B4
033104,000118:                                                                                                  #                           2             1                 0
033105,000119:                                                                                                  #        DDUM = -------------------------------------------------------------------------------------------
033106,000120:                                                                                                  #                                                 10
033107,000121:                                                                                                  #                                                2   (VGU - 16 VGU KIGNX/B4)

Page 782

033109,000123:                                                                                                  #                                                        2        0
033110,000124:                                                                                                  #  THE NUMERATOR IS SCALED IN METERS AT 2(28).  THE DENOMINATOR IS A VELOCITY IN UNITS OF 2(10) M/CS.
033111,000125:                                                                                                  #  THE QUOTIENT IS THUS A TIME IN UNITS OF 2(18) CENTISECONDS.  THE FINAL SHIFT RESCALES TO UNITS OF 2(28) CS.
033112,000126:                                                                                                  #  THERE IS NO DAMPING FACTOR.  THE CONSTANTS KIGNX/B4, KIGNY/B8 AND KIGNV/B4 ARE ALL NEGATIVE IN SIGN.
033113,000127: 
033114,000128: 32,3104           55646        DDUMCALC           TS       NIGNLOOP                              
033115,000129: 32,3105           06042                           TC       INTPRET                               
033116,000130: 32,3106           57345                           DLOAD    DMPR                                  #  FORM DENOMINATOR FIRST
033117,000131: 32,3107           03627                                    VGU                                   
033118,000132: 32,3110           02501                                    KIGNX/B4                              
033119,000133: 32,3111           44232                           SL4R     BDSU                                  
033120,000134: 32,3112           03633                                    VGU        +4                         
033121,000135: 32,3113           45325                           PDDL     DSU                                   
033122,000136: 32,3114           02477                                    RIGNZ                                 
033123,000137: 32,3115           02633                                    RGU        +4                         
033124,000138: 32,3116           65222                           SR4R     PDDL                                  
033125,000139: 32,3117           02631                                    RGU        +2                         
033126,000140: 32,3120           57316                           DSQ      DMPR                                  
033127,000141: 32,3121           02503                                    KIGNY/B8                              
033128,000142: 32,3122           65232                           SL4R     PDDL                                  
033129,000143: 32,3123           02627                                    RGU                                   
033130,000144: 32,3124           57225                           DSU      DMPR                                  
033131,000145: 32,3125           02475                                    RIGNX                                 
033132,000146: 32,3126           02501                                    KIGNX/B4                              
033133,000147: 32,3127           51515                           PDVL     ABVAL                                 
033134,000148: 32,3130           03627                                    VGU                                   
033135,000149: 32,3131           57225                           DSU      DMPR                                  
033136,000150: 32,3132           02473                                    VIGN                                  
033137,000151: 32,3133           02505                                    KIGNV/B4                              
033138,000152: 32,3134           43215                           DAD      DAD                                   
033139,000153: 32,3135           56215                           DAD      DDV                                   
033140,000154: 32,3136           77661                           SRR                                            
033141,000155: 32,3137           21613                                    10D                                   
033142,000156: 
033143,000157: 32,3140           43206                           PUSH     DAD                                   
033144,000158: 32,3141           03561                                    PIPTIME1                              
033145,000159: 32,3142           14041                           STODL    TDEC1                                 #  STORE NEW GUESS FOR NEXT INTEGRATION
033146,000160: 32,3143           45246                           ABS      DSU                                   
033147,000161: 32,3144           25264                                    DDUMCRIT                              
033148,000162: 32,3145           45040                           BMN      CALL                                  
033149,000163: 32,3146           65165                                    DDUMGOOD                              
033150,000164: 32,3147           27410                                    INTSTALL                              
033151,000165: 32,3150           43014                           SET      SET                                   
033152,000166: 32,3151           01473                                    INTYPFLG                              
033153,000167: 32,3152           00063                                    MOONFLAG                              
033154,000168: 32,3153           77745                           DLOAD                                          
033155,000169: 32,3154           03561                                    PIPTIME1                              
033156,000170: 32,3155           25517                           STOVL    TET                                   #  HOPEFULLY ?GUIDSUB DID NOT
033157,000171: 32,3156           00017                                    RATT1                                 #        CLOBBER RATT1 AND VATT1

Page 783

033159,000173: 32,3157           25535                           STOVL    RCV                                   
033160,000174: 32,3160           00025                                    VATT1                                 
033161,000175: 32,3161           35543                           STCALL   VCV                                   
033162,000176: 32,3162           27106                                    INTEGRVS                              
033163,000177: 32,3163           77650                           GOTO                                           
033164,000178: 32,3164           65072                                    IGNALOOP                              
033165,000179: 
033166,000180: 32,3165           54335        DDUMGOOD           SLOAD    SR                                    
033167,000181: 32,3166           03423                                    ZOOMTIME                              
033168,000182: 32,3167           20617                                    14D                                   
033169,000183: 32,3170           77621                           BDSU                                           
033170,000184: 32,3171           00041                                    TDEC1                                 
033171,000185: 32,3172           27442                           STOVL    TIG                                   #  COMPUTE DISTANCE LANDING SITE WILL BE
033172,000186: 32,3173           03527                                    V                                     #    OUT OF LM'S ORBITAL PLANE AT IGNITION:
033173,000187: 32,3174           53435                           VXV      UNIT                                  #    SIGN IS + IF LANDING SITE IS TO THE
033174,000188: 32,3175           03521                                    R                                     #    RIGHT, NORTH; - IF TO THE LEFT, SOUTH.
033175,000189: 32,3176           72441                           DOT      SL1                                   
033176,000190: 32,3177           03635                                    LAND                                  
033177,000191: 32,3200           26617        R60INIT            STOVL    OUTOFPLN                              #  INITIALIZATION FOR CALCMANU
033178,000192: 32,3201           03253                                    UNFC/2                                
033179,000193: 32,3202           02621                           STORE    R60VSAVE                              #  STORE UNFC/2 TEMPORARILY IN R60SAVE
033180,000194: 32,3203           77776                           EXIT                                           
033181,000195:                                                                                                  #  ****************************************
033182,000196: 
033183,000197: 32,3204           05353        IGNALGRT           TC       PHASCHNG                              #  PREVENT REPEATING IGNALG
033184,000198: 32,3205           04024                           OCT      04024                                 
033185,000199: 
033186,000200: 32,3206           44362        ASTNCLOK           CS       ASTNDEX                               
033187,000201: 32,3207           04616                           TC       BANKCALL                              
033188,000202: 32,3210           74670                           CADR     STCLOK2                               
033189,000203: 32,3211           15155                           TCF      ENDOFJOB                              #  RETURN IN NEW JOB AND IN EBANK FIVE
033190,000204: 
033191,000205: 32,3212           06042        ASTNRET            TC       INTPRET                               
033192,000206: 32,3213           47131                           SSP      RTB                                   #  GO PICK UP DISPLAY AT END OF R51:
033193,000207: 32,3214           02747                                    QMAJ                                  #        "PROCEED" WILL DO A FINE ALIGNMENT
033194,000208: 32,3215           65217                           FCADR    P63SPOT2                              #        "ENTER" WILL RETURN TO P63SPOT2
033195,000209: 32,3216           31127                                    R51P63                                
033196,000210: 32,3217           53575        P63SPOT2           VLOAD    UNIT                                  #  INITIALIZE KALCMANU FOR BURN ATTITUDE
033197,000211: 32,3220           02621                                    R60VSAVE                              
033198,000212: 32,3221           27773                           STOVL    POINTVSM                              
033199,000213: 32,3222           06522                                    UNITX                                 
033200,000214: 32,3223           03765                           STORE    SCAXIS                                
033201,000215: 32,3224           77776                           EXIT                                           
033202,000216: 
033203,000217: 32,3225           35016                           CAF      EBANK7                                
033204,000218: 32,3226           54003                           TS       EBANK                                 
033205,000219: 
033206,000220: 32,3227           00004                           INHINT                                         
033207,000221: 32,3230           04674                           TC       IBNKCALL                              
033208,000222: 32,3231           40143                           CADR     PFLITEDB                              

Page 784

033210,000224: 32,3232           00003                           RELINT                                         
033211,000225: 
033212,000226: 32,3233           04616                           TC       BANKCALL                              
033213,000227: 32,3234           54123                           CADR     R60LEM                                
033214,000228: 
033215,000229: 32,3235           05353                           TC       PHASCHNG                              #  PREVENT RECALLING R60
033216,000230: 32,3236           04024                           OCT      04024                                 
033217,000231: 
033218,000232: 32,3237           34746        P63SPOT3           CA       BIT6                                  #  IS THE LR ANTENNA IN POSITION 1 YET
033219,000233: 32,3240           00006                           EXTEND                                         
033220,000234: 32,3241           02033                           RAND     CHAN33                                
033221,000235: 32,3242           00006                           EXTEND                                         
033222,000236: 32,3243           13251                           BZF      P63SPOT4                              #  BRANCH IF ANTENNA ALREADY IN POSITION 1
033223,000237: 
033224,000238: 32,3244           33256                           CAF      CODE500                               #  ASTRONAUT:    PLEASE CRANK THE
033225,000239: 32,3245           04616                           TC       BANKCALL                              #                SILLY THING AROUND
033226,000240: 32,3246           20624                           CADR     GOPERF1                               
033227,000241: 32,3247           16001                           TCF      GOTOPOOH                              #  TERMINATE
033228,000242: 32,3250           13237                           TCF      P63SPOT3                              #  PROCEED       SEE IF HE'S LYING
033229,000243: 
033230,000244: 32,3251           04616        P63SPOT4           TC       BANKCALL                              #  ENTER         INITIALIZE LANDING RADAR
033231,000245: 32,3252           67701                           CADR     SETPOS1                               
033232,000246: 
033233,000247: 32,3253           04635                           TC       POSTJUMP                              #  OFF TO SEE THE WIZARD ...
033234,000248: 32,3254           74130                           CADR     BURNBABY                              
033235,000249: 
033236,000250:                                                                                                  #        ----------------------------------------
033237,000251: 
033238,000252:                                                                                                  #  CONSTANTS FOR P63LM AND IGNALG
033239,000253: 
033240,000254: 32,3255           02100        P63ADRES           GENADR   P63TABLE                              
033241,000255: 
033242,000256: 32,3256     4362               ASTNDEX            =        MD1                                   #  OCT 25; INDEX FOR CLOKTASK
033243,000257: 
033244,000258: 32,3256           00500        CODE500            OCT      00500                                 
033245,000259: 
033246,000260: 32,3257           00035 30373  99999CON           2DEC     30479.7    B-24                       
033247,000261: 
033248,000262: 32,3261           00004 01610  GUIDDURN           2DEC     +66440     B-28                       #  GUIDDURN +6.64400314 E+2
033249,000263: 32,3263           00000 00010  DDUMCRIT           2DEC     +8         B-28                       #  CRITERION FOR IGNALG CONVERGENCE
033250,000264: 

Page 785

033252,000266:                                                                                                  #        ----------------------------------------
033253,000267: 

Page 786

033255,000269:                                                                                                  #        ****************************************
033256,000270:                                                                                                  #        P68: LANDING CONFIRMATION
033257,000271:                                                                                                  #        ****************************************
033258,000272: 
033259,000273: 34,3271                                           BANK     34                                    
033260,000274: 34,2000                                           SETLOC   F2DPS*34                              
033261,000275: 34,2000                                           BANK                                           
033262,000276: 
033263,000277: 34,3271                                           COUNT*   $$/P6567                              
033264,000278: 
033265,000279: 34,3271           05353        LANDJUNK           TC       PHASCHNG                              
033266,000280: 34,3272           04024                           OCT      04024                                 
033267,000281: 
033268,000282: 34,3273           00004                           INHINT                                         
033269,000283: 34,3274           04616                           TC       BANKCALL                              #  ZERO ATTITUDE ERROR
033270,000284: 34,3275           40154                           CADR     ZATTEROR                              
033271,000285: 
033272,000286: 34,3276           06042                           TC       INTPRET                               #  TO INTERPRETIVE AS TIME IS NOT CRITICAL
033273,000287: 34,3277           77614                           SET                                            #  PREVENT RCS JET FIRINGS IF MODE CONT IS
033274,000288: 34,3300           06460                                    PULSEFLG                              #  IN ATT HOLD
033275,000289: 34,3301           43014                           SET      CLEAR                                 
033276,000290: 34,3302           04067                                    SURFFLAG                              
033277,000291: 34,3303           04666                                    LETABORT                              
033278,000292: 34,3304           77214                           SET      VLOAD                                 
033279,000293: 34,3305           05062                                    APSFLAG                               
033280,000294: 34,3306           01220                                    RN                                    
033281,000295: 34,3307           16032                           STODL    ALPHAV                                
033282,000296: 34,3310           01234                                    PIPTIME                               
033283,000297: 34,3311           45014                           SET      CALL                                  
033284,000298: 34,3312           01463                                    LUNAFLAG                              
033285,000299: 34,3313           26347                                    LAT-LONG                              
033286,000300: 34,3314           77201                           SETPD    VLOAD                                 #  COMPUTE RLS AND STORE IT AWAY
033287,000301: 34,3315           00001                                    0                                     
033288,000302: 34,3316           01220                                    RN                                    
033289,000303: 34,3317           65352                           VSL2     PDDL                                  
033290,000304: 34,3320           01234                                    PIPTIME                               
033291,000305: 34,3321           45006                           PUSH     CALL                                  
033292,000306: 34,3322           51700                                    R-TO-RP                               
033293,000307: 34,3323           02023                           STORE    RLS                                   
033294,000308: 34,3324           77776                           EXIT                                           
033295,000309: 34,3325           33342                           CAF      V06N43*                               #  ASTRONAUT:  NOW LOOK WHERE YOU ENDED UP
033296,000310: 34,3326           04616                           TC       BANKCALL                              
033297,000311: 34,3327           20477                           CADR     GOFLASH                               
033298,000312: 34,3330           16001                           TCF      GOTOPOOH                              #  TERMINATE
033299,000313: 34,3331           13333                           TCF      +2                                    #  PROCEED
033300,000314: 34,3332           13325                           TCF      -5                                    #  RECYCLE
033301,000315: 
033302,000316: 34,3333           06042                           TC       INTPRET                               
033303,000317: 34,3334           77775                           VLOAD                                          #  INITIALIZE GSAV AND (USING REFMF)

Page 787

033305,000319: 34,3335           06522                                    UNITX                                 #  YNBSAV, ZNBSAV AND ATTFLAG FOR P57
033306,000320: 34,3336           36231                           STCALL   GSAV                                  
033307,000321: 34,3337           33471                                    REFMF                                 
033308,000322: 34,3340           77776                           EXIT                                           
033309,000323: 
033310,000324: 34,3341           16001                           TCF      GOTOPOOH                              #  ASTRONAUT:  PLEASE SELECT P57
033311,000325: 
033312,000326: 34,3342           01453        V06N43*            VN       0643                                  
033313,000327: 

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