Source Code

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

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

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

029562,000002:                                                                                                  ## Copyright:   Public domain.
029563,000003:                                                                                                  ## Filename:    R31.agc
029564,000004:                                                                                                  ## Purpose:     A section of Luminary revision 96.
029565,000005:                                                                                                  ##              It is part of the reconstructed source code for the
029566,000006:                                                                                                  ##              original release of the flight software for the Lunar 
029567,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
029568,000008:                                                                                                  ##              The code has been recreated from a previously reconstructed
029569,000009:                                                                                                  ##              copy of Luminary 97 by undoing changes described in anomaly
029570,000010:                                                                                                  ##              report LNY-59. The code has been adapted such that the
029571,000011:                                                                                                  ##              resulting bugger words exactly match those specified for
029572,000012:                                                                                                  ##              Luminary 96 in NASA drawing 2021152D, which gives relatively
029573,000013:                                                                                                  ##              high confidence that the reconstruction is correct.
029574,000014:                                                                                                  ## Reference:   pp. 703-708
029575,000015:                                                                                                  ## Assembler:   yaYUL
029576,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
029577,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
029578,000018:                                                                                                  ## Mod history: 2019-08-04 MAS  Created from Luminary 97.
029579,000019: 

Page 703

029581,000021: 40,3674                                           BANK     40                                    
029582,000022: 40,2000                                           SETLOC   R31LOC                                
029583,000023: 40,2000                                           BANK                                           
029584,000024: 
029585,000025: 40,3674                                           COUNT*   $$/R31                                
029586,000026: 
029587,000027: 40,3674           35015        R31CALL            CAF      PRIO3                                 
029588,000028: 40,3675           05105                           TC       FINDVAC                               
029589,000029: 40,3676  E7,1470                                  EBANK=   SUBEXIT                               
029590,000030: 40,3676           03121 76067                     2CADR    V83CALL                               
029591,000031: 
029592,000032: 40,3700           05221        DSPDELAY           TC       FIXDELAY                              
029593,000033: 40,3701           00144                           DEC      100        B-14                       
029594,000034: 40,3702           31044                           CA       EXTVBACT                              
029595,000035: 40,3703           74740                           MASK     BIT12                                 
029596,000036: 40,3704           00006                           EXTEND                                         
029597,000037: 40,3705           13700                           BZF      DSPDELAY                              
029598,000038: 
029599,000039: 40,3706           35017                           CAF      PRIO5                                 
029600,000040: 40,3707           05072                           TC       NOVAC                                 
029601,000041: 40,3710  E7,1611                                  EBANK=   TSTRT                                 
029602,000042: 40,3710           03113 76067                     2CADR    DISPN5X                               
029603,000043: 
029604,000044: 40,3712           15261                           TCF      TASKOVER                              
029605,000045: 
029606,000046: 37,3113                                           BANK     37                                    
029607,000047: 37,2000                                           SETLOC   R31                                   
029608,000048: 37,2000                                           BANK                                           
029609,000049: 37,3113                                           COUNT*   $$/R31                                
029610,000050: 
029611,000051: 37,3113           33407        DISPN5X            CAF      V16N54                                
029612,000052: 37,3114           04616                           TC       BANKCALL                              
029613,000053: 37,3115           20334                           CADR     GOMARKF                               
029614,000054: 37,3116           05563                           TC       B5OFF                                 
029615,000055: 37,3117           05563                           TC       B5OFF                                 
029616,000056: 37,3120           13113                           TCF      DISPN5X                               
029617,000057: 
029618,000058: 37,3121           40103        V83CALL            CS       FLAGWRD7                              #  TEST AVERAGE G FLAG
029619,000059: 37,3122           74747                           MASK     AVEGFBIT                              
029620,000060: 37,3123           00006                           EXTEND                                         
029621,000061: 37,3124           13377                           BZF      MUNG?                                 #  ON - TEST MUNFLAG
029622,000062: 
029623,000063: 37,3125           40104                           CS       FLAGWRD8                              
029624,000064: 37,3126           74744                           MASK     SURFFBIT                              
029625,000065: 37,3127           00006                           EXTEND                                         
029626,000066: 37,3130           13403                           BZF      ONEBASE                               #  ON SURFACE - BYPASS LEMPREC
029627,000067: 
029628,000068: 37,3131           06037                           TC       INTPRET                               #  EXTRAPOLATE BOTH STATE VECTORS
029629,000069: 37,3132           77634                           RTB                                            

Page 704

029631,000071: 37,3133           21573                                    LOADTIME                              
029632,000072: 37,3134           34041                           STCALL   TDEC1                                 
029633,000073: 37,3135           27057                                    LEMPREC                               #  PRECISION BASE VECTOR FOR LM
029634,000074: 37,3136           77775                           VLOAD                                          
029635,000075: 37,3137           00017                                    RATT1                                 
029636,000076: 37,3140           26170                           STOVL    BASETHP                               
029637,000077: 37,3141           00025                                    VATT1                                 
029638,000078: 37,3142           16105                           STODL    BASETHV                               
029639,000079: 37,3143           00015                                    TAT                                   
029640,000080: 37,3144           02114        DOCMBASE           STORE    BASETIME                              #  PRECISION BASE VECTOR FOR CM
029641,000081: 37,3145           34041                           STCALL   TDEC1                                 
029642,000082: 37,3146           27043                                    CSMPREC                               
029643,000083: 37,3147           77775                           VLOAD                                          
029644,000084: 37,3150           00017                                    RATT1                                 
029645,000085: 37,3151           26140                           STOVL    BASEOTP                               
029646,000086: 37,3152           00025                                    VATT1                                 
029647,000087: 37,3153           02120                           STORE    BASEOTV                               
029648,000088: 37,3154           77776                           EXIT                                           
029649,000089: 
029650,000090: 37,3155           40103        REV83              CS       FLAGWRD7                              
029651,000091: 37,3156           74747                           MASK     AVEGFBIT                              
029652,000092: 37,3157           00006                           EXTEND                                         
029653,000093: 37,3160           13326                           BZF      GETRVN                                #  IF AVEGFLAG SET, USE RN,VN
029654,000094: 
029655,000095: 37,3161           40104                           CS       FLAGWRD8                              
029656,000096: 37,3162           74744                           MASK     SURFFBIT                              
029657,000097: 37,3163           00006                           EXTEND                                         
029658,000098: 37,3164           13370                           BZF      R31SURF                               #  IF ON SURFACE, USE LEMAREC
029659,000099: 
029660,000100: 37,3165           06037                           TC       INTPRET                               #  DO CONIC EXTRAPOLATION FOR BOTH VEHICLES
029661,000101: 37,3166           77634                           RTB                                            
029662,000102: 37,3167           21573                                    LOADTIME                              
029663,000103: 37,3170           34041                           STCALL   TDEC1                                 
029664,000104: 37,3171           27414                                    INTSTALL                              
029665,000105: 37,3172           43175                           VLOAD    CLEAR                                 
029666,000106: 37,3173           02170                                    BASETHP                               
029667,000107: 37,3174           00263                                    MOONFLAG                              
029668,000108: 37,3175           25535                           STOVL    RCV                                   
029669,000109: 37,3176           02105                                    BASETHV                               
029670,000110: 37,3177           15543                           STODL    VCV                                   
029671,000111: 37,3200           02114                                    BASETIME                              
029672,000112: 37,3201           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
029673,000113: 37,3202           04344                                    MOONTHIS                              
029674,000114: 37,3203           77205                                    +2                                    
029675,000115: 37,3204           00063                                    MOONFLAG                              
029676,000116: 37,3205           77614                           SET                                            
029677,000117: 37,3206           01473                                    INTYPFLG                              #  CONIC EXTRAP.
029678,000118: 37,3207           35517                           STCALL   TET                                   
029679,000119: 37,3210           27107                                    INTEGRVS                              #  INTEGRATION --- AT LAST ---
029680,000120: 37,3211           77775        OTHCONIC           VLOAD                                          

Page 705

029682,000122: 37,3212           00001                                    RATT                                  
029683,000123: 37,3213           26207                           STOVL    RONE                                  
029684,000124: 37,3214           00007                                    VATT                                  
029685,000125: 37,3215           36215                           STCALL   VONE                                  #  GET SET FOR CONIC EXTRAP., OTHER.
029686,000126: 37,3216           27414                                    INTSTALL                              
029687,000127: 37,3217           71214                           SET      DLOAD                                 
029688,000128: 37,3220           01473                                    INTYPFLG                              
029689,000129: 37,3221           00015                                    TAT                                   
029690,000130: 37,3222           00041        OTHINT             STORE    TDEC1                                 
029691,000131: 37,3223           43175                           VLOAD    CLEAR                                 
029692,000132: 37,3224           02140                                    BASEOTP                               
029693,000133: 37,3225           00263                                    MOONFLAG                              
029694,000134: 37,3226           25535                           STOVL    RCV                                   
029695,000135: 37,3227           02120                                    BASEOTV                               
029696,000136: 37,3230           15543                           STODL    VCV                                   
029697,000137: 37,3231           02114                                    BASETIME                              
029698,000138: 37,3232           43014                           BOF      SET                                   
029699,000139: 37,3233           04344                                    MOONTHIS                              
029700,000140: 37,3234           77236                                    +2                                    
029701,000141: 37,3235           00063                                    MOONFLAG                              
029702,000142: 37,3236           35517                           STCALL   TET                                   
029703,000143: 37,3237           27107                                    INTEGRVS                              
029704,000144: 37,3240           52375        COMPDISP           VLOAD    VSU                                   
029705,000145: 37,3241           00001                                    RATT                                  
029706,000146: 37,3242           02207                                    RONE                                  
029707,000147: 37,3243           65234                           RTB      PDDL                                  
029708,000148: 37,3244           21724                                    NORMUNX1                              #  UNIT(RANGE) TO PD 0-5
029709,000149: 37,3245           00045                                    36D                                   
029710,000150: 37,3246           77657                           SL*                                            #  RESCALE AFTER NORMUNIT
029711,000151: 37,3247           20201                                    0,1                                   
029712,000152: 37,3250           26201                           STOVL    RANGE                                 #  SCALED 2(29)M
029713,000153: 37,3251           00007                                    VATT                                  
029714,000154: 37,3252           50251                           VSU      DOT                                   #  (VCM-VLM).UNIT(LOS), PD=0
029715,000155: 37,3253           02215                                    VONE                                  
029716,000156: 37,3254           77752                           SL1                                            #  SCALED 2(7)M/CS
029717,000157: 37,3255           26203                           STOVL    RRATE                                 
029718,000158: 37,3256           02207                                    RONE                                  
029719,000159: 37,3257           63256                           UNIT     PDVL                                  #  UNIT(R) TO PD 0-5
029720,000160: 37,3260           06514                                    UNITZ                                 
029721,000161: 37,3261           77624                           CALL                                           
029722,000162: 37,3262           47661                                    CDU*NBSM                              
029723,000163: 37,3263           41505                           VXM      PUSH                                  #  UNIT(Z)/4 TO PD 6-11
029724,000164: 37,3264           01734                                    REFSMMAT                              
029725,000165: 37,3265           72431                           VPROJ    VSL2                                  #  UNIT(P)=UNIT(UZ-(UZ)PROJ(UR))
029726,000166: 37,3266           00001                                    0D                                    
029727,000167: 37,3267           53445                           BVSU     UNIT                                  
029728,000168: 37,3270           00007                                    6D                                    
029729,000169: 37,3271           47315                           PDVL     VXV                                   #  UNIT(P) TO PD 12-17
029730,000170: 37,3272           00001                                    0D                                    #  UNIT(RL)
029731,000171: 37,3273           02215                                    VONE                                  

Page 706

029733,000173: 37,3274           50235                           VXV      DOT                                   #  (UR * VL) * UR . U(P)
029734,000174: 37,3275           00001                                    0D                                    
029735,000175: 37,3276           00015                                    12D                                   
029736,000176: 37,3277           77715                           PDVL                                           #  SIGN TO 12-13, LOAD U(P)
029737,000177: 37,3300           75241                           DOT      SIGN                                  
029738,000178: 37,3301           00007                                    6D                                    
029739,000179: 37,3302           00015                                    12D                                   
029740,000180: 37,3303           65512                           SL2      ACOS                                  #  ARCCOS(UP.UZ(SIGN))
029741,000181: 37,3304           26205                           STOVL    RTHETA                                
029742,000182: 37,3305           00001                                    0D                                    
029743,000183: 37,3306           51041                           DOT      BPL                                   #  IF UR.UZ NEG,
029744,000184: 37,3307           00007                                    6D                                    #        RTHETA = 1 - RTHETA
029745,000185: 37,3310           77315                                    +5                                    
029746,000186: 37,3311           45345                           DLOAD    DSU                                   
029747,000187: 37,3312           06530                                    DPPOSMAX                              
029748,000188: 37,3313           02205                                    RTHETA                                
029749,000189: 37,3314           02205                           STORE    RTHETA                                
029750,000190: 37,3315           77776                           EXIT                                           
029751,000191: 
029752,000192: 37,3316           34747                           CA       BIT5                                  
029753,000193: 37,3317           71044                           MASK     EXTVBACT                              
029754,000194: 37,3320           00006                           EXTEND                                         #  IF ANSWERED,
029755,000195: 37,3321           15472                           BZF      ENDEXT                                #        TERMINATE
029756,000196: 
029757,000197: 37,3322           41044                           CS       EXTVBACT                              
029758,000198: 37,3323           74740                           MASK     BIT12                                 
029759,000199: 37,3324           27044                           ADS      EXTVBACT                              #  SET BIT 12
029760,000200: 37,3325           13155                           TCF      REV83                                 #  AND START AGAIN.
029761,000201: 
029762,000202: 37,3326           37710        GETRVN             CA       PRIO22                                #  INHIBIT SERVICER
029763,000203: 37,3327           05146                           TC       PRIOCHNG                              
029764,000204: 37,3330           06037                           TC       INTPRET                               
029765,000205: 37,3331           40375                           VLOAD    SETPD                                 
029766,000206: 37,3332           01221                                    RN                                    #  LM STATE VECTOR IN RN,VN
029767,000207: 37,3333           00001                                    0                                     
029768,000208: 37,3334           26207                           STOVL    RONE                                  
029769,000209: 37,3335           01227                                    VN                                    
029770,000210: 37,3336           26215                           STOVL    VONE                                  #  LOAD R(CSM),V(CSM) IN CASE MUNFLAG SET
029771,000211: 37,3337           01726                                    V(CSM)                                #  (TO INSURE TIME COMPATABILITY)
029772,000212: 37,3340           65315                           PDVL     PDDL                                  
029773,000213: 37,3341           01720                                    R(CSM)                                
029774,000214: 37,3342           01235                                    PIPTIME                               
029775,000215: 37,3343           77776                           EXIT                                           
029776,000216: 37,3344           35015                           CA       PRIO3                                 
029777,000217: 37,3345           05146                           TC       PRIOCHNG                              
029778,000218: 37,3346           06037                           TC       INTPRET                               
029779,000219: 37,3347           77214                           BOFF     VLOAD                                 
029780,000220: 37,3350           03347                                    MUNFLAG                               
029781,000221: 37,3351           77363                                    GETRVN2                               #  IF MUNFLAG RESET, DO CM DELTA PRECISION

Page 707

029783,000223: 37,3352           60505                           VXM      VSR4                                  #  CHANGE TO REFERENCE SYSTEM AND RESCALE
029784,000224: 37,3353           01734                                    REFSMMAT                              
029785,000225: 37,3354           77715                           PDVL                                           #  R TO PD 0-5
029786,000226: 37,3355           76505                           VXM      VSL1                                  
029787,000227: 37,3356           01734                                    REFSMMAT                              
029788,000228: 37,3357           40206                           PUSH     SETPD                                 #  V TO PD 5-11
029789,000229: 37,3360           00001                                    0                                     
029790,000230: 37,3361           77650                           GOTO                                           
029791,000231: 37,3362           77240                                    COMPDISP                              
029792,000232: 
029793,000233: 37,3363           77624        GETRVN2            CALL                                           
029794,000234: 37,3364           27414                                    INTSTALL                              
029795,000235: 37,3365           52014                           CLEAR    GOTO                                  
029796,000236: 37,3366           01673                                    INTYPFLG                              #  PREC EXTRAP FOR OTHER
029797,000237: 37,3367           77222                                    OTHINT                                
029798,000238: 37,3370           06037        R31SURF            TC       INTPRET                               
029799,000239: 37,3371           77634                           RTB                                            #  LM IS ON SURFACE, SO PRECISION
029800,000240: 37,3372           21573                                    LOADTIME                              #  INTEGRATION USES PLANETARY INERTIAL
029801,000241: 37,3373           34041                           STCALL   TDEC1                                 #  ORIENTATION SUBROUTINE
029802,000242: 37,3374           27057                                    LEMPREC                               
029803,000243: 37,3375           77650                           GOTO                                           #  DO CSM CONIC
029804,000244: 37,3376           77211                                    OTHCONIC                              
029805,000245: 37,3377           40102        MUNG?              CS       FLAGWRD6                              
029806,000246: 37,3400           74744                           MASK     MUNFLBIT                              
029807,000247: 37,3401           00006                           EXTEND                                         
029808,000248: 37,3402           13326                           BZF      GETRVN                                #  IF MUNFLAG SET, CSM BASE NOT NEEDED
029809,000249: 
029810,000250: 37,3403           06037        ONEBASE            TC       INTPRET                               #  GET CSM BASE VECTOR
029811,000251: 37,3404           52034                           RTB      GOTO                                  
029812,000252: 37,3405           21573                                    LOADTIME                              
029813,000253: 37,3406           77144                                    DOCMBASE                              
029814,000254: 
029815,000255: 37,3407           04066        V16N54             VN       1654                                  
029816,000256: 

Page 708
This page is empty.

029819,000259: 

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