Source Code

These source-code files are part of a reconstructed copy of Luminary 163, the first (unflown) release of the Apollo 14 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 173. Changes between revision 163 and 173 were backed out, as described by Luminary memos 157 and 158. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 163 listing would be different.

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.

029993,000002:                                                                                                  ## Copyright:   Public domain.
029994,000003:                                                                                                  ## Filename:    R31.agc
029995,000004:                                                                                                  ## Purpose:     A section of Luminary revision 163.
029996,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
029997,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
029998,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
029999,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
030000,000009:                                                                                                  ##              Luminary 173, as well as Luminary memos 157 amd 158.
030001,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
030002,000011:                                                                                                  ##              exactly match those specified for Luminary 163 in NASA
030003,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
030004,000013:                                                                                                  ##              that the reconstruction is correct.
030005,000014:                                                                                                  ## Reference:   pp. 698-702
030006,000015:                                                                                                  ## Assembler:   yaYUL
030007,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
030008,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
030009,000018:                                                                                                  ## Mod history: 2019-08-21 MAS  Created from Luminary 173.
030010,000019: 

Page 698

030012,000021: 40,3746                                           BANK     40                                    
030013,000022: 40,2000                                           SETLOC   R31LOC                                
030014,000023: 40,2000                                           BANK                                           
030015,000024: 
030016,000025: 40,3746                                           COUNT*   $$/R31                                
030017,000026: 
030018,000027: 40,3746           35015        R31CALL            CAF      PRIO3                                 
030019,000028: 40,3747           05105                           TC       FINDVAC                               
030020,000029: 40,3750  E7,1470                                  EBANK=   SUBEXIT                               
030021,000030: 40,3750           03113 76067                     2CADR    V83CALL                               
030022,000031: 
030023,000032: 40,3752           05232        DSPDELAY           TC       FIXDELAY                              
030024,000033: 40,3753           00144                           DEC      100        B-14                       
030025,000034: 40,3754           31043                           CA       EXTVBACT                              
030026,000035: 40,3755           74740                           MASK     BIT12                                 
030027,000036: 40,3756           00006                           EXTEND                                         
030028,000037: 40,3757           13752                           BZF      DSPDELAY                              
030029,000038: 
030030,000039: 40,3760           35017                           CAF      PRIO5                                 
030031,000040: 40,3761           05072                           TC       NOVAC                                 
030032,000041: 40,3762  E7,1611                                  EBANK=   TSTRT                                 
030033,000042: 40,3762           03766 60107                     2CADR    DISPN5X                               
030034,000043: 
030035,000044: 40,3764           15272                           TCF      TASKOVER                              
030036,000045: 
030037,000046: 40,3765           04066        V16N54             VN       1654                                  
030038,000047: 40,3766           33765        DISPN5X            CAF      V16N54                                
030039,000048: 40,3767           04616                           TC       BANKCALL                              
030040,000049: 40,3770           20334                           CADR     GOMARKF                               
030041,000050: 40,3771           05574                           TC       B5OFF                                 
030042,000051: 40,3772           05574                           TC       B5OFF                                 
030043,000052: 40,3773           13766                           TCF      DISPN5X                               
030044,000053: 
030045,000054: 37,3113                                           BANK     37                                    
030046,000055: 37,2000                                           SETLOC   R31                                   
030047,000056: 37,2000                                           BANK                                           
030048,000057: 
030049,000058: 37,3113           40103        V83CALL            CS       FLAGWRD7                              #  TEST AVERAGE G FLAG
030050,000059: 37,3114           74747                           MASK     AVEGFBIT                              
030051,000060: 37,3115           00006                           EXTEND                                         
030052,000061: 37,3116           13371                           BZF      MUNG?                                 #  ON - TEST MUNFLAG
030053,000062: 
030054,000063: 37,3117           40104                           CS       FLAGWRD8                              
030055,000064: 37,3120           74744                           MASK     SURFFBIT                              
030056,000065: 37,3121           00006                           EXTEND                                         
030057,000066: 37,3122           13375                           BZF      ONEBASE                               #  ON SURFACE - BYPASS LEMPREC
030058,000067: 
030059,000068: 37,3123           06042                           TC       INTPRET                               #  EXTRAPOLATE BOTH STATE VECTORS
030060,000069: 37,3124           77634                           RTB                                            

Page 699

030062,000071: 37,3125           21574                                    LOADTIME                              
030063,000072: 37,3126           34041                           STCALL   TDEC1                                 
030064,000073: 37,3127           27056                                    LEMPREC                               #  PRECISION BASE VECTOR FOR LM
030065,000074: 37,3130           77775                           VLOAD                                          
030066,000075: 37,3131           00017                                    RATT1                                 
030067,000076: 37,3132           26170                           STOVL    BASETHP                               
030068,000077: 37,3133           00025                                    VATT1                                 
030069,000078: 37,3134           16105                           STODL    BASETHV                               
030070,000079: 37,3135           00015                                    TAT                                   
030071,000080: 37,3136           02114        DOCMBASE           STORE    BASETIME                              #  PRECISION BASE VECTOR FOR CM
030072,000081: 37,3137           34041                           STCALL   TDEC1                                 
030073,000082: 37,3140           27042                                    CSMPREC                               
030074,000083: 37,3141           77775                           VLOAD                                          
030075,000084: 37,3142           00017                                    RATT1                                 
030076,000085: 37,3143           26140                           STOVL    BASEOTP                               
030077,000086: 37,3144           00025                                    VATT1                                 
030078,000087: 37,3145           02120                           STORE    BASEOTV                               
030079,000088: 37,3146           77776                           EXIT                                           
030080,000089: 
030081,000090: 37,3147           40103        REV83              CS       FLAGWRD7                              
030082,000091: 37,3150           74747                           MASK     AVEGFBIT                              
030083,000092: 37,3151           00006                           EXTEND                                         
030084,000093: 37,3152           13320                           BZF      GETRVN                                #  IF AVEGFLAG SET, USE RN,VN
030085,000094: 
030086,000095: 37,3153           40104                           CS       FLAGWRD8                              
030087,000096: 37,3154           74744                           MASK     SURFFBIT                              
030088,000097: 37,3155           00006                           EXTEND                                         
030089,000098: 37,3156           13362                           BZF      R31SURF                               #  IF ON SURFACE,USE LEMAREC
030090,000099: 
030091,000100: 37,3157           06042                           TC       INTPRET                               #  DO CONIC EXTRAPOLATION FOR BOTH VEHICLES
030092,000101: 37,3160           77634                           RTB                                            
030093,000102: 37,3161           21574                                    LOADTIME                              
030094,000103: 37,3162           34041                           STCALL   TDEC1                                 
030095,000104: 37,3163           27410                                    INTSTALL                              
030096,000105: 37,3164           43175                           VLOAD    CLEAR                                 
030097,000106: 37,3165           02170                                    BASETHP                               
030098,000107: 37,3166           00263                                    MOONFLAG                              
030099,000108: 37,3167           25535                           STOVL    RCV                                   
030100,000109: 37,3170           02105                                    BASETHV                               
030101,000110: 37,3171           15543                           STODL    VCV                                   
030102,000111: 37,3172           02114                                    BASETIME                              
030103,000112: 37,3173           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
030104,000113: 37,3174           04344                                    MOONTHIS                              
030105,000114: 37,3175           77177                                    +2                                    
030106,000115: 37,3176           00063                                    MOONFLAG                              
030107,000116: 37,3177           77614                           SET                                            
030108,000117: 37,3200           01473                                    INTYPFLG                              #  CONIC EXTRAP.
030109,000118: 37,3201           35517                           STCALL   TET                                   
030110,000119: 37,3202           27106                                    INTEGRVS                              #  INTEGRATION --- AT LAST---
030111,000120: 37,3203           77775        OTHCONIC           VLOAD                                          

Page 700

030113,000122: 37,3204           00001                                    RATT                                  
030114,000123: 37,3205           26207                           STOVL    RONE                                  
030115,000124: 37,3206           00007                                    VATT                                  
030116,000125: 37,3207           36215                           STCALL   VONE                                  #  GET SET FOR CONIC EXTRAP.,OTHER.
030117,000126: 37,3210           27410                                    INTSTALL                              
030118,000127: 37,3211           71214                           SET      DLOAD                                 
030119,000128: 37,3212           01473                                    INTYPFLG                              
030120,000129: 37,3213           00015                                    TAT                                   
030121,000130: 37,3214           00041        OTHINT             STORE    TDEC1                                 
030122,000131: 37,3215           43175                           VLOAD    CLEAR                                 
030123,000132: 37,3216           02140                                    BASEOTP                               
030124,000133: 37,3217           00263                                    MOONFLAG                              
030125,000134: 37,3220           25535                           STOVL    RCV                                   
030126,000135: 37,3221           02120                                    BASEOTV                               
030127,000136: 37,3222           15543                           STODL    VCV                                   
030128,000137: 37,3223           02114                                    BASETIME                              
030129,000138: 37,3224           43014                           BOF      SET                                   
030130,000139: 37,3225           04344                                    MOONTHIS                              
030131,000140: 37,3226           77230                                    +2                                    
030132,000141: 37,3227           00063                                    MOONFLAG                              
030133,000142: 37,3230           35517                           STCALL   TET                                   
030134,000143: 37,3231           27106                                    INTEGRVS                              
030135,000144: 37,3232           52375        COMPDISP           VLOAD    VSU                                   
030136,000145: 37,3233           00001                                    RATT                                  
030137,000146: 37,3234           02207                                    RONE                                  
030138,000147: 37,3235           65234                           RTB      PDDL                                  
030139,000148: 37,3236           21725                                    NORMUNX1                              #  UNIT(RANGE) TO PD 0-5
030140,000149: 37,3237           00045                                    36D                                   
030141,000150: 37,3240           77657                           SL*                                            #  RESCALE AFTER NORMUNIT
030142,000151: 37,3241           20201                                    0,1                                   
030143,000152: 37,3242           26201                           STOVL    RANGE                                 #  SCALED 2(29)M
030144,000153: 37,3243           00007                                    VATT                                  
030145,000154: 37,3244           50251                           VSU      DOT                                   #  (VCM- VLM).UNIT(LOS), PD=0
030146,000155: 37,3245           02215                                    VONE                                  
030147,000156: 37,3246           77752                           SL1                                            #  SCALED 2(7)M/CS
030148,000157: 37,3247           26203                           STOVL    RRATE                                 
030149,000158: 37,3250           02207                                    RONE                                  
030150,000159: 37,3251           63256                           UNIT     PDVL                                  #  UNIT(R) TO PD 0-5
030151,000160: 37,3252           06512                                    UNITZ                                 
030152,000161: 37,3253           77624                           CALL                                           
030153,000162: 37,3254           47666                                    CDU*NBSM                              
030154,000163: 37,3255           41505                           VXM      PUSH                                  #  UNIT (Z)/4 TO PD 6-11
030155,000164: 37,3256           01732                                    REFSMMAT                              
030156,000165: 37,3257           72431                           VPROJ    VSL2                                  #  UNIT(P)=UNIT(UZ -(UZ)PROJ(UR))
030157,000166: 37,3260           00001                                    0D                                    
030158,000167: 37,3261           53445                           BVSU     UNIT                                  
030159,000168: 37,3262           00007                                    6D                                    
030160,000169: 37,3263           47315                           PDVL     VXV                                   #  UNIT(P) TO PD 12-17
030161,000170: 37,3264           00001                                    0D                                    #  UNIT(RL)
030162,000171: 37,3265           02215                                    VONE                                  

Page 701

030164,000173: 37,3266           50235                           VXV      DOT                                   #  (UR * VL)*UR . U(P)
030165,000174: 37,3267           00001                                    0D                                    
030166,000175: 37,3270           00015                                    12D                                   
030167,000176: 37,3271           77715                           PDVL                                           #  SIGN TO 12-13 , LOAD U(P)
030168,000177: 37,3272           75241                           DOT      SIGN                                  
030169,000178: 37,3273           00007                                    6D                                    
030170,000179: 37,3274           00015                                    12D                                   
030171,000180: 37,3275           65512                           SL2      ACOS                                  #  ARCCOS(UP.UZ(SIGN))
030172,000181: 37,3276           26205                           STOVL    RTHETA                                
030173,000182: 37,3277           00001                                    0D                                    
030174,000183: 37,3300           51041                           DOT      BPL                                   #  IF UR.UZ NEG,
030175,000184: 37,3301           00007                                    6D                                    #    RTHETA = 1 - RTHETA
030176,000185: 37,3302           77307                                    +5                                    
030177,000186: 37,3303           45345                           DLOAD    DSU                                   
030178,000187: 37,3304           06526                                    DPPOSMAX                              
030179,000188: 37,3305           02205                                    RTHETA                                
030180,000189: 37,3306           02205                           STORE    RTHETA                                
030181,000190: 37,3307           77776                           EXIT                                           
030182,000191: 
030183,000192: 37,3310           34747                           CA       BIT5                                  
030184,000193: 37,3311           71043                           MASK     EXTVBACT                              
030185,000194: 37,3312           00006                           EXTEND                                         #  IF ANSWERED,
030186,000195: 37,3313           15503                           BZF      ENDEXT                                #         TERMINATE
030187,000196: 
030188,000197: 37,3314           41043                           CS       EXTVBACT                              
030189,000198: 37,3315           74740                           MASK     BIT12                                 
030190,000199: 37,3316           27043                           ADS      EXTVBACT                              #  SET BIT 12
030191,000200: 37,3317           13147                           TCF      REV83                                 #  AND START AGAIN.
030192,000201: 
030193,000202: 37,3320           37713        GETRVN             CA       PRIO22                                #  INHIBIT SERVICER
030194,000203: 37,3321           05146                           TC       PRIOCHNG                              
030195,000204: 37,3322           06042                           TC       INTPRET                               
030196,000205: 37,3323           40375                           VLOAD    SETPD                                 
030197,000206: 37,3324           01220                                    RN                                    #  LM STATE VECTOR IN RN,VN
030198,000207: 37,3325           00001                                    0                                     
030199,000208: 37,3326           26207                           STOVL    RONE                                  
030200,000209: 37,3327           01226                                    VN                                    
030201,000210: 37,3330           26215                           STOVL    VONE                                  #  LOAD R(CSM),V(CSM) IN CASE MUNFLAG SET
030202,000211: 37,3331           01724                                    V(CSM)                                #  (TO INSURE TIME COMPATABILITY)
030203,000212: 37,3332           65315                           PDVL     PDDL                                  
030204,000213: 37,3333           01716                                    R(CSM)                                
030205,000214: 37,3334           01234                                    PIPTIME                               
030206,000215: 37,3335           77776                           EXIT                                           
030207,000216: 37,3336           35015                           CA       PRIO3                                 
030208,000217: 37,3337           05146                           TC       PRIOCHNG                              
030209,000218: 37,3340           06042                           TC       INTPRET                               
030210,000219: 37,3341           77214                           BOFF     VLOAD                                 
030211,000220: 37,3342           03347                                    MUNFLAG                               
030212,000221: 37,3343           77355                                    GETRVN2                               #  IF MUNFLAG RESET, DO CM DELTA PRECISION

Page 702

030214,000223: 37,3344           60505                           VXM      VSR4                                  #  CHANGE TO REFERENCE SYSTEM AND RESCALE
030215,000224: 37,3345           01732                                    REFSMMAT                              
030216,000225: 37,3346           77715                           PDVL                                           #  R TO PD 0-5
030217,000226: 37,3347           76505                           VXM      VSL1                                  
030218,000227: 37,3350           01732                                    REFSMMAT                              
030219,000228: 37,3351           40206                           PUSH     SETPD                                 #  V TO PD 5-11
030220,000229: 37,3352           00001                                    0                                     
030221,000230: 37,3353           77650                           GOTO                                           
030222,000231: 37,3354           77232                                    COMPDISP                              
030223,000232: 
030224,000233: 37,3355           77624        GETRVN2            CALL                                           
030225,000234: 37,3356           27410                                    INTSTALL                              
030226,000235: 37,3357           52014                           CLEAR    GOTO                                  
030227,000236: 37,3360           01673                                    INTYPFLG                              #  PREC EXTRAP FOR OTHER
030228,000237: 37,3361           77214                                    OTHINT                                
030229,000238: 37,3362           06042        R31SURF            TC       INTPRET                               
030230,000239: 37,3363           77634                           RTB                                            #  LM IS ON SURFACE, SO PRECISION
030231,000240: 37,3364           21574                                    LOADTIME                              #  INTEGRATION USES PLANETARY INERTIAL
030232,000241: 37,3365           34041                           STCALL   TDEC1                                 #  ORIENTATION SUBROUTINE
030233,000242: 37,3366           27056                                    LEMPREC                               
030234,000243: 37,3367           77650                           GOTO                                           #  DO CSM CONIC
030235,000244: 37,3370           77203                                    OTHCONIC                              
030236,000245: 37,3371           40102        MUNG?              CS       FLAGWRD6                              
030237,000246: 37,3372           74744                           MASK     MUNFLBIT                              
030238,000247: 37,3373           00006                           EXTEND                                         
030239,000248: 37,3374           13320                           BZF      GETRVN                                #  IF MUNFLAG SET, CSM BASE NOT NEEDED
030240,000249: 
030241,000250: 37,3375           06042        ONEBASE            TC       INTPRET                               #  GET CSM BASE VECTOR
030242,000251: 37,3376           52034                           RTB      GOTO                                  
030243,000252: 37,3377           21574                                    LOADTIME                              
030244,000253: 37,3400           77136                                    DOCMBASE                              

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