Source Code

This is a reconstructed version of Luminary 130, the initial AGC program released in November 1969 for the Apollo 13 LM. Three more releases followed before the flown revision was finally manufactured in February 1970.

This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G.

In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'.

029916,000002:                                                                                                  ## Copyright:   Public domain.
029917,000003:                                                                                                  ## Filename:    R31.agc
029918,000004:                                                                                                  ## Purpose:     A section of the reconstructed source code for Luminary 130.
029919,000005:                                                                                                  ##              This was the original program released for the Apollo 13 LM,
029920,000006:                                                                                                  ##              although several more revisions would follow. It has been
029921,000007:                                                                                                  ##              reconstructed from a listing of Luminary 131, from which it
029922,000008:                                                                                                  ##              differs on only two lines in P70-P71. The difference is
029923,000009:                                                                                                  ##              described in detail in Luminary memo #129, which was used
029924,000010:                                                                                                  ##              to perform the reconstruction. This file is intended to be a
029925,000011:                                                                                                  ##              faithful reconstruction, except that the code format has been
029926,000012:                                                                                                  ##              changed to conform to the requirements of the yaYUL assembler
029927,000013:                                                                                                  ##              rather than the original YUL assembler.
029928,000014:                                                                                                  ## Reference:   pp. 705-710
029929,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
029930,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
029931,000017:                                                                                                  ## Mod history: 05/24/03 RSB.   Began transcribing.
029932,000018:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
029933,000019:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
029934,000020:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
029935,000021:                                                                                                  ##                              numbers in 1701.pdf.
029936,000022:                                                                                                  ##              2017-02-24 RSB  Proofed comment text using octopus/ProoferComments.
029937,000023:                                                                                                  ##              2017-03-09 RSB  Comment-text fixes noted in proofing Luminary 116.
029938,000024:                                                                                                  ##              2018-09-04 MAS  Copied from Luminary 131 for Luminary 130.
029939,000025: 

Page 705

029941,000027: 40,3737                                           BANK     40                                    
029942,000028: 40,2000                                           SETLOC   R31LOC                                
029943,000029: 40,2000                                           BANK                                           
029944,000030: 
029945,000031: 40,3737                                           COUNT*   $$/R31                                
029946,000032: 
029947,000033: 40,3737           35015        R31CALL            CAF      PRIO3                                 
029948,000034: 40,3740           05105                           TC       FINDVAC                               
029949,000035: 40,3741  E7,1470                                  EBANK=   SUBEXIT                               
029950,000036: 40,3741           03121 76067                     2CADR    V83CALL                               
029951,000037: 
029952,000038: 40,3743           05221        DSPDELAY           TC       FIXDELAY                              
029953,000039: 40,3744           00144                           DEC      100        B-14                       
029954,000040: 40,3745           31043                           CA       EXTVBACT                              
029955,000041: 40,3746           74740                           MASK     BIT12                                 
029956,000042: 40,3747           00006                           EXTEND                                         
029957,000043: 40,3750           13743                           BZF      DSPDELAY                              
029958,000044: 
029959,000045: 40,3751           35017                           CAF      PRIO5                                 
029960,000046: 40,3752           05072                           TC       NOVAC                                 
029961,000047: 40,3753  E7,1611                                  EBANK=   TSTRT                                 
029962,000048: 40,3753           03113 76067                     2CADR    DISPN5X                               
029963,000049: 
029964,000050: 40,3755           15261                           TCF      TASKOVER                              
029965,000051: 
029966,000052: 37,3113                                           BANK     37                                    
029967,000053: 37,2000                                           SETLOC   R31                                   
029968,000054: 37,2000                                           BANK                                           
029969,000055: 37,3113                                           COUNT*   $$/R31                                
029970,000056: 
029971,000057: 37,3113           33407        DISPN5X            CAF      V16N54                                
029972,000058: 37,3114           04616                           TC       BANKCALL                              
029973,000059: 37,3115           20334                           CADR     GOMARKF                               
029974,000060: 37,3116           05563                           TC       B5OFF                                 
029975,000061: 37,3117           05563                           TC       B5OFF                                 
029976,000062: 37,3120           13113                           TCF      DISPN5X                               
029977,000063: 
029978,000064: 37,3121           40103        V83CALL            CS       FLAGWRD7                              #  TEST AVERAGE G FLAG
029979,000065: 37,3122           74747                           MASK     AVEGFBIT                              
029980,000066: 37,3123           00006                           EXTEND                                         
029981,000067: 37,3124           13377                           BZF      MUNG?                                 #  ON - TEST MUNFLAG
029982,000068: 
029983,000069: 37,3125           40104                           CS       FLAGWRD8                              
029984,000070: 37,3126           74744                           MASK     SURFFBIT                              
029985,000071: 37,3127           00006                           EXTEND                                         
029986,000072: 37,3130           13403                           BZF      ONEBASE                               #  ON SURFACE - BYPASS LEMPREC
029987,000073: 
029988,000074: 37,3131           06042                           TC       INTPRET                               #  EXTRAPOLATE BOTH STATE VECTORS
029989,000075: 37,3132           77634                           RTB                                            

Page 706

029991,000077: 37,3133           21574                                    LOADTIME                              
029992,000078: 37,3134           34041                           STCALL   TDEC1                                 
029993,000079: 37,3135           27056                                    LEMPREC                               #  PRECISION BASE VECTOR FOR LM
029994,000080: 37,3136           77775                           VLOAD                                          
029995,000081: 37,3137           00017                                    RATT1                                 
029996,000082: 37,3140           26170                           STOVL    BASETHP                               
029997,000083: 37,3141           00025                                    VATT1                                 
029998,000084: 37,3142           16105                           STODL    BASETHV                               
029999,000085: 37,3143           00015                                    TAT                                   
030000,000086: 37,3144           02114        DOCMBASE           STORE    BASETIME                              #  PRECISION BASE VECTOR FOR CM
030001,000087: 37,3145           34041                           STCALL   TDEC1                                 
030002,000088: 37,3146           27042                                    CSMPREC                               
030003,000089: 37,3147           77775                           VLOAD                                          
030004,000090: 37,3150           00017                                    RATT1                                 
030005,000091: 37,3151           26140                           STOVL    BASEOTP                               
030006,000092: 37,3152           00025                                    VATT1                                 
030007,000093: 37,3153           02120                           STORE    BASEOTV                               
030008,000094: 37,3154           77776                           EXIT                                           
030009,000095: 
030010,000096: 37,3155           40103        REV83              CS       FLAGWRD7                              
030011,000097: 37,3156           74747                           MASK     AVEGFBIT                              
030012,000098: 37,3157           00006                           EXTEND                                         
030013,000099: 37,3160           13326                           BZF      GETRVN                                #  IF AVEGFLAG SET, USE RN,VN
030014,000100: 
030015,000101: 37,3161           40104                           CS       FLAGWRD8                              
030016,000102: 37,3162           74744                           MASK     SURFFBIT                              
030017,000103: 37,3163           00006                           EXTEND                                         
030018,000104: 37,3164           13370                           BZF      R31SURF                               #  IF ON SURFACE, USE LEMAREC
030019,000105: 
030020,000106: 37,3165           06042                           TC       INTPRET                               #  DO CONIC EXTRAPOLATION FOR BOTH VEHICLES
030021,000107: 37,3166           77634                           RTB                                            
030022,000108: 37,3167           21574                                    LOADTIME                              
030023,000109: 37,3170           34041                           STCALL   TDEC1                                 
030024,000110: 37,3171           27410                                    INTSTALL                              
030025,000111: 37,3172           43175                           VLOAD    CLEAR                                 
030026,000112: 37,3173           02170                                    BASETHP                               
030027,000113: 37,3174           00263                                    MOONFLAG                              
030028,000114: 37,3175           25535                           STOVL    RCV                                   
030029,000115: 37,3176           02105                                    BASETHV                               
030030,000116: 37,3177           15543                           STODL    VCV                                   
030031,000117: 37,3200           02114                                    BASETIME                              
030032,000118: 37,3201           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
030033,000119: 37,3202           04344                                    MOONTHIS                              
030034,000120: 37,3203           77205                                    +2                                    
030035,000121: 37,3204           00063                                    MOONFLAG                              
030036,000122: 37,3205           77614                           SET                                            
030037,000123: 37,3206           01473                                    INTYPFLG                              #  CONIC EXTRAP.
030038,000124: 37,3207           35517                           STCALL   TET                                   
030039,000125: 37,3210           27106                                    INTEGRVS                              #  INTEGRATION --- AT LAST ---
030040,000126: 37,3211           77775        OTHCONIC           VLOAD                                          

Page 707

030042,000128: 37,3212           00001                                    RATT                                  
030043,000129: 37,3213           26207                           STOVL    RONE                                  
030044,000130: 37,3214           00007                                    VATT                                  
030045,000131: 37,3215           36215                           STCALL   VONE                                  #  GET SET FOR CONIC EXTRAP., OTHER.
030046,000132: 37,3216           27410                                    INTSTALL                              
030047,000133: 37,3217           71214                           SET      DLOAD                                 
030048,000134: 37,3220           01473                                    INTYPFLG                              
030049,000135: 37,3221           00015                                    TAT                                   
030050,000136: 37,3222           00041        OTHINT             STORE    TDEC1                                 
030051,000137: 37,3223           43175                           VLOAD    CLEAR                                 
030052,000138: 37,3224           02140                                    BASEOTP                               
030053,000139: 37,3225           00263                                    MOONFLAG                              
030054,000140: 37,3226           25535                           STOVL    RCV                                   
030055,000141: 37,3227           02120                                    BASEOTV                               
030056,000142: 37,3230           15543                           STODL    VCV                                   
030057,000143: 37,3231           02114                                    BASETIME                              
030058,000144: 37,3232           43014                           BOF      SET                                   
030059,000145: 37,3233           04344                                    MOONTHIS                              
030060,000146: 37,3234           77236                                    +2                                    
030061,000147: 37,3235           00063                                    MOONFLAG                              
030062,000148: 37,3236           35517                           STCALL   TET                                   
030063,000149: 37,3237           27106                                    INTEGRVS                              
030064,000150: 37,3240           52375        COMPDISP           VLOAD    VSU                                   
030065,000151: 37,3241           00001                                    RATT                                  
030066,000152: 37,3242           02207                                    RONE                                  
030067,000153: 37,3243           65234                           RTB      PDDL                                  
030068,000154: 37,3244           21725                                    NORMUNX1                              #  UNIT(RANGE) TO PD 0-5
030069,000155: 37,3245           00045                                    36D                                   
030070,000156: 37,3246           77657                           SL*                                            #  RESCALE AFTER NORMUNIT
030071,000157: 37,3247           20201                                    0,1                                   
030072,000158: 37,3250           26201                           STOVL    RANGE                                 #  SCALED 2(29)M
030073,000159: 37,3251           00007                                    VATT                                  
030074,000160: 37,3252           50251                           VSU      DOT                                   #  (VCM-VLM).UNIT(LOS), PD=0
030075,000161: 37,3253           02215                                    VONE                                  
030076,000162: 37,3254           77752                           SL1                                            #  SCALED 2(7)M/CS
030077,000163: 37,3255           26203                           STOVL    RRATE                                 
030078,000164: 37,3256           02207                                    RONE                                  
030079,000165: 37,3257           63256                           UNIT     PDVL                                  #  UNIT(R) TO PD 0-5
030080,000166: 37,3260           06516                                    UNITZ                                 
030081,000167: 37,3261           77624                           CALL                                           
030082,000168: 37,3262           47663                                    CDU*NBSM                              
030083,000169: 37,3263           41505                           VXM      PUSH                                  #  UNIT(Z)/4 TO PD 6-11
030084,000170: 37,3264           01734                                    REFSMMAT                              
030085,000171: 37,3265           72431                           VPROJ    VSL2                                  #  UNIT(P)=UNIT(UZ-(UZ)PROJ(UR))
030086,000172: 37,3266           00001                                    0D                                    
030087,000173: 37,3267           53445                           BVSU     UNIT                                  
030088,000174: 37,3270           00007                                    6D                                    
030089,000175: 37,3271           47315                           PDVL     VXV                                   #  UNIT(P) TO PD 12-17
030090,000176: 37,3272           00001                                    0D                                    #  UNIT(RL)
030091,000177: 37,3273           02215                                    VONE                                  

Page 708

030093,000179: 37,3274           50235                           VXV      DOT                                   #  (UR * VL) * UR . U(P)
030094,000180: 37,3275           00001                                    0D                                    
030095,000181: 37,3276           00015                                    12D                                   
030096,000182: 37,3277           77715                           PDVL                                           #  SIGN TO 12-13, LOAD U(P)
030097,000183: 37,3300           75241                           DOT      SIGN                                  
030098,000184: 37,3301           00007                                    6D                                    
030099,000185: 37,3302           00015                                    12D                                   
030100,000186: 37,3303           65512                           SL2      ACOS                                  #  ARCCOS(UP.UZ(SIGN))
030101,000187: 37,3304           26205                           STOVL    RTHETA                                
030102,000188: 37,3305           00001                                    0D                                    
030103,000189: 37,3306           51041                           DOT      BPL                                   #  IF UR.UZ NEG,
030104,000190: 37,3307           00007                                    6D                                    #        RTHETA = 1 - RTHETA
030105,000191: 37,3310           77315                                    +5                                    
030106,000192: 37,3311           45345                           DLOAD    DSU                                   
030107,000193: 37,3312           06532                                    DPPOSMAX                              
030108,000194: 37,3313           02205                                    RTHETA                                
030109,000195: 37,3314           02205                           STORE    RTHETA                                
030110,000196: 37,3315           77776                           EXIT                                           
030111,000197: 
030112,000198: 37,3316           34747                           CA       BIT5                                  
030113,000199: 37,3317           71043                           MASK     EXTVBACT                              
030114,000200: 37,3320           00006                           EXTEND                                         #  IF ANSWERED,
030115,000201: 37,3321           15472                           BZF      ENDEXT                                #        TERMINATE
030116,000202: 
030117,000203: 37,3322           41043                           CS       EXTVBACT                              
030118,000204: 37,3323           74740                           MASK     BIT12                                 
030119,000205: 37,3324           27043                           ADS      EXTVBACT                              #  SET BIT 12
030120,000206: 37,3325           13155                           TCF      REV83                                 #  AND START AGAIN.
030121,000207: 
030122,000208: 37,3326           37713        GETRVN             CA       PRIO22                                #  INHIBIT SERVICER
030123,000209: 37,3327           05146                           TC       PRIOCHNG                              
030124,000210: 37,3330           06042                           TC       INTPRET                               
030125,000211: 37,3331           40375                           VLOAD    SETPD                                 
030126,000212: 37,3332           01220                                    RN                                    #  LM STATE VECTOR IN RN,VN
030127,000213: 37,3333           00001                                    0                                     
030128,000214: 37,3334           26207                           STOVL    RONE                                  
030129,000215: 37,3335           01226                                    VN                                    
030130,000216: 37,3336           26215                           STOVL    VONE                                  #  LOAD R(CSM),V(CSM) IN CASE MUNFLAG SET
030131,000217: 37,3337           01726                                    V(CSM)                                #  (TO INSURE TIME COMPATABILITY)
030132,000218: 37,3340           65315                           PDVL     PDDL                                  
030133,000219: 37,3341           01720                                    R(CSM)                                
030134,000220: 37,3342           01234                                    PIPTIME                               
030135,000221: 37,3343           77776                           EXIT                                           
030136,000222: 37,3344           35015                           CA       PRIO3                                 
030137,000223: 37,3345           05146                           TC       PRIOCHNG                              
030138,000224: 37,3346           06042                           TC       INTPRET                               
030139,000225: 37,3347           77214                           BOFF     VLOAD                                 
030140,000226: 37,3350           03347                                    MUNFLAG                               
030141,000227: 37,3351           77363                                    GETRVN2                               #  IF MUNFLAG RESET, DO CM DELTA PRECISION

Page 709

030143,000229: 37,3352           60505                           VXM      VSR4                                  #  CHANGE TO REFERENCE SYSTEM AND RESCALE
030144,000230: 37,3353           01734                                    REFSMMAT                              
030145,000231: 37,3354           77715                           PDVL                                           #  R TO PD 0-5
030146,000232: 37,3355           76505                           VXM      VSL1                                  
030147,000233: 37,3356           01734                                    REFSMMAT                              
030148,000234: 37,3357           40206                           PUSH     SETPD                                 #  V TO PD 5-11
030149,000235: 37,3360           00001                                    0                                     
030150,000236: 37,3361           77650                           GOTO                                           
030151,000237: 37,3362           77240                                    COMPDISP                              
030152,000238: 
030153,000239: 37,3363           77624        GETRVN2            CALL                                           
030154,000240: 37,3364           27410                                    INTSTALL                              
030155,000241: 37,3365           52014                           CLEAR    GOTO                                  
030156,000242: 37,3366           01673                                    INTYPFLG                              #  PREC EXTRAP FOR OTHER
030157,000243: 37,3367           77222                                    OTHINT                                
030158,000244: 37,3370           06042        R31SURF            TC       INTPRET                               
030159,000245: 37,3371           77634                           RTB                                            #  LM IS ON SURFACE, SO PRECISION
030160,000246: 37,3372           21574                                    LOADTIME                              #  INTEGRATION USES PLANETARY INERTIAL
030161,000247: 37,3373           34041                           STCALL   TDEC1                                 #  ORIENTATION SUBROUTINE
030162,000248: 37,3374           27056                                    LEMPREC                               
030163,000249: 37,3375           77650                           GOTO                                           #  DO CSM CONIC
030164,000250: 37,3376           77211                                    OTHCONIC                              
030165,000251: 37,3377           40102        MUNG?              CS       FLAGWRD6                              
030166,000252: 37,3400           74744                           MASK     MUNFLBIT                              
030167,000253: 37,3401           00006                           EXTEND                                         
030168,000254: 37,3402           13326                           BZF      GETRVN                                #  IF MUNFLAG SET, CSM BASE NOT NEEDED
030169,000255: 
030170,000256: 37,3403           06042        ONEBASE            TC       INTPRET                               #  GET CSM BASE VECTOR
030171,000257: 37,3404           52034                           RTB      GOTO                                  
030172,000258: 37,3405           21574                                    LOADTIME                              
030173,000259: 37,3406           77144                                    DOCMBASE                              
030174,000260: 
030175,000261: 37,3407           04066        V16N54             VN       1654                                  
030176,000262: 

Page 710
The original program listing had no source lines on this page.

030179,000265: 

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