Source Code

This source code is very close to the Apollo Guidance Computer software for the Apollo 13 Lunar module. This revision of the Luminary 131 program is from December of 1969, whereas there was a later revision in January of 1970, and still another revision in February, which is the code that flew on the mission. As far as this transcription is concerned, it was originally from a copy made in 1991 of a printout from the collection of AGC developer Don Eyles for collector David Craig. It was subsequently scanned by Gary Neff, reprocessed for online presentation at the now-discontinued History of Recent Science and Technology (HRST) website of MIT's Dibner Institute (the full-quality scans being discarded in the process), and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a high-quality replacement scan for a completely illegible page was later provided by Gary Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many errors to be introduced into the transcription. Accordingly, a second scan of the same physical printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive, and used to correct the transcription errors. All of the scanned materials mentioned, as well as other Luminary 131 related material, are available online. Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017, so the two scans are not identical in that respect. The page-headings in the printout read, in part:
	GAP:  ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091
	17:53 DEC. 19, 1969
Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together.

033530,000002:                                                                                                  ## Copyright:   Public domain.
033531,000003:                                                                                                  ## Filename:    THROTTLE_CONTROL_ROUTINES.agc
033532,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
033533,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
033534,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
033535,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
033536,000008:                                                                                                  ##              that the code format has been changed to conform to the
033537,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
033538,000010:                                                                                                  ##              original YUL assembler.
033539,000011:                                                                                                  ## Reference:   pp. 788-792
033540,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033541,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033542,000014:                                                                                                  ## Mod history: 05/24/03 RSB.   Began transcribing.
033543,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
033544,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
033545,000017:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
033546,000018:                                                                                                  ##                              numbers in 1701.pdf.
033547,000019:                                                                                                  ##              2017-02-25 RSB  Proofed comment text using octopus/ProoferComments.
033548,000020:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 5-way
033549,000021:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
033550,000022: 

Page 788

033552,000024: 31,2144                                           BANK     31                                    
033553,000025: 31,2000                                           SETLOC   FTHROT                                
033554,000026: 31,2000                                           BANK                                           
033555,000027: 31,2144  E7,1612                                  EBANK=   PIF                                   
033556,000028: 31,2144                                           COUNT*   $$/THROT                              
033557,000029: 
033558,000030:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
033559,000031:                                                                                                  #  HERE FC, DESIRED THRUST, AND FP, PRESENT THRUST, UNWEIGHTED, ARE COMPUTED.
033560,000032: 
033561,000033: 31,2144           31245        THROTTLE           CA       ABDELV                                #  COMPUTE PRESENT ACCELERATION IN UNITS OF
033562,000034: 31,2145           00006                           EXTEND                                         #  2(-4) M/CS/CS, SAVING SERVICER TROUBLE
033563,000035: 31,2146           72356                           MP       /AF/CNST                              
033564,000036: 31,2147           00006                 +3        EXTEND                                         
033565,000037: 31,2150           23607                           QXCH     RTNHOLD                               
033566,000038: 31,2151           02337        AFDUMP             TC       MASSMULT                              
033567,000039: 31,2152           53470                           DXCH     FP                                    #  FP = PRESENT THRUST
033568,000040: 31,2153           00006                           EXTEND                                         
033569,000041: 31,2154           31464                           DCA      /AFC/                                 
033570,000042: 31,2155           02337                           TC       MASSMULT                              
033571,000043: 31,2156           55615                           TS       FC                                    #  FC = THRUST DESIRED BY GUIDANCE
033572,000044: 31,2157           53466                           DXCH     FCODD                                 #  FCODD = WHAT IT IS GOING TO GET
033573,000045: 
033574,000046:                                                                                                  #  COMPUTE DESIRED THRUST FOR DISPLAY AS A PERCENTAGE OF 10,500 POUNDS
033575,000047: 
033576,000048: 31,2160           32360                           CAF      4FMAXNOM                              #  MOVE 4FMAXNOM TO ERASABLE FOR DV BELOW
033577,000049: 31,2161           54002                           TS       Q                                     
033578,000050: 31,2162           31615                           CA       FC                                    
033579,000051: 31,2163           72357                           MASK     OCT17777                              #  FOR SAFETY
033580,000052: 31,2164           00006                           EXTEND                                         
033581,000053: 31,2165           10002                           DV       Q                                     
033582,000054: 31,2166           00006                           EXTEND                                         
033583,000055: 31,2167           75003                           MP       4SECS                                 
033584,000056: 31,2170           55750                           TS       THRDISP                               #  FOR DISPLAY IN N92
033585,000057: 
033586,000058:                                                                                                  #  IF IT HAS BEEN LESS THAN 3 SECONDS SINCE THE LAST THROTTLING, AUGMENT FP USING THE FWEIGHT CALCULATED THEN.
033587,000059: 
033588,000060: 31,2171           41617                           CS       TTHROT                                #  THIS CODING ASSUMES A FLATOUT WITHIN
033589,000061: 31,2172           60025                           AD       TIME1                                 #        80 SECONDS BEFORE FIRST THROTTLE CALL
033590,000062: 31,2173           74733                           MASK     POSMAX                                
033591,000063: 31,2174           40000                           COM                                            
033592,000064: 31,2175           65002                           AD       3SECS                                 
033593,000065: 31,2176           00006                           EXTEND                                         
033594,000066: 31,2177           62203                           BZMF     WHERETO                               #  BRANCH IF (TIME1-TTHROT +1) > 3 SECONDS

Page 789

033596,000068: 31,2200           00006                           EXTEND                                         
033597,000069: 31,2201           31611                           DCA      FWEIGHT                               
033598,000070: 31,2202           21470                           DAS      FP                                    
033599,000071: 
033600,000072:                                                                                                  #  THIS LOGIC DETERMINES THE THROTTLING IN THE REGION 10% - 94%.  THE MANUAL THROTTLE, NOMINALLY SET AT
033601,000073:                                                                                                  #  MINIMUM BY ASTRONAUT OR MISSION CONTROL PROGRAMS, PROVIDES THE LOWER BOUND.  A STOP IN THE THROTTLE HARDWARE
033602,000074:                                                                                                  #  PROVIDES THE UPPER.
033603,000075: 
033604,000076: 31,2203           35014        WHERETO            CA       EBANK5                                #  INITIALIZE L*WCR*T AND H*GHCR*T FROM
033605,000077: 31,2204           54003                           TS       EBANK                                 #        PAD LOADED ERASABLES IN W-MATRIX
033606,000078: 31,2205  E5,1506                                  EBANK=   LOWCRIT                               
033607,000079: 31,2205           00006                           EXTEND                                         
033608,000080: 31,2206           31507                           DCA      LOWCRIT                               
033609,000081: 31,2207           52131                           DXCH     L*WCR*T                               
033610,000082: 31,2210           35016                           CA       EBANK7                                
033611,000083: 31,2211           54003                           TS       EBANK                                 
033612,000084: 31,2212  E7,1612                                  EBANK=   PIF                                   
033613,000085: 31,2212           44755                           CS       ZERO                                  #  INITIALIZE PIFPSET
033614,000086: 31,2213           55606                           TS       PIFPSET                               
033615,000087: 31,2214           40131                           CS       H*GHCR*T                              
033616,000088: 31,2215           61620                           AD       FCOLD                                 
033617,000089: 31,2216           00006                           EXTEND                                         
033618,000090: 31,2217           62231                           BZMF     LOWFCOLD                              #  BRANCH IF FCOLD < OR = HIGHCRIT
033619,000091: 31,2220           40130                           CS       L*WCR*T                               
033620,000092: 31,2221           61465                           AD       FCODD                                 
033621,000093: 31,2222           00006                           EXTEND                                         
033622,000094: 31,2223           62226                           BZMF     FCOMPSET                              #  BRANCH IF FC < OR = LOWCRIT
033623,000095: 31,2224           31467                           CA       FP                                    #  SEE NOTE 1
033624,000096: 31,2225           12236                           TCF      FLATOUT1                              
033625,000097: 
033626,000098: 31,2226           42002        FCOMPSET           CS       FMAXODD                               #  SEE NOTE 2
033627,000099: 31,2227           61467                           AD       FP                                    
033628,000100: 31,2230           12240                           TCF      FLATOUT2                              
033629,000101: 
033630,000102: 31,2231           40131        LOWFCOLD           CS       H*GHCR*T                              
033631,000103: 31,2232           61465                           AD       FCODD                                 
033632,000104: 31,2233           00006                           EXTEND                                         
033633,000105: 31,2234           62241                           BZMF     DOPIF                                 #  BRANCH IF FC < OR = HIGHCRIT
033634,000106: 
033635,000107: 31,2235           32003                           CA       FMAXPOS                               #  NO:  THROTTLE-UP
033636,000108: 31,2236           53466        FLATOUT1           DXCH     FCODD                                 
033637,000109: 31,2237           34737                           CA       FEXTRA                                
033638,000110: 31,2240           55606        FLATOUT2           TS       PIFPSET                               
033639,000111: 
033640,000112:                                                                                                  #  NOTE 1        FC IS SET EQUAL TO FP SO PIF WILL BE ZERO.  THIS IS DESIRABLE
033641,000113:                                                                                                  #                AS THERE IS ACTUALLY NO THROTTLE CHANGE.
033642,000114: 
033643,000115:                                                                                                  #  NOTE2         HERE, SINCE WE ARE ABOUT TO RETURN TO THE THROTTLEABLE REGION

Page 790

033645,000117:                                                                                                  #                (BELOW 55%) THE QUANTITY -(FMAXODD-FP) IS COMPUTED AND PUT
033646,000118:                                                                                                  #                INTO PIFPSET TO COMPENSATE FOR THE DIFFERENCE BETWEEN THE
033647,000119:                                                                                                  #                NUMBER OF BITS CORRESPONDING TO FULL THROTTLE (FMAXODD) AND THE
033648,000120:                                                                                                  #                NUMBER CORRESPONDING TO ACTUAL THRUST (FP).  THUS THE TOTAL
033649,000121:                                                                                                  #                THROTTLE COMMAND PIF = FC - FP - (FMAXODD - FP) = FC - FMAXODD.
033650,000122: 
033651,000123: 31,2241           03677        DOPIF              TC       FASTCHNG                              
033652,000124: 31,2242           00006                           EXTEND                                         
033653,000125: 31,2243           31466                           DCA      FCODD                                 
033654,000126: 31,2244           55620                           TS       FCOLD                                 
033655,000127: 31,2245           53613                           DXCH     PIF                                   
033656,000128: 31,2246           00006                           EXTEND                                         
033657,000129: 31,2247           41470                           DCS      FP                                    
033658,000130: 31,2250           21613                           DAS      PIF                                   #  PIF = FC - FP, NEVER EQUALS +0
033659,000131: 
033660,000132: 31,2251           31612        DOIT               CA       PIF                                   
033661,000133: 31,2252           61606                           AD       PIFPSET                               #  ADD IN PIFPSET, WITHOUT CHANGING PIF
033662,000134: 31,2253           55614                           TS       PSEUDO55                              
033663,000135: 31,2254           54055                           TS       THRUST                                
033664,000136: 31,2255           34750                           CAF      BIT4                                  
033665,000137: 31,2256           00006                           EXTEND                                         
033666,000138: 31,2257           05014                           WOR      CHAN14                                
033667,000139: 31,2260           30025                           CA       TIME1                                 
033668,000140: 31,2261           55617                           TS       TTHROT                                
033669,000141: 
033670,000142:                                                                                                  #  SINCE /AF/ IS NOT AN INSTANTANEOUS ACCELERATION, BUT RATHER AN "AVERAGE" OF THE ACCELERATION LEVELS DURING
033671,000143:                                                                                                  #  THE PRECEEDING PIPA INTERVAL, AND SINCE FP IS COMPUTED DIRECTLY FROM /AF/, FP IN ORDER TO CORRESPOND TO THE
033672,000144:                                                                                                  #  ACTUAL THRUST LEVEL AT THE END OF THE INTERVAL MUST BE WEIGHTED BY
033673,000145:                                                                                                  #                  PIF(PPROCESS + TL)     PIF /PIF/
033674,000146:                                                                                                  #        FWEIGHT = ------------------ + -------------
033675,000147:                                                                                                  #                       PGUID           2 PGUID FRATE
033676,000148:                                                                                                  #  WHERE PPROCESS IS THE TIME BETWEEN PIPA READING AND THE START OF THROTTLING, PGUID IS THE GUIDANCE PERIOD, AND
033677,000149:                                                                                                  #  FRATE IS THE THROTTLING RATE (32 UNITS PER CENTISECOND).  PGUID IS EITHER 1 OR 2 SECONDS.  THE "TL" IN THE
033678,000150:                                                                                                  #  FIRST TERM REPRESENTS THE ENGINE'S RESPONSE LAG.  HERE FWEIGHT IS COMPUTED FOR USE NEXT PASS.
033679,000151: 
033680,000152: 31,2262           31762                           CA       THISTPIP   +1                         #  INITIALIZE FWEIGHT COMP AS IF FOR P66
033681,000153: 31,2263           54130                           TS       BUF                                   
033682,000154: 
033683,000155: 31,2264           41010                           CS       MODREG                                #  ARE WE IN FACT IN P66?
033684,000156: 31,2265           62452                           AD       DEC66                                 
033685,000157: 31,2266           00006                           EXTEND                                         
033686,000158: 31,2267           12274                           BZF      FWCOMP                                #  YES
033687,000159: 
033688,000160: 31,2270           31234                           CA       PIPTIME    +1                         #  NO:  INITIALIZE FOR TWO SECOND PERIOD
033689,000161: 31,2271           54130                           TS       BUF                                   
033690,000162: 31,2272           35003                           CAF      4SECS                                 
033691,000163: 31,2273           12275                           TCF      FWCOMP     +1                         

Page 791

033693,000165: 
033694,000166: 31,2274           35000        FWCOMP             CAF      2SECS                                 
033695,000167: 31,2275           54002                 +1        TS       Q                                     
033696,000168: 31,2276           00006                           EXTEND                                         
033697,000169: 31,2277           74746                           MP       BIT6                                  
033698,000170: 31,2300           22131                           LXCH     BUF        +1                         
033699,000171: 31,2301           40130                           CS       BUF                                   #  TIME OF LAST PIPA READING.
033700,000172: 31,2302           60025                           AD       TIME1                                 
033701,000173: 31,2303           62004                           AD       THROTLAG                              #  COMPENSATE FOR ENGINE RESPONSE LAG
033702,000174: 31,2304           74357                           MASK     LOW8                                  #  MAKE SURE SMALL AND POSITIVE
033703,000175: 31,2305           22007                           ZL                                             
033704,000176: 31,2306           00006                           EXTEND                                         
033705,000177: 31,2307           10002                           DV       Q                                     
033706,000178: 31,2310           00006                           EXTEND                                         
033707,000179: 31,2311           71612                           MP       PIF                                   
033708,000180: 31,2312           60000                           DOUBLE                                         
033709,000181: 31,2313           53611                           DXCH     FWEIGHT                               
033710,000182: 31,2314           11612                           CCS      PIF                                   
033711,000183: 31,2315           64753                           AD       ONE                                   
033712,000184: 31,2316           12320                           TCF      +2                                    
033713,000185: 31,2317           64753                           AD       ONE                                   
033714,000186: 31,2320           00006                           EXTEND                                         
033715,000187: 31,2321           71612                           MP       PIF                                   
033716,000188: 31,2322           00006                           EXTEND                                         
033717,000189: 31,2323           10131                           DV       BUF        +1                         
033718,000190: 31,2324           22007                           ZL                                             
033719,000191: 31,2325           21611                           DAS      FWEIGHT                               
033720,000192: 
033721,000193: 31,2326           01607        THDUMP             TC       RTNHOLD                               
033722,000194: 
033723,000195:                                                                                                  #  FLATOUT THROTTLES UP THE DESCENT ENGINE, AND IS CALLED AS A BASIC SUBROUTINE.
033724,000196: 
033725,000197: 31,2327           34737        FLATOUT            CAF      BIT13                                 #  4096 PULSES
033726,000198: 31,2330           55606        WHATOUT            TS       PIFPSET                               #  USE PIFPSET SO FWEIGHT WILL BE ZERO
033727,000199: 31,2331           44755                           CS       ZERO                                  
033728,000200: 31,2332           55620                           TS       FCOLD                                 
033729,000201: 31,2333           55612                           TS       PIF                                   
033730,000202: 31,2334           00006                           EXTEND                                         
033731,000203: 31,2335           23607                           QXCH     RTNHOLD                               
033732,000204: 31,2336           12251                           TCF      DOIT                                  
033733,000205: 
033734,000206:                                                                                                  #  MASSMULT SCALES ACCELERATION, ARRIVING IN A AND L IN UNITS OF 2(-4) M/CS/CS, TO FORCE IN PULSE UNITS.
033735,000207: 
033736,000208: 31,2337           00006        MASSMULT           EXTEND                                         
033737,000209: 31,2340           22130                           QXCH     BUF                                   
033738,000210: 31,2341           52155                           DXCH     MPAC                                  
033739,000211: 31,2342           07106                           TC       DMP                                   
033740,000212: 31,2343           01243                           ADRES    MASS                                  

Page 792

033742,000214: 31,2344           07106                           TC       DMP                                   #  LEAVES PROPERLY SCALED FORCE IM MPAC
033743,000215: 31,2345           02005                           ADRES    SCALEFAC                              
033744,000216: 31,2346           07262                           TC       TPAGREE                               
033745,000217: 31,2347           30154                           CA       MPAC                                  
033746,000218: 31,2350           00006                           EXTEND                                         
033747,000219: 31,2351           12354                           BZF      +3                                    
033748,000220: 31,2352           34733                           CAF      POSMAX                                
033749,000221: 31,2353           00130                           TC       BUF                                   
033750,000222: 31,2354           52156                           DXCH     MPAC       +1                         
033751,000223: 31,2355           00130                           TC       BUF                                   
033752,000224: 
033753,000225:                                                                                                  #  CONSTANTS:-
033754,000226: 
033755,000227: 31,2356     4737               FEXTRA             =        BIT13                                 #  FEXT +5.13309020 E+4
033756,000228: 
033757,000229: 31,2356           04143        /AF/CNST           DEC      .13107                                
033758,000230: 
033759,000231: 31,2357           17777        OCT17777           OCT      17777                                 
033760,000232: 31,2360           35074        4FMAXNOM           DEC      14908      B-14                       #  EQUIVALENT TO 10,500 LBS.
033761,000233: 
033762,000234:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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