Source Code

These source-code files were from the printout at the MIT Museum, with many thanks to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing it to us. The printout was digitally photographed by Paul Fjeld. A team of volunteers transcribed the source code manually from these images or, where appropriate, modified already-transcribed but similar source Luminary 131 (Apollo 13) source code to agree with the images from the printout. Note that the page images presented online are of reduced quality, and that higher-quality images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 001 OF AGC PROGRAM LMY99 BY NASA 2021112-061
	16:27 JULY 14,1969
Note that the date is the date of the printout, not the date of the program revision.

036598,000002:                                                                                                  ## Copyright:   Public domain.
036599,000003:                                                                                                  ## Filename:    P12.agc
036600,000004:                                                                                                  ## Purpose:     Part of the source code for Luminary 1A build 099.
036601,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
036602,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 11.
036603,000007:                                                                                                  ## Assembler:   yaYUL
036604,000008:                                                                                                  ## Contact:     Hartmuth Gutsche <hgutsche@xplornet.com>.
036605,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo.
036606,000010:                                                                                                  ## Pages:       838-842
036607,000011:                                                                                                  ## Mod history: 2009-05-23 HG   Transcribed from page images.
036608,000012:                                                                                                  ##              2016-12-13 RSB  GOTOP00H -> GOTOPOOH
036609,000013:                                                                                                  ##              2016-12-17 RSB  Proofed text comments with octopus/ProoferComments
036610,000014:                                                                                                  ##                              and corrected the errors found.
036611,000015:                                                                                                  ##              2017-01-28 RSB  Back-ported a comment fix from Luminary 69.
036612,000016:                                                                                                  ##              2017-08-26 MAS  Fixed a comment-text error found while transcribing
036613,000017:                                                                                                  ##                              Zerlina 56.
036614,000018:                                                                                                  ##
036615,000019:                                                                                                  ## This source code has been transcribed or otherwise adapted from
036616,000020:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
036617,000021:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
036618,000022:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
036619,000023:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
036620,000024:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
036621,000025:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
036622,000026:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
036623,000027:                                                                                                  ## actually created.
036624,000028:                                                                                                  ##
036625,000029:                                                                                                  ## Notations on the hardcopy document read, in part:
036626,000030:                                                                                                  ##
036627,000031:                                                                                                  ##      Assemble revision 001 of AGC program LMY99 by NASA 2021112-61
036628,000032:                                                                                                  ##      16:27 JULY 14, 1969 
036629,000033: 

Page 838

036631,000035: 24,3670                                           BANK     24                                    
036632,000036: 30,2000                                           SETLOC   P12                                   
036633,000037: 30,2000                                           BANK                                           
036634,000038: 
036635,000039: 30,2061  E7,1515                                  EBANK=   DVCNTR                                
036636,000040: 30,2061                                           COUNT*   $$/P12                                
036637,000041: 
036638,000042: 30,2061           05353        P12LM              TC       PHASCHNG                              
036639,000043: 30,2062           04024                           OCT      04024                                 
036640,000044: 
036641,000045: 30,2063           04616                           TC       BANKCALL                              
036642,000046: 30,2064           11254                           CADR     R02BOTH                               #  CHECK THE STATUS OF THE IMU.
036643,000047: 
036644,000048: 30,2065           05504                           TC       UPFLAG                                
036645,000049: 30,2066           00141                           ADRES    MUNFLAG                               
036646,000050: 
036647,000051: 30,2067           05504                           TC       UPFLAG                                #  INSURE 4-JET TRANSLATION CAPABILITY.
036648,000052: 30,2070           00307                           ADRES    ACC4-2FL                              
036649,000053: 
036650,000054: 30,2071           05504                           TC       UPFLAG                                #  PREVENT R10 FROM ISSUING CROSS-POINTER
036651,000055: 30,2072           00015                           ADRES    R10FLAG                               #  OUTPUTS.
036652,000056: 
036653,000057: 30,2073           06011                           TC       CLRADMOD                              #  INITIALIZE RADMODES FOR R29.
036654,000058: 
036655,000059: 30,2074           05516                           TC       DOWNFLAG                              #  CLEAR RENDEZVOUS FLAG  FOR P22
036656,000060: 30,2075           00010                           ADRES    RNDVZFLG                              
036657,000061: 
036658,000062: 30,2076           36000                           CAF      THRESH2                               #  INITIALIZE DVMON
036659,000063: 30,2077           55251                           TS       DVTHRUSH                              
036660,000064: 30,2100           34751                           CAF      FOUR                                  
036661,000065: 30,2101           55515                           TS       DVCNTR                                
036662,000066: 
036663,000067: 30,2102           34755                           CA       ZERO                                  
036664,000068: 30,2103           55462                           TS       TRKMKCNT                              #  SHOW THAT R29 DOWNLINK DATA ISN'T READY.
036665,000069: 30,2104           33035                           CAF      V06N33A                               
036666,000070: 30,2105           04616                           TC       BANKCALL                              #  FLASH TIG
036667,000071: 30,2106           20476                           CADR     GOFLASH                               
036668,000072: 30,2107           16001                           TCF      GOTOPOOH                              
036669,000073: 30,2110           12112                           TCF      +2                                    #  PROCEED
036670,000074: 30,2111           12104                           TCF      -5                                    #  ENTER
036671,000075: 
036672,000076: 30,2112           05353                           TC       PHASCHNG                              
036673,000077: 30,2113           04024                           OCT      04024                                 
036674,000078: 
036675,000079: 30,2114           06037                           TC       INTPRET                               
036676,000080: 30,2115           77624                           CALL                                           #  INITIALIZE WM AND /LAND/
036677,000081: 30,2116           46432                                    GUIDINIT                              
036678,000082: 30,2117           45014                           SET      CALL                                  
036679,000083: 30,2120           04464                                    FLPI                                  
036680,000084: 30,2121           60254                                    P12INIT                               

Page 839

036682,000086: 30,2122           77745        P12LMB             DLOAD                                          
036683,000087: 30,2123           25761                                    (TGO)A                                #  SET TGO TO AN INITIAL NOMINAL VALUE.
036684,000088: 30,2124           17517                           STODL    TGO                                   
036685,000089: 30,2125           03442                                    TIG                                   
036686,000090: 30,2126           34041                           STCALL   TDEC1                                 
036687,000091: 30,2127           27057                                    LEMPREC                               #  ROTATE THE STATE VECTORS TO THE
036688,000092: 30,2130           64375                           VLOAD    MXV                                   #  IGNITION TIME.
036689,000093: 30,2131           00007                                    VATT                                  
036690,000094: 30,2132           01734                                    REFSMMAT                              
036691,000095: 30,2133           77772                           VSL1                                           
036692,000096: 30,2134           27601                           STOVL    V1S                                   #  COMPUTE V1S = VEL(TIG)*2(-7) M/CS.
036693,000097: 30,2135           00001                                    RATT                                  
036694,000098: 30,2136           52521                           MXV      VSL6                                  
036695,000099: 30,2137           01734                                    REFSMMAT                              
036696,000100: 30,2140           37521                           STCALL   R                                     #  COMPUTE R = POS(TIG)*2(-24) M.
036697,000101: 30,2141           67130                                    MUNGRAV                               #  COMPUTE GDT1/2(TIG)*2(-7)M/CS.
036698,000102: 30,2142           53575                           VLOAD    UNIT                                  
036699,000103: 30,2143           03521                                    R                                     
036700,000104: 30,2144           37537                           STCALL   UNIT/R/                               #  COMPUTE UNIT/R/ FOR YCOMP.
036701,000105: 30,2145           57312                                    YCOMP                                 
036702,000106: 30,2146           57461                           SR       DCOMP                                 
036703,000107: 30,2147           20606                                    5D                                    
036704,000108: 30,2150           17643                           STODL    XRANGE                                #  INITIALIZE XRANGE FOR NOUN 76.
036705,000109: 30,2151           06456                                    VINJNOM                               
036706,000110: 30,2152           16277                           STODL    ZDOTD                                 
036707,000111: 30,2153           06460                                    RDOTDNOM                              
036708,000112: 30,2154           02273                           STORE    RDOTD                                 
036709,000113: 30,2155           77776                           EXIT                                           
036710,000114: 
036711,000115: 30,2156           05353                           TC       PHASCHNG                              
036712,000116: 30,2157           04024                           OCT      04024                                 
036713,000117: 
036714,000118: 30,2160           33034        NEWLOAD            CAF      V06N76                                #  FLASH CROSS-RANGE AND APOLUNE VALUES.
036715,000119: 30,2161           04616                           TC       BANKCALL                              
036716,000120: 30,2162           20476                           CADR     GOFLASH                               
036717,000121: 30,2163           16001                           TCF      GOTOPOOH                              
036718,000122: 30,2164           12166                           TCF      +2                                    #  PROCEED
036719,000123: 30,2165           12160                           TCF      NEWLOAD                               #  ENTER NEW DATA.
036720,000124: 
036721,000125: 30,2166           32320                           CAF      P12ADRES                              
036722,000126: 30,2167           55455                           TS       WHICH                                 
036723,000127: 
036724,000128: 30,2170           05353                           TC       PHASCHNG                              
036725,000129: 30,2171           04024                           OCT      04024                                 
036726,000130: 
036727,000131: 30,2172           06037                           TC       INTPRET                               
036728,000132: 30,2173           54345                           DLOAD    SL                                    
036729,000133: 30,2174           03643                                    XRANGE                                
036730,000134: 30,2175           20206                                    5D                                    
036731,000135: 30,2176           77615                           DAD                                            

Page 840

036733,000137: 30,2177           02335                                    Y                                     
036734,000138: 30,2200           27633                           STOVL    YCO                                   
036735,000139: 30,2201           03537                                    UNIT/R/                               
036736,000140: 30,2202           53361                           VXSC     VAD                                   
036737,000141: 30,2203           06454                                    49FPS                                 
036738,000142: 30,2204           03601                                    V1S                                   
036739,000143: 30,2205           03527                           STORE    V                                     #  V(TIPOVER) = V(IGN) + 57FPS (UNIT/R/)
036740,000144: 30,2206           72441                           DOT      SL1                                   
036741,000145: 30,2207           03537                                    UNIT/R/                               
036742,000146: 30,2210           27474                           STOVL    RDOT                                  #  RDOT * 2(-7)
036743,000147: 30,2211           03537                                    UNIT/R/                               
036744,000148: 30,2212           53435                           VXV      UNIT                                  
036745,000149: 30,2213           03720                                    QAXIS                                 
036746,000150: 30,2214           03726                           STORE    ZAXIS1                                
036747,000151: 30,2215           77614                           SETGO                                          
036748,000152: 30,2216           04421                                    FLVR                                  
036749,000153: 30,2217           60321                                    ASCENT                                
036750,000154: 30,2220           77745        P12RET             DLOAD                                          
036751,000155: 30,2221           02361                                    ATP                                   #  ATP(2)*2(18)
036752,000156: 30,2222           65316                           DSQ      PDDL                                  
036753,000157: 30,2223           02355                                    ATY                                   #  ATY(2)*2(18)
036754,000158: 30,2224           43316                           DSQ      DAD                                   
036755,000159: 30,2225           75454                           BZE      SQRT                                  
036756,000160: 30,2226           60232                                    YAWDUN                                
036757,000161: 30,2227           55352                           SL1      BDDV                                  
036758,000162: 30,2230           02355                                    ATY                                   
036759,000163: 30,2231           77736                           ARCSIN                                         
036760,000164: 30,2232           26363        YAWDUN             STOVL    YAW                                   
036761,000165: 30,2233           03254                                    UNFC/2                                
036762,000166: 30,2234           50256                           UNIT     DOT                                   
036763,000167: 30,2235           03537                                    UNIT/R/                               
036764,000168: 30,2236           65552                           SL1      ARCCOS                                
036765,000169: 30,2237           77676                           DCOMP                                          
036766,000170: 30,2240           02365                           STORE    PITCH                                 
036767,000171: 30,2241           77776                           EXIT                                           
036768,000172: 30,2242           05353                           TC       PHASCHNG                              
036769,000173: 30,2243           04024                           OCT      04024                                 
036770,000174: 
036771,000175: 30,2244           05516                           TC       DOWNFLAG                              
036772,000176: 30,2245           00213                           ADRES    FLPI                                  
036773,000177: 
036774,000178: 30,2246           00004                           INHINT                                         
036775,000179: 30,2247           04674                           TC       IBNKCALL                              
036776,000180: 30,2250           40142                           CADR     PFLITEDB                              
036777,000181: 30,2251           00003                           RELINT                                         
036778,000182: 
036779,000183: 30,2252           04635                           TC       POSTJUMP                              
036780,000184: 30,2253           74126                           CADR     BURNBABY                              
036781,000185: 
036782,000186: 30,2254           77745        P12INIT            DLOAD                                          #  INITIALIZE ENGINE DATA.  USED FOR P12 AND

Page 841

036784,000188: 30,2255           16013                                    (1/DV)A                               #  P71.
036785,000189: 30,2256           03641                           STORE    1/DV3                                 
036786,000190: 30,2257           03637                           STORE    1/DV2                                 
036787,000191: 30,2260           17635                           STODL    1/DV1                                 
036788,000192: 30,2261           16017                                    (AT)A                                 
036789,000193: 30,2262           16263                           STODL    AT                                    
036790,000194: 30,2263           16021                                    (TBUP)A                               
036791,000195: 30,2264           16271                           STODL    TBUP                                  
036792,000196: 30,2265           34013                                    ATDECAY                               
036793,000197: 30,2266           54276                           DCOMP    SL                                    
036794,000198: 30,2267           20214                                    11D                                   
036795,000199: 30,2270           02267                           STORE    TTO                                   
036796,000200: 30,2271           57535                           SLOAD    DCOMP                                 
036797,000201: 30,2272           26001                                    APSVEX                                
036798,000202: 30,2273           77702                           SR2                                            
036799,000203: 30,2274           02265                           STORE    VE                                    
036800,000204: 30,2275           43414                           BOFF     RVQ                                   
036801,000205: 30,2276           04747                                    FLAP                                  
036802,000206: 30,2277           60300                                    COMMINIT                              
036803,000207: 30,2300           43345        COMMINIT           DLOAD    DAD                                   #  INITIALIZE TARGET DATA.  USED BY P12, P70
036804,000208: 30,2301           25757                                    HINJECT                               #  AND P71 IF IT DOES NOT FOLLOW P70.
036805,000209: 30,2302           02333                                    /LAND/                                
036806,000210: 30,2303           17631                           STODL    RCO                                   
036807,000211: 30,2304           06522                                    HI6ZEROS                              
036808,000212: 30,2305           03654                           STORE    TXO                                   
036809,000213: 30,2306           03633                           STORE    YCO                                   
036810,000214: 30,2307           02273                           STORE    RDOTD                                 
036811,000215: 30,2310           26275                           STOVL    YDOTD                                 
036812,000216: 30,2311           01563                                    VRECTCSM                              
036813,000217: 30,2312           64235                           VXV      MXV                                   
036814,000218: 30,2313           01555                                    RRECTCSM                              
036815,000219: 30,2314           01734                                    REFSMMAT                              
036816,000220: 30,2315           77656                           UNIT                                           
036817,000221: 30,2316           03720                           STORE    QAXIS                                 
036818,000222: 30,2317           77616                           RVQ                                            
036819,000223: 30,2320           02022        P12ADRES           REMADR   P12TABLE                              
036820,000224: 
036821,000225: 23,2000                                           SETLOC   P12A                                  
036822,000226: 23,2000                                           BANK                                           
036823,000227: 23,2432                                           COUNT*   $$/P12                                
036824,000228: 
036825,000229: 23,2432           40220        GUIDINIT           STQ      SETPD                                 
036826,000230: 23,2433           01164                                    TEMPR60                               
036827,000231: 23,2434           00001                                    0D                                    
036828,000232: 23,2435           41575                           VLOAD    PUSH                                  
036829,000233: 23,2436           06514                                    UNITZ                                 
036830,000234: 23,2437           41434                           RTB      PUSH                                  
036831,000235: 23,2440           21573                                    LOADTIME                              
036832,000236: 23,2441           77624                           CALL                                           
036833,000237: 23,2442           55716                                    RP-TO-R                               

Page 842

036835,000239: 23,2443           74321                           MXV      VXSC                                  
036836,000240: 23,2444           01734                                    REFSMMAT                              
036837,000241: 23,2445           16027                                    MOONRATE                              
036838,000242: 23,2446           26325                           STOVL    WM                                    
036839,000243: 23,2447           02023                                    RLS                                   
036840,000244: 23,2450           52446                           ABVAL    SL3                                   
036841,000245: 23,2451           36333                           STCALL   /LAND/                                
036842,000246: 23,2452           01164                                    TEMPR60                               
036843,000247: 
036844,000248: 23,2453           00046 07374  49FPS              2DEC     .149352    B-6                        #  EXPECTED RDOT AT TIPOVER
036845,000249: 23,2455           04145 15527  VINJNOM            2DEC     16.7924    B-7                        #  5509.5 FPS(APO=30NM WITH RDOT=19.5FPS)
036846,000250: 23,2457           00007 23346  RDOTDNOM           2DEC     .059436    B-7                        #  19.5 FPS
036847,000251: 
036848,000252: 

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