Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97. A bug (which had been around since at least Apollo 10, Luminary 69) was discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute revision into Rev 1, which is what actually flew rather than the Rev 0 presented here. A hardcopy of Rev 0 is known to exist — it belonged to AGC developer Allan Klumpp for many years — but unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus the code you see here had been reconstructed (we believe accurately) rather than transcribed. The first step of the reconstruction of the Rev 0 source code was the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection. The process of reverting the active portion of the source code (i.e., other than program comments) from Rev 1 to Rev 0 was very minor, consisting only of moving the position of the STARTSB1 label in FRESH START AND RESTART. Allan had previously given us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read, in part:

	GAP:  ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051

A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here.

030702,000002:                                                                                                  ## Copyright:   Public domain.
030703,000003:                                                                                                  ## Filename:    R31.agc
030704,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
030705,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the third release
030706,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
030707,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
030708,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
030709,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
030710,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
030711,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
030712,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
030713,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
030714,000014:                                                                                                  ##              the original YUL assembler.
030715,000015:                                                                                                  ##
030716,000016:                                                                                                  ## Assembler:   yaYUL
030717,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
030718,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
030719,000019:                                                                                                  ## Pages:       703-708
030720,000020:                                                                                                  ## Mod history: 2009-05-19 RSB  Adapted from the corresponding 
030721,000021:                                                                                                  ##                              Luminary131 file, using page 
030722,000022:                                                                                                  ##                              images from Luminary 1A.
030723,000023:                                                                                                  ##              2016-12-14 RSB  Proofed text comments with octopus/ProoferComments
030724,000024:                                                                                                  ##                              and corrected the errors found.
030725,000025:                                                                                                  ##              2017-03-09 RSB  Comment-text fixes noted in proofing Luminary 116.
030726,000026:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
030727,000027: 
030728,000028:                                                                                                  ## This source code has been transcribed or otherwise adapted from
030729,000029:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
030730,000030:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
030731,000031:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
030732,000032:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
030733,000033:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
030734,000034:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
030735,000035:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
030736,000036:                                                                                                  ## actually created.
030737,000037:                                                                                                  ##
030738,000038:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
030739,000039:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
030740,000040:                                                                                                  ## the listing from which it was transcribed. It has been verified to
030741,000041:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
030742,000042:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
030743,000043:                                                                                                  ##
030744,000044:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
030745,000045:                                                                                                  ##
030746,000046:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
030747,000047: 

Page 703

030749,000049: 40,3674                                           BANK     40                                    
030750,000050: 40,2000                                           SETLOC   R31LOC                                
030751,000051: 40,2000                                           BANK                                           
030752,000052: 
030753,000053: 40,3674                                           COUNT*   $$/R31                                
030754,000054: 
030755,000055: 40,3674           35015        R31CALL            CAF      PRIO3                                 
030756,000056: 40,3675           05105                           TC       FINDVAC                               
030757,000057: 40,3676  E7,1470                                  EBANK=   SUBEXIT                               
030758,000058: 40,3676           03121 76067                     2CADR    V83CALL                               
030759,000059: 
030760,000060: 40,3700           05221        DSPDELAY           TC       FIXDELAY                              
030761,000061: 40,3701           00144                           DEC      100        B-14                       
030762,000062: 40,3702           31044                           CA       EXTVBACT                              
030763,000063: 40,3703           74740                           MASK     BIT12                                 
030764,000064: 40,3704           00006                           EXTEND                                         
030765,000065: 40,3705           13700                           BZF      DSPDELAY                              
030766,000066: 
030767,000067: 40,3706           35017                           CAF      PRIO5                                 
030768,000068: 40,3707           05072                           TC       NOVAC                                 
030769,000069: 40,3710  E7,1611                                  EBANK=   TSTRT                                 
030770,000070: 40,3710           03113 76067                     2CADR    DISPN5X                               
030771,000071: 
030772,000072: 40,3712           15261                           TCF      TASKOVER                              
030773,000073: 
030774,000074: 37,3113                                           BANK     37                                    
030775,000075: 37,2000                                           SETLOC   R31                                   
030776,000076: 37,2000                                           BANK                                           
030777,000077: 37,3113                                           COUNT*   $$/R31                                
030778,000078: 
030779,000079: 37,3113           33407        DISPN5X            CAF      V16N54                                
030780,000080: 37,3114           04616                           TC       BANKCALL                              
030781,000081: 37,3115           20334                           CADR     GOMARKF                               
030782,000082: 37,3116           05563                           TC       B5OFF                                 
030783,000083: 37,3117           05563                           TC       B5OFF                                 
030784,000084: 37,3120           13113                           TCF      DISPN5X                               
030785,000085: 
030786,000086: 37,3121           40103        V83CALL            CS       FLAGWRD7                              #  TEST AVERAGE G FLAG
030787,000087: 37,3122           74747                           MASK     AVEGFBIT                              
030788,000088: 37,3123           00006                           EXTEND                                         
030789,000089: 37,3124           13377                           BZF      MUNG?                                 #  ON - TEST MUNFLAG
030790,000090: 
030791,000091: 37,3125           40104                           CS       FLAGWRD8                              
030792,000092: 37,3126           74744                           MASK     SURFFBIT                              
030793,000093: 37,3127           00006                           EXTEND                                         
030794,000094: 37,3130           13403                           BZF      ONEBASE                               #  ON SURFACE - BYPASS LEMPREC
030795,000095: 
030796,000096: 37,3131           06037                           TC       INTPRET                               #  EXTRAPOLATE BOTH STATE VECTORS
030797,000097: 37,3132           77634                           RTB                                            

Page 704

030799,000099: 37,3133           21573                                    LOADTIME                              
030800,000100: 37,3134           34041                           STCALL   TDEC1                                 
030801,000101: 37,3135           27057                                    LEMPREC                               #  PRECISION BASE VECTOR FOR LM
030802,000102: 37,3136           77775                           VLOAD                                          
030803,000103: 37,3137           00017                                    RATT1                                 
030804,000104: 37,3140           26170                           STOVL    BASETHP                               
030805,000105: 37,3141           00025                                    VATT1                                 
030806,000106: 37,3142           16105                           STODL    BASETHV                               
030807,000107: 37,3143           00015                                    TAT                                   
030808,000108: 37,3144           02114        DOCMBASE           STORE    BASETIME                              #  PRECISION BASE VECTOR FOR CM
030809,000109: 37,3145           34041                           STCALL   TDEC1                                 
030810,000110: 37,3146           27043                                    CSMPREC                               
030811,000111: 37,3147           77775                           VLOAD                                          
030812,000112: 37,3150           00017                                    RATT1                                 
030813,000113: 37,3151           26140                           STOVL    BASEOTP                               
030814,000114: 37,3152           00025                                    VATT1                                 
030815,000115: 37,3153           02120                           STORE    BASEOTV                               
030816,000116: 37,3154           77776                           EXIT                                           
030817,000117: 
030818,000118: 37,3155           40103        REV83              CS       FLAGWRD7                              
030819,000119: 37,3156           74747                           MASK     AVEGFBIT                              
030820,000120: 37,3157           00006                           EXTEND                                         
030821,000121: 37,3160           13326                           BZF      GETRVN                                #  IF AVEGFLAG SET, USE RN,VN
030822,000122: 
030823,000123: 37,3161           40104                           CS       FLAGWRD8                              
030824,000124: 37,3162           74744                           MASK     SURFFBIT                              
030825,000125: 37,3163           00006                           EXTEND                                         
030826,000126: 37,3164           13370                           BZF      R31SURF                               #  IF ON SURFACE, USE LEMAREC
030827,000127: 
030828,000128: 37,3165           06037                           TC       INTPRET                               #  DO CONIC EXTRAPOLATION FOR BOTH VEHICLES
030829,000129: 37,3166           77634                           RTB                                            
030830,000130: 37,3167           21573                                    LOADTIME                              
030831,000131: 37,3170           34041                           STCALL   TDEC1                                 
030832,000132: 37,3171           27414                                    INTSTALL                              
030833,000133: 37,3172           43175                           VLOAD    CLEAR                                 
030834,000134: 37,3173           02170                                    BASETHP                               
030835,000135: 37,3174           00263                                    MOONFLAG                              
030836,000136: 37,3175           25535                           STOVL    RCV                                   
030837,000137: 37,3176           02105                                    BASETHV                               
030838,000138: 37,3177           15543                           STODL    VCV                                   
030839,000139: 37,3200           02114                                    BASETIME                              
030840,000140: 37,3201           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
030841,000141: 37,3202           04344                                    MOONTHIS                              
030842,000142: 37,3203           77205                                    +2                                    
030843,000143: 37,3204           00063                                    MOONFLAG                              
030844,000144: 37,3205           77614                           SET                                            
030845,000145: 37,3206           01473                                    INTYPFLG                              #  CONIC EXTRAP.
030846,000146: 37,3207           35517                           STCALL   TET                                   
030847,000147: 37,3210           27107                                    INTEGRVS                              #  INTEGRATION --- AT LAST ---
030848,000148: 37,3211           77775        OTHCONIC           VLOAD                                          

Page 705

030850,000150: 37,3212           00001                                    RATT                                  
030851,000151: 37,3213           26207                           STOVL    RONE                                  
030852,000152: 37,3214           00007                                    VATT                                  
030853,000153: 37,3215           36215                           STCALL   VONE                                  #  GET SET FOR CONIC EXTRAP., OTHER.
030854,000154: 37,3216           27414                                    INTSTALL                              
030855,000155: 37,3217           71214                           SET      DLOAD                                 
030856,000156: 37,3220           01473                                    INTYPFLG                              
030857,000157: 37,3221           00015                                    TAT                                   
030858,000158: 37,3222           00041        OTHINT             STORE    TDEC1                                 
030859,000159: 37,3223           43175                           VLOAD    CLEAR                                 
030860,000160: 37,3224           02140                                    BASEOTP                               
030861,000161: 37,3225           00263                                    MOONFLAG                              
030862,000162: 37,3226           25535                           STOVL    RCV                                   
030863,000163: 37,3227           02120                                    BASEOTV                               
030864,000164: 37,3230           15543                           STODL    VCV                                   
030865,000165: 37,3231           02114                                    BASETIME                              
030866,000166: 37,3232           43014                           BOF      SET                                   
030867,000167: 37,3233           04344                                    MOONTHIS                              
030868,000168: 37,3234           77236                                    +2                                    
030869,000169: 37,3235           00063                                    MOONFLAG                              
030870,000170: 37,3236           35517                           STCALL   TET                                   
030871,000171: 37,3237           27107                                    INTEGRVS                              
030872,000172: 37,3240           52375        COMPDISP           VLOAD    VSU                                   
030873,000173: 37,3241           00001                                    RATT                                  
030874,000174: 37,3242           02207                                    RONE                                  
030875,000175: 37,3243           65234                           RTB      PDDL                                  
030876,000176: 37,3244           21724                                    NORMUNX1                              #  UNIT(RANGE) TO PD 0-5
030877,000177: 37,3245           00045                                    36D                                   
030878,000178: 37,3246           77657                           SL*                                            #  RESCALE AFTER NORMUNIT
030879,000179: 37,3247           20201                                    0,1                                   
030880,000180: 37,3250           26201                           STOVL    RANGE                                 #  SCALED 2(29)M
030881,000181: 37,3251           00007                                    VATT                                  
030882,000182: 37,3252           50251                           VSU      DOT                                   #  (VCM-VLM).UNIT(LOS), PD=0
030883,000183: 37,3253           02215                                    VONE                                  
030884,000184: 37,3254           77752                           SL1                                            #  SCALED 2(7)M/CS
030885,000185: 37,3255           26203                           STOVL    RRATE                                 
030886,000186: 37,3256           02207                                    RONE                                  
030887,000187: 37,3257           63256                           UNIT     PDVL                                  #  UNIT(R) TO PD 0-5
030888,000188: 37,3260           06514                                    UNITZ                                 
030889,000189: 37,3261           77624                           CALL                                           
030890,000190: 37,3262           47661                                    CDU*NBSM                              
030891,000191: 37,3263           41505                           VXM      PUSH                                  #  UNIT(Z)/4 TO PD 6-11
030892,000192: 37,3264           01734                                    REFSMMAT                              
030893,000193: 37,3265           72431                           VPROJ    VSL2                                  #  UNIT(P)=UNIT(UZ-(UZ)PROJ(UR))
030894,000194: 37,3266           00001                                    0D                                    
030895,000195: 37,3267           53445                           BVSU     UNIT                                  
030896,000196: 37,3270           00007                                    6D                                    
030897,000197: 37,3271           47315                           PDVL     VXV                                   #  UNIT(P) TO PD 12-17
030898,000198: 37,3272           00001                                    0D                                    #  UNIT(RL)
030899,000199: 37,3273           02215                                    VONE                                  

Page 706

030901,000201: 37,3274           50235                           VXV      DOT                                   #  (UR * VL) * UR . U(P)
030902,000202: 37,3275           00001                                    0D                                    
030903,000203: 37,3276           00015                                    12D                                   
030904,000204: 37,3277           77715                           PDVL                                           #  SIGN TO 12-13, LOAD U(P)
030905,000205: 37,3300           75241                           DOT      SIGN                                  
030906,000206: 37,3301           00007                                    6D                                    
030907,000207: 37,3302           00015                                    12D                                   
030908,000208: 37,3303           65512                           SL2      ACOS                                  #  ARCCOS(UP.UZ(SIGN))
030909,000209: 37,3304           26205                           STOVL    RTHETA                                
030910,000210: 37,3305           00001                                    0D                                    
030911,000211: 37,3306           51041                           DOT      BPL                                   #  IF UR.UZ NEG,
030912,000212: 37,3307           00007                                    6D                                    #        RTHETA = 1 - RTHETA
030913,000213: 37,3310           77315                                    +5                                    
030914,000214: 37,3311           45345                           DLOAD    DSU                                   
030915,000215: 37,3312           06530                                    DPPOSMAX                              
030916,000216: 37,3313           02205                                    RTHETA                                
030917,000217: 37,3314           02205                           STORE    RTHETA                                
030918,000218: 37,3315           77776                           EXIT                                           
030919,000219: 
030920,000220: 37,3316           34747                           CA       BIT5                                  
030921,000221: 37,3317           71044                           MASK     EXTVBACT                              
030922,000222: 37,3320           00006                           EXTEND                                         #  IF ANSWERED,
030923,000223: 37,3321           15472                           BZF      ENDEXT                                #        TERMINATE
030924,000224: 
030925,000225: 37,3322           41044                           CS       EXTVBACT                              
030926,000226: 37,3323           74740                           MASK     BIT12                                 
030927,000227: 37,3324           27044                           ADS      EXTVBACT                              #  SET BIT 12
030928,000228: 37,3325           13155                           TCF      REV83                                 #  AND START AGAIN.
030929,000229: 
030930,000230: 37,3326           37710        GETRVN             CA       PRIO22                                #  INHIBIT SERVICER
030931,000231: 37,3327           05146                           TC       PRIOCHNG                              
030932,000232: 37,3330           06037                           TC       INTPRET                               
030933,000233: 37,3331           40375                           VLOAD    SETPD                                 
030934,000234: 37,3332           01221                                    RN                                    #  LM STATE VECTOR IN RN,VN
030935,000235: 37,3333           00001                                    0                                     
030936,000236: 37,3334           26207                           STOVL    RONE                                  
030937,000237: 37,3335           01227                                    VN                                    
030938,000238: 37,3336           26215                           STOVL    VONE                                  #  LOAD R(CSM),V(CSM) IN CASE MUNFLAG SET
030939,000239: 37,3337           01726                                    V(CSM)                                #  (TO INSURE TIME COMPATABILITY)
030940,000240: 37,3340           65315                           PDVL     PDDL                                  
030941,000241: 37,3341           01720                                    R(CSM)                                
030942,000242: 37,3342           01235                                    PIPTIME                               
030943,000243: 37,3343           77776                           EXIT                                           
030944,000244: 37,3344           35015                           CA       PRIO3                                 
030945,000245: 37,3345           05146                           TC       PRIOCHNG                              
030946,000246: 37,3346           06037                           TC       INTPRET                               
030947,000247: 37,3347           77214                           BOFF     VLOAD                                 
030948,000248: 37,3350           03347                                    MUNFLAG                               
030949,000249: 37,3351           77363                                    GETRVN2                               #  IF MUNFLAG RESET, DO CM DELTA PRECISION

Page 707

030951,000251: 37,3352           60505                           VXM      VSR4                                  #  CHANGE TO REFERENCE SYSTEM AND RESCALE
030952,000252: 37,3353           01734                                    REFSMMAT                              
030953,000253: 37,3354           77715                           PDVL                                           #  R TO PD 0-5
030954,000254: 37,3355           76505                           VXM      VSL1                                  
030955,000255: 37,3356           01734                                    REFSMMAT                              
030956,000256: 37,3357           40206                           PUSH     SETPD                                 #  V TO PD 5-11
030957,000257: 37,3360           00001                                    0                                     
030958,000258: 37,3361           77650                           GOTO                                           
030959,000259: 37,3362           77240                                    COMPDISP                              
030960,000260: 
030961,000261: 37,3363           77624        GETRVN2            CALL                                           
030962,000262: 37,3364           27414                                    INTSTALL                              
030963,000263: 37,3365           52014                           CLEAR    GOTO                                  
030964,000264: 37,3366           01673                                    INTYPFLG                              #  PREC EXTRAP FOR OTHER
030965,000265: 37,3367           77222                                    OTHINT                                
030966,000266: 37,3370           06037        R31SURF            TC       INTPRET                               
030967,000267: 37,3371           77634                           RTB                                            #  LM IS ON SURFACE, SO PRECISION
030968,000268: 37,3372           21573                                    LOADTIME                              #  INTEGRATION USES PLANETARY INERTIAL
030969,000269: 37,3373           34041                           STCALL   TDEC1                                 #  ORIENTATION SUBROUTINE
030970,000270: 37,3374           27057                                    LEMPREC                               
030971,000271: 37,3375           77650                           GOTO                                           #  DO CSM CONIC
030972,000272: 37,3376           77211                                    OTHCONIC                              
030973,000273: 37,3377           40102        MUNG?              CS       FLAGWRD6                              
030974,000274: 37,3400           74744                           MASK     MUNFLBIT                              
030975,000275: 37,3401           00006                           EXTEND                                         
030976,000276: 37,3402           13326                           BZF      GETRVN                                #  IF MUNFLAG SET, CSM BASE NOT NEEDED
030977,000277: 
030978,000278: 37,3403           06037        ONEBASE            TC       INTPRET                               #  GET CSM BASE VECTOR
030979,000279: 37,3404           52034                           RTB      GOTO                                  
030980,000280: 37,3405           21573                                    LOADTIME                              
030981,000281: 37,3406           77144                                    DOCMBASE                              
030982,000282: 
030983,000283: 37,3407           04066        V16N54             VN       1654                                  
030984,000284: 

Page 708
This page is empty.

030987,000287: 

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