Source Code

These source-code files are part of a reconstructed copy of Luminary 96, the original release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 96 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

033699,000002:                                                                                                  ## Copyright:   Public domain.
033700,000003:                                                                                                  ## Filename:    THROTTLE_CONTROL_ROUTINES.agc
033701,000004:                                                                                                  ## Purpose:     A section of Luminary revision 96.
033702,000005:                                                                                                  ##              It is part of the reconstructed source code for the
033703,000006:                                                                                                  ##              original release of the flight software for the Lunar 
033704,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
033705,000008:                                                                                                  ##              The code has been recreated from a previously reconstructed
033706,000009:                                                                                                  ##              copy of Luminary 97 by undoing changes described in anomaly
033707,000010:                                                                                                  ##              report LNY-59. The code has been adapted such that the
033708,000011:                                                                                                  ##              resulting bugger words exactly match those specified for
033709,000012:                                                                                                  ##              Luminary 96 in NASA drawing 2021152D, which gives relatively
033710,000013:                                                                                                  ##              high confidence that the reconstruction is correct.
033711,000014:                                                                                                  ## Reference:   pp. 793-797
033712,000015:                                                                                                  ## Assembler:   yaYUL
033713,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033714,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033715,000018:                                                                                                  ## Mod history: 2019-08-04 MAS  Created from Luminary 97.
033716,000019: 

Page 793

033718,000021: 31,2216                                           BANK     31                                    
033719,000022: 31,2000                                           SETLOC   FTHROT                                
033720,000023: 31,2000                                           BANK                                           
033721,000024: 31,2216  E7,1612                                  EBANK=   PIF                                   
033722,000025: 31,2216                                           COUNT*   $$/THROT                              
033723,000026: 
033724,000027:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
033725,000028:                                                                                                  #  HERE FC, DESIRED THRUST, AND FP, PRESENT THRUST, UNWEIGHTED, ARE COMPUTED.
033726,000029: 
033727,000030: 31,2216           31246        THROTTLE           CA       ABDELV                                #  COMPUTE PRESENT ACCELERATION IN UNITS OF
033728,000031: 31,2217           00006                           EXTEND                                         #  2(-4) M/CS/CS, SAVING SERVICER TROUBLE
033729,000032: 31,2220           72417                           MP       /AF/CNST                              
033730,000033: 31,2221           00006                 +3        EXTEND                                         
033731,000034: 31,2222           23607                           QXCH     RTNHOLD                               
033732,000035: 31,2223           02400        AFDUMP             TC       MASSMULT                              
033733,000036: 31,2224           53470                           DXCH     FP                                    #  FP = PRESENT THRUST
033734,000037: 31,2225           00006                           EXTEND                                         
033735,000038: 31,2226           31464                           DCA      /AFC/                                 
033736,000039: 31,2227           02400                           TC       MASSMULT                              
033737,000040: 31,2230           55615                           TS       FC                                    #  FC = THRUST DESIRED BY GUIDANCE
033738,000041: 31,2231           53466                           DXCH     FCODD                                 #  FCODD = WHAT IT IS GOING TO GET
033739,000042: 
033740,000043:                                                                                                  #  IF IT HAS BEEN LESS THAN 3 SECONDS SINCE THE LAST THROTTLING, AUGMENT FP USING THE FWEIGHT CALCULATED THEN.
033741,000044: 
033742,000045: 31,2232           41617                           CS       TTHROT                                #  THIS CODING ASSUMES A FLATOUT WITHIN
033743,000046: 31,2233           60025                           AD       TIME1                                 #        80 SECONDS BEFORE FIRST THROTTLE CALL
033744,000047: 31,2234           74733                           MASK     POSMAX                                
033745,000048: 31,2235           40000                           COM                                            
033746,000049: 31,2236           65002                           AD       3SECS                                 
033747,000050: 31,2237           00006                           EXTEND                                         
033748,000051: 31,2240           62244                           BZMF     WHERETO                               #  BRANCH IF (TIME1-TTHROT +1) > 3 SECONDS
033749,000052: 31,2241           00006                           EXTEND                                         
033750,000053: 31,2242           31611                           DCA      FWEIGHT                               
033751,000054: 31,2243           21470                           DAS      FP                                    
033752,000055: 
033753,000056:                                                                                                  #      THIS LOGIC DETERMINES THE THROTTLING IN THE REGION 10% - 94%.  THE MANUAL THROTTLE, NOMINALLY SET AT
033754,000057:                                                                                                  #  MINIMUM BY ASTRONAUT OR MISSION CONTROL PROGRAMS, PROVIDES THE LOWER BOUND.  A STOP IN THE THROTTLE HARDWARE
033755,000058:                                                                                                  #  PROVIDES THE UPPER.
033756,000059: 
033757,000060: 31,2244           35014        WHERETO            CA       EBANK5                                #  INITIALIZE L*WCR*T AND H*GHCR*T FROM
033758,000061: 31,2245           54003                           TS       EBANK                                 #        PAD LOADED ERASABLES IN W-MATRIX

Page 794

033760,000063: 31,2246  E5,1506                                  EBANK=   LOWCRIT                               
033761,000064: 31,2246           00006                           EXTEND                                         
033762,000065: 31,2247           31507                           DCA      LOWCRIT                               
033763,000066: 31,2250           52131                           DXCH     L*WCR*T                               
033764,000067: 31,2251           35016                           CA       EBANK7                                
033765,000068: 31,2252           54003                           TS       EBANK                                 
033766,000069: 31,2253  E7,1612                                  EBANK=   PIF                                   
033767,000070: 31,2253           44755                           CS       ZERO                                  #  INITIALIZE PIFPSET
033768,000071: 31,2254           55606                           TS       PIFPSET                               
033769,000072: 31,2255           40131                           CS       H*GHCR*T                              
033770,000073: 31,2256           61620                           AD       FCOLD                                 
033771,000074: 31,2257           00006                           EXTEND                                         
033772,000075: 31,2260           62272                           BZMF     LOWFCOLD                              #  BRANCH IF FCOLD < OR = HIGHCRIT
033773,000076: 31,2261           40130                           CS       L*WCR*T                               
033774,000077: 31,2262           61465                           AD       FCODD                                 
033775,000078: 31,2263           00006                           EXTEND                                         
033776,000079: 31,2264           62267                           BZMF     FCOMPSET                              #  BRANCH IF FC < OR = LOWCRIT
033777,000080: 31,2265           31467                           CA       FP                                    #  SEE NOTE 1
033778,000081: 31,2266           12277                           TCF      FLATOUT1                              
033779,000082: 
033780,000083: 31,2267           42002        FCOMPSET           CS       FMAXODD                               #  SEE NOTE 2
033781,000084: 31,2270           61467                           AD       FP                                    
033782,000085: 31,2271           12301                           TCF      FLATOUT2                              
033783,000086: 
033784,000087: 31,2272           40131        LOWFCOLD           CS       H*GHCR*T                              
033785,000088: 31,2273           61465                           AD       FCODD                                 
033786,000089: 31,2274           00006                           EXTEND                                         
033787,000090: 31,2275           62302                           BZMF     DOPIF                                 #  BRANCH IF FC < OR = HIGHCRIT
033788,000091: 
033789,000092: 31,2276           32003                           CA       FMAXPOS                               #  NO:  THROTTLE-UP
033790,000093: 31,2277           53466        FLATOUT1           DXCH     FCODD                                 
033791,000094: 31,2300           34737                           CA       FEXTRA                                
033792,000095: 31,2301           55606        FLATOUT2           TS       PIFPSET                               
033793,000096: 
033794,000097:                                                                                                  #  NOTE 1        FC IS SET EQUAL TO FP SO PIF WILL BE ZERO.  THIS IS DESIRABLE
033795,000098:                                                                                                  #                AS THERE IS ACTUALLY NO THROTTLE CHANGE.
033796,000099: 
033797,000100:                                                                                                  #  NOTE2         HERE, SINCE WE ARE ABOUT TO RETURN TO THE THROTTLEABLE REGION
033798,000101:                                                                                                  #                (BELOW 55%) THE QUANTITY -(FMAXODD-FP) IS COMPUTED AND PUT
033799,000102:                                                                                                  #                INTO PIFPSET TO COMPENSATE FOR THE DIFFERENCE BETWEEN THE
033800,000103:                                                                                                  #                NUMBER OF BITS CORRESPONDING TO FULL THROTTLE (FMAXODD) AND THE
033801,000104:                                                                                                  #                NUMBER CORRESPONDING TO ACTUAL THRUST (FP).  THUS THE TOTAL
033802,000105:                                                                                                  #                THROTTLE COMMAND PIF = FC - FP - (FMAXODD - FP) = FC - FMAXODD.
033803,000106: 
033804,000107: 31,2302           03740        DOPIF              TC       FASTCHNG                              
033805,000108: 31,2303           00006                           EXTEND                                         
033806,000109: 31,2304           31466                           DCA      FCODD                                 
033807,000110: 31,2305           55620                           TS       FCOLD                                 
033808,000111: 31,2306           53613                           DXCH     PIF                                   
033809,000112: 31,2307           00006                           EXTEND                                         

Page 795

033811,000114: 31,2310           41470                           DCS      FP                                    
033812,000115: 31,2311           21613                           DAS      PIF                                   #  PIF = FC - FP, NEVER EQUALS +0
033813,000116: 
033814,000117: 31,2312           31612        DOIT               CA       PIF                                   
033815,000118: 31,2313           61606                           AD       PIFPSET                               #  ADD IN PIFPSET, WITHOUT CHANGING PIF
033816,000119: 31,2314           55614                           TS       PSEUDO55                              
033817,000120: 31,2315           54055                           TS       THRUST                                
033818,000121: 31,2316           34750                           CAF      BIT4                                  
033819,000122: 31,2317           00006                           EXTEND                                         
033820,000123: 31,2320           05014                           WOR      CHAN14                                
033821,000124: 31,2321           30025                           CA       TIME1                                 
033822,000125: 31,2322           55617                           TS       TTHROT                                
033823,000126: 
033824,000127:                                                                                                  #  SINCE /AF/ IS NOT AN INSTANTANEOUS ACCELERATION, BUT RATHER AN "AVERAGE" OF THE ACCELERATION LEVELS DURING
033825,000128:                                                                                                  #  THE PRECEEDING PIPA INTERVAL, AND SINCE FP IS COMPUTED DIRECTLY FROM /AF/, FP IN ORDER TO CORRESPOND TO THE
033826,000129:                                                                                                  #  ACTUAL THRUST LEVEL AT THE END OF THE INTERVAL MUST BE WEIGHTED BY
033827,000130: 
033828,000131:                                                                                                  #                  PIF(PPROCESS + TL)     PIF /PIF/
033829,000132:                                                                                                  #        FWEIGHT = ------------------ + -------------
033830,000133:                                                                                                  #                       PGUID           2 PGUID FRATE
033831,000134: 
033832,000135:                                                                                                  #  WHERE PPROCESS IS THE TIME BETWEEN PIPA READING AND THE START OF THROTTLING, PGUID IS THE GUIDANCE PERIOD, AND
033833,000136:                                                                                                  #  FRATE IS THE THROTTLING RATE (32 UNITS PER CENTISECOND).  PGUID IS EITHER 1 OR 2 SECONDS.  THE "TL" IN THE
033834,000137:                                                                                                  #  FIRST TERM REPRESENTS THE ENGINE'S RESPONSE LAG.  HERE FWEIGHT IS COMPUTED FOR USE NEXT PASS.
033835,000138: 
033836,000139: 31,2323           31762                           CA       THISTPIP   +1                         #  INITIALIZE FWEIGHT COMP AS IF FOR P66
033837,000140: 31,2324           54130                           TS       BUF                                   
033838,000141: 
033839,000142: 31,2325           41011                           CS       MODREG                                #  ARE WE IN FACT IN P66?
033840,000143: 31,2326           62501                           AD       DEC66                                 
033841,000144: 31,2327           00006                           EXTEND                                         
033842,000145: 31,2330           12335                           BZF      FWCOMP                                #  YES
033843,000146: 
033844,000147: 31,2331           31235                           CA       PIPTIME    +1                         #  NO:  INITIALIZE FOR TWO SECOND PERIOD
033845,000148: 31,2332           54130                           TS       BUF                                   
033846,000149: 31,2333           35003                           CAF      4SECS                                 
033847,000150: 31,2334           12336                           TCF      FWCOMP     +1                         
033848,000151: 
033849,000152: 31,2335           35000        FWCOMP             CAF      2SECS                                 
033850,000153: 31,2336           54002                 +1        TS       Q                                     
033851,000154: 31,2337           00006                           EXTEND                                         
033852,000155: 31,2340           74746                           MP       BIT6                                  
033853,000156: 31,2341           22131                           LXCH     BUF        +1                         
033854,000157: 31,2342           40130                           CS       BUF                                   #  TIME OF LAST PIPA READING.
033855,000158: 31,2343           60025                           AD       TIME1                                 
033856,000159: 31,2344           62004                           AD       THROTLAG                              #  COMPENSATE FOR ENGINE RESPONSE LAG
033857,000160: 31,2345           74357                           MASK     LOW8                                  #  MAKE SURE SMALL AND POSITIVE
033858,000161: 31,2346           22007                           ZL                                             
033859,000162: 31,2347           00006                           EXTEND                                         

Page 796

033861,000164: 31,2350           10002                           DV       Q                                     
033862,000165: 31,2351           00006                           EXTEND                                         
033863,000166: 31,2352           71612                           MP       PIF                                   
033864,000167: 31,2353           60000                           DOUBLE                                         
033865,000168: 31,2354           53611                           DXCH     FWEIGHT                               
033866,000169: 31,2355           11612                           CCS      PIF                                   
033867,000170: 31,2356           64753                           AD       ONE                                   
033868,000171: 31,2357           12361                           TCF      +2                                    
033869,000172: 31,2360           64753                           AD       ONE                                   
033870,000173: 31,2361           00006                           EXTEND                                         
033871,000174: 31,2362           71612                           MP       PIF                                   
033872,000175: 31,2363           00006                           EXTEND                                         
033873,000176: 31,2364           10131                           DV       BUF        +1                         
033874,000177: 31,2365           22007                           ZL                                             
033875,000178: 31,2366           21611                           DAS      FWEIGHT                               
033876,000179: 
033877,000180: 31,2367           01607        THDUMP             TC       RTNHOLD                               
033878,000181: 
033879,000182:                                                                                                  #  FLATOUT THROTTLES UP THE DESCENT ENGINE, AND IS CALLED AS A BASIC SUBROUTINE.
033880,000183: 
033881,000184: 31,2370           34737        FLATOUT            CAF      BIT13                                 #  4096 PULSES
033882,000185: 31,2371           55606        WHATOUT            TS       PIFPSET                               #  USE PIFPSET SO FWEIGHT WILL BE ZERO
033883,000186: 31,2372           44755                           CS       ZERO                                  
033884,000187: 31,2373           55620                           TS       FCOLD                                 
033885,000188: 31,2374           55612                           TS       PIF                                   
033886,000189: 31,2375           00006                           EXTEND                                         
033887,000190: 31,2376           23607                           QXCH     RTNHOLD                               
033888,000191: 31,2377           12312                           TCF      DOIT                                  
033889,000192: 
033890,000193:                                                                                                  #  MASSMULT SCALES ACCELERATION, ARRIVING IN A AND L IN UNITS OF 2(-4) M/CS/CS, TO FORCE IN PULSE UNITS.
033891,000194: 
033892,000195: 31,2400           00006        MASSMULT           EXTEND                                         
033893,000196: 31,2401           22130                           QXCH     BUF                                   
033894,000197: 31,2402           52155                           DXCH     MPAC                                  
033895,000198: 31,2403           07103                           TC       DMP                                   
033896,000199: 31,2404           01244                           ADRES    MASS                                  
033897,000200: 31,2405           07103                           TC       DMP                                   #  LEAVES PROPERLY SCALED FORCE IM MPAC
033898,000201: 31,2406           02005                           ADRES    SCALEFAC                              
033899,000202: 31,2407           07257                           TC       TPAGREE                               
033900,000203: 31,2410           30154                           CA       MPAC                                  
033901,000204: 31,2411           00006                           EXTEND                                         
033902,000205: 31,2412           12415                           BZF      +3                                    
033903,000206: 31,2413           34733                           CAF      POSMAX                                
033904,000207: 31,2414           00130                           TC       BUF                                   
033905,000208: 31,2415           52156                           DXCH     MPAC       +1                         
033906,000209: 31,2416           00130                           TC       BUF                                   

Page 797

033908,000211:                                                                                                  #  CONSTANTS:-
033909,000212: 
033910,000213: 31,2417     4737               FEXTRA             =        BIT13                                 #  FEXT +5.13309020 E+4
033911,000214: 
033912,000215: 31,2417           04143        /AF/CNST           DEC      .13107                                
033913,000216: 
033914,000217:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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