Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
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.

030827,000002:                                                                                                  ## Copyright:   Public domain.
030828,000003:                                                                                                  ## Filename:    R31.agc
030829,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
030830,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
030831,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
030832,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
030833,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
030834,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
030835,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
030836,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
030837,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
030838,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
030839,000014:                                                                                                  ## Reference:   pp. 712-716
030840,000015:                                                                                                  ## Assembler:   yaYUL
030841,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
030842,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
030843,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
030844,000019:                                                                                                  ##              2021-05-30 ABS  Aligned IAW to field boundary.
030845,000020: 

Page 712

030847,000022: 34,3271                                           BANK     34                                    
030848,000023: 37,2000                                           SETLOC   R31                                   
030849,000024: 37,2000                                           BANK                                           
030850,000025: 
030851,000026: 37,3113                                           COUNT*   $$/R31                                
030852,000027: 
030853,000028: 37,3113           35015        R31CALL            CAF      PRIO3                                 
030854,000029: 37,3114           05105                           TC       FINDVAC                               
030855,000030: 37,3115  E7,1466                                  EBANK=   SUBEXIT                               
030856,000031: 37,3115           03145 76067                     2CADR    V83CALL                               
030857,000032: 
030858,000033: 37,3117           05221        DSPDELAY           TC       FIXDELAY                              
030859,000034: 37,3120           00144                           DEC      100        B-14                       
030860,000035: 37,3121           31044                           CA       EXTVBACT                              
030861,000036: 37,3122           74740                           MASK     BIT12                                 
030862,000037: 37,3123           00006                           EXTEND                                         
030863,000038: 37,3124           13117                           BZF      DSPDELAY                              
030864,000039: 
030865,000040: 37,3125           35017                           CAF      PRIO5                                 
030866,000041: 37,3126           05072                           TC       NOVAC                                 
030867,000042: 37,3127  E7,1607                                  EBANK=   TSTRT                                 
030868,000043: 37,3127           03132 76067                     2CADR    DISPN5X                               
030869,000044: 
030870,000045: 37,3131           15261                           TCF      TASKOVER                              
030871,000046: 
030872,000047: 37,3132           33240        DISPN5X            CAF      V16N54                                
030873,000048: 37,3133           04616                           TC       BANKCALL                              
030874,000049: 37,3134           20212                           CADR     GOMARKF                               
030875,000050: 37,3135           05563                           TC       B5OFF                                 
030876,000051: 37,3136           05563                           TC       B5OFF                                 
030877,000052: 37,3137           13132                           TCF      DISPN5X                               
030878,000053: 
030879,000054: 37,3140           06036        V83                TC       INTPRET                               
030880,000055: 37,3141           77624                           CALL                                           
030881,000056: 37,3142           77371                                    REDOEXTP                              
030882,000057: 37,3143           77650                           GOTO                                           
030883,000058: 37,3144           77150                                    COMPDISP                              
030884,000059: 37,3145           06036        V83CALL            TC       INTPRET                               
030885,000060: 37,3146           77624                           CALL                                           
030886,000061: 37,3147           77241                                    STATEXTP                              #  EXTRAPOLATE STATE VECTORS
030887,000062: 37,3150           52375        COMPDISP           VLOAD    VSU                                   
030888,000063: 37,3151           00001                                    RATT                                  
030889,000064: 37,3152           02213                                    RONE                                  
030890,000065: 37,3153           51406                           PUSH     ABVAL                                 #  RATT-RONE TO 0D               PD = 6
030891,000066: 37,3154           02205                           STORE    RANGE                                 #  METERS B-29
030892,000067: 37,3155           77301                           NORM     VLOAD                                 
030893,000068: 37,3156           00047                                    X1                                    #  RATT-RONE                     PD = 0
030894,000069: 37,3157           53457                           VSL*     UNIT                                  
030895,000070: 37,3160           20201                                    0,1                                   

Page 713

030897,000072: 37,3161           52315                           PDVL     VSU                                   #  UNIT(LOS) TO 0D              PD = 6
030898,000073: 37,3162           00007                                    VATT                                  
030899,000074: 37,3163           02221                                    VONE                                  
030900,000075: 37,3164           77641                           DOT                                            #  (VATT-VONE).UNIT(LOS)        PD = 0
030901,000076: 37,3165           77752                           SL1                                            
030902,000077: 37,3166           26207                           STOVL    RRATE                                 #  RANGE RATE M/CS B-7
030903,000078: 37,3167           02213                                    RONE                                  
030904,000079: 37,3170           63256                           UNIT     PDVL                                  #  UR TO 0D                           PD = 6
030905,000080: 37,3171           06416                                    THISAXIS                              #  UNITX FOR CM, UNTIZ FOR LM
030906,000081: 37,3172           77624                           CALL                                           
030907,000082: 37,3173           47565                                    CDU*NBSM                              
030908,000083: 37,3174           41505                           VXM      PUSH                                  #  UXORZ TO 6D                  PD=12D
030909,000084: 37,3175           01734                                    REFSMMAT                              
030910,000085: 37,3176           72431                           VPROJ    VSL2                                  
030911,000086: 37,3177           00001                                    0D                                    
030912,000087: 37,3200           53445                           BVSU     UNIT                                  
030913,000088: 37,3201           00007                                    6D                                    
030914,000089: 37,3202           47315                           PDVL     VXV                                   #  UP/2 TO 12D                  PD=18D
030915,000090: 37,3203           02213                                    RONE                                  
030916,000091: 37,3204           02221                                    VONE                                  
030917,000092: 37,3205           47256                           UNIT     VXV                                   
030918,000093: 37,3206           02213                                    RONE                                  
030919,000094: 37,3207           63241                           DOT      PDVL                                  #  SIGN TO 12D, UP/2 TO MPAC    PD=18D
030920,000095: 37,3210           00015                                    12D                                   
030921,000096: 37,3211           50372                           VSL1     DOT                                   #  UP.UXORZ
030922,000097: 37,3212           00007                                    6D                                    
030923,000098: 37,3213           72565                           SIGN     SL1                                   
030924,000099: 37,3214           00015                                    12D                                   
030925,000100: 37,3215           77726                           ACOS                                           
030926,000101: 37,3216           26211                           STOVL    RTHETA                                
030927,000102: 37,3217           02213                                    RONE                                  
030928,000103: 37,3220           51041                           DOT      BPL                                   
030929,000104: 37,3221           00007                                    6D                                    
030930,000105: 37,3222           77227                                    +5                                    
030931,000106: 37,3223           44345                           DLOAD    BDSU                                  #  IF UXORZ.R NEG, RTHETA = 1 - RTHETA
030932,000107: 37,3224           02211                                    RTHETA                                
030933,000108: 37,3225           06432                                    DPPOSMAX                              
030934,000109: 37,3226           02211                           STORE    RTHETA                                #  RTHETA BETWEEN 0 AND 1 REV.
030935,000110: 37,3227           77776                           EXIT                                           
030936,000111: 37,3230           34747                           CAF      BIT5                                  #  HAVE WE BEEN ANSWERED
030937,000112: 37,3231           71044                           MASK     EXTVBACT                              
030938,000113: 37,3232           00006                           EXTEND                                         
030939,000114: 37,3233           15472                           BZF      ENDEXT                                #  YES, DIE
030940,000115: 
030941,000116: 37,3234           41044                           CS       EXTVBACT                              
030942,000117: 37,3235           74740                           MASK     BIT12                                 
030943,000118: 37,3236           27044                           ADS      EXTVBACT                              
030944,000119: 
030945,000120: 37,3237           13140                           TCF      V83                                   
030946,000121: 37,3240           04066        V16N54             VN       1654                                  
030947,000122: 

Page 714

030949,000124:                                                                                                  #  THE STATEXTP SUBROUTINE DOES A PRECISION EXTRAPOLATION OF BOTH VEHICLES
030950,000125:                                                                                                  #  STATE VECTORS TO PRESENT TIME AND SAVES THEM AS BASE VECTORS.
030951,000126:                                                                                                  #  IF SERVICER IS OFF ---
030952,000127:                                                                                                  #                  THIS VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED TO
030953,000128:                                                                                                  #                  PRESENT TIME AND SAVED AS RONE, VONE.
030954,000129:                                                                                                  #                  THE OTHER VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED
030955,000130:                                                                                                  #                  TO THE SAME TIME, THE OUTPUT BEING LEFT IN RATT, VATT.
030956,000131:                                                                                                  #  IF SERVICER IS ON ---
030957,000132:                                                                                                  #                  RONE, VONE ARE SET EQUAL TO RN, VN AND THE OTHER
030958,000133:                                                                                                  #                  VEHICLES STATE VECTOR IS PREC. EXTRAPOLATED TO PIPTIME.
030959,000134: 
030960,000135: 37,3241           47020        STATEXTP           STQ      RTB                                   
030961,000136: 37,3242           02116                                    STATEXIT                              
030962,000137: 37,3243           21462                                    LOADTIME                              
030963,000138: 37,3244           34041                           STCALL   TDEC1                                 
030964,000139: 37,3245           27043                                    OTHPREC                               #  GET BASE VECTORS
030965,000140: 37,3246           77775                           VLOAD                                          
030966,000141: 37,3247           00017                                    RATT1                                 
030967,000142: 37,3250           26140                           STOVL    BASEOTP                               #  OTHER POS.
030968,000143: 37,3251           00025                                    VATT1                                 
030969,000144: 37,3252           16120                           STODL    BASEOTV                               #  OTHER VEL.
030970,000145: 37,3253           00015                                    TAT                                   
030971,000146: 37,3254           02114                           STORE    BASETIME                              
030972,000147: 37,3255           34041                           STCALL   TDEC1                                 
030973,000148: 37,3256           27057                                    THISPREC                              
030974,000149: 37,3257           77775                           VLOAD                                          
030975,000150: 37,3260           00017                                    RATT1                                 
030976,000151: 37,3261           26170                           STOVL    BASETHP                               #  THIS POS.
030977,000152: 37,3262           00025                                    VATT1                                 
030978,000153: 37,3263           02105                           STORE    BASETHV                               #  THIS VEL
030979,000154: 37,3264           47014        HAVEBASE           BON      RTB                                   
030980,000155: 37,3265           03712                                    AVEGFLAG                              
030981,000156: 37,3266           77346                                    GETRVN                                #  IF AVG ON ,GET RN ETC.
030982,000157: 37,3267           21462                                    LOADTIME                              
030983,000158: 37,3270           52014                           BON      GOTO                                  #  TEST FOR LM ON SURFACE.
030984,000159: 37,3271           04307                                    SURFFLAG                              
030985,000160: 37,3272           77365                                    R31SURF                               
030986,000161: 37,3273           77274                                    +1                                    
030987,000162: 37,3274           34041                           STCALL   TDEC1                                 #  BEGIN SET UP FOR CONIC EXTRAP. FOR THIS.
030988,000163: 37,3275           27412                                    INTSTALL                              
030989,000164: 37,3276           43175                           VLOAD    CLEAR                                 
030990,000165: 37,3277           02170                                    BASETHP                               
030991,000166: 37,3300           00263                                    MOONFLAG                              
030992,000167: 37,3301           25535                           STOVL    RCV                                   
030993,000168: 37,3302           02105                                    BASETHV                               
030994,000169: 37,3303           15543                           STODL    VCV                                   
030995,000170: 37,3304           02114                                    BASETIME                              
030996,000171: 37,3305           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
030997,000172: 37,3306           04344                                    MOONTHIS                              
030998,000173: 37,3307           77311                                    +2                                    
030999,000174: 37,3310           00063                                    MOONFLAG                              

Page 715

031001,000176: 37,3311           77614                           SET                                            
031002,000177: 37,3312           01473                                    INTYPFLG                              #  CONIC EXTRAP.
031003,000178: 37,3313           35517                           STCALL   TET                                   
031004,000179: 37,3314           27107                                    INTEGRVS                              #  INTEGRATION --- AT LAST---
031005,000180: 37,3315           77775        OTHCONIC           VLOAD                                          
031006,000181: 37,3316           00001                                    RATT                                  
031007,000182: 37,3317           26213                           STOVL    RONE                                  
031008,000183: 37,3320           00007                                    VATT                                  
031009,000184: 37,3321           36221                           STCALL   VONE                                  #  GET SET FOR CONIC EXTRAP.,OTHER.
031010,000185: 37,3322           27412                                    INTSTALL                              
031011,000186: 37,3323           71214                           SET      DLOAD                                 
031012,000187: 37,3324           01473                                    INTYPFLG                              
031013,000188: 37,3325           00015                                    TAT                                   
031014,000189: 37,3326           00041        OTHINT             STORE    TDEC1                                 
031015,000190: 37,3327           43175                           VLOAD    CLEAR                                 
031016,000191: 37,3330           02140                                    BASEOTP                               
031017,000192: 37,3331           00263                                    MOONFLAG                              
031018,000193: 37,3332           25535                           STOVL    RCV                                   
031019,000194: 37,3333           02120                                    BASEOTV                               
031020,000195: 37,3334           15543                           STODL    VCV                                   
031021,000196: 37,3335           02114                                    BASETIME                              
031022,000197: 37,3336           43014                           BOF      SET                                   
031023,000198: 37,3337           04344                                    MOONTHIS                              
031024,000199: 37,3340           77342                                    +2                                    
031025,000200: 37,3341           00063                                    MOONFLAG                              
031026,000201: 37,3342           35517                           STCALL   TET                                   
031027,000202: 37,3343           27107                                    INTEGRVS                              
031028,000203: 37,3344           77650                           GOTO                                           
031029,000204: 37,3345           02116                                    STATEXIT                              #  THIS VEHICLES POS.,VEL. IN PUSHLIST.
031030,000205: 37,3346           52175        GETRVN             VLOAD    GOTO                                  
031031,000206: 37,3347           01221                                    RN                                    
031032,000207: 37,3350           77351                                    +1                                    
031033,000208: 37,3351           36213                           STCALL   RONE                                  
031034,000209: 37,3352           77353                                    +1                                    
031035,000210: 37,3353           52175                           VLOAD    GOTO                                  
031036,000211: 37,3354           01227                                    VN                                    
031037,000212: 37,3355           77356                                    +1                                    
031038,000213: 37,3356           16221                           STODL    VONE                                  
031039,000214: 37,3357           01235                                    PIPTIME                               
031040,000215: 37,3360           77624        GETRVN2            CALL                                           
031041,000216: 37,3361           27412                                    INTSTALL                              
031042,000217: 37,3362           52014                           CLEAR    GOTO                                  
031043,000218: 37,3363           01673                                    INTYPFLG                              #  PREC EXTRAP FOR OTHER
031044,000219: 37,3364           77326                                    OTHINT                                
031045,000220: 37,3365           34041        R31SURF            STCALL   TDEC1                                 #  LM ON SURFACE.
031046,000221: 37,3366           27057                                    LEMPREC                               
031047,000222: 37,3367           77650                           GOTO                                           #  DO CSM CONIC
031048,000223: 37,3370           77315                                    OTHCONIC                              

Page 716

031050,000225: 37,3371           52020        REDOEXTP           STQ      GOTO                                  
031051,000226: 37,3372           02116                                    STATEXIT                              
031052,000227: 37,3373           77264                                    HAVEBASE                              
031053,000228: 

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