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.

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

Page 789

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

Page 790

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

Page 791

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

Page 792

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

Page 793

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

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