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.

033550,000002:                                                                                                  ## Copyright:   Public domain.
033551,000003:                                                                                                  ## Filename:    THROTTLE_CONTROL_ROUTINES.agc
033552,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
033553,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
033554,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
033555,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
033556,000008:                                                                                                  ##              that the code format has been changed to conform to the
033557,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
033558,000010:                                                                                                  ##              original YUL assembler.
033559,000011:                                                                                                  ## Reference:   pp. 788-792
033560,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033561,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033562,000014:                                                                                                  ## Mod history: 05/24/03 RSB.   Began transcribing.
033563,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
033564,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
033565,000017:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
033566,000018:                                                                                                  ##                              numbers in 1701.pdf.
033567,000019:                                                                                                  ##              2017-02-25 RSB  Proofed comment text using octopus/ProoferComments.
033568,000020:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 5-way
033569,000021:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
033570,000022: 

Page 788

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

Page 789

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

Page 790

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

Page 791

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

Page 792

033762,000214: 31,2344           07106                           TC       DMP                                   #  LEAVES PROPERLY SCALED FORCE IM MPAC
033763,000215: 31,2345           02005                           ADRES    SCALEFAC                              
033764,000216: 31,2346           07262                           TC       TPAGREE                               
033765,000217: 31,2347           30154                           CA       MPAC                                  
033766,000218: 31,2350           00006                           EXTEND                                         
033767,000219: 31,2351           12354                           BZF      +3                                    
033768,000220: 31,2352           34733                           CAF      POSMAX                                
033769,000221: 31,2353           00130                           TC       BUF                                   
033770,000222: 31,2354           52156                           DXCH     MPAC       +1                         
033771,000223: 31,2355           00130                           TC       BUF                                   
033772,000224: 
033773,000225:                                                                                                  #  CONSTANTS:-
033774,000226: 
033775,000227: 31,2356     4737               FEXTRA             =        BIT13                                 #  FEXT +5.13309020 E+4
033776,000228: 
033777,000229: 31,2356           04143        /AF/CNST           DEC      .13107                                
033778,000230: 
033779,000231: 31,2357           17777        OCT17777           OCT      17777                                 
033780,000232: 31,2360           35074        4FMAXNOM           DEC      14908      B-14                       #  EQUIVALENT TO 10,500 LBS.
033781,000233: 
033782,000234:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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