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.

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

Page 786

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

Page 787

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

Page 788

033732,000129: 31,2236           41470                           DCS      FP                                    
033733,000130: 31,2237           21613                           DAS      PIF                                   #  PIF = FC - FP, NEVER EQUALS +0
033734,000131: 
033735,000132: 
033736,000133: 31,2240           31612        DOIT               CA       PIF                                   
033737,000134: 31,2241           61606                           AD       PIFPSET                               #  ADD IN PIFPSET, WITHOUT CHANGING PIF
033738,000135: 31,2242           55614                           TS       PSEUDO55                              

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

033740,000137: 31,2243           54055                           TS       THRUST                                
033741,000138: 31,2244           34750                           CAF      BIT4                                  
033742,000139: 31,2245           00006                           EXTEND                                         
033743,000140: 31,2246           05014                           WOR      CHAN14                                
033744,000141: 31,2247           30025                           CA       TIME1                                 
033745,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

033747,000144: 
033748,000145:                                                                                                  #      SINCE /AF/ IS NOT AN INSTANTANEOUS ACCELERATION, BUT RATHER AN "AVERAGE" OF THE ACCELERATION LEVELS DURING
033749,000146:                                                                                                  #  THE PRECEEDING PIPA INTERVAL, AND SINCE FP IS COMPUTED DIRECTLY FROM /AF/, FP IN ORDER TO CORRESPOND TO THE
033750,000147:                                                                                                  #  ACTUAL THRUST LEVEL AT THE END OF THE INTERVAL MUST BE WEIGHTED BY
033751,000148: 
033752,000149:                                                                                                  #                                    PIF(PPROCESS + TL)     PIF /PIF/
033753,000150:                                                                                                  #                          FWEIGHT = ------------------ + -------------
033754,000151:                                                                                                  #                                          PGUID          2 PGUID FRATE
033755,000152: 
033756,000153:                                                                                                  #  WHERE PPROCESS IS THE TIME BETWEEN PIPA READING AND THE START OF THROTTLING, PGUID IS THE GUIDANCE PERIOD, AND
033757,000154:                                                                                                  #  FRATE IS THE THROTTLING RATE (32 UNITS PER CENTISECOND).  PGUID IS EITHER 1 OR 2 SECONDS. THE "TL" IN THE
033758,000155:                                                                                                  #  FIRST TERM REPRESENTS THE ENGINE'S RESPONSE LAG.   HERE FWEIGHT IS COMPUTED FOR USE NEXT PASS.
033759,000156: 
033760,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.

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

Page 789

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

033839,000236:                                                                                                  ##

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

033848,000245: 

Page 790

033850,000247:                                                                                                  #      CONSTANTS:-
033851,000248: 
033852,000249: 31,2345     4737               FEXTRA             =        BIT13                                 #  FEXT       +5.13309020E+4
033853,000250: 
033854,000251: 31,2345           04143        /AF/CNST           DEC      .13107                                
033855,000252: 
033856,000253:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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