Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

034642,000002:                                                                                                  ## Copyright:   Public domain.
034643,000003:                                                                                                  ## Filename:    THROTTLE_CONTROL_ROUTINES.agc
034644,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
034645,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
034646,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
034647,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
034648,000008:                                                                                                  ##              that the code format has been changed to conform to the
034649,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
034650,000010:                                                                                                  ##              original YUL assembler.
034651,000011:                                                                                                  ## Reference:   pp. 789-793
034652,000012:                                                                                                  ## Assembler:   yaYUL
034653,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
034654,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
034655,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
034656,000016:                                                                                                  ##              2016-12-01 RSB  Completed transcription
034657,000017:                                                                                                  ##              2016-12-10 HG   fix operator DXCH  -> XCH
034658,000018:                                                                                                  ##                                           DOUBLE -> DDOUBL
034659,000019:                                                                                                  ##              2016-12-25 RSB  Comment-text proofed using ProoferComments
034660,000020:                                                                                                  ##                              and corrected errors found.
034661,000021: 

Page 789

034663,000023: 31,2144                                           BANK     31                                    
034664,000024: 
034665,000025: 31,2000                                           SETLOC   FTHROT                                
034666,000026: 
034667,000027: 31,2000                                           BANK                                           
034668,000028: 
034669,000029: 31,2144  E7,1612                                  EBANK=   PIF                                   
034670,000030: 
034671,000031: 31,2144                                           COUNT*   $$/THROT                              
034672,000032:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
034673,000033:                                                                                                  #  HERE FC, DESIRED THRUST, AND FP, PRESENT THRUST, UNWEIGHTED, ARE COMPUTED.
034674,000034: 
034675,000035: 31,2144           31245        THROTTLE           CA       ABDELV                                #  COMPUTE PRESENT ACCELERATION IN UNITS OF
034676,000036: 31,2145           00006                           EXTEND                                         #   2(-4) M/CS/CS, SAVING SERVICER TROUBLE
034677,000037: 31,2146           72363                           MP       /AF/CNST                              
034678,000038: 31,2147           00006                 +3        EXTEND                                         
034679,000039: 31,2150           23607                           QXCH     RTNHOLD                               
034680,000040: 31,2151           02344        AFDUMP             TC       MASSMULT                              
034681,000041: 31,2152           53470                           DXCH     FP                                    #  FP = PRESENT THRUST
034682,000042: 31,2153           00006                           EXTEND                                         
034683,000043: 31,2154           31464                           DCA      /AFC/                                 
034684,000044: 31,2155           02344                           TC       MASSMULT                              
034685,000045: 31,2156           00004                           INHINT                                         #  PREVENT A DOWNRUPT
034686,000046: 31,2157           55615                           TS       FC                                    #  FC = THRUST DESIRED BY GUIDANCE
034687,000047: 31,2160           53466                           DXCH     FCODD                                 #  FCODD = WHAT IT IS GOING TO GET
034688,000048: 
034689,000049: 
034690,000050: 31,2161           00006                           EXTEND                                         
034691,000051: 31,2162           31234                           DCA      PIPTIME                               
034692,000052: 31,2163           53753                           DXCH     GTCTIME                               #  DOWNLINK TIME AGREEMENT
034693,000053: 31,2164           00003                           RELINT                                         
034694,000054: 
034695,000055:                                                                                                  #  COMPUTE DESIRED THRUST FOR DISPLAY AS A PERCENTAGE OF 10,500 POUNDS
034696,000056: 
034697,000057: 31,2165           32365                           CAF      4FMAXNOM                              #  MOVE 4FMAXNOM TO ERASABLE FOR DV BELOW
034698,000058: 31,2166           54002                           TS       Q                                     
034699,000059: 31,2167           31615                           CA       FC                                    
034700,000060: 31,2170           72364                           MASK     OCT17777                              #  FOR SAFETY
034701,000061: 31,2171           00006                           EXTEND                                         
034702,000062: 31,2172           10002                           DV       Q                                     
034703,000063: 31,2173           00006                           EXTEND                                         
034704,000064: 31,2174           74774                           MP       4SECS                                 
034705,000065: 31,2175           55750                           TS       THRDISP                               #  FOR DISPLAY IN  N92
034706,000066: 
034707,000067:                                                                                                  #  IF IT HAS BEEN LESS THAN 3 SECONDS SINCE THE LAST THROTTLING, AUGMENT FP USING THE FWEIGHT CALCULATED THEN.
034708,000068: 
034709,000069: 31,2176           41617                           CS       TTHROT                                #  THIS CODING ASSUMES A FLATOUT WITHIN

Page 790

034711,000071: 31,2177           60025                           AD       TIME1                                 #    80 SECONDS BEFORE FIRST THROTTLE CALL
034712,000072: 31,2200           74724                           MASK     POSMAX                                
034713,000073: 31,2201           40000                           COM                                            
034714,000074: 31,2202           64773                           AD       3SECS                                 
034715,000075: 31,2203           00006                           EXTEND                                         
034716,000076: 31,2204           62210                           BZMF     WHERETO                               #  BRANCH IF (TIME1-TTHROT +1) > 3 SECONDS
034717,000077: 31,2205           00006                           EXTEND                                         
034718,000078: 31,2206           31611                           DCA      FWEIGHT                               
034719,000079: 31,2207           21470                           DAS      FP                                    
034720,000080: 
034721,000081: 
034722,000082:                                                                                                  #      THIS LOGIC DETERMINES THE THROTTLING IN THE REGION 10% - 94%.   THE MANUAL THROTTLE, NOMINALLY SET AT
034723,000083:                                                                                                  #  MINIMUM BY ASTRONAUT OR MISSION CONTROL PROGRAMS, PROVIDES THE LOWER BOUND.   A STOP IN THE THROTTLE HARDWARE
034724,000084:                                                                                                  #  PROVIDES THE UPPER.
034725,000085: 
034726,000086: 31,2210           35005        WHERETO            CA       EBANK5                                #  INITIALIZE L*WCR*T AND H*GHCR*T FROM
034727,000087: 31,2211           54003                           TS       EBANK                                 #   PAD LOADED ERASABLES IN W-MATRIX
034728,000088: 31,2212  E5,1472                                  EBANK=   LOWCRIT                               
034729,000089: 31,2212           00006                           EXTEND                                         
034730,000090: 31,2213           31473                           DCA      LOWCRIT                               
034731,000091: 31,2214           52131                           DXCH     L*WCR*T                               
034732,000092: 31,2215           35007                           CA       EBANK7                                
034733,000093: 31,2216           54003                           TS       EBANK                                 
034734,000094: 31,2217  E7,1612                                  EBANK=   PIF                                   
034735,000095: 31,2217           44746                           CS       ZERO                                  #  INITIALIZE PIFPSET
034736,000096: 31,2220           55606                           TS       PIFPSET                               
034737,000097: 31,2221           40131                           CS       H*GHCR*T                              
034738,000098: 31,2222           61620                           AD       FCOLD                                 
034739,000099: 31,2223           00006                           EXTEND                                         
034740,000100: 31,2224           62236                           BZMF     LOWFCOLD                              #  BRANCH IF FCOLD < OR = HIGHCRIT
034741,000101: 31,2225           40130                           CS       L*WCR*T                               
034742,000102: 31,2226           61465                           AD       FCODD                                 
034743,000103: 31,2227           00006                           EXTEND                                         
034744,000104: 31,2230           62233                           BZMF     FCOMPSET                              #  BRANCH IF FC < OR = LOWCRIT
034745,000105: 31,2231           31467                           CA       FP                                    #  SEE NOTE 1
034746,000106: 31,2232           12243                           TCF      FLATOUT1                              
034747,000107: 
034748,000108: 31,2233           42002        FCOMPSET           CS       FMAXODD                               #  SEE NOTE 2
034749,000109: 31,2234           61467                           AD       FP                                    
034750,000110: 31,2235           12245                           TCF      FLATOUT2                              
034751,000111: 
034752,000112: 31,2236           40131        LOWFCOLD           CS       H*GHCR*T                              
034753,000113: 31,2237           61465                           AD       FCODD                                 
034754,000114: 31,2240           00006                           EXTEND                                         
034755,000115: 31,2241           62246                           BZMF     DOPIF                                 #  BRANCH IF FC < OR = HIGHCRIT
034756,000116: 
034757,000117: 31,2242           32003                           CA       FMAXPOS                               #  NO:   THROTTLE-UP
034758,000118: 31,2243           57465        FLATOUT1           XCH      FCODD                                 
034759,000119: 31,2244           34730                           CA       FEXTRA                                

Page 791

034761,000121: 31,2245           55606        FLATOUT2           TS       PIFPSET                               
034762,000122: 
034763,000123:                                                                                                  #  NOTE 1   FC IS SET EQUAL TO FP SO PIF WILL BE ZERO.   THIS IS DESIRABLE
034764,000124:                                                                                                  #           AS THERE IS ACTUALLY NO THROTTLE CHANGE.
034765,000125: 
034766,000126:                                                                                                  #  NOTE 2   HERE, SINCE WE ARE ABOUT TO RETURN TO THE THROTTLEABLE REGION
034767,000127:                                                                                                  #           (BELOW 55%) THE QUANTITY -(FMAXODD - FP) IS COMPUTED AND PUT
034768,000128:                                                                                                  #           INTO PIFPSET TO COMPENSATE FOR THE DIFFERENCE BETWEEN THE
034769,000129:                                                                                                  #           NUMBER OF BITS CORRESPONDING TO FULL THROTTLE (FMAXODD) AND THE
034770,000130:                                                                                                  #           NUMBER CORRESPONDING TO ACTUAL THRUST (FP).   THUS THE TOTAL
034771,000131:                                                                                                  #           THROTTLE COMMAND PIF = FC - FP -(FMAXODD - FP) = FC - FMAXODD.
034772,000132: 
034773,000133: 31,2246           03751        DOPIF              TC       FASTCHNG                              
034774,000134: 31,2247           00006                           EXTEND                                         
034775,000135: 31,2250           31466                           DCA      FCODD                                 
034776,000136: 31,2251           55620                           TS       FCOLD                                 
034777,000137: 31,2252           53613                           DXCH     PIF                                   
034778,000138: 31,2253           00006                           EXTEND                                         
034779,000139: 31,2254           41470                           DCS      FP                                    
034780,000140: 31,2255           21613                           DAS      PIF                                   #  PIF = FC - FP, NEVER EQUALS +0
034781,000141: 
034782,000142: 
034783,000143: 31,2256           31612        DOIT               CA       PIF                                   
034784,000144: 31,2257           61606                           AD       PIFPSET                               #  ADD IN PIFPSET, WITHOUT CHANGING PIF
034785,000145: 31,2260           55614                           TS       PSEUDO55                              
034786,000146: 31,2261           54055                           TS       THRUST                                
034787,000147: 31,2262           34741                           CAF      BIT4                                  
034788,000148: 31,2263           00006                           EXTEND                                         
034789,000149: 31,2264           05014                           WOR      CHAN14                                
034790,000150: 31,2265           30025                           CA       TIME1                                 
034791,000151: 31,2266           55617                           TS       TTHROT                                
034792,000152: 
034793,000153:                                                                                                  #      SINCE /AF/ IS NOT AN INSTANTANEOUS ACCELERATION, BUT RATHER AN "AVERAGE" OF THE ACCELERATION LEVELS DURING
034794,000154:                                                                                                  #  THE PRECEEDING PIPA INTERVAL, AND SINCE FP IS COMPUTED DIRECTLY FROM /AF/, FP IN ORDER TO CORRESPOND TO THE
034795,000155:                                                                                                  #  ACTUAL THRUST LEVEL AT THE END OF THE INTERVAL MUST BE WEIGHTED BY
034796,000156: 
034797,000157:                                                                                                  #                                    PIF(PPROCESS + TL)     PIF /PIF/
034798,000158:                                                                                                  #                          FWEIGHT = ------------------ + -------------
034799,000159:                                                                                                  #                                          PGUID          2 PGUID FRATE
034800,000160: 
034801,000161:                                                                                                  #  WHERE PPROCESS IS THE TIME BETWEEN PIPA READING AND THE START OF THROTTLING, PGUID IS THE GUIDANCE PERIOD, AND
034802,000162:                                                                                                  #  FRATE IS THE THROTTLING RATE (32 UNITS PER CENTISECOND).  PGUID IS EITHER 1 OR 2 SECONDS. THE "TL" IN THE
034803,000163:                                                                                                  #  FIRST TERM REPRESENTS THE ENGINE'S RESPONSE LAG.   HERE FWEIGHT IS COMPUTED FOR USE NEXT PASS.
034804,000164: 
034805,000165: 31,2267           31762                           CA       THISTPIP   +1                         #  INITIALIZE FWEIGHT COMP AS IF FOR P66
034806,000166: 31,2270           54130                           TS       BUF                                   
034807,000167: 
034808,000168: 31,2271           41010                           CS       MODREG                                #  ARE WE IN FACT IN P66?
034809,000169: 31,2272           62454                           AD       DEC66                                 
034810,000170: 31,2273           00006                           EXTEND                                         

Page 792

034812,000172: 31,2274           12301                           BZF      FWCOMP                                #  YES
034813,000173: 
034814,000174: 31,2275           31234                           CA       PIPTIME    +1                         #  NO:   INITIALIZE FOR TWO SECOND PERIOD
034815,000175: 31,2276           54130                           TS       BUF                                   
034816,000176: 31,2277           34774                           CAF      4SECS                                 
034817,000177: 31,2300           12302                           TCF      FWCOMP     +1                         
034818,000178: 
034819,000179: 31,2301           34771        FWCOMP             CAF      2SECS                                 
034820,000180: 31,2302           54002                 +1        TS       Q                                     
034821,000181: 31,2303           00006                           EXTEND                                         
034822,000182: 31,2304           74737                           MP       BIT6                                  
034823,000183: 31,2305           22131                           LXCH     BUF        +1                         
034824,000184: 31,2306           40130                           CS       BUF                                   #  TIME OF LAST PIPA READING.
034825,000185: 31,2307           60025                           AD       TIME1                                 
034826,000186: 31,2310           62004                           AD       THROTLAG                              #  COMPENSATE FOR ENGINE RESPONSE LAG
034827,000187: 31,2311           74350                           MASK     LOW8                                  #  MAKE SURE SMALL AND POSITIVE
034828,000188: 31,2312           22007                           ZL                                             
034829,000189: 31,2313           00006                           EXTEND                                         
034830,000190: 31,2314           10002                           DV       Q                                     
034831,000191: 31,2315           00006                           EXTEND                                         
034832,000192: 31,2316           71612                           MP       PIF                                   
034833,000193: 31,2317           20001                           DDOUBL                                         
034834,000194: 31,2320           53611                           DXCH     FWEIGHT                               
034835,000195: 31,2321           11612                           CCS      PIF                                   
034836,000196: 31,2322           64744                           AD       ONE                                   
034837,000197: 31,2323           12325                           TCF      +2                                    
034838,000198: 31,2324           64744                           AD       ONE                                   
034839,000199: 31,2325           00006                           EXTEND                                         
034840,000200: 31,2326           71612                           MP       PIF                                   
034841,000201: 31,2327           00006                           EXTEND                                         
034842,000202: 31,2330           10131                           DV       BUF        +1                         
034843,000203: 31,2331           22007                           ZL                                             
034844,000204: 31,2332           21611                           DAS      FWEIGHT                               
034845,000205: 
034846,000206: 
034847,000207: 31,2333           01607        THDUMP             TC       RTNHOLD                               
034848,000208: 
034849,000209: 
034850,000210:                                                                                                  #  FLATOUT THROTTLES UP THE DESCENT ENGINE, AND IS CALLED AS A BASIC SUBROUTINE.
034851,000211: 
034852,000212: 31,2334           34730        FLATOUT            CAF      BIT13                                 #  4096 PULSES
034853,000213: 31,2335           55606        WHATOUT            TS       PIFPSET                               #  USE PIFPSET SO FWEIGHT WILL BE ZERO
034854,000214: 31,2336           44746                           CS       ZERO                                  
034855,000215: 31,2337           55620                           TS       FCOLD                                 
034856,000216: 31,2340           55612                           TS       PIF                                   
034857,000217: 31,2341           00006                           EXTEND                                         
034858,000218: 31,2342           23607                           QXCH     RTNHOLD                               
034859,000219: 31,2343           12256                           TCF      DOIT                                  
034860,000220: 

Page 793

034862,000222:                                                                                                  #  MASSMULT SCALES ACCELERATION, ARRIVING IN A AND L IN UNITS OF 2(-4) M/CS/CS, TO FORCE IN PULSE UNITS.
034863,000223: 
034864,000224: 31,2344           00006        MASSMULT           EXTEND                                         
034865,000225: 31,2345           22130                           QXCH     BUF                                   
034866,000226: 31,2346           52155                           DXCH     MPAC                                  
034867,000227: 31,2347           07124                           TC       DMP                                   
034868,000228: 31,2350           01243                           ADRES    MASS                                  
034869,000229: 31,2351           07124                           TC       DMP                                   #  LEAVES PROPERLY SCALED FORCE IM MPAC
034870,000230: 31,2352           02005                           ADRES    SCALEFAC                              
034871,000231: 31,2353           07300                           TC       TPAGREE                               
034872,000232: 31,2354           30154                           CA       MPAC                                  
034873,000233: 31,2355           00006                           EXTEND                                         
034874,000234: 31,2356           12361                           BZF      +3                                    
034875,000235: 31,2357           34724                           CAF      POSMAX                                
034876,000236: 31,2360           00130                           TC       BUF                                   
034877,000237: 31,2361           52156                           DXCH     MPAC       +1                         
034878,000238: 31,2362           00130                           TC       BUF                                   
034879,000239: 
034880,000240: 
034881,000241:                                                                                                  #  CONSTANTS:-
034882,000242: 
034883,000243: 31,2363     4730               FEXTRA             =        BIT13                                 #         FEXT +5.13309020 E+4
034884,000244: 
034885,000245: 31,2363           04143        /AF/CNST           DEC      .13107                                
034886,000246: 
034887,000247: 31,2364           17777        OCT17777           OCT      17777                                 
034888,000248: 31,2365           35074        4FMAXNOM           DEC      14908      B-14                       #  EQUIVALENT TO 10,500 LBS.
034889,000249:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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