Source Code

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

The reconstruction began with source code of Zerlina 56, Luminary 210, and Luminary 131, previously transcribed from digitized copies of those programs. The code was created by combining the three, using Zerlina 56 as a base, since it was based off of Luminary 183. The differences between the three were carefully merged using the Luminary memos as a guide, with all changes made after Luminary 178 being backed out. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 178 listing would be different.

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.

033878,000002:                                                                                                  ## Copyright:   Public domain.
033879,000003:                                                                                                  ## Filename:    THROTTLE_CONTROL_ROUTINES.agc
033880,000004:                                                                                                  ## Purpose:     A section of Luminary revision 178.
033881,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
033882,000006:                                                                                                  ##              release of the flight software for the Lunar Module's
033883,000007:                                                                                                  ##              (LM) Apollo Guidance Computer (AGC) for Apollo 14. The
033884,000008:                                                                                                  ##              code has been recreated from copies of Zerlina 56, Luminary
033885,000009:                                                                                                  ##              210, and Luminary 131, as well as many Luminary memos.
033886,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
033887,000011:                                                                                                  ##              exactly match those specified for Luminary 178 in NASA
033888,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
033889,000013:                                                                                                  ##              that the reconstruction is correct.
033890,000014:                                                                                                  ## Reference:   pp. 779-783
033891,000015:                                                                                                  ## Assembler:   yaYUL
033892,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033893,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033894,000018:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Zerlina 56.
033895,000019:                                                                                                  ##              2019-09-08 MAS  Re-based on Luminary 210, since Don entirely
033896,000020:                                                                                                  ##                              rewrote this section in Zerlina. Undid a
033897,000021:                                                                                                  ##                              couple of small changes made after Luminary
033898,000022:                                                                                                  ##                              178; namely a DXCH->XCH and a DOUBLE->DDOUBL.
033899,000023: 

Page 789

033901,000025: 31,2144                                           BANK     31                                    
033902,000026: 
033903,000027: 31,2000                                           SETLOC   FTHROT                                
033904,000028: 
033905,000029: 31,2000                                           BANK                                           
033906,000030: 
033907,000031: 31,2144  E7,1612                                  EBANK=   PIF                                   
033908,000032: 
033909,000033: 31,2144                                           COUNT*   $$/THROT                              
033910,000034:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
033911,000035:                                                                                                  #  HERE FC, DESIRED THRUST, AND FP, PRESENT THRUST, UNWEIGHTED, ARE COMPUTED.
033912,000036: 
033913,000037: 31,2144           31245        THROTTLE           CA       ABDELV                                #  COMPUTE PRESENT ACCELERATION IN UNITS OF
033914,000038: 31,2145           00006                           EXTEND                                         #   2(-4) M/CS/CS, SAVING SERVICER TROUBLE
033915,000039: 31,2146           72363                           MP       /AF/CNST                              
033916,000040: 31,2147           00006                 +3        EXTEND                                         
033917,000041: 31,2150           23607                           QXCH     RTNHOLD                               
033918,000042: 31,2151           02344        AFDUMP             TC       MASSMULT                              
033919,000043: 31,2152           53470                           DXCH     FP                                    #  FP = PRESENT THRUST
033920,000044: 31,2153           00006                           EXTEND                                         
033921,000045: 31,2154           31464                           DCA      /AFC/                                 
033922,000046: 31,2155           02344                           TC       MASSMULT                              
033923,000047: 31,2156           00004                           INHINT                                         #  PREVENT A DOWNRUPT
033924,000048: 31,2157           55615                           TS       FC                                    #  FC = THRUST DESIRED BY GUIDANCE
033925,000049: 31,2160           53466                           DXCH     FCODD                                 #  FCODD = WHAT IT IS GOING TO GET
033926,000050: 
033927,000051: 
033928,000052: 31,2161           00006                           EXTEND                                         
033929,000053: 31,2162           31234                           DCA      PIPTIME                               
033930,000054: 31,2163           53753                           DXCH     GTCTIME                               #  DOWNLINK TIME AGREEMENT
033931,000055: 31,2164           00003                           RELINT                                         
033932,000056: 
033933,000057:                                                                                                  #  COMPUTE DESIRED THRUST FOR DISPLAY AS A PERCENTAGE OF 10,500 POUNDS
033934,000058: 
033935,000059: 31,2165           32365                           CAF      4FMAXNOM                              #  MOVE 4FMAXNOM TO ERASABLE FOR DV BELOW
033936,000060: 31,2166           54002                           TS       Q                                     
033937,000061: 31,2167           31615                           CA       FC                                    
033938,000062: 31,2170           72364                           MASK     OCT17777                              #  FOR SAFETY
033939,000063: 31,2171           00006                           EXTEND                                         
033940,000064: 31,2172           10002                           DV       Q                                     
033941,000065: 31,2173           00006                           EXTEND                                         
033942,000066: 31,2174           75003                           MP       4SECS                                 
033943,000067: 31,2175           55750                           TS       THRDISP                               #  FOR DISPLAY IN  N92
033944,000068: 
033945,000069:                                                                                                  #  IF IT HAS BEEN LESS THAN 3 SECONDS SINCE THE LAST THROTTLING, AUGMENT FP USING THE FWEIGHT CALCULATED THEN.
033946,000070: 
033947,000071: 31,2176           41617                           CS       TTHROT                                #  THIS CODING ASSUMES A FLATOUT WITHIN

Page 790

033949,000073: 31,2177           60025                           AD       TIME1                                 #    80 SECONDS BEFORE FIRST THROTTLE CALL
033950,000074: 31,2200           74733                           MASK     POSMAX                                
033951,000075: 31,2201           40000                           COM                                            
033952,000076: 31,2202           65002                           AD       3SECS                                 
033953,000077: 31,2203           00006                           EXTEND                                         
033954,000078: 31,2204           62210                           BZMF     WHERETO                               #  BRANCH IF (TIME1-TTHROT +1) > 3 SECONDS
033955,000079: 31,2205           00006                           EXTEND                                         
033956,000080: 31,2206           31611                           DCA      FWEIGHT                               
033957,000081: 31,2207           21470                           DAS      FP                                    
033958,000082: 
033959,000083: 
033960,000084:                                                                                                  #      THIS LOGIC DETERMINES THE THROTTLING IN THE REGION 10% - 94%.   THE MANUAL THROTTLE, NOMINALLY SET AT
033961,000085:                                                                                                  #  MINIMUM BY ASTRONAUT OR MISSION CONTROL PROGRAMS, PROVIDES THE LOWER BOUND.   A STOP IN THE THROTTLE HARDWARE
033962,000086:                                                                                                  #  PROVIDES THE UPPER.
033963,000087: 
033964,000088: 31,2210           35014        WHERETO            CA       EBANK5                                #  INITIALIZE L*WCR*T AND H*GHCR*T FROM
033965,000089: 31,2211           54003                           TS       EBANK                                 #   PAD LOADED ERASABLES IN W-MATRIX
033966,000090: 31,2212  E5,1472                                  EBANK=   LOWCRIT                               
033967,000091: 31,2212           00006                           EXTEND                                         
033968,000092: 31,2213           31473                           DCA      LOWCRIT                               
033969,000093: 31,2214           52131                           DXCH     L*WCR*T                               
033970,000094: 31,2215           35016                           CA       EBANK7                                
033971,000095: 31,2216           54003                           TS       EBANK                                 
033972,000096: 31,2217  E7,1612                                  EBANK=   PIF                                   
033973,000097: 31,2217           44755                           CS       ZERO                                  #  INITIALIZE PIFPSET
033974,000098: 31,2220           55606                           TS       PIFPSET                               
033975,000099: 31,2221           40131                           CS       H*GHCR*T                              
033976,000100: 31,2222           61620                           AD       FCOLD                                 
033977,000101: 31,2223           00006                           EXTEND                                         
033978,000102: 31,2224           62236                           BZMF     LOWFCOLD                              #  BRANCH IF FCOLD < OR = HIGHCRIT
033979,000103: 31,2225           40130                           CS       L*WCR*T                               
033980,000104: 31,2226           61465                           AD       FCODD                                 
033981,000105: 31,2227           00006                           EXTEND                                         
033982,000106: 31,2230           62233                           BZMF     FCOMPSET                              #  BRANCH IF FC < OR = LOWCRIT
033983,000107: 31,2231           31467                           CA       FP                                    #  SEE NOTE 1
033984,000108: 31,2232           12243                           TCF      FLATOUT1                              
033985,000109: 
033986,000110: 31,2233           42002        FCOMPSET           CS       FMAXODD                               #  SEE NOTE 2
033987,000111: 31,2234           61467                           AD       FP                                    
033988,000112: 31,2235           12245                           TCF      FLATOUT2                              
033989,000113: 
033990,000114: 31,2236           40131        LOWFCOLD           CS       H*GHCR*T                              
033991,000115: 31,2237           61465                           AD       FCODD                                 
033992,000116: 31,2240           00006                           EXTEND                                         
033993,000117: 31,2241           62246                           BZMF     DOPIF                                 #  BRANCH IF FC < OR = HIGHCRIT
033994,000118: 
033995,000119: 31,2242           32003                           CA       FMAXPOS                               #  NO:   THROTTLE-UP
033996,000120: 31,2243           53466        FLATOUT1           DXCH     FCODD                                 
033997,000121: 31,2244           34737                           CA       FEXTRA                                

Page 791

033999,000123: 31,2245           55606        FLATOUT2           TS       PIFPSET                               
034000,000124: 
034001,000125:                                                                                                  #  NOTE 1   FC IS SET EQUAL TO FP SO PIF WILL BE ZERO.   THIS IS DESIRABLE
034002,000126:                                                                                                  #           AS THERE IS ACTUALLY NO THROTTLE CHANGE.
034003,000127: 
034004,000128:                                                                                                  #  NOTE 2   HERE, SINCE WE ARE ABOUT TO RETURN TO THE THROTTLEABLE REGION
034005,000129:                                                                                                  #           (BELOW 55%) THE QUANTITY -(FMAXODD - FP) IS COMPUTED AND PUT
034006,000130:                                                                                                  #           INTO PIFPSET TO COMPENSATE FOR THE DIFFERENCE BETWEEN THE
034007,000131:                                                                                                  #           NUMBER OF BITS CORRESPONDING TO FULL THROTTLE (FMAXODD) AND THE
034008,000132:                                                                                                  #           NUMBER CORRESPONDING TO ACTUAL THRUST (FP).   THUS THE TOTAL
034009,000133:                                                                                                  #           THROTTLE COMMAND PIF = FC - FP -(FMAXODD - FP) = FC - FMAXODD.
034010,000134: 
034011,000135: 31,2246           03741        DOPIF              TC       FASTCHNG                              
034012,000136: 31,2247           00006                           EXTEND                                         
034013,000137: 31,2250           31466                           DCA      FCODD                                 
034014,000138: 31,2251           55620                           TS       FCOLD                                 
034015,000139: 31,2252           53613                           DXCH     PIF                                   
034016,000140: 31,2253           00006                           EXTEND                                         
034017,000141: 31,2254           41470                           DCS      FP                                    
034018,000142: 31,2255           21613                           DAS      PIF                                   #  PIF = FC - FP, NEVER EQUALS +0
034019,000143: 
034020,000144: 
034021,000145: 31,2256           31612        DOIT               CA       PIF                                   
034022,000146: 31,2257           61606                           AD       PIFPSET                               #  ADD IN PIFPSET, WITHOUT CHANGING PIF
034023,000147: 31,2260           55614                           TS       PSEUDO55                              
034024,000148: 31,2261           54055                           TS       THRUST                                
034025,000149: 31,2262           34750                           CAF      BIT4                                  
034026,000150: 31,2263           00006                           EXTEND                                         
034027,000151: 31,2264           05014                           WOR      CHAN14                                
034028,000152: 31,2265           30025                           CA       TIME1                                 
034029,000153: 31,2266           55617                           TS       TTHROT                                
034030,000154: 
034031,000155:                                                                                                  #      SINCE /AF/ IS NOT AN INSTANTANEOUS ACCELERATION, BUT RATHER AN "AVERAGE" OF THE ACCELERATION LEVELS DURING
034032,000156:                                                                                                  #  THE PRECEEDING PIPA INTERVAL, AND SINCE FP IS COMPUTED DIRECTLY FROM /AF/, FP IN ORDER TO CORRESPOND TO THE
034033,000157:                                                                                                  #  ACTUAL THRUST LEVEL AT THE END OF THE INTERVAL MUST BE WEIGHTED BY
034034,000158: 
034035,000159:                                                                                                  #                                    PIF(PPROCESS + TL)     PIF /PIF/
034036,000160:                                                                                                  #                          FWEIGHT = ------------------ + -------------
034037,000161:                                                                                                  #                                          PGUID          2 PGUID FRATE
034038,000162: 
034039,000163:                                                                                                  #  WHERE PPROCESS IS THE TIME BETWEEN PIPA READING AND THE START OF THROTTLING, PGUID IS THE GUIDANCE PERIOD, AND
034040,000164:                                                                                                  #  FRATE IS THE THROTTLING RATE (32 UNITS PER CENTISECOND).  PGUID IS EITHER 1 OR 2 SECONDS. THE "TL" IN THE
034041,000165:                                                                                                  #  FIRST TERM REPRESENTS THE ENGINE'S RESPONSE LAG.   HERE FWEIGHT IS COMPUTED FOR USE NEXT PASS.
034042,000166: 
034043,000167: 31,2267           31762                           CA       THISTPIP   +1                         #  INITIALIZE FWEIGHT COMP AS IF FOR P66
034044,000168: 31,2270           54130                           TS       BUF                                   
034045,000169: 
034046,000170: 31,2271           41010                           CS       MODREG                                #  ARE WE IN FACT IN P66?
034047,000171: 31,2272           62454                           AD       DEC66                                 
034048,000172: 31,2273           00006                           EXTEND                                         

Page 792

034050,000174: 31,2274           12301                           BZF      FWCOMP                                #  YES
034051,000175: 
034052,000176: 31,2275           31234                           CA       PIPTIME    +1                         #  NO:   INITIALIZE FOR TWO SECOND PERIOD
034053,000177: 31,2276           54130                           TS       BUF                                   
034054,000178: 31,2277           35003                           CAF      4SECS                                 
034055,000179: 31,2300           12302                           TCF      FWCOMP     +1                         
034056,000180: 
034057,000181: 31,2301           35000        FWCOMP             CAF      2SECS                                 
034058,000182: 31,2302           54002                 +1        TS       Q                                     
034059,000183: 31,2303           00006                           EXTEND                                         
034060,000184: 31,2304           74746                           MP       BIT6                                  
034061,000185: 31,2305           22131                           LXCH     BUF        +1                         
034062,000186: 31,2306           40130                           CS       BUF                                   #  TIME OF LAST PIPA READING.
034063,000187: 31,2307           60025                           AD       TIME1                                 
034064,000188: 31,2310           62004                           AD       THROTLAG                              #  COMPENSATE FOR ENGINE RESPONSE LAG
034065,000189: 31,2311           74357                           MASK     LOW8                                  #  MAKE SURE SMALL AND POSITIVE
034066,000190: 31,2312           22007                           ZL                                             
034067,000191: 31,2313           00006                           EXTEND                                         
034068,000192: 31,2314           10002                           DV       Q                                     
034069,000193: 31,2315           00006                           EXTEND                                         
034070,000194: 31,2316           71612                           MP       PIF                                   
034071,000195: 31,2317           60000                           DOUBLE                                         
034072,000196: 31,2320           53611                           DXCH     FWEIGHT                               
034073,000197: 31,2321           11612                           CCS      PIF                                   
034074,000198: 31,2322           64753                           AD       ONE                                   
034075,000199: 31,2323           12325                           TCF      +2                                    
034076,000200: 31,2324           64753                           AD       ONE                                   
034077,000201: 31,2325           00006                           EXTEND                                         
034078,000202: 31,2326           71612                           MP       PIF                                   
034079,000203: 31,2327           00006                           EXTEND                                         
034080,000204: 31,2330           10131                           DV       BUF        +1                         
034081,000205: 31,2331           22007                           ZL                                             
034082,000206: 31,2332           21611                           DAS      FWEIGHT                               
034083,000207: 
034084,000208: 
034085,000209: 31,2333           01607        THDUMP             TC       RTNHOLD                               
034086,000210: 
034087,000211: 
034088,000212:                                                                                                  #  FLATOUT THROTTLES UP THE DESCENT ENGINE, AND IS CALLED AS A BASIC SUBROUTINE.
034089,000213: 
034090,000214: 31,2334           34737        FLATOUT            CAF      BIT13                                 #  4096 PULSES
034091,000215: 31,2335           55606        WHATOUT            TS       PIFPSET                               #  USE PIFPSET SO FWEIGHT WILL BE ZERO
034092,000216: 31,2336           44755                           CS       ZERO                                  
034093,000217: 31,2337           55620                           TS       FCOLD                                 
034094,000218: 31,2340           55612                           TS       PIF                                   
034095,000219: 31,2341           00006                           EXTEND                                         
034096,000220: 31,2342           23607                           QXCH     RTNHOLD                               
034097,000221: 31,2343           12256                           TCF      DOIT                                  
034098,000222: 

Page 793

034100,000224:                                                                                                  #  MASSMULT SCALES ACCELERATION, ARRIVING IN A AND L IN UNITS OF 2(-4) M/CS/CS, TO FORCE IN PULSE UNITS.
034101,000225: 
034102,000226: 31,2344           00006        MASSMULT           EXTEND                                         
034103,000227: 31,2345           22130                           QXCH     BUF                                   
034104,000228: 31,2346           52155                           DXCH     MPAC                                  
034105,000229: 31,2347           07106                           TC       DMP                                   
034106,000230: 31,2350           01243                           ADRES    MASS                                  
034107,000231: 31,2351           07106                           TC       DMP                                   #  LEAVES PROPERLY SCALED FORCE IM MPAC
034108,000232: 31,2352           02005                           ADRES    SCALEFAC                              
034109,000233: 31,2353           07262                           TC       TPAGREE                               
034110,000234: 31,2354           30154                           CA       MPAC                                  
034111,000235: 31,2355           00006                           EXTEND                                         
034112,000236: 31,2356           12361                           BZF      +3                                    
034113,000237: 31,2357           34733                           CAF      POSMAX                                
034114,000238: 31,2360           00130                           TC       BUF                                   
034115,000239: 31,2361           52156                           DXCH     MPAC       +1                         
034116,000240: 31,2362           00130                           TC       BUF                                   
034117,000241: 
034118,000242: 
034119,000243:                                                                                                  #  CONSTANTS:-
034120,000244: 
034121,000245: 31,2363     4737               FEXTRA             =        BIT13                                 #         FEXT +5.13309020 E+4
034122,000246: 
034123,000247: 31,2363           04143        /AF/CNST           DEC      .13107                                
034124,000248: 
034125,000249: 31,2364           17777        OCT17777           OCT      17777                                 
034126,000250: 31,2365           35074        4FMAXNOM           DEC      14908      B-14                       #  EQUIVALENT TO 10,500 LBS.
034127,000251:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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