Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 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.

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

Page 793

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

Page 794

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

Page 795

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

Page 796

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

Page 797

035309,000239:                                                                                                  #  CONSTANTS:-
035310,000240: 
035311,000241: 31,2417     4737               FEXTRA             =        BIT13                                 #  FEXT +5.13309020 E+4
035312,000242: 
035313,000243: 31,2417           04143        /AF/CNST           DEC      .13107                                
035314,000244: 
035315,000245:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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