Source Code

These source-code files were transcribed from scans made from Don Eyles's personal copy of Luminary 069. They were scanned at archive.org's Boston facility, and the scanning was sponsored by Onno Hommes. The code was transcribed from these scans by a team of volunteers who are referenced in the program comments. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". In some cases, where similar code blocks exist in previously-transcribed AGC programs (primarily Luminary 99, from Apollo 11) those code blocks were used as a starting point and then corrected to agree with the Luminary 69 scans. The full scans are available at the Virtual AGC project's collection at archive.org, while more-convenient reduced-size (but reduced-quality) images are available at the main Virtual AGC website. Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 069 OF AGC PROGRAM LUMINARY BY NASA 2021112-011
	19:02 NOV. 25,1968
Note that the date is the date of the printout, not the date of the program revision.

030964,000002:                                                                                                  ## Copyright:   Public domain.
030965,000003:                                                                                                  ## Filename:    R31.agc
030966,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
030967,000005:                                                                                                  ##              It is part of the source code for the original release
030968,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
030969,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
030970,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
030971,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
030972,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
030973,000011:                                                                                                  ##              that the code format has been changed to conform to the
030974,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
030975,000013:                                                                                                  ##              original YUL assembler.
030976,000014:                                                                                                  ## Reference:   pp. 712-716
030977,000015:                                                                                                  ## Assembler:   yaYUL
030978,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
030979,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
030980,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
030981,000019:                                                                                                  ##              2016-12-14 MAS  Updated from comment-proofed Luminary 99 version.
030982,000020:                                                                                                  ##              2016-12-15 RRB  Updated for Luminary 69.
030983,000021:                                                                                                  ##              2017-01-20 HG   add label V16N54
030984,000022:                                                                                                  ##                              fix label REDOEXPT -> REDOEXTP
030985,000023:                                                                                                  ##                                        GETRVN   -> GETRVN2
030986,000024:                                                                                                  ##                              fix operand RRONE   -> RONE 
030987,000025:                                                                                                  ##                                          REFSMAT -> REFSMMAT
030988,000026:                                                                                                  ##                                          RHTETA  -> RTHETA
030989,000027:                                                                                                  ##                                          EDNEXT  -> ENDEXT
030990,000028:                                                                                                  ##              2017-01-22 HG   Add missing segemnt of interpretive statements
030991,000029:                                                                                                  ##                              Fix some comments, remove tabs
030992,000030:                                                                                                  ##              2017-01-28 RSB  Proofed comment text using octopus/prooferComments
030993,000031:                                                                                                  ##                              and fixed errors found.
030994,000032: 

Page 712

030996,000034: 34,3271                                           BANK     34                                    
030997,000035: 37,2000                                           SETLOC   R31                                   
030998,000036: 37,2000                                           BANK                                           
030999,000037: 
031000,000038: 37,3113                                           COUNT*   $$/R31                                
031001,000039: 
031002,000040: 37,3113           35015        R31CALL            CAF      PRIO3                                 
031003,000041: 37,3114           05105                           TC       FINDVAC                               
031004,000042: 37,3115  E7,1466                                  EBANK=   SUBEXIT                               
031005,000043: 37,3115           03145 76067                     2CADR    V83CALL                               
031006,000044: 
031007,000045: 37,3117           05221        DSPDELAY           TC       FIXDELAY                              
031008,000046: 37,3120           00144                           DEC      100        B-14                       
031009,000047: 37,3121           31044                           CA       EXTVBACT                              
031010,000048: 37,3122           74740                           MASK     BIT12                                 
031011,000049: 37,3123           00006                           EXTEND                                         
031012,000050: 37,3124           13117                           BZF      DSPDELAY                              
031013,000051: 
031014,000052: 37,3125           35017                           CAF      PRIO5                                 
031015,000053: 37,3126           05072                           TC       NOVAC                                 
031016,000054: 37,3127  E7,1607                                  EBANK=   TSTRT                                 
031017,000055: 37,3127           03132 76067                     2CADR    DISPN5X                               
031018,000056: 
031019,000057: 37,3131           15261                           TCF      TASKOVER                              
031020,000058: 
031021,000059: 37,3132           33240        DISPN5X            CAF      V16N54                                
031022,000060: 37,3133           04616                           TC       BANKCALL                              
031023,000061: 37,3134           20212                           CADR     GOMARKF                               
031024,000062: 37,3135           05563                           TC       B5OFF                                 
031025,000063: 37,3136           05563                           TC       B5OFF                                 
031026,000064: 37,3137           13132                           TCF      DISPN5X                               
031027,000065: 
031028,000066: 37,3140           06036        V83                TC       INTPRET                               
031029,000067: 37,3141           77624                           CALL                                           
031030,000068: 37,3142           77371                                    REDOEXTP                              
031031,000069: 37,3143           77650                           GOTO                                           
031032,000070: 37,3144           77150                                    COMPDISP                              
031033,000071: 37,3145           06036        V83CALL            TC       INTPRET                               
031034,000072: 37,3146           77624                           CALL                                           
031035,000073: 37,3147           77241                                    STATEXTP                              #  EXTRAPOLATE STATE VECTORS
031036,000074: 37,3150           52375        COMPDISP           VLOAD    VSU                                   
031037,000075: 37,3151           00001                                    RATT                                  
031038,000076: 37,3152           02213                                    RONE                                  
031039,000077: 37,3153           51406                           PUSH     ABVAL                                 #  RATT-RONE TO 0D               PD = 6
031040,000078: 37,3154           02205                           STORE    RANGE                                 #  METERS B-29
031041,000079: 37,3155           77301                           NORM     VLOAD                                 
031042,000080: 37,3156           00047                                    X1                                    #  RATT-RONE                     PD = 0
031043,000081: 37,3157           53457                           VSL*     UNIT                                  
031044,000082: 37,3160           20201                                    0,1                                   

Page 713

031046,000084: 37,3161           52315                           PDVL     VSU                                   #  UNIT(LOS) TO 0D              PD = 6
031047,000085: 37,3162           00007                                    VATT                                  
031048,000086: 37,3163           02221                                    VONE                                  
031049,000087: 37,3164           77641                           DOT                                            #  (VATT-VONE).UNIT(LOS)        PD = 0
031050,000088: 37,3165           77752                           SL1                                            
031051,000089: 37,3166           26207                           STOVL    RRATE                                 #  RANGE RATE M/CS B-7
031052,000090: 37,3167           02213                                    RONE                                  
031053,000091: 37,3170           63256                           UNIT     PDVL                                  #  UR TO 0D                           PD = 6
031054,000092: 37,3171           06416                                    THISAXIS                              #  UNITX FOR CM, UNTIZ FOR LM
031055,000093: 37,3172           77624                           CALL                                           
031056,000094: 37,3173           47565                                    CDU*NBSM                              
031057,000095: 37,3174           41505                           VXM      PUSH                                  #  UXORZ TO 6D                  PD=12D
031058,000096: 37,3175           01734                                    REFSMMAT                              
031059,000097: 37,3176           72431                           VPROJ    VSL2                                  
031060,000098: 37,3177           00001                                    0D                                    
031061,000099: 37,3200           53445                           BVSU     UNIT                                  
031062,000100: 37,3201           00007                                    6D                                    
031063,000101: 37,3202           47315                           PDVL     VXV                                   #  UP/2 TO 12D                  PD=18D
031064,000102: 37,3203           02213                                    RONE                                  
031065,000103: 37,3204           02221                                    VONE                                  
031066,000104: 37,3205           47256                           UNIT     VXV                                   
031067,000105: 37,3206           02213                                    RONE                                  
031068,000106: 37,3207           63241                           DOT      PDVL                                  #  SIGN TO 12D, UP/2 TO MPAC    PD=18D
031069,000107: 37,3210           00015                                    12D                                   
031070,000108: 37,3211           50372                           VSL1     DOT                                   #  UP.UXORZ
031071,000109: 37,3212           00007                                    6D                                    
031072,000110: 37,3213           72565                           SIGN     SL1                                   
031073,000111: 37,3214           00015                                    12D                                   
031074,000112: 37,3215           77726                           ACOS                                           
031075,000113: 37,3216           26211                           STOVL    RTHETA                                
031076,000114: 37,3217           02213                                    RONE                                  
031077,000115: 37,3220           51041                           DOT      BPL                                   
031078,000116: 37,3221           00007                                    6D                                    
031079,000117: 37,3222           77227                                    +5                                    
031080,000118: 37,3223           44345                           DLOAD    BDSU                                  #  IF UXORZ.R NEG, RTHETA = 1 - RTHETA
031081,000119: 37,3224           02211                                    RTHETA                                
031082,000120: 37,3225           06432                                    DPPOSMAX                              
031083,000121: 37,3226           02211                           STORE    RTHETA                                #  RTHETA BETWEEN 0 AND 1 REV.
031084,000122: 37,3227           77776                           EXIT                                           
031085,000123: 37,3230           34747                           CAF      BIT5                                  #  HAVE WE BEEN ANSWERED
031086,000124: 37,3231           71044                           MASK     EXTVBACT                              
031087,000125: 37,3232           00006                           EXTEND                                         
031088,000126: 37,3233           15472                           BZF      ENDEXT                                #  YES, DIE
031089,000127: 
031090,000128: 37,3234           41044                           CS       EXTVBACT                              
031091,000129: 37,3235           74740                           MASK     BIT12                                 
031092,000130: 37,3236           27044                           ADS      EXTVBACT                              
031093,000131: 
031094,000132: 37,3237           13140                           TCF      V83                                   
031095,000133: 37,3240           04066        V16N54             VN       1654                                  
031096,000134: 

Page 714

031098,000136:                                                                                                  #  THE STATEXTP SUBROUTINE DOES A PRECISION EXTRAPOLATION OF BOTH VEHICLES
031099,000137:                                                                                                  #  STATE VECTORS TO PRESENT TIME AND SAVES THEM AS BASE VECTORS.
031100,000138:                                                                                                  #  IF SERVICER IS OFF ---
031101,000139:                                                                                                  #                  THIS VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED TO
031102,000140:                                                                                                  #                  PRESENT TIME AND SAVED AS RONE, VONE.
031103,000141:                                                                                                  #                  THE OTHER VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED
031104,000142:                                                                                                  #                  TO THE SAME TIME, THE OUTPUT BEING LEFT IN RATT, VATT.
031105,000143:                                                                                                  #  IF SERVICER IS ON ---
031106,000144:                                                                                                  #                  RONE, VONE ARE SET EQUAL TO RN, VN AND THE OTHER
031107,000145:                                                                                                  #                  VEHICLES STATE VECTOR IS PREC. EXTRAPOLATED TO PIPTIME.
031108,000146: 
031109,000147: 37,3241           47020        STATEXTP           STQ      RTB                                   
031110,000148: 37,3242           02116                                    STATEXIT                              
031111,000149: 37,3243           21462                                    LOADTIME                              
031112,000150: 37,3244           34041                           STCALL   TDEC1                                 
031113,000151: 37,3245           27043                                    OTHPREC                               #  GET BASE VECTORS
031114,000152: 37,3246           77775                           VLOAD                                          
031115,000153: 37,3247           00017                                    RATT1                                 
031116,000154: 37,3250           26140                           STOVL    BASEOTP                               #  OTHER POS.
031117,000155: 37,3251           00025                                    VATT1                                 
031118,000156: 37,3252           16120                           STODL    BASEOTV                               #  OTHER VEL.
031119,000157: 37,3253           00015                                    TAT                                   
031120,000158: 37,3254           02114                           STORE    BASETIME                              
031121,000159: 37,3255           34041                           STCALL   TDEC1                                 
031122,000160: 37,3256           27057                                    THISPREC                              
031123,000161: 37,3257           77775                           VLOAD                                          
031124,000162: 37,3260           00017                                    RATT1                                 
031125,000163: 37,3261           26170                           STOVL    BASETHP                               #  THIS POS.
031126,000164: 37,3262           00025                                    VATT1                                 
031127,000165: 37,3263           02105                           STORE    BASETHV                               #  THIS VEL
031128,000166: 37,3264           47014        HAVEBASE           BON      RTB                                   
031129,000167: 37,3265           03712                                    AVEGFLAG                              
031130,000168: 37,3266           77346                                    GETRVN                                #  IF AVG ON ,GET RN ETC.
031131,000169: 37,3267           21462                                    LOADTIME                              
031132,000170: 37,3270           52014                           BON      GOTO                                  #  TEST FOR LM ON SURFACE.
031133,000171: 37,3271           04307                                    SURFFLAG                              
031134,000172: 37,3272           77365                                    R31SURF                               
031135,000173: 37,3273           77274                                    +1                                    
031136,000174: 37,3274           34041                           STCALL   TDEC1                                 #  BEGIN SET UP FOR CONIC EXTRAP. FOR THIS.
031137,000175: 37,3275           27412                                    INTSTALL                              
031138,000176: 37,3276           43175                           VLOAD    CLEAR                                 
031139,000177: 37,3277           02170                                    BASETHP                               
031140,000178: 37,3300           00263                                    MOONFLAG                              
031141,000179: 37,3301           25535                           STOVL    RCV                                   
031142,000180: 37,3302           02105                                    BASETHV                               
031143,000181: 37,3303           15543                           STODL    VCV                                   
031144,000182: 37,3304           02114                                    BASETIME                              
031145,000183: 37,3305           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
031146,000184: 37,3306           04344                                    MOONTHIS                              
031147,000185: 37,3307           77311                                    +2                                    
031148,000186: 37,3310           00063                                    MOONFLAG                              

Page 715

031150,000188: 37,3311           77614                           SET                                            
031151,000189: 37,3312           01473                                    INTYPFLG                              #  CONIC EXTRAP.
031152,000190: 37,3313           35517                           STCALL   TET                                   
031153,000191: 37,3314           27107                                    INTEGRVS                              #  INTEGRATION --- AT LAST---
031154,000192: 37,3315           77775        OTHCONIC           VLOAD                                          
031155,000193: 37,3316           00001                                    RATT                                  
031156,000194: 37,3317           26213                           STOVL    RONE                                  
031157,000195: 37,3320           00007                                    VATT                                  
031158,000196: 37,3321           36221                           STCALL   VONE                                  #  GET SET FOR CONIC EXTRAP.,OTHER.
031159,000197: 37,3322           27412                                    INTSTALL                              
031160,000198: 37,3323           71214                           SET      DLOAD                                 
031161,000199: 37,3324           01473                                    INTYPFLG                              
031162,000200: 37,3325           00015                                    TAT                                   
031163,000201: 37,3326           00041        OTHINT             STORE    TDEC1                                 
031164,000202: 37,3327           43175                           VLOAD    CLEAR                                 
031165,000203: 37,3330           02140                                    BASEOTP                               
031166,000204: 37,3331           00263                                    MOONFLAG                              
031167,000205: 37,3332           25535                           STOVL    RCV                                   
031168,000206: 37,3333           02120                                    BASEOTV                               
031169,000207: 37,3334           15543                           STODL    VCV                                   
031170,000208: 37,3335           02114                                    BASETIME                              
031171,000209: 37,3336           43014                           BOF      SET                                   
031172,000210: 37,3337           04344                                    MOONTHIS                              
031173,000211: 37,3340           77342                                    +2                                    
031174,000212: 37,3341           00063                                    MOONFLAG                              
031175,000213: 37,3342           35517                           STCALL   TET                                   
031176,000214: 37,3343           27107                                    INTEGRVS                              
031177,000215: 37,3344           77650                           GOTO                                           
031178,000216: 37,3345           02116                                    STATEXIT                              #  THIS VEHICLES POS.,VEL. IN PUSHLIST.
031179,000217: 37,3346           52175        GETRVN             VLOAD    GOTO                                  
031180,000218: 37,3347           01221                                    RN                                    
031181,000219: 37,3350           77351                                    +1                                    
031182,000220: 37,3351           36213                           STCALL   RONE                                  
031183,000221: 37,3352           77353                                    +1                                    
031184,000222: 37,3353           52175                           VLOAD    GOTO                                  
031185,000223: 37,3354           01227                                    VN                                    
031186,000224: 37,3355           77356                                    +1                                    
031187,000225: 37,3356           16221                           STODL    VONE                                  
031188,000226: 37,3357           01235                                    PIPTIME                               
031189,000227: 37,3360           77624        GETRVN2            CALL                                           
031190,000228: 37,3361           27412                                    INTSTALL                              
031191,000229: 37,3362           52014                           CLEAR    GOTO                                  
031192,000230: 37,3363           01673                                    INTYPFLG                              #  PREC EXTRAP FOR OTHER
031193,000231: 37,3364           77326                                    OTHINT                                
031194,000232: 37,3365           34041        R31SURF            STCALL   TDEC1                                 #  LM ON SURFACE.
031195,000233: 37,3366           27057                                    LEMPREC                               
031196,000234: 37,3367           77650                           GOTO                                           #  DO CSM CONIC
031197,000235: 37,3370           77315                                    OTHCONIC                              

Page 716

031199,000237: 37,3371           52020        REDOEXTP           STQ      GOTO                                  
031200,000238: 37,3372           02116                                    STATEXIT                              
031201,000239: 37,3373           77264                                    HAVEBASE                              
031202,000240: 

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