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.

037261,000002:                                                                                                  ## Copyright:   Public domain.
037262,000003:                                                                                                  ## Filename:    P12.agc
037263,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
037264,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the second release
037265,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
037266,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
037267,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
037268,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
037269,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
037270,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
037271,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
037272,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
037273,000014:                                                                                                  ##              the original YUL assembler.
037274,000015:                                                                                                  ##
037275,000016:                                                                                                  ## Assembler:   yaYUL
037276,000017:                                                                                                  ## Contact:     Hartmuth Gutsche <hgutsche@xplornet.com>.
037277,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
037278,000019:                                                                                                  ## Pages:       838-842
037279,000020:                                                                                                  ## Mod history: 2009-05-23 HG   Transcribed from page images.
037280,000021:                                                                                                  ##              2016-12-13 RSB  GOTOP00H -> GOTOPOOH
037281,000022:                                                                                                  ##              2016-12-17 RSB  Proofed text comments with octopus/ProoferComments
037282,000023:                                                                                                  ##                              and corrected the errors found.
037283,000024:                                                                                                  ##              2017-01-28 RSB  Back-ported a comment fix from Luminary 69.
037284,000025:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
037285,000026:                                                                                                  ##              2017-08-26 MAS  Fixed a comment-text error found while transcribing
037286,000027:                                                                                                  ##                              Zerlina 56.
037287,000028: 
037288,000029:                                                                                                  ## This source code has been transcribed or otherwise adapted from
037289,000030:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
037290,000031:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
037291,000032:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
037292,000033:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
037293,000034:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
037294,000035:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
037295,000036:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
037296,000037:                                                                                                  ## actually created.
037297,000038:                                                                                                  ##
037298,000039:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
037299,000040:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
037300,000041:                                                                                                  ## the listing from which it was transcribed. It has been verified to
037301,000042:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
037302,000043:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
037303,000044:                                                                                                  ##
037304,000045:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
037305,000046:                                                                                                  ##
037306,000047:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
037307,000048: 

Page 838

037309,000050: 24,3670                                           BANK     24                                    
037310,000051: 30,2000                                           SETLOC   P12                                   
037311,000052: 30,2000                                           BANK                                           
037312,000053: 
037313,000054: 30,2061  E7,1515                                  EBANK=   DVCNTR                                
037314,000055: 30,2061                                           COUNT*   $$/P12                                
037315,000056: 
037316,000057: 30,2061           05353        P12LM              TC       PHASCHNG                              
037317,000058: 30,2062           04024                           OCT      04024                                 
037318,000059: 
037319,000060: 30,2063           04616                           TC       BANKCALL                              
037320,000061: 30,2064           11254                           CADR     R02BOTH                               #  CHECK THE STATUS OF THE IMU.
037321,000062: 
037322,000063: 30,2065           05504                           TC       UPFLAG                                
037323,000064: 30,2066           00141                           ADRES    MUNFLAG                               
037324,000065: 
037325,000066: 30,2067           05504                           TC       UPFLAG                                #  INSURE 4-JET TRANSLATION CAPABILITY.
037326,000067: 30,2070           00307                           ADRES    ACC4-2FL                              
037327,000068: 
037328,000069: 30,2071           05504                           TC       UPFLAG                                #  PREVENT R10 FROM ISSUING CROSS-POINTER
037329,000070: 30,2072           00015                           ADRES    R10FLAG                               #  OUTPUTS.
037330,000071: 
037331,000072: 30,2073           06011                           TC       CLRADMOD                              #  INITIALIZE RADMODES FOR R29.
037332,000073: 
037333,000074: 30,2074           05516                           TC       DOWNFLAG                              #  CLEAR RENDEZVOUS FLAG  FOR P22
037334,000075: 30,2075           00010                           ADRES    RNDVZFLG                              
037335,000076: 
037336,000077: 30,2076           36000                           CAF      THRESH2                               #  INITIALIZE DVMON
037337,000078: 30,2077           55251                           TS       DVTHRUSH                              
037338,000079: 30,2100           34751                           CAF      FOUR                                  
037339,000080: 30,2101           55515                           TS       DVCNTR                                
037340,000081: 
037341,000082: 30,2102           34755                           CA       ZERO                                  
037342,000083: 30,2103           55462                           TS       TRKMKCNT                              #  SHOW THAT R29 DOWNLINK DATA ISN'T READY.
037343,000084: 30,2104           33035                           CAF      V06N33A                               
037344,000085: 30,2105           04616                           TC       BANKCALL                              #  FLASH TIG
037345,000086: 30,2106           20476                           CADR     GOFLASH                               
037346,000087: 30,2107           16001                           TCF      GOTOPOOH                              
037347,000088: 30,2110           12112                           TCF      +2                                    #  PROCEED
037348,000089: 30,2111           12104                           TCF      -5                                    #  ENTER
037349,000090: 
037350,000091: 30,2112           05353                           TC       PHASCHNG                              
037351,000092: 30,2113           04024                           OCT      04024                                 
037352,000093: 
037353,000094: 30,2114           06037                           TC       INTPRET                               
037354,000095: 30,2115           77624                           CALL                                           #  INITIALIZE WM AND /LAND/
037355,000096: 30,2116           46432                                    GUIDINIT                              
037356,000097: 30,2117           45014                           SET      CALL                                  
037357,000098: 30,2120           04464                                    FLPI                                  
037358,000099: 30,2121           60254                                    P12INIT                               

Page 839

037360,000101: 30,2122           77745        P12LMB             DLOAD                                          
037361,000102: 30,2123           25761                                    (TGO)A                                #  SET TGO TO AN INITIAL NOMINAL VALUE.
037362,000103: 30,2124           17517                           STODL    TGO                                   
037363,000104: 30,2125           03442                                    TIG                                   
037364,000105: 30,2126           34041                           STCALL   TDEC1                                 
037365,000106: 30,2127           27057                                    LEMPREC                               #  ROTATE THE STATE VECTORS TO THE
037366,000107: 30,2130           64375                           VLOAD    MXV                                   #  IGNITION TIME.
037367,000108: 30,2131           00007                                    VATT                                  
037368,000109: 30,2132           01734                                    REFSMMAT                              
037369,000110: 30,2133           77772                           VSL1                                           
037370,000111: 30,2134           27601                           STOVL    V1S                                   #  COMPUTE V1S = VEL(TIG)*2(-7) M/CS.
037371,000112: 30,2135           00001                                    RATT                                  
037372,000113: 30,2136           52521                           MXV      VSL6                                  
037373,000114: 30,2137           01734                                    REFSMMAT                              
037374,000115: 30,2140           37521                           STCALL   R                                     #  COMPUTE R = POS(TIG)*2(-24) M.
037375,000116: 30,2141           67130                                    MUNGRAV                               #  COMPUTE GDT1/2(TIG)*2(-7)M/CS.
037376,000117: 30,2142           53575                           VLOAD    UNIT                                  
037377,000118: 30,2143           03521                                    R                                     
037378,000119: 30,2144           37537                           STCALL   UNIT/R/                               #  COMPUTE UNIT/R/ FOR YCOMP.
037379,000120: 30,2145           57312                                    YCOMP                                 
037380,000121: 30,2146           57461                           SR       DCOMP                                 
037381,000122: 30,2147           20606                                    5D                                    
037382,000123: 30,2150           17643                           STODL    XRANGE                                #  INITIALIZE XRANGE FOR NOUN 76.
037383,000124: 30,2151           06456                                    VINJNOM                               
037384,000125: 30,2152           16277                           STODL    ZDOTD                                 
037385,000126: 30,2153           06460                                    RDOTDNOM                              
037386,000127: 30,2154           02273                           STORE    RDOTD                                 
037387,000128: 30,2155           77776                           EXIT                                           
037388,000129: 
037389,000130: 30,2156           05353                           TC       PHASCHNG                              
037390,000131: 30,2157           04024                           OCT      04024                                 
037391,000132: 
037392,000133: 30,2160           33034        NEWLOAD            CAF      V06N76                                #  FLASH CROSS-RANGE AND APOLUNE VALUES.
037393,000134: 30,2161           04616                           TC       BANKCALL                              
037394,000135: 30,2162           20476                           CADR     GOFLASH                               
037395,000136: 30,2163           16001                           TCF      GOTOPOOH                              
037396,000137: 30,2164           12166                           TCF      +2                                    #  PROCEED
037397,000138: 30,2165           12160                           TCF      NEWLOAD                               #  ENTER NEW DATA.
037398,000139: 
037399,000140: 30,2166           32320                           CAF      P12ADRES                              
037400,000141: 30,2167           55455                           TS       WHICH                                 
037401,000142: 
037402,000143: 30,2170           05353                           TC       PHASCHNG                              
037403,000144: 30,2171           04024                           OCT      04024                                 
037404,000145: 
037405,000146: 30,2172           06037                           TC       INTPRET                               
037406,000147: 30,2173           54345                           DLOAD    SL                                    
037407,000148: 30,2174           03643                                    XRANGE                                
037408,000149: 30,2175           20206                                    5D                                    
037409,000150: 30,2176           77615                           DAD                                            

Page 840

037411,000152: 30,2177           02335                                    Y                                     
037412,000153: 30,2200           27633                           STOVL    YCO                                   
037413,000154: 30,2201           03537                                    UNIT/R/                               
037414,000155: 30,2202           53361                           VXSC     VAD                                   
037415,000156: 30,2203           06454                                    49FPS                                 
037416,000157: 30,2204           03601                                    V1S                                   
037417,000158: 30,2205           03527                           STORE    V                                     #  V(TIPOVER) = V(IGN) + 57FPS (UNIT/R/)
037418,000159: 30,2206           72441                           DOT      SL1                                   
037419,000160: 30,2207           03537                                    UNIT/R/                               
037420,000161: 30,2210           27474                           STOVL    RDOT                                  #  RDOT * 2(-7)
037421,000162: 30,2211           03537                                    UNIT/R/                               
037422,000163: 30,2212           53435                           VXV      UNIT                                  
037423,000164: 30,2213           03720                                    QAXIS                                 
037424,000165: 30,2214           03726                           STORE    ZAXIS1                                
037425,000166: 30,2215           77614                           SETGO                                          
037426,000167: 30,2216           04421                                    FLVR                                  
037427,000168: 30,2217           60321                                    ASCENT                                
037428,000169: 30,2220           77745        P12RET             DLOAD                                          
037429,000170: 30,2221           02361                                    ATP                                   #  ATP(2)*2(18)
037430,000171: 30,2222           65316                           DSQ      PDDL                                  
037431,000172: 30,2223           02355                                    ATY                                   #  ATY(2)*2(18)
037432,000173: 30,2224           43316                           DSQ      DAD                                   
037433,000174: 30,2225           75454                           BZE      SQRT                                  
037434,000175: 30,2226           60232                                    YAWDUN                                
037435,000176: 30,2227           55352                           SL1      BDDV                                  
037436,000177: 30,2230           02355                                    ATY                                   
037437,000178: 30,2231           77736                           ARCSIN                                         
037438,000179: 30,2232           26363        YAWDUN             STOVL    YAW                                   
037439,000180: 30,2233           03254                                    UNFC/2                                
037440,000181: 30,2234           50256                           UNIT     DOT                                   
037441,000182: 30,2235           03537                                    UNIT/R/                               
037442,000183: 30,2236           65552                           SL1      ARCCOS                                
037443,000184: 30,2237           77676                           DCOMP                                          
037444,000185: 30,2240           02365                           STORE    PITCH                                 
037445,000186: 30,2241           77776                           EXIT                                           
037446,000187: 30,2242           05353                           TC       PHASCHNG                              
037447,000188: 30,2243           04024                           OCT      04024                                 
037448,000189: 
037449,000190: 30,2244           05516                           TC       DOWNFLAG                              
037450,000191: 30,2245           00213                           ADRES    FLPI                                  
037451,000192: 
037452,000193: 30,2246           00004                           INHINT                                         
037453,000194: 30,2247           04674                           TC       IBNKCALL                              
037454,000195: 30,2250           40142                           CADR     PFLITEDB                              
037455,000196: 30,2251           00003                           RELINT                                         
037456,000197: 
037457,000198: 30,2252           04635                           TC       POSTJUMP                              
037458,000199: 30,2253           74126                           CADR     BURNBABY                              
037459,000200: 
037460,000201: 30,2254           77745        P12INIT            DLOAD                                          #  INITIALIZE ENGINE DATA.  USED FOR P12 AND

Page 841

037462,000203: 30,2255           16013                                    (1/DV)A                               #  P71.
037463,000204: 30,2256           03641                           STORE    1/DV3                                 
037464,000205: 30,2257           03637                           STORE    1/DV2                                 
037465,000206: 30,2260           17635                           STODL    1/DV1                                 
037466,000207: 30,2261           16017                                    (AT)A                                 
037467,000208: 30,2262           16263                           STODL    AT                                    
037468,000209: 30,2263           16021                                    (TBUP)A                               
037469,000210: 30,2264           16271                           STODL    TBUP                                  
037470,000211: 30,2265           34013                                    ATDECAY                               
037471,000212: 30,2266           54276                           DCOMP    SL                                    
037472,000213: 30,2267           20214                                    11D                                   
037473,000214: 30,2270           02267                           STORE    TTO                                   
037474,000215: 30,2271           57535                           SLOAD    DCOMP                                 
037475,000216: 30,2272           26001                                    APSVEX                                
037476,000217: 30,2273           77702                           SR2                                            
037477,000218: 30,2274           02265                           STORE    VE                                    
037478,000219: 30,2275           43414                           BOFF     RVQ                                   
037479,000220: 30,2276           04747                                    FLAP                                  
037480,000221: 30,2277           60300                                    COMMINIT                              
037481,000222: 30,2300           43345        COMMINIT           DLOAD    DAD                                   #  INITIALIZE TARGET DATA.  USED BY P12, P70
037482,000223: 30,2301           25757                                    HINJECT                               #  AND P71 IF IT DOES NOT FOLLOW P70.
037483,000224: 30,2302           02333                                    /LAND/                                
037484,000225: 30,2303           17631                           STODL    RCO                                   
037485,000226: 30,2304           06522                                    HI6ZEROS                              
037486,000227: 30,2305           03654                           STORE    TXO                                   
037487,000228: 30,2306           03633                           STORE    YCO                                   
037488,000229: 30,2307           02273                           STORE    RDOTD                                 
037489,000230: 30,2310           26275                           STOVL    YDOTD                                 
037490,000231: 30,2311           01563                                    VRECTCSM                              
037491,000232: 30,2312           64235                           VXV      MXV                                   
037492,000233: 30,2313           01555                                    RRECTCSM                              
037493,000234: 30,2314           01734                                    REFSMMAT                              
037494,000235: 30,2315           77656                           UNIT                                           
037495,000236: 30,2316           03720                           STORE    QAXIS                                 
037496,000237: 30,2317           77616                           RVQ                                            
037497,000238: 30,2320           02022        P12ADRES           REMADR   P12TABLE                              
037498,000239: 
037499,000240: 23,2000                                           SETLOC   P12A                                  
037500,000241: 23,2000                                           BANK                                           
037501,000242: 23,2432                                           COUNT*   $$/P12                                
037502,000243: 
037503,000244: 23,2432           40220        GUIDINIT           STQ      SETPD                                 
037504,000245: 23,2433           01164                                    TEMPR60                               
037505,000246: 23,2434           00001                                    0D                                    
037506,000247: 23,2435           41575                           VLOAD    PUSH                                  
037507,000248: 23,2436           06514                                    UNITZ                                 
037508,000249: 23,2437           41434                           RTB      PUSH                                  
037509,000250: 23,2440           21573                                    LOADTIME                              
037510,000251: 23,2441           77624                           CALL                                           
037511,000252: 23,2442           55716                                    RP-TO-R                               

Page 842

037513,000254: 23,2443           74321                           MXV      VXSC                                  
037514,000255: 23,2444           01734                                    REFSMMAT                              
037515,000256: 23,2445           16027                                    MOONRATE                              
037516,000257: 23,2446           26325                           STOVL    WM                                    
037517,000258: 23,2447           02023                                    RLS                                   
037518,000259: 23,2450           52446                           ABVAL    SL3                                   
037519,000260: 23,2451           36333                           STCALL   /LAND/                                
037520,000261: 23,2452           01164                                    TEMPR60                               
037521,000262: 
037522,000263: 23,2453           00046 07374  49FPS              2DEC     .149352    B-6                        #  EXPECTED RDOT AT TIPOVER
037523,000264: 23,2455           04145 15527  VINJNOM            2DEC     16.7924    B-7                        #  5509.5 FPS(APO=30NM WITH RDOT=19.5FPS)
037524,000265: 23,2457           00007 23346  RDOTDNOM           2DEC     .059436    B-7                        #  19.5 FPS
037525,000266: 
037526,000267: 

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