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.

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

Page 838

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

Page 839

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

Page 840

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

Page 841

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

Page 842

037525,000254: 23,2443           74321                           MXV      VXSC                                  
037526,000255: 23,2444           01734                                    REFSMMAT                              
037527,000256: 23,2445           16027                                    MOONRATE                              
037528,000257: 23,2446           26325                           STOVL    WM                                    
037529,000258: 23,2447           02023                                    RLS                                   
037530,000259: 23,2450           52446                           ABVAL    SL3                                   
037531,000260: 23,2451           36333                           STCALL   /LAND/                                
037532,000261: 23,2452           01164                                    TEMPR60                               
037533,000262: 
037534,000263: 23,2453           00046 07374  49FPS              2DEC     .149352    B-6                        #  EXPECTED RDOT AT TIPOVER
037535,000264: 23,2455           04145 15527  VINJNOM            2DEC     16.7924    B-7                        #  5509.5 FPS(APO=30NM WITH RDOT=19.5FPS)
037536,000265: 23,2457           00007 23346  RDOTDNOM           2DEC     .059436    B-7                        #  19.5 FPS
037537,000266: 
037538,000267: 

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