Source Code

These source-code files derive from a printout of Luminary 116 (the Apollo 12 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Ron Burkey, 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 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071
	19:09 AUG. 11,1969
Note that the date is the date of the printout, not the date of the program revision.

033596,000002:                                                                                                  ## Copyright:   Public domain.
033597,000003:                                                                                                  ## Filename:    THROTTLE_CONTROL_ROUTINES.agc
033598,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
033599,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
033600,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
033601,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
033602,000008:                                                                                                  ##              that the code format has been changed to conform to the
033603,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
033604,000010:                                                                                                  ##              original YUL assembler.
033605,000011:                                                                                                  ## Reference:   pp. 786-790
033606,000012:                                                                                                  ## Assembler:   yaYUL
033607,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033608,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033609,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
033610,000016:                                                                                                  ##              2017-03-01 HG   Transcribed
033611,000017:                                                                                                  ##              2017-03-14 RSB  Proofed comment text via 3-way diff vs
033612,000018:                                                                                                  ##                              Luminary 99 and 131. No problems were found,
033613,000019:                                                                                                  ##                              but a ##-comment that wouldn't have been 
033614,000020:                                                                                                  ##                              displayed properly was fixed.
033615,000021:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 5-way
033616,000022:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
033617,000023: 

Page 786

033619,000025: 31,2144                                           BANK     31                                    
033620,000026: 
033621,000027: 31,2000                                           SETLOC   FTHROT                                
033622,000028: 
033623,000029: 31,2000                                           BANK                                           
033624,000030: 
033625,000031: 31,2144  E7,1612                                  EBANK=   PIF                                   
033626,000032: 
033627,000033: 31,2144                                           COUNT*   $$/THROT                              
033628,000034:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
033629,000035: 
033630,000036:                                                                                                  #      HERE FC, DESIRED THRUST, AND FP, PRESENT THRUST, UNWEIGHTED, ARE COMPUTED.
033631,000037: 
033632,000038: 
033633,000039: 31,2144           31245        THROTTLE           CA       ABDELV                                #  COMPUTE PRESENT ACCELERATION IN UNITS OF
033634,000040: 31,2145           00006                           EXTEND                                         #    2(-4) M/CS/CS, SAVING SERVICER TROUBLE
033635,000041: 31,2146           72345                           MP       /AF/CNST                              
033636,000042: 31,2147           00006                 +3        EXTEND                                         
033637,000043: 31,2150           23607                           QXCH     RTNHOLD                               
033638,000044: 31,2151           02326        AFDUMP             TC       MASSMULT                              
033639,000045: 31,2152           53470                           DXCH     FP                                    #  FP = PRESENT THRUST
033640,000046: 31,2153           00006                           EXTEND                                         
033641,000047: 31,2154           31464                           DCA      /AFC/                                 
033642,000048: 31,2155           02326                           TC       MASSMULT                              
033643,000049: 31,2156           55615                           TS       FC                                    #  FC = THRUST DESIRED BY GUIDANCE
033644,000050: 31,2157           53466                           DXCH     FCODD                                 #  FCODD = WHAT IT IS GOING TO GET
033645,000051: 
033646,000052: 
033647,000053:                                                                                                  #      IF IT HAS BEEN LESS THAN 3 SECONDS SINCE THE LAST THROTTLING, AUGMENT FP USING THE FWEIGHT CALCULATED THEN.
033648,000054: 
033649,000055: 
033650,000056: 31,2160           41617                           CS       TTHROT                                #  THIS CODING ASSUMES A FLATOUT WITHIN
033651,000057: 31,2161           60025                           AD       TIME1                                 #    80 SECONDS BEFORE FIRST THROTTLE CALL
033652,000058: 31,2162           74733                           MASK     POSMAX                                
033653,000059: 31,2163           40000                           COM                                            
033654,000060: 31,2164           65002                           AD       3SECS                                 
033655,000061: 31,2165           00006                           EXTEND                                         
033656,000062: 31,2166           62172                           BZMF     WHERETO                               #  BRANCH IF (TIME1-TTHROT +1) > 3 SECONDS
033657,000063: 31,2167           00006                           EXTEND                                         
033658,000064: 31,2170           31611                           DCA      FWEIGHT                               
033659,000065: 31,2171           21470                           DAS      FP                                    
033660,000066: 
033661,000067: 
033662,000068:                                                                                                  #      THIS LOGIC DETERMINES THE THROTTLING IN THE REGION 10% - 94%.   THE MANUAL THROTTLE, NOMINALLY SET AT
033663,000069:                                                                                                  #  MINIMUM BY ASTRONAUT OR MISSION CONTROL PROGRAMS, PROVIDES THE LOWER BOUND.   A STOP IN THE THROTTLE HARDWARE
033664,000070:                                                                                                  #  PROVIDES THE UPPER.
033665,000071: 
033666,000072: 
033667,000073: 31,2172           35014        WHERETO            CA       EBANK5                                #  INITIALIZE L*WCR*T AND H*GHCR*T FROM
033668,000074: 31,2173           54003                           TS       EBANK                                 #    PAD LOADED ERASABLES IN W-MATRIX
033669,000075: 

Page 787

033671,000077: 31,2174  E5,1506                                  EBANK=   LOWCRIT                               
033672,000078: 31,2174           00006                           EXTEND                                         
033673,000079: 31,2175           31507                           DCA      LOWCRIT                               
033674,000080: 31,2176           52131                           DXCH     L*WCR*T                               
033675,000081: 31,2177           35016                           CA       EBANK7                                
033676,000082: 31,2200           54003                           TS       EBANK                                 
033677,000083: 31,2201  E7,1612                                  EBANK=   PIF                                   
033678,000084: 31,2201           44755                           CS       ZERO                                  #  INITIALIZE PIFPSET
033679,000085: 31,2202           55606                           TS       PIFPSET                               
033680,000086: 31,2203           40131                           CS       H*GHCR*T                              
033681,000087: 31,2204           61620                           AD       FCOLD                                 
033682,000088: 31,2205           00006                           EXTEND                                         
033683,000089: 31,2206           62220                           BZMF     LOWFCOLD                              #  BRANCH IF FCOLD < OR = HIGHCRIT
033684,000090: 31,2207           40130                           CS       L*WCR*T                               
033685,000091: 31,2210           61465                           AD       FCODD                                 
033686,000092: 31,2211           00006                           EXTEND                                         
033687,000093: 31,2212           62215                           BZMF     FCOMPSET                              #  BRANCH IF FC < OR = LOWCRIT
033688,000094: 31,2213           31467                           CA       FP                                    #  SEE NOTE 1
033689,000095: 31,2214           12225                           TCF      FLATOUT1                              
033690,000096: 
033691,000097: 31,2215           42002        FCOMPSET           CS       FMAXODD                               #  SEE NOTE 2
033692,000098: 31,2216           61467                           AD       FP                                    
033693,000099: 31,2217           12227                           TCF      FLATOUT2                              
033694,000100: 
033695,000101: 31,2220           40131        LOWFCOLD           CS       H*GHCR*T                              
033696,000102: 31,2221           61465                           AD       FCODD                                 
033697,000103: 31,2222           00006                           EXTEND                                         
033698,000104: 31,2223           62230                           BZMF     DOPIF                                 #  BRANCH IF FC < OR = HIGHCRIT
033699,000105: 
033700,000106: 31,2224           32003                           CA       FMAXPOS                               #  NO:   THROTTLE-UP
033701,000107: 31,2225           53466        FLATOUT1           DXCH     FCODD                                 
033702,000108: 31,2226           34737                           CA       FEXTRA                                
033703,000109: 31,2227           55606        FLATOUT2           TS       PIFPSET                               
033704,000110: 
033705,000111:                                                                                                  #  NOTE 1   FC IS SET EQUAL TO FP SO PIF WILL BE ZERO.   THIS IS DESIRABLE
033706,000112:                                                                                                  #           AS THERE IS ACTUALLY NO THROTTLE CHANGE.
033707,000113: 
033708,000114:                                                                                                  #  NOTE2    HERE, SINCE WE ARE ABOUT TO RETURN TO THE THROTTLEABLE REGION
033709,000115:                                                                                                  #           (BELOW 55%) THE QUANTITY -(FMAXODD - FP) IS COMPUTED AND PUT
033710,000116:                                                                                                  #           INTO PIFPSET TO COMPENSATE FOR THE DIFFERENCE BETWEEN THE
033711,000117:                                                                                                  #           NUMBER OF BITS CORRESPONDING TO FULL THROTTLE (FMAXODD) AND THE
033712,000118:                                                                                                  #           NUMBER CORRESPONDING TO ACTUAL THRUST (FP).   THUS THE TOTAL
033713,000119:                                                                                                  #           THROTTLE COMMAND PIF = FC - FP - (FMAXODD - FP) = FC - FMAXODD.
033714,000120: 
033715,000121: 31,2230           03717        DOPIF              TC       FASTCHNG                              
033716,000122: 31,2231           00006                           EXTEND                                         
033717,000123: 31,2232           31466                           DCA      FCODD                                 
033718,000124: 31,2233           55620                           TS       FCOLD                                 
033719,000125: 31,2234           53613                           DXCH     PIF                                   
033720,000126: 31,2235           00006                           EXTEND                                         
033721,000127: 

Page 788

033723,000129: 31,2236           41470                           DCS      FP                                    
033724,000130: 31,2237           21613                           DAS      PIF                                   #  PIF = FC - FP, NEVER EQUALS +0
033725,000131: 
033726,000132: 
033727,000133: 31,2240           31612        DOIT               CA       PIF                                   
033728,000134: 31,2241           61606                           AD       PIFPSET                               #  ADD IN PIFPSET, WITHOUT CHANGING PIF
033729,000135: 31,2242           55614                           TS       PSEUDO55                              

Note: The above statement has a blue check mark right after the operand

033731,000137: 31,2243           54055                           TS       THRUST                                
033732,000138: 31,2244           34750                           CAF      BIT4                                  
033733,000139: 31,2245           00006                           EXTEND                                         
033734,000140: 31,2246           05014                           WOR      CHAN14                                
033735,000141: 31,2247           30025                           CA       TIME1                                 
033736,000142: 31,2250           55617                           TS       TTHROT                                

Note: Three statements above are marked with a single light vertical pen mark to the right of the operands

033738,000144: 
033739,000145:                                                                                                  #      SINCE /AF/ IS NOT AN INSTANTANEOUS ACCELERATION, BUT RATHER AN "AVERAGE" OF THE ACCELERATION LEVELS DURING
033740,000146:                                                                                                  #  THE PRECEEDING PIPA INTERVAL, AND SINCE FP IS COMPUTED DIRECTLY FROM /AF/, FP IN ORDER TO CORRESPOND TO THE
033741,000147:                                                                                                  #  ACTUAL THRUST LEVEL AT THE END OF THE INTERVAL MUST BE WEIGHTED BY
033742,000148: 
033743,000149:                                                                                                  #                                    PIF(PPROCESS + TL)     PIF /PIF/
033744,000150:                                                                                                  #                          FWEIGHT = ------------------ + -------------
033745,000151:                                                                                                  #                                          PGUID          2 PGUID FRATE
033746,000152: 
033747,000153:                                                                                                  #  WHERE PPROCESS IS THE TIME BETWEEN PIPA READING AND THE START OF THROTTLING, PGUID IS THE GUIDANCE PERIOD, AND
033748,000154:                                                                                                  #  FRATE IS THE THROTTLING RATE (32 UNITS PER CENTISECOND).  PGUID IS EITHER 1 OR 2 SECONDS. THE "TL" IN THE
033749,000155:                                                                                                  #  FIRST TERM REPRESENTS THE ENGINE'S RESPONSE LAG.   HERE FWEIGHT IS COMPUTED FOR USE NEXT PASS.
033750,000156: 
033751,000157: 31,2251           31762                           CA       THISTPIP   +1                         #  INITIALIZE FWEIGHT COMP AS IF FOR P66

Note: the complete comment for the above statement has a box drawn arround it using a blue pen.

033753,000159: 31,2252           54130                           TS       BUF                                   
033754,000160: 
033755,000161: 31,2253           41010                           CS       MODREG                                #  ARE WE IN FACT IN P66?
033756,000162: 31,2254           62433                           AD       DEC66                                 
033757,000163: 31,2255           00006                           EXTEND                                         
033758,000164: 31,2256           12263                           BZF      FWCOMP                                #  YES
033759,000165: 
033760,000166: 31,2257           31234                           CA       PIPTIME    +1                         #  NO:   INITIALIZE FOR TWO SECOND PERIOD
033761,000167: 31,2260           54130                           TS       BUF                                   
033762,000168: 31,2261           35003                           CAF      4SECS                                 
033763,000169: 31,2262           12264                           TCF      FWCOMP     +1                         
033764,000170: 
033765,000171: 31,2263           35000        FWCOMP             CAF      2SECS                                 
033766,000172: 31,2264           54002                 +1        TS       Q                                     
033767,000173: 31,2265           00006                           EXTEND                                         
033768,000174: 31,2266           74746                           MP       BIT6                                  
033769,000175: 31,2267           22131                           LXCH     BUF        +1                         
033770,000176: 31,2270           40130                           CS       BUF                                   #  TIME OF LAST PIPA READING.
033771,000177: 31,2271           60025                           AD       TIME1                                 
033772,000178: 31,2272           62004                           AD       THROTLAG                              #  COMPENSATE FOR ENGINE RESPONSE LAG
033773,000179: 31,2273           74357                           MASK     LOW8                                  #  MAKE SURE SMALL AND POSITIVE
033774,000180: 31,2274           22007                           ZL                                             
033775,000181: 31,2275           00006                           EXTEND                                         
033776,000182: 

Page 789

033778,000184: 31,2276           10002                           DV       Q                                     
033779,000185: 31,2277           00006                           EXTEND                                         
033780,000186: 31,2300           71612                           MP       PIF                                   
033781,000187: 31,2301           60000                           DOUBLE                                         
033782,000188: 31,2302           53611                           DXCH     FWEIGHT                               
033783,000189: 31,2303           11612                           CCS      PIF                                   
033784,000190: 31,2304           64753                           AD       ONE                                   
033785,000191: 31,2305           12307                           TCF      +2                                    
033786,000192: 31,2306           64753                           AD       ONE                                   
033787,000193: 31,2307           00006                           EXTEND                                         
033788,000194: 31,2310           71612                           MP       PIF                                   
033789,000195: 31,2311           00006                           EXTEND                                         
033790,000196: 31,2312           10131                           DV       BUF        +1                         
033791,000197: 31,2313           22007                           ZL                                             
033792,000198: 31,2314           21611                           DAS      FWEIGHT                               
033793,000199: 
033794,000200: 
033795,000201: 31,2315           01607        THDUMP             TC       RTNHOLD                               
033796,000202: 
033797,000203: 
033798,000204:                                                                                                  #      FLATOUT THROTTLES UP THE DESCENT ENGINE, AND IS CALLED AS A BASIC SUBROUTINE.
033799,000205: 
033800,000206: 31,2316           34737        FLATOUT            CAF      BIT13                                 #  4096 PULSES
033801,000207: 31,2317           55606        WHATOUT            TS       PIFPSET                               #  USE PIFPSET SO FWEIGHT WILL BE ZERO
033802,000208: 31,2320           44755                           CS       ZERO                                  
033803,000209: 31,2321           55620                           TS       FCOLD                                 
033804,000210: 31,2322           55612                           TS       PIF                                   
033805,000211: 31,2323           00006                           EXTEND                                         
033806,000212: 31,2324           23607                           QXCH     RTNHOLD                               
033807,000213: 31,2325           12240                           TCF      DOIT                                  
033808,000214: 
033809,000215: 
033810,000216:                                                                                                  #      MASSMULT SCALES ACCELERATION, ARRIVING IN A AND L IN UNITS OF 2(-4) M/CS/CS, TO FORCE IN PULSE UNITS.
033811,000217: 
033812,000218: 31,2326           00006        MASSMULT           EXTEND                                         
033813,000219: 31,2327           22130                           QXCH     BUF                                   
033814,000220: 31,2330           52155                           DXCH     MPAC                                  
033815,000221: 31,2331           07106                           TC       DMP                                   
033816,000222: 31,2332           01243                           ADRES    MASS                                  
033817,000223: 31,2333           07106                           TC       DMP                                   #  LEAVES PROPERLY SCALED FORCE IM MPAC
033818,000224: 31,2334           02005                           ADRES    SCALEFAC                              
033819,000225: 31,2335           07262                           TC       TPAGREE                               
033820,000226: 31,2336           30154                           CA       MPAC                                  
033821,000227: 31,2337           00006                           EXTEND                                         
033822,000228: 31,2340           12343                           BZF      +3                                    
033823,000229: 31,2341           34733                           CAF      POSMAX                                
033824,000230: 31,2342           00130                           TC       BUF                                   
033825,000231: 31,2343           52156                           DXCH     MPAC       +1                         
033826,000232: 31,2344           00130                           TC       BUF                                   

Note: There is a small drawing in blue pen in the comment section of the above statements starting in the line of statement CA MPAC. The drawing resembles a linear step function.

033830,000236:                                                                                                  ##

| | | ----| | / | | / | |----/ | | | | |

033839,000245: 

Page 790

033841,000247:                                                                                                  #      CONSTANTS:-
033842,000248: 
033843,000249: 31,2345     4737               FEXTRA             =        BIT13                                 #  FEXT       +5.13309020E+4
033844,000250: 
033845,000251: 31,2345           04143        /AF/CNST           DEC      .13107                                
033846,000252: 
033847,000253:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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