Source Code

These source code files are an attempted reconstruction of Sundance revision 306, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
These dumps were then modified using memos, checklists, observed address changes, and the Sundance GSOPs to get the entire program to match Sundance revision 306 as closely as possible. Without more information, it is not possible to say how close it actually is; however, this code should be quite close. It is capable of flying the whole Apollo 9 mission using the original checklists and padload. Since only binary dumps (rather than listings) of Sundance are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

031488,000002:                                                                                                  ## Copyright:   Public domain.
031489,000003:                                                                                                  ## Filename:    THROTTLE_CONTROL_ROUTINES.agc
031490,000004:                                                                                                  ## Purpose:     A section of an attempt to reconstruct Sundance revision 306
031491,000005:                                                                                                  ##              as closely as possible with available information. Sundance
031492,000006:                                                                                                  ##              306 is the source code for the Lunar Module's (LM) Apollo
031493,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 9. This program was created
031494,000008:                                                                                                  ##              using the mixed-revision SundanceXXX as a starting point, and
031495,000009:                                                                                                  ##              pulling back features from Luminary 69 believed to have been
031496,000010:                                                                                                  ##              added based on memos, checklists, observed address changes,
031497,000011:                                                                                                  ##              or the Sundance GSOPs.
031498,000012:                                                                                                  ## Assembler:   yaYUL
031499,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
031500,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
031501,000015:                                                                                                  ## Mod history: 2020-07-24 MAS  Created from SundanceXXX.
031502,000016: 
031503,000017: 
031504,000018: 
031505,000019: 31,2235                                           BANK     31                                    
031506,000020: 31,2000                                           SETLOC   FTHROT                                
031507,000021: 31,2000                                           BANK                                           
031508,000022: 31,2235  E7,1417                                  EBANK=   PIF                                   
031509,000023: 31,2235                                           COUNT*   $$/THROT                              
031510,000024: 
031511,000025:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
031512,000026:                                                                                                  #  HERE FC, DESIRED THRUST, AND FP, PRESENT THRUST, UNWEIGHTED, ARE COMPUTED.
031513,000027: 
031514,000028: 31,2235           31245        THROTTLE           CA       ABDELV                                #  COMPUTE PRESENT ACCELERATION IN UNITS OF
031515,000029: 31,2236           00006                           EXTEND                                         #  2(-4) M/CS/CS, SAVING SERVICER TROUBLE
031516,000030: 31,2237           72414                           MP       /AF/CNST                              
031517,000031: 31,2240           00006                 +3        EXTEND                                         
031518,000032: 31,2241           23600                           QXCH     RTNHOLD                               
031519,000033: 31,2242           02373        AFDUMP             TC       MASSMULT                              
031520,000034: 31,2243           53553                           DXCH     FP                                    #  FP = PRESENT THRUST
031521,000035: 31,2244           00006                           EXTEND                                         
031522,000036: 31,2245           31570                           DCA      /AFC/                                 
031523,000037: 31,2246           02373                           TC       MASSMULT                              
031524,000038: 31,2247           53551                           DXCH     FCODD                                 #  FCODD = WHAT IT IS GOING TO GET
031525,000039: 
031526,000040:                                                                                                  #  IF IT HAS BEEN LESS THAN 3 SECONDS SINCE THE LAST THROTTLING, AUGMENT FP USING THE FWEIGHT CALCULATED THEN.
031527,000041: 
031528,000042: 31,2250           41604                           CS       TTHROT                                #  THIS CODING ASSUMES A FLATOUT WITHIN
031529,000043: 31,2251           60025                           AD       TIME1                                 #    80 SECONDS BEFORE FIRST THROTTLE CALL
031530,000044: 31,2252           75006                           MASK     POSMAX                                
031531,000045: 31,2253           40000                           COM                                            
031532,000046: 31,2254           65052                           AD       3SECS                                 
031533,000047: 31,2255           00006                           EXTEND                                         
031534,000048: 31,2256           62262                           BZMF     WHERETO                               #  BRANCH IF (TIME1-TTHROT +1) > 3 SECONDS
031535,000049: 31,2257           00006                           EXTEND                                         
031536,000050: 31,2260           31602                           DCA      FWEIGHT                               
031537,000051: 31,2261           21553                           DAS      FP                                    
031538,000052: 
031539,000053:                                                                                                  #      THIS LOGIC DETERMINES THE THROTTLING IN THE REGION 10% - 94%.  THE MANUAL THROTTLE, NOMINALLY SET AT
031540,000054:                                                                                                  #  MINIMUM BY ASTRONAUT OR MISSION CONTROL PROGRAMS, PROVIDES THE LOWER BOUND.  A STOP IN THE THROTTLE HARDWARE
031541,000055:                                                                                                  #  PROVIDES THE UPPER.
031542,000056: 
031543,000057: 31,2262           45030        WHERETO            CS       ZERO                                  #  INITIALIZE PIFPSET
031544,000058: 31,2263           55577                           TS       PIFPSET                               
031545,000059: 31,2264           42407                           CS       HIGHCRIT                              
031546,000060: 31,2265           61657                           AD       FCOLD                                 
031547,000061: 31,2266           00006                           EXTEND                                         
031548,000062: 31,2267           62301                           BZMF     LOWFCOLD                              #  BRANCH IF FCOLD < OR = HIGHCRIT
031549,000063: 31,2270           42410                           CS       LOWCRIT                               
031550,000064: 31,2271           61550                           AD       FCODD                                 
031551,000065: 31,2272           00006                           EXTEND                                         
031552,000066: 31,2273           62276                           BZMF     FCOMPSET                              #  BRANCH IF FC < OR = LOWCRIT
031553,000067: 31,2274           31552                           CA       FP                                    #  SEE NOTE 1
031554,000068: 31,2275           12306                           TCF      FLATOUT1                              
031555,000069: 
031556,000070: 31,2276           42405        FCOMPSET           CS       FMAXODD                               #  SEE NOTE 2
031557,000071: 31,2277           61552                           AD       FP                                    
031558,000072: 31,2300           12310                           TCF      FLATOUT2                              
031559,000073: 
031560,000074: 31,2301           42407        LOWFCOLD           CS       HIGHCRIT                              
031561,000075: 31,2302           61550                           AD       FCODD                                 
031562,000076: 31,2303           00006                           EXTEND                                         
031563,000077: 31,2304           62311                           BZMF     DOPIF                                 #  BRANCH IF FC < OR = HIGHCRIT
031564,000078: 
031565,000079: 31,2305           32406                           CA       FMAXPOS                               #  NO:  THROTTLE-UP
031566,000080: 31,2306           53551        FLATOUT1           DXCH     FCODD                                 
031567,000081: 31,2307           35020                           CA       FEXTRA                                
031568,000082: 31,2310           55577        FLATOUT2           TS       PIFPSET                               
031569,000083: 
031570,000084:                                                                                                  #  NOTE 1        FC IS SET EQUAL TO FP SO PIF WILL BE ZERO.  THIS IS DESIRABLE
031571,000085:                                                                                                  #                AS THERE IS ACTUALLY NO THROTTLE CHANGE.
031572,000086: 
031573,000087:                                                                                                  #  NOTE2         HERE, SINCE WE ARE ABOUT TO RETURN TO THE THROTTLEABLE REGION
031574,000088:                                                                                                  #                (BELOW 55%) THE QUANTITY -(FMAXODD-FP) IS COMPUTED AND PUT
031575,000089:                                                                                                  #                INTO PIFPSET TO COMPENSATE FOR THE DIFFERENCE BETWEEN THE
031576,000090:                                                                                                  #                NUMBER OF BITS CORRESPONDING TO FULL THROTTLE (FMAXODD) AND THE
031577,000091:                                                                                                  #                NUMBER CORRESPONDING TO ACTUAL THRUST (FP).  THUS THE TOTAL
031578,000092:                                                                                                  #                THROTTLE COMMAND PIF = FC - FP - (FMAXODD - FP) = FC - FMAXODD.
031579,000093: 
031580,000094: 31,2311           03562        DOPIF              TC       FASTCHNG                              #  RESTART PROTECTION
031581,000095: 31,2312           00006                           EXTEND                                         
031582,000096: 31,2313           31551                           DCA      FCODD                                 
031583,000097: 31,2314           55657                           TS       FCOLD                                 
031584,000098: 31,2315           53420                           DXCH     PIF                                   
031585,000099: 31,2316           00006                           EXTEND                                         
031586,000100: 31,2317           41553                           DCS      FP                                    
031587,000101: 31,2320           21420                           DAS      PIF                                   #  PIF = FC - FP, NEVER EQUALS +0
031588,000102: 
031589,000103: 31,2321           31417        DOIT               CA       PIF                                   
031590,000104: 31,2322           61577                           AD       PIFPSET                               #  ADD IN PIFPSET, WITHOUT CHANGING PIF
031591,000105: 31,2323           55603                           TS       PSEUDO55                              
031592,000106: 31,2324           54055                           TS       THRUST                                
031593,000107: 31,2325           35023                           CAF      BIT4                                  
031594,000108: 31,2326           00006                           EXTEND                                         
031595,000109: 31,2327           05014                           WOR      CHAN14                                
031596,000110: 31,2330           30025                           CA       TIME1                                 
031597,000111: 31,2331           55604                           TS       TTHROT                                
031598,000112: 
031599,000113:                                                                                                  #  SINCE /AF/ IS NOT AN INSTANTANEOUS ACCELERATION, BUT RATHER AN "AVERAGE" OF THE ACCELERATION LEVELS DURING
031600,000114:                                                                                                  #  THE PRECEEDING PIPA INTERVAL, AND SINCE FP IS COMPUTED DIRECTLY FROM /AF/, FP IN ORDER TO CORRESPOND TO THE
031601,000115:                                                                                                  #  ACTUAL THRUST LEVEL AT THE END OF THE INTERVAL MUST BE WEIGHTED BY
031602,000116: 
031603,000117:                                                                                                  #                  PIF(PPROCESS + TL)     PIF /PIF/
031604,000118:                                                                                                  #        FWEIGHT = ------------------ + -------------
031605,000119:                                                                                                  #                       PGUID           2 PGUID FRATE
031606,000120: 
031607,000121:                                                                                                  #  WHERE PPROCESS IS THE TIME BETWEEN PIPA READING AND THE START OF THROTTLING, PGUID IS THE GUIDANCE PERIOD, AND
031608,000122:                                                                                                  #  FRATE IS THE THROTTLING RATE (32 UNITS PER CENTISECOND).  PGUID IS ASSUMED TO BE 2 SECONDS.  THE "TL" IN THE
031609,000123:                                                                                                  #  FIRST TERM REPRESENTS THE ENGINE'S RESPONSE LAG.  HERE FWEIGHT IS COMPUTED FOR USE NEXT PASS.
031610,000124: 
031611,000125: 31,2332           35053                           CA       4SECS                                 
031612,000126: 31,2333           54002                           TS       Q                                     
031613,000127: 31,2334           41234                           CS       PIPTIME    +1                         #  TIME OF LAST PIPA READING
031614,000128: 31,2335           60025                           AD       TIME1                                 
031615,000129: 31,2336           62412                           AD       THROTLAG                              #  COMPENSATE FOR ENGINE RESPONSE LAG
031616,000130: 31,2337           74371                           MASK     LOW8                                  #  MAKE SURE SMALL AND POSITIVE
031617,000131: 31,2340           22007                           ZL                                             
031618,000132: 31,2341           00006                           EXTEND                                         
031619,000133: 31,2342           10002                           DV       Q                                     
031620,000134: 31,2343           00006                           EXTEND                                         
031621,000135: 31,2344           71417                           MP       PIF                                   
031622,000136: 31,2345           60000                           DOUBLE                                         
031623,000137: 31,2346           53602                           DXCH     FWEIGHT                               
031624,000138: 31,2347           32413                           CA       2.PG.FRT                              
031625,000139: 31,2350           54002                           TS       Q                                     
031626,000140: 31,2351           11417                           CCS      PIF                                   
031627,000141: 31,2352           65026                           AD       ONE                                   
031628,000142: 31,2353           12355                           TCF      +2                                    
031629,000143: 31,2354           65026                           AD       ONE                                   
031630,000144: 31,2355           00006                           EXTEND                                         
031631,000145: 31,2356           71417                           MP       PIF                                   
031632,000146: 31,2357           00006                           EXTEND                                         
031633,000147: 31,2360           10002                           DV       Q                                     
031634,000148: 31,2361           22007                           ZL                                             
031635,000149: 31,2362           21602                           DAS      FWEIGHT                               
031636,000150: 
031637,000151: 31,2363           01600        THDUMP             TC       RTNHOLD                               
031638,000152: 
031639,000153:                                                                                                  #  FLATOUT THROTTLES UP THE DESCENT ENGINE, AND IS CALLED AS A BASIC SUBROUTINE.
031640,000154: 
031641,000155: 31,2364           35012        FLATOUT            CAF      BIT13                                 #  4096 PULSES
031642,000156: 31,2365           55577        WHATOUT            TS       PIFPSET                               #  USE PIFPSET SO FWEIGHT WILL BE ZERO
031643,000157: 31,2366           45030                           CS       ZERO                                  
031644,000158: 31,2367           55417                           TS       PIF                                   
031645,000159: 31,2370           00006                           EXTEND                                         
031646,000160: 31,2371           23600                           QXCH     RTNHOLD                               
031647,000161: 31,2372           12321                           TCF      DOIT                                  
031648,000162: 
031649,000163:                                                                                                  #  MASSMULT SCALES ACCELERATION, ARRIVING IN A AND L IN UNITS OF 2(-4) M/CS/CS, TO FORCE IN PULSE UNITS.
031650,000164: 
031651,000165: 31,2373           00006        MASSMULT           EXTEND                                         
031652,000166: 31,2374           22130                           QXCH     BUF                                   
031653,000167: 31,2375           00006                           EXTEND                                         
031654,000168: 31,2376           71243                           MP       MASS                                  #  LEAVES ODDLY SCALED FORCE IN A AND L
031655,000169: 31,2377           52155                           DXCH     MPAC                                  
031656,000170: 31,2400           07057                           TC       DMP                                   #  LEAVES PROPERLY SCALED FORCE IM MPAC
031657,000171: 31,2401           02415                           ADRES    SCALEFAC                              
031658,000172: 31,2402           52156                           DXCH     MPAC       +1                         
031659,000173: 31,2403           00130                           TC       BUF                                   
031660,000174: 
031661,000175:                                                                                                  #  CONSTANTS:-
031662,000176: 
031663,000177: 31,2404           07452        FMAXMAX            DEC      +3882      B-14                       
031664,000178: 31,2405           07432        FMAXODD            DEC      +3866      B-14                       #  THROTTLE SATURATION THRESHOLD
031665,000179: 31,2406           07100        FMAXPOS            DEC      +3648      B-14                       #  FMAX    43245 NEWTONS
031666,000180: 31,2407           04616        HIGHCRIT           DEC      2446       B-14                       
031667,000181: 31,2410           04127        LOWCRIT            DEC      2135       B-14                       
031668,000182: 31,2411     5020               FEXTRA             =        BIT7                                  
031669,000183: 31,2411           00666        DEC438             DEC      438        B-14                       
031670,000184: 31,2412           00024        THROTLAG           DEC      20         B-14                       #  EMPIRICALLY DETERMINED THROTTLE LAG TIME
031671,000185: 31,2413           31000        2.PG.FRT           DEC      12800      B-14                       
031672,000186: 31,2414           04143        /AF/CNST           DEC      .13107                                
031673,000187: 31,2415           00317 31157  SCALEFAC           2DEC     51.947     B-12                       #  SCALES A (AT 2(-4) M/CS/CS) TIMES MASS
031674,000188:                                                                                                  #  (AT 2(16) KGS. ) TO PULSE UNITS.
031675,000189: 
031676,000190:                                                                                                  #  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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