Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the second release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 97. A bug (which had been around since at least Apollo 10, Luminary 69) was discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute revision into Rev 1, which is what actually flew rather than the Rev 0 presented here. A hardcopy of Rev 0 is known to exist — it belonged to AGC developer Allan Klumpp for many years — but unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus the code you see here had been reconstructed (we believe accurately) rather than transcribed. The first step of the reconstruction of the Rev 0 source code was the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection. The process of reverting the active portion of the source code (i.e., other than program comments) from Rev 1 to Rev 0 was very minor, consisting only of moving the position of the STARTSB1 label in FRESH START AND RESTART. Allan had previously given us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read, in part:

	GAP:  ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051

A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here.

035060,000002:                                                                                                  ## Copyright:   Public domain.
035061,000003:                                                                                                  ## Filename:    THROTTLE_CONTROL_ROUTINES.agc
035062,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
035063,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the second release
035064,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
035065,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
035066,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
035067,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
035068,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
035069,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
035070,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
035071,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
035072,000014:                                                                                                  ##              the original YUL assembler.
035073,000015:                                                                                                  ##
035074,000016:                                                                                                  ## Assembler:   yaYUL
035075,000017:                                                                                                  ## Contact:     HARTMUTH GUTSCHE <hgutsche@xplornet.com>.
035076,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
035077,000019:                                                                                                  ## Pages:       793-797
035078,000020:                                                                                                  ## Mod history: 2009-05-20 HG   Transcribed from page images.
035079,000021:                                                                                                  ##              2010-12-31 JL   Fixed page number comments.
035080,000022:                                                                                                  ##              2016-12-16 RSB  Proofed text comments with octopus/ProoferComments
035081,000023:                                                                                                  ##                              and corrected the errors found.
035082,000024:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 5-way
035083,000025:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
035084,000026:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
035085,000027: 
035086,000028:                                                                                                  ## This source code has been transcribed or otherwise adapted from
035087,000029:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
035088,000030:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
035089,000031:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
035090,000032:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
035091,000033:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
035092,000034:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
035093,000035:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
035094,000036:                                                                                                  ## actually created.
035095,000037:                                                                                                  ##
035096,000038:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
035097,000039:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
035098,000040:                                                                                                  ## the listing from which it was transcribed. It has been verified to
035099,000041:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
035100,000042:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
035101,000043:                                                                                                  ##
035102,000044:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
035103,000045:                                                                                                  ##
035104,000046:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
035105,000047: 

Page 793

035107,000049: 31,2216                                           BANK     31                                    
035108,000050: 31,2000                                           SETLOC   FTHROT                                
035109,000051: 31,2000                                           BANK                                           
035110,000052: 31,2216  E7,1612                                  EBANK=   PIF                                   
035111,000053: 31,2216                                           COUNT*   $$/THROT                              
035112,000054: 
035113,000055:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
035114,000056:                                                                                                  #  HERE FC, DESIRED THRUST, AND FP, PRESENT THRUST, UNWEIGHTED, ARE COMPUTED.
035115,000057: 
035116,000058: 31,2216           31246        THROTTLE           CA       ABDELV                                #  COMPUTE PRESENT ACCELERATION IN UNITS OF
035117,000059: 31,2217           00006                           EXTEND                                         #  2(-4) M/CS/CS, SAVING SERVICER TROUBLE
035118,000060: 31,2220           72417                           MP       /AF/CNST                              
035119,000061: 31,2221           00006                 +3        EXTEND                                         
035120,000062: 31,2222           23607                           QXCH     RTNHOLD                               
035121,000063: 31,2223           02400        AFDUMP             TC       MASSMULT                              
035122,000064: 31,2224           53470                           DXCH     FP                                    #  FP = PRESENT THRUST
035123,000065: 31,2225           00006                           EXTEND                                         
035124,000066: 31,2226           31464                           DCA      /AFC/                                 
035125,000067: 31,2227           02400                           TC       MASSMULT                              
035126,000068: 31,2230           55615                           TS       FC                                    #  FC = THRUST DESIRED BY GUIDANCE
035127,000069: 31,2231           53466                           DXCH     FCODD                                 #  FCODD = WHAT IT IS GOING TO GET
035128,000070: 
035129,000071:                                                                                                  #  IF IT HAS BEEN LESS THAN 3 SECONDS SINCE THE LAST THROTTLING, AUGMENT FP USING THE FWEIGHT CALCULATED THEN.
035130,000072: 
035131,000073: 31,2232           41617                           CS       TTHROT                                #  THIS CODING ASSUMES A FLATOUT WITHIN
035132,000074: 31,2233           60025                           AD       TIME1                                 #        80 SECONDS BEFORE FIRST THROTTLE CALL
035133,000075: 31,2234           74733                           MASK     POSMAX                                
035134,000076: 31,2235           40000                           COM                                            
035135,000077: 31,2236           65002                           AD       3SECS                                 
035136,000078: 31,2237           00006                           EXTEND                                         
035137,000079: 31,2240           62244                           BZMF     WHERETO                               #  BRANCH IF (TIME1-TTHROT +1) > 3 SECONDS
035138,000080: 31,2241           00006                           EXTEND                                         
035139,000081: 31,2242           31611                           DCA      FWEIGHT                               
035140,000082: 31,2243           21470                           DAS      FP                                    
035141,000083: 
035142,000084:                                                                                                  #      THIS LOGIC DETERMINES THE THROTTLING IN THE REGION 10% - 94%.  THE MANUAL THROTTLE, NOMINALLY SET AT
035143,000085:                                                                                                  #  MINIMUM BY ASTRONAUT OR MISSION CONTROL PROGRAMS, PROVIDES THE LOWER BOUND.  A STOP IN THE THROTTLE HARDWARE
035144,000086:                                                                                                  #  PROVIDES THE UPPER.
035145,000087: 
035146,000088: 31,2244           35014        WHERETO            CA       EBANK5                                #  INITIALIZE L*WCR*T AND H*GHCR*T FROM
035147,000089: 31,2245           54003                           TS       EBANK                                 #        PAD LOADED ERASABLES IN W-MATRIX

Page 794

035149,000091: 31,2246  E5,1506                                  EBANK=   LOWCRIT                               
035150,000092: 31,2246           00006                           EXTEND                                         
035151,000093: 31,2247           31507                           DCA      LOWCRIT                               
035152,000094: 31,2250           52131                           DXCH     L*WCR*T                               
035153,000095: 31,2251           35016                           CA       EBANK7                                
035154,000096: 31,2252           54003                           TS       EBANK                                 
035155,000097: 31,2253  E7,1612                                  EBANK=   PIF                                   
035156,000098: 31,2253           44755                           CS       ZERO                                  #  INITIALIZE PIFPSET
035157,000099: 31,2254           55606                           TS       PIFPSET                               
035158,000100: 31,2255           40131                           CS       H*GHCR*T                              
035159,000101: 31,2256           61620                           AD       FCOLD                                 
035160,000102: 31,2257           00006                           EXTEND                                         
035161,000103: 31,2260           62272                           BZMF     LOWFCOLD                              #  BRANCH IF FCOLD < OR = HIGHCRIT
035162,000104: 31,2261           40130                           CS       L*WCR*T                               
035163,000105: 31,2262           61465                           AD       FCODD                                 
035164,000106: 31,2263           00006                           EXTEND                                         
035165,000107: 31,2264           62267                           BZMF     FCOMPSET                              #  BRANCH IF FC < OR = LOWCRIT
035166,000108: 31,2265           31467                           CA       FP                                    #  SEE NOTE 1
035167,000109: 31,2266           12277                           TCF      FLATOUT1                              
035168,000110: 
035169,000111: 31,2267           42002        FCOMPSET           CS       FMAXODD                               #  SEE NOTE 2
035170,000112: 31,2270           61467                           AD       FP                                    
035171,000113: 31,2271           12301                           TCF      FLATOUT2                              
035172,000114: 
035173,000115: 31,2272           40131        LOWFCOLD           CS       H*GHCR*T                              
035174,000116: 31,2273           61465                           AD       FCODD                                 
035175,000117: 31,2274           00006                           EXTEND                                         
035176,000118: 31,2275           62302                           BZMF     DOPIF                                 #  BRANCH IF FC < OR = HIGHCRIT
035177,000119: 
035178,000120: 31,2276           32003                           CA       FMAXPOS                               #  NO:  THROTTLE-UP
035179,000121: 31,2277           53466        FLATOUT1           DXCH     FCODD                                 
035180,000122: 31,2300           34737                           CA       FEXTRA                                
035181,000123: 31,2301           55606        FLATOUT2           TS       PIFPSET                               
035182,000124: 
035183,000125:                                                                                                  #  NOTE 1        FC IS SET EQUAL TO FP SO PIF WILL BE ZERO.  THIS IS DESIRABLE
035184,000126:                                                                                                  #                AS THERE IS ACTUALLY NO THROTTLE CHANGE.
035185,000127: 
035186,000128:                                                                                                  #  NOTE2         HERE, SINCE WE ARE ABOUT TO RETURN TO THE THROTTLEABLE REGION
035187,000129:                                                                                                  #                (BELOW 55%) THE QUANTITY -(FMAXODD-FP) IS COMPUTED AND PUT
035188,000130:                                                                                                  #                INTO PIFPSET TO COMPENSATE FOR THE DIFFERENCE BETWEEN THE
035189,000131:                                                                                                  #                NUMBER OF BITS CORRESPONDING TO FULL THROTTLE (FMAXODD) AND THE
035190,000132:                                                                                                  #                NUMBER CORRESPONDING TO ACTUAL THRUST (FP).  THUS THE TOTAL
035191,000133:                                                                                                  #                THROTTLE COMMAND PIF = FC - FP - (FMAXODD - FP) = FC - FMAXODD.
035192,000134: 
035193,000135: 31,2302           03740        DOPIF              TC       FASTCHNG                              
035194,000136: 31,2303           00006                           EXTEND                                         
035195,000137: 31,2304           31466                           DCA      FCODD                                 
035196,000138: 31,2305           55620                           TS       FCOLD                                 
035197,000139: 31,2306           53613                           DXCH     PIF                                   
035198,000140: 31,2307           00006                           EXTEND                                         

Page 795

035200,000142: 31,2310           41470                           DCS      FP                                    
035201,000143: 31,2311           21613                           DAS      PIF                                   #  PIF = FC - FP, NEVER EQUALS +0
035202,000144: 
035203,000145: 31,2312           31612        DOIT               CA       PIF                                   
035204,000146: 31,2313           61606                           AD       PIFPSET                               #  ADD IN PIFPSET, WITHOUT CHANGING PIF
035205,000147: 31,2314           55614                           TS       PSEUDO55                              
035206,000148: 31,2315           54055                           TS       THRUST                                
035207,000149: 31,2316           34750                           CAF      BIT4                                  
035208,000150: 31,2317           00006                           EXTEND                                         
035209,000151: 31,2320           05014                           WOR      CHAN14                                
035210,000152: 31,2321           30025                           CA       TIME1                                 
035211,000153: 31,2322           55617                           TS       TTHROT                                
035212,000154: 
035213,000155:                                                                                                  #  SINCE /AF/ IS NOT AN INSTANTANEOUS ACCELERATION, BUT RATHER AN "AVERAGE" OF THE ACCELERATION LEVELS DURING
035214,000156:                                                                                                  #  THE PRECEEDING PIPA INTERVAL, AND SINCE FP IS COMPUTED DIRECTLY FROM /AF/, FP IN ORDER TO CORRESPOND TO THE
035215,000157:                                                                                                  #  ACTUAL THRUST LEVEL AT THE END OF THE INTERVAL MUST BE WEIGHTED BY
035216,000158: 
035217,000159:                                                                                                  #                  PIF(PPROCESS + TL)     PIF /PIF/
035218,000160:                                                                                                  #        FWEIGHT = ------------------ + -------------
035219,000161:                                                                                                  #                       PGUID           2 PGUID FRATE
035220,000162: 
035221,000163:                                                                                                  #  WHERE PPROCESS IS THE TIME BETWEEN PIPA READING AND THE START OF THROTTLING, PGUID IS THE GUIDANCE PERIOD, AND
035222,000164:                                                                                                  #  FRATE IS THE THROTTLING RATE (32 UNITS PER CENTISECOND).  PGUID IS EITHER 1 OR 2 SECONDS.  THE "TL" IN THE
035223,000165:                                                                                                  #  FIRST TERM REPRESENTS THE ENGINE'S RESPONSE LAG.  HERE FWEIGHT IS COMPUTED FOR USE NEXT PASS.
035224,000166: 
035225,000167: 31,2323           31762                           CA       THISTPIP   +1                         #  INITIALIZE FWEIGHT COMP AS IF FOR P66
035226,000168: 31,2324           54130                           TS       BUF                                   
035227,000169: 
035228,000170: 31,2325           41011                           CS       MODREG                                #  ARE WE IN FACT IN P66?
035229,000171: 31,2326           62501                           AD       DEC66                                 
035230,000172: 31,2327           00006                           EXTEND                                         
035231,000173: 31,2330           12335                           BZF      FWCOMP                                #  YES
035232,000174: 
035233,000175: 31,2331           31235                           CA       PIPTIME    +1                         #  NO:  INITIALIZE FOR TWO SECOND PERIOD
035234,000176: 31,2332           54130                           TS       BUF                                   
035235,000177: 31,2333           35003                           CAF      4SECS                                 
035236,000178: 31,2334           12336                           TCF      FWCOMP     +1                         
035237,000179: 
035238,000180: 31,2335           35000        FWCOMP             CAF      2SECS                                 
035239,000181: 31,2336           54002                 +1        TS       Q                                     
035240,000182: 31,2337           00006                           EXTEND                                         
035241,000183: 31,2340           74746                           MP       BIT6                                  
035242,000184: 31,2341           22131                           LXCH     BUF        +1                         
035243,000185: 31,2342           40130                           CS       BUF                                   #  TIME OF LAST PIPA READING.
035244,000186: 31,2343           60025                           AD       TIME1                                 
035245,000187: 31,2344           62004                           AD       THROTLAG                              #  COMPENSATE FOR ENGINE RESPONSE LAG
035246,000188: 31,2345           74357                           MASK     LOW8                                  #  MAKE SURE SMALL AND POSITIVE
035247,000189: 31,2346           22007                           ZL                                             
035248,000190: 31,2347           00006                           EXTEND                                         

Page 796

035250,000192: 31,2350           10002                           DV       Q                                     
035251,000193: 31,2351           00006                           EXTEND                                         
035252,000194: 31,2352           71612                           MP       PIF                                   
035253,000195: 31,2353           60000                           DOUBLE                                         
035254,000196: 31,2354           53611                           DXCH     FWEIGHT                               
035255,000197: 31,2355           11612                           CCS      PIF                                   
035256,000198: 31,2356           64753                           AD       ONE                                   
035257,000199: 31,2357           12361                           TCF      +2                                    
035258,000200: 31,2360           64753                           AD       ONE                                   
035259,000201: 31,2361           00006                           EXTEND                                         
035260,000202: 31,2362           71612                           MP       PIF                                   
035261,000203: 31,2363           00006                           EXTEND                                         
035262,000204: 31,2364           10131                           DV       BUF        +1                         
035263,000205: 31,2365           22007                           ZL                                             
035264,000206: 31,2366           21611                           DAS      FWEIGHT                               
035265,000207: 
035266,000208: 31,2367           01607        THDUMP             TC       RTNHOLD                               
035267,000209: 
035268,000210:                                                                                                  #  FLATOUT THROTTLES UP THE DESCENT ENGINE, AND IS CALLED AS A BASIC SUBROUTINE.
035269,000211: 
035270,000212: 31,2370           34737        FLATOUT            CAF      BIT13                                 #  4096 PULSES
035271,000213: 31,2371           55606        WHATOUT            TS       PIFPSET                               #  USE PIFPSET SO FWEIGHT WILL BE ZERO
035272,000214: 31,2372           44755                           CS       ZERO                                  
035273,000215: 31,2373           55620                           TS       FCOLD                                 
035274,000216: 31,2374           55612                           TS       PIF                                   
035275,000217: 31,2375           00006                           EXTEND                                         
035276,000218: 31,2376           23607                           QXCH     RTNHOLD                               
035277,000219: 31,2377           12312                           TCF      DOIT                                  
035278,000220: 
035279,000221:                                                                                                  #  MASSMULT SCALES ACCELERATION, ARRIVING IN A AND L IN UNITS OF 2(-4) M/CS/CS, TO FORCE IN PULSE UNITS.
035280,000222: 
035281,000223: 31,2400           00006        MASSMULT           EXTEND                                         
035282,000224: 31,2401           22130                           QXCH     BUF                                   
035283,000225: 31,2402           52155                           DXCH     MPAC                                  
035284,000226: 31,2403           07103                           TC       DMP                                   
035285,000227: 31,2404           01244                           ADRES    MASS                                  
035286,000228: 31,2405           07103                           TC       DMP                                   #  LEAVES PROPERLY SCALED FORCE IM MPAC
035287,000229: 31,2406           02005                           ADRES    SCALEFAC                              
035288,000230: 31,2407           07257                           TC       TPAGREE                               
035289,000231: 31,2410           30154                           CA       MPAC                                  
035290,000232: 31,2411           00006                           EXTEND                                         
035291,000233: 31,2412           12415                           BZF      +3                                    
035292,000234: 31,2413           34733                           CAF      POSMAX                                
035293,000235: 31,2414           00130                           TC       BUF                                   
035294,000236: 31,2415           52156                           DXCH     MPAC       +1                         
035295,000237: 31,2416           00130                           TC       BUF                                   

Page 797

035297,000239:                                                                                                  #  CONSTANTS:-
035298,000240: 
035299,000241: 31,2417     4737               FEXTRA             =        BIT13                                 #  FEXT +5.13309020 E+4
035300,000242: 
035301,000243: 31,2417           04143        /AF/CNST           DEC      .13107                                
035302,000244: 
035303,000245:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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