Source Code

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

The reconstruction began with source code of Zerlina 56, Luminary 210, and Luminary 131, previously transcribed from digitized copies of those programs. The code was created by combining the three, using Zerlina 56 as a base, since it was based off of Luminary 183. The differences between the three were carefully merged using the Luminary memos as a guide, with all changes made after Luminary 178 being backed out. 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 178 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.

030064,000002:                                                                                                  ## Copyright:   Public domain.
030065,000003:                                                                                                  ## Filename:    R31.agc
030066,000004:                                                                                                  ## Purpose:     A section of Luminary revision 178.
030067,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
030068,000006:                                                                                                  ##              release of the flight software for the Lunar Module's
030069,000007:                                                                                                  ##              (LM) Apollo Guidance Computer (AGC) for Apollo 14. The
030070,000008:                                                                                                  ##              code has been recreated from copies of Zerlina 56, Luminary
030071,000009:                                                                                                  ##              210, and Luminary 131, as well as many Luminary memos.
030072,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
030073,000011:                                                                                                  ##              exactly match those specified for Luminary 178 in NASA
030074,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
030075,000013:                                                                                                  ##              that the reconstruction is correct.
030076,000014:                                                                                                  ## Reference:   pp. 698-702
030077,000015:                                                                                                  ## Assembler:   yaYUL
030078,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
030079,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
030080,000018:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Zerlina 56.
030081,000019: 

Page 698

030083,000021: 40,3746                                           BANK     40                                    
030084,000022: 40,2000                                           SETLOC   R31LOC                                
030085,000023: 40,2000                                           BANK                                           
030086,000024: 
030087,000025: 40,3746                                           COUNT*   $$/R31                                
030088,000026: 
030089,000027: 40,3746           35015        R31CALL            CAF      PRIO3                                 
030090,000028: 40,3747           05105                           TC       FINDVAC                               
030091,000029: 40,3750  E7,1470                                  EBANK=   SUBEXIT                               
030092,000030: 40,3750           03113 76067                     2CADR    V83CALL                               
030093,000031: 
030094,000032: 40,3752           05232        DSPDELAY           TC       FIXDELAY                              
030095,000033: 40,3753           00144                           DEC      100        B-14                       
030096,000034: 40,3754           31043                           CA       EXTVBACT                              
030097,000035: 40,3755           74740                           MASK     BIT12                                 
030098,000036: 40,3756           00006                           EXTEND                                         
030099,000037: 40,3757           13752                           BZF      DSPDELAY                              
030100,000038: 
030101,000039: 40,3760           35017                           CAF      PRIO5                                 
030102,000040: 40,3761           05072                           TC       NOVAC                                 
030103,000041: 40,3762  E7,1611                                  EBANK=   TSTRT                                 
030104,000042: 40,3762           03766 60107                     2CADR    DISPN5X                               
030105,000043: 
030106,000044: 40,3764           15272                           TCF      TASKOVER                              
030107,000045: 
030108,000046: 40,3765           04066        V16N54             VN       1654                                  
030109,000047: 40,3766           33765        DISPN5X            CAF      V16N54                                
030110,000048: 40,3767           04616                           TC       BANKCALL                              
030111,000049: 40,3770           20334                           CADR     GOMARKF                               
030112,000050: 40,3771           05574                           TC       B5OFF                                 
030113,000051: 40,3772           05574                           TC       B5OFF                                 
030114,000052: 40,3773           13766                           TCF      DISPN5X                               
030115,000053: 
030116,000054: 37,3113                                           BANK     37                                    
030117,000055: 37,2000                                           SETLOC   R31                                   
030118,000056: 37,2000                                           BANK                                           
030119,000057: 
030120,000058: 37,3113           40103        V83CALL            CS       FLAGWRD7                              #  TEST AVERAGE G FLAG
030121,000059: 37,3114           74747                           MASK     AVEGFBIT                              
030122,000060: 37,3115           00006                           EXTEND                                         
030123,000061: 37,3116           13371                           BZF      MUNG?                                 #  ON - TEST MUNFLAG
030124,000062: 
030125,000063: 37,3117           40104                           CS       FLAGWRD8                              
030126,000064: 37,3120           74744                           MASK     SURFFBIT                              
030127,000065: 37,3121           00006                           EXTEND                                         
030128,000066: 37,3122           13375                           BZF      ONEBASE                               #  ON SURFACE - BYPASS LEMPREC
030129,000067: 
030130,000068: 37,3123           06042                           TC       INTPRET                               #  EXTRAPOLATE BOTH STATE VECTORS
030131,000069: 37,3124           77634                           RTB                                            

Page 699

030133,000071: 37,3125           21574                                    LOADTIME                              
030134,000072: 37,3126           34041                           STCALL   TDEC1                                 
030135,000073: 37,3127           27056                                    LEMPREC                               #  PRECISION BASE VECTOR FOR LM
030136,000074: 37,3130           77775                           VLOAD                                          
030137,000075: 37,3131           00017                                    RATT1                                 
030138,000076: 37,3132           26170                           STOVL    BASETHP                               
030139,000077: 37,3133           00025                                    VATT1                                 
030140,000078: 37,3134           16105                           STODL    BASETHV                               
030141,000079: 37,3135           00015                                    TAT                                   
030142,000080: 37,3136           02114        DOCMBASE           STORE    BASETIME                              #  PRECISION BASE VECTOR FOR CM
030143,000081: 37,3137           34041                           STCALL   TDEC1                                 
030144,000082: 37,3140           27042                                    CSMPREC                               
030145,000083: 37,3141           77775                           VLOAD                                          
030146,000084: 37,3142           00017                                    RATT1                                 
030147,000085: 37,3143           26140                           STOVL    BASEOTP                               
030148,000086: 37,3144           00025                                    VATT1                                 
030149,000087: 37,3145           02120                           STORE    BASEOTV                               
030150,000088: 37,3146           77776                           EXIT                                           
030151,000089: 
030152,000090: 37,3147           40103        REV83              CS       FLAGWRD7                              
030153,000091: 37,3150           74747                           MASK     AVEGFBIT                              
030154,000092: 37,3151           00006                           EXTEND                                         
030155,000093: 37,3152           13320                           BZF      GETRVN                                #  IF AVEGFLAG SET, USE RN,VN
030156,000094: 
030157,000095: 37,3153           40104                           CS       FLAGWRD8                              
030158,000096: 37,3154           74744                           MASK     SURFFBIT                              
030159,000097: 37,3155           00006                           EXTEND                                         
030160,000098: 37,3156           13362                           BZF      R31SURF                               #  IF ON SURFACE,USE LEMAREC
030161,000099: 
030162,000100: 37,3157           06042                           TC       INTPRET                               #  DO CONIC EXTRAPOLATION FOR BOTH VEHICLES
030163,000101: 37,3160           77634                           RTB                                            
030164,000102: 37,3161           21574                                    LOADTIME                              
030165,000103: 37,3162           34041                           STCALL   TDEC1                                 
030166,000104: 37,3163           27410                                    INTSTALL                              
030167,000105: 37,3164           43175                           VLOAD    CLEAR                                 
030168,000106: 37,3165           02170                                    BASETHP                               
030169,000107: 37,3166           00263                                    MOONFLAG                              
030170,000108: 37,3167           25535                           STOVL    RCV                                   
030171,000109: 37,3170           02105                                    BASETHV                               
030172,000110: 37,3171           15543                           STODL    VCV                                   
030173,000111: 37,3172           02114                                    BASETIME                              
030174,000112: 37,3173           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
030175,000113: 37,3174           04344                                    MOONTHIS                              
030176,000114: 37,3175           77177                                    +2                                    
030177,000115: 37,3176           00063                                    MOONFLAG                              
030178,000116: 37,3177           77614                           SET                                            
030179,000117: 37,3200           01473                                    INTYPFLG                              #  CONIC EXTRAP.
030180,000118: 37,3201           35517                           STCALL   TET                                   
030181,000119: 37,3202           27106                                    INTEGRVS                              #  INTEGRATION --- AT LAST---
030182,000120: 37,3203           77775        OTHCONIC           VLOAD                                          

Page 700

030184,000122: 37,3204           00001                                    RATT                                  
030185,000123: 37,3205           26207                           STOVL    RONE                                  
030186,000124: 37,3206           00007                                    VATT                                  
030187,000125: 37,3207           36215                           STCALL   VONE                                  #  GET SET FOR CONIC EXTRAP.,OTHER.
030188,000126: 37,3210           27410                                    INTSTALL                              
030189,000127: 37,3211           71214                           SET      DLOAD                                 
030190,000128: 37,3212           01473                                    INTYPFLG                              
030191,000129: 37,3213           00015                                    TAT                                   
030192,000130: 37,3214           00041        OTHINT             STORE    TDEC1                                 
030193,000131: 37,3215           43175                           VLOAD    CLEAR                                 
030194,000132: 37,3216           02140                                    BASEOTP                               
030195,000133: 37,3217           00263                                    MOONFLAG                              
030196,000134: 37,3220           25535                           STOVL    RCV                                   
030197,000135: 37,3221           02120                                    BASEOTV                               
030198,000136: 37,3222           15543                           STODL    VCV                                   
030199,000137: 37,3223           02114                                    BASETIME                              
030200,000138: 37,3224           43014                           BOF      SET                                   
030201,000139: 37,3225           04344                                    MOONTHIS                              
030202,000140: 37,3226           77230                                    +2                                    
030203,000141: 37,3227           00063                                    MOONFLAG                              
030204,000142: 37,3230           35517                           STCALL   TET                                   
030205,000143: 37,3231           27106                                    INTEGRVS                              
030206,000144: 37,3232           52375        COMPDISP           VLOAD    VSU                                   
030207,000145: 37,3233           00001                                    RATT                                  
030208,000146: 37,3234           02207                                    RONE                                  
030209,000147: 37,3235           65234                           RTB      PDDL                                  
030210,000148: 37,3236           21725                                    NORMUNX1                              #  UNIT(RANGE) TO PD 0-5
030211,000149: 37,3237           00045                                    36D                                   
030212,000150: 37,3240           77657                           SL*                                            #  RESCALE AFTER NORMUNIT
030213,000151: 37,3241           20201                                    0,1                                   
030214,000152: 37,3242           26201                           STOVL    RANGE                                 #  SCALED 2(29)M
030215,000153: 37,3243           00007                                    VATT                                  
030216,000154: 37,3244           50251                           VSU      DOT                                   #  (VCM- VLM).UNIT(LOS), PD=0
030217,000155: 37,3245           02215                                    VONE                                  
030218,000156: 37,3246           77752                           SL1                                            #  SCALED 2(7)M/CS
030219,000157: 37,3247           26203                           STOVL    RRATE                                 
030220,000158: 37,3250           02207                                    RONE                                  
030221,000159: 37,3251           63256                           UNIT     PDVL                                  #  UNIT(R) TO PD 0-5
030222,000160: 37,3252           06462                                    UNITZ                                 
030223,000161: 37,3253           77624                           CALL                                           
030224,000162: 37,3254           47636                                    CDU*NBSM                              
030225,000163: 37,3255           41505                           VXM      PUSH                                  #  UNIT (Z)/4 TO PD 6-11
030226,000164: 37,3256           01732                                    REFSMMAT                              
030227,000165: 37,3257           72431                           VPROJ    VSL2                                  #  UNIT(P)=UNIT(UZ -(UZ)PROJ(UR))
030228,000166: 37,3260           00001                                    0D                                    
030229,000167: 37,3261           53445                           BVSU     UNIT                                  
030230,000168: 37,3262           00007                                    6D                                    
030231,000169: 37,3263           47315                           PDVL     VXV                                   #  UNIT(P) TO PD 12-17
030232,000170: 37,3264           00001                                    0D                                    #  UNIT(RL)
030233,000171: 37,3265           02215                                    VONE                                  

Page 701

030235,000173: 37,3266           50235                           VXV      DOT                                   #  (UR * VL)*UR . U(P)
030236,000174: 37,3267           00001                                    0D                                    
030237,000175: 37,3270           00015                                    12D                                   
030238,000176: 37,3271           77715                           PDVL                                           #  SIGN TO 12-13 , LOAD U(P)
030239,000177: 37,3272           75241                           DOT      SIGN                                  
030240,000178: 37,3273           00007                                    6D                                    
030241,000179: 37,3274           00015                                    12D                                   
030242,000180: 37,3275           65512                           SL2      ACOS                                  #  ARCCOS(UP.UZ(SIGN))
030243,000181: 37,3276           26205                           STOVL    RTHETA                                
030244,000182: 37,3277           00001                                    0D                                    
030245,000183: 37,3300           51041                           DOT      BPL                                   #  IF UR.UZ NEG,
030246,000184: 37,3301           00007                                    6D                                    #    RTHETA = 1 - RTHETA
030247,000185: 37,3302           77307                                    +5                                    
030248,000186: 37,3303           45345                           DLOAD    DSU                                   
030249,000187: 37,3304           06476                                    DPPOSMAX                              
030250,000188: 37,3305           02205                                    RTHETA                                
030251,000189: 37,3306           02205                           STORE    RTHETA                                
030252,000190: 37,3307           77776                           EXIT                                           
030253,000191: 
030254,000192: 37,3310           34747                           CA       BIT5                                  
030255,000193: 37,3311           71043                           MASK     EXTVBACT                              
030256,000194: 37,3312           00006                           EXTEND                                         #  IF ANSWERED,
030257,000195: 37,3313           15503                           BZF      ENDEXT                                #         TERMINATE
030258,000196: 
030259,000197: 37,3314           41043                           CS       EXTVBACT                              
030260,000198: 37,3315           74740                           MASK     BIT12                                 
030261,000199: 37,3316           27043                           ADS      EXTVBACT                              #  SET BIT 12
030262,000200: 37,3317           13147                           TCF      REV83                                 #  AND START AGAIN.
030263,000201: 
030264,000202: 37,3320           37713        GETRVN             CA       PRIO22                                #  INHIBIT SERVICER
030265,000203: 37,3321           05146                           TC       PRIOCHNG                              
030266,000204: 37,3322           06042                           TC       INTPRET                               
030267,000205: 37,3323           40375                           VLOAD    SETPD                                 
030268,000206: 37,3324           01220                                    RN                                    #  LM STATE VECTOR IN RN,VN
030269,000207: 37,3325           00001                                    0                                     
030270,000208: 37,3326           26207                           STOVL    RONE                                  
030271,000209: 37,3327           01226                                    VN                                    
030272,000210: 37,3330           26215                           STOVL    VONE                                  #  LOAD R(CSM),V(CSM) IN CASE MUNFLAG SET
030273,000211: 37,3331           01724                                    V(CSM)                                #  (TO INSURE TIME COMPATABILITY)
030274,000212: 37,3332           65315                           PDVL     PDDL                                  
030275,000213: 37,3333           01716                                    R(CSM)                                
030276,000214: 37,3334           01234                                    PIPTIME                               
030277,000215: 37,3335           77776                           EXIT                                           
030278,000216: 37,3336           35015                           CA       PRIO3                                 
030279,000217: 37,3337           05146                           TC       PRIOCHNG                              
030280,000218: 37,3340           06042                           TC       INTPRET                               
030281,000219: 37,3341           77214                           BOFF     VLOAD                                 
030282,000220: 37,3342           03347                                    MUNFLAG                               
030283,000221: 37,3343           77355                                    GETRVN2                               #  IF MUNFLAG RESET, DO CM DELTA PRECISION

Page 702

030285,000223: 37,3344           60505                           VXM      VSR4                                  #  CHANGE TO REFERENCE SYSTEM AND RESCALE
030286,000224: 37,3345           01732                                    REFSMMAT                              
030287,000225: 37,3346           77715                           PDVL                                           #  R TO PD 0-5
030288,000226: 37,3347           76505                           VXM      VSL1                                  
030289,000227: 37,3350           01732                                    REFSMMAT                              
030290,000228: 37,3351           40206                           PUSH     SETPD                                 #  V TO PD 5-11
030291,000229: 37,3352           00001                                    0                                     
030292,000230: 37,3353           77650                           GOTO                                           
030293,000231: 37,3354           77232                                    COMPDISP                              
030294,000232: 
030295,000233: 37,3355           77624        GETRVN2            CALL                                           
030296,000234: 37,3356           27410                                    INTSTALL                              
030297,000235: 37,3357           52014                           CLEAR    GOTO                                  
030298,000236: 37,3360           01673                                    INTYPFLG                              #  PREC EXTRAP FOR OTHER
030299,000237: 37,3361           77214                                    OTHINT                                
030300,000238: 37,3362           06042        R31SURF            TC       INTPRET                               
030301,000239: 37,3363           77634                           RTB                                            #  LM IS ON SURFACE, SO PRECISION
030302,000240: 37,3364           21574                                    LOADTIME                              #  INTEGRATION USES PLANETARY INERTIAL
030303,000241: 37,3365           34041                           STCALL   TDEC1                                 #  ORIENTATION SUBROUTINE
030304,000242: 37,3366           27056                                    LEMPREC                               
030305,000243: 37,3367           77650                           GOTO                                           #  DO CSM CONIC
030306,000244: 37,3370           77203                                    OTHCONIC                              
030307,000245: 37,3371           40102        MUNG?              CS       FLAGWRD6                              
030308,000246: 37,3372           74744                           MASK     MUNFLBIT                              
030309,000247: 37,3373           00006                           EXTEND                                         
030310,000248: 37,3374           13320                           BZF      GETRVN                                #  IF MUNFLAG SET, CSM BASE NOT NEEDED
030311,000249: 
030312,000250: 37,3375           06042        ONEBASE            TC       INTPRET                               #  GET CSM BASE VECTOR
030313,000251: 37,3376           52034                           RTB      GOTO                                  
030314,000252: 37,3377           21574                                    LOADTIME                              
030315,000253: 37,3400           77136                                    DOCMBASE                              

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