Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the second release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 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.

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

Page 703

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

Page 704

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

Page 705

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

Page 706

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

Page 707

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

Page 708
This page is empty.

030977,000287: 

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