Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

034831,000002:                                                                                                  ## Copyright:   Public domain.
034832,000003:                                                                                                  ## Filename:    THROTTLE_CONTROL_ROUTINES.agc
034833,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
034834,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
034835,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
034836,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
034837,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
034838,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
034839,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
034840,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
034841,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
034842,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
034843,000014:                                                                                                  ## Reference:   pp. 797-801
034844,000015:                                                                                                  ## Assembler:   yaYUL
034845,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
034846,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
034847,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
034848,000019: 

Page 797

034850,000021: 
034851,000022: 31,2247                                           BANK     31                                    
034852,000023: 31,2000                                           SETLOC   FTHROT                                
034853,000024: 31,2000                                           BANK                                           
034854,000025: 31,2247  E7,1610                                  EBANK=   PIF                                   
034855,000026: 31,2247                                           COUNT*   $$/THROT                              
034856,000027: 
034857,000028:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
034858,000029:                                                                                                  #  HERE FC, DESIRED THRUST, AND FP, PRESENT THRUST, UNWEIGHTED, ARE COMPUTED.
034859,000030: 
034860,000031: 31,2247           31246        THROTTLE           CA       ABDELV                                #  COMPUTE PRESENT ACCELERATION IN UNITS OF
034861,000032: 31,2250           00006                           EXTEND                                         #  2(-4) M/CS/CS, SAVING SERVICER TROUBLE
034862,000033: 31,2251           72444                           MP       /AF/CNST                              
034863,000034: 31,2252           00006                 +3        EXTEND                                         
034864,000035: 31,2253           23605                           QXCH     RTNHOLD                               
034865,000036: 31,2254           02425        AFDUMP             TC       MASSMULT                              
034866,000037: 31,2255           53563                           DXCH     FP                                    #  FP = PRESENT THRUST
034867,000038: 31,2256           00006                           EXTEND                                         
034868,000039: 31,2257           31574                           DCA      /AFC/                                 
034869,000040: 31,2260           02425                           TC       MASSMULT                              
034870,000041: 31,2261           55613                           TS       FC                                    #  FC = THRUST DESIRED BY GUIDANCE
034871,000042: 31,2262           53561                           DXCH     FCODD                                 #  FCODD = WHAT IT IS GOING TO GET
034872,000043: 
034873,000044:                                                                                                  #  IF IT HAS BEEN LESS THAN 3 SECONDS SINCE THE LAST THROTTLING, AUGMENT FP USING THE FWEIGHT CALCULATED THEN.
034874,000045: 
034875,000046: 31,2263           41615                           CS       TTHROT                                #  THIS CODING ASSUMES A FLATOUT WITHIN
034876,000047: 31,2264           60025                           AD       TIME1                                 #    80 SECONDS BEFORE FIRST THROTTLE CALL
034877,000048: 31,2265           74733                           MASK     POSMAX                                
034878,000049: 31,2266           40000                           COM                                            
034879,000050: 31,2267           65002                           AD       3SECS                                 
034880,000051: 31,2270           00006                           EXTEND                                         
034881,000052: 31,2271           62275                           BZMF     WHERETO                               #  BRANCH IF (TIME1-TTHROT +1) > 3 SECONDS
034882,000053: 31,2272           00006                           EXTEND                                         
034883,000054: 31,2273           31607                           DCA      FWEIGHT                               
034884,000055: 31,2274           21563                           DAS      FP                                    
034885,000056: 
034886,000057:                                                                                                  #      THIS LOGIC DETERMINES THE THROTTLING IN THE REGION 10% - 94%.  THE MANUAL THROTTLE, NOMINALLY SET AT
034887,000058:                                                                                                  #  MINIMUM BY ASTRONAUT OR MISSION CONTROL PROGRAMS, PROVIDES THE LOWER BOUND.  A STOP IN THE THROTTLE HARDWARE
034888,000059:                                                                                                  #  PROVIDES THE UPPER.
034889,000060: 
034890,000061: 31,2275           35014        WHERETO            CA       EBANK5                                #  INITIALIZE L*WCR*T AND H*GHCR*T FROM
034891,000062: 31,2276           54003                           TS       EBANK                                 #    PAD LOADED ERASABLES IN W-MATRIX

Page 798

034893,000064: 31,2277  E5,1476                                  EBANK=   LOWCRIT                               
034894,000065: 31,2277           00006                           EXTEND                                         
034895,000066: 31,2300           31477                           DCA      LOWCRIT                               
034896,000067: 31,2301           52131                           DXCH     L*WCR*T                               
034897,000068: 31,2302           35016                           CA       EBANK7                                
034898,000069: 31,2303           54003                           TS       EBANK                                 
034899,000070: 31,2304  E7,1610                                  EBANK=   PIF                                   
034900,000071: 31,2304           44755                           CS       ZERO                                  #  INITIALIZE PIFPSET
034901,000072: 31,2305           55604                           TS       PIFPSET                               
034902,000073: 31,2306           40131                           CS       H*GHCR*T                              
034903,000074: 31,2307           61616                           AD       FCOLD                                 
034904,000075: 31,2310           00006                           EXTEND                                         
034905,000076: 31,2311           62323                           BZMF     LOWFCOLD                              #  BRANCH IF FCOLD < OR = HIGHCRIT
034906,000077: 31,2312           40130                           CS       L*WCR*T                               
034907,000078: 31,2313           61560                           AD       FCODD                                 
034908,000079: 31,2314           00006                           EXTEND                                         
034909,000080: 31,2315           62320                           BZMF     FCOMPSET                              #  BRANCH IF FC < OR = LOWCRIT
034910,000081: 31,2316           31562                           CA       FP                                    #  SEE NOTE 1
034911,000082: 31,2317           12337                           TCF      FLATOUT1                              
034912,000083: 
034913,000084: 31,2320           42002        FCOMPSET           CS       FMAXODD                               #  SEE NOTE 2
034914,000085: 31,2321           61562                           AD       FP                                    
034915,000086: 31,2322           12341                           TCF      FLATOUT2                              
034916,000087: 
034917,000088: 31,2323           40131        LOWFCOLD           CS       H*GHCR*T                              
034918,000089: 31,2324           61560                           AD       FCODD                                 
034919,000090: 31,2325           00006                           EXTEND                                         
034920,000091: 31,2326           62342                           BZMF     DOPIF                                 #  BRANCH IF FC < OR = HIGHCRIT
034921,000092: 
034922,000093: 31,2327           30102                           CA       FLAGWRD6                              #  IS POUTFLAG SET?
034923,000094: 31,2330           74745                           MASK     POUTBIT                               
034924,000095: 31,2331           00006                           EXTEND                                         
034925,000096: 31,2332           12336                           BZF      FLATOUT1   -1                         
034926,000097: 
034927,000098: 31,2333           30131                           CA       H*GHCR*T                              #  YES:  THROTTLE-UP ONLY TO HIGHCRIT
034928,000099: 31,2334           55560                           TS       FCODD                                 
034929,000100: 31,2335           12342                           TCF      DOPIF                                 
034930,000101: 
034931,000102: 31,2336           32003                           CA       FMAXPOS                               #  NO:  THROTTLE-UP
034932,000103: 31,2337           53561        FLATOUT1           DXCH     FCODD                                 
034933,000104: 31,2340           34737                           CA       FEXTRA                                
034934,000105: 31,2341           55604        FLATOUT2           TS       PIFPSET                               
034935,000106: 
034936,000107:                                                                                                  #  NOTE 1        FC IS SET EQUAL TO FP SO PIF WILL BE ZERO.  THIS IS DESIRABLE
034937,000108:                                                                                                  #                AS THERE IS ACTUALLY NO THROTTLE CHANGE.
034938,000109: 
034939,000110:                                                                                                  #  NOTE2         HERE, SINCE WE ARE ABOUT TO RETURN TO THE THROTTLEABLE REGION
034940,000111:                                                                                                  #                (BELOW 55%) THE QUANTITY -(FMAXODD-FP) IS COMPUTED AND PUT
034941,000112:                                                                                                  #                INTO PIFPSET TO COMPENSATE FOR THE DIFFERENCE BETWEEN THE
034942,000113:                                                                                                  #                NUMBER OF BITS CORRESPONDING TO FULL THROTTLE (FMAXODD) AND THE

Page 799

034944,000115:                                                                                                  #                NUMBER CORRESPONDING TO ACTUAL THRUST (FP).  THUS THE TOTAL
034945,000116:                                                                                                  #                THROTTLE COMMAND PIF = FC - FP - (FMAXODD - FP) = FC - FMAXODD.
034946,000117: 
034947,000118: 31,2342           03721        DOPIF              TC       FASTCHNG                              #  RESTART PROTECTION
034948,000119: 31,2343           00006                           EXTEND                                         
034949,000120: 31,2344           31561                           DCA      FCODD                                 
034950,000121: 31,2345           55616                           TS       FCOLD                                 
034951,000122: 31,2346           53611                           DXCH     PIF                                   
034952,000123: 31,2347           00006                           EXTEND                                         
034953,000124: 31,2350           41563                           DCS      FP                                    
034954,000125: 31,2351           21611                           DAS      PIF                                   #  PIF = FC - FP, NEVER EQUALS +0
034955,000126: 
034956,000127: 31,2352           31610        DOIT               CA       PIF                                   
034957,000128: 31,2353           61604                           AD       PIFPSET                               #  ADD IN PIFPSET, WITHOUT CHANGING PIF
034958,000129: 31,2354           55612                           TS       PSEUDO55                              
034959,000130: 31,2355           54055                           TS       THRUST                                
034960,000131: 31,2356           34750                           CAF      BIT4                                  
034961,000132: 31,2357           00006                           EXTEND                                         
034962,000133: 31,2360           05014                           WOR      CHAN14                                
034963,000134: 31,2361           30025                           CA       TIME1                                 
034964,000135: 31,2362           55615                           TS       TTHROT                                
034965,000136: 
034966,000137:                                                                                                  #  SINCE /AF/ IS NOT AN INSTANTANEOUS ACCELERATION, BUT RATHER AN "AVERAGE" OF THE ACCELERATION LEVELS DURING
034967,000138:                                                                                                  #  THE PRECEEDING PIPA INTERVAL, AND SINCE FP IS COMPUTED DIRECTLY FROM /AF/, FP IN ORDER TO CORRESPOND TO THE
034968,000139:                                                                                                  #  ACTUAL THRUST LEVEL AT THE END OF THE INTERVAL MUST BE WEIGHTED BY
034969,000140: 
034970,000141:                                                                                                  #                  PIF(PPROCESS + TL)     PIF /PIF/
034971,000142:                                                                                                  #        FWEIGHT = ------------------ + -------------
034972,000143:                                                                                                  #                       PGUID           2 PGUID FRATE
034973,000144: 
034974,000145:                                                                                                  #  WHERE PPROCESS IS THE TIME BETWEEN PIPA READING AND THE START OF THROTTLING, PGUID IS THE GUIDANCE PERIOD, AND
034975,000146:                                                                                                  #  FRATE IS THE THROTTLING RATE (32 UNITS PER CENTISECOND).  PGUID IS ASSUMED TO BE 2 SECONDS.  THE "TL" IN THE
034976,000147:                                                                                                  #  FIRST TERM REPRESENTS THE ENGINE'S RESPONSE LAG.  HERE FWEIGHT IS COMPUTED FOR USE NEXT PASS.
034977,000148: 
034978,000149: 31,2363           35003                           CA       4SECS                                 
034979,000150: 31,2364           54002                           TS       Q                                     
034980,000151: 31,2365           41235                           CS       PIPTIME    +1                         #  TIME OF LAST PIPA READING
034981,000152: 31,2366           60025                           AD       TIME1                                 
034982,000153: 31,2367           62004                           AD       THROTLAG                              #  COMPENSATE FOR ENGINE RESPONSE LAG
034983,000154: 31,2370           74357                           MASK     LOW8                                  #  MAKE SURE SMALL AND POSITIVE
034984,000155: 31,2371           22007                           ZL                                             
034985,000156: 31,2372           00006                           EXTEND                                         
034986,000157: 31,2373           10002                           DV       Q                                     
034987,000158: 31,2374           00006                           EXTEND                                         
034988,000159: 31,2375           71610                           MP       PIF                                   
034989,000160: 31,2376           60000                           DOUBLE                                         
034990,000161: 31,2377           53607                           DXCH     FWEIGHT                               
034991,000162: 31,2400           37715                           CA       2.PG.FRT                              
034992,000163: 31,2401           54002                           TS       Q                                     

Page 800

034994,000165: 31,2402           11610                           CCS      PIF                                   
034995,000166: 31,2403           64753                           AD       ONE                                   
034996,000167: 31,2404           12406                           TCF      +2                                    
034997,000168: 31,2405           64753                           AD       ONE                                   
034998,000169: 31,2406           00006                           EXTEND                                         
034999,000170: 31,2407           71610                           MP       PIF                                   
035000,000171: 31,2410           00006                           EXTEND                                         
035001,000172: 31,2411           10002                           DV       Q                                     
035002,000173: 31,2412           22007                           ZL                                             
035003,000174: 31,2413           21607                           DAS      FWEIGHT                               
035004,000175: 
035005,000176: 31,2414           01605        THDUMP             TC       RTNHOLD                               
035006,000177: 
035007,000178:                                                                                                  #  FLATOUT THROTTLES UP THE DESCENT ENGINE, AND IS CALLED AS A BASIC SUBROUTINE.
035008,000179: 
035009,000180: 31,2415           34737        FLATOUT            CAF      BIT13                                 #  4096 PULSES
035010,000181: 31,2416           55604        WHATOUT            TS       PIFPSET                               #  USE PIFPSET SO FWEIGHT WILL BE ZERO
035011,000182: 31,2417           44755                           CS       ZERO                                  
035012,000183: 31,2420           55616                           TS       FCOLD                                 
035013,000184: 31,2421           55610                           TS       PIF                                   
035014,000185: 31,2422           00006                           EXTEND                                         
035015,000186: 31,2423           23605                           QXCH     RTNHOLD                               
035016,000187: 31,2424           12352                           TCF      DOIT                                  
035017,000188: 
035018,000189:                                                                                                  #  MASSMULT SCALES ACCELERATION, ARRIVING IN A AND L IN UNITS OF 2(-4) M/CS/CS, TO FORCE IN PULSE UNITS.
035019,000190: 
035020,000191: 31,2425           00006        MASSMULT           EXTEND                                         
035021,000192: 31,2426           22130                           QXCH     BUF                                   
035022,000193: 31,2427           00006                           EXTEND                                         
035023,000194: 31,2430           71244                           MP       MASS                                  #  LEAVES ODDLY SCALED FORCE IN A AND L
035024,000195: 31,2431           52155                           DXCH     MPAC                                  
035025,000196: 31,2432           07102                           TC       DMP                                   #  LEAVES PROPERLY SCALED FORCE IM MPAC
035026,000197: 31,2433           02005                           ADRES    SCALEFAC                              
035027,000198: 31,2434           07256                           TC       TPAGREE                               
035028,000199: 31,2435           30154                           CA       MPAC                                  
035029,000200: 31,2436           00006                           EXTEND                                         
035030,000201: 31,2437           12442                           BZF      +3                                    
035031,000202: 31,2440           34733                           CAF      POSMAX                                
035032,000203: 31,2441           00130                           TC       BUF                                   
035033,000204: 31,2442           52156                           DXCH     MPAC       +1                         
035034,000205: 31,2443           00130                           TC       BUF                                   
035035,000206: 
035036,000207:                                                                                                  #  CONSTANTS:-
035037,000208: 
035038,000209: 31,2444     4737               FEXTRA             =        BIT13                                 

Page 801

035040,000211: 31,2444     7715               2.PG.FRT           =        PRIO31                                #  DECIMAL 12800
035041,000212: 31,2444           04143        /AF/CNST           DEC      .13107                                
035042,000213: 
035043,000214:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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