Source Code

These source-code files are part of a reconstructed copy of LM131 revision 1, the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

035516,000002:                                                                                                  ## Copyright:   Public domain.
035517,000003:                                                                                                  ## Filename:    P12.agc
035518,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
035519,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
035520,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
035521,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
035522,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
035523,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
035524,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
035525,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
035526,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
035527,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
035528,000014:                                                                                                  ##              resulting binary is.
035529,000015:                                                                                                  ## Reference:   pp. 831-835
035530,000016:                                                                                                  ## Assembler:   yaYUL
035531,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
035532,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
035533,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
035534,000020: 

Page 831

035536,000022: 24,3700                                           BANK     24                                    
035537,000023: 30,2000                                           SETLOC   P12                                   
035538,000024: 30,2000                                           BANK                                           
035539,000025: 
035540,000026: 30,2061  E7,1515                                  EBANK=   DVCNTR                                
035541,000027: 30,2061                                           COUNT*   $$/P12                                
035542,000028: 
035543,000029: 30,2061           05353        P12LM              TC       PHASCHNG                              
035544,000030: 30,2062           04024                           OCT      04024                                 
035545,000031: 
035546,000032: 30,2063           04616                           TC       BANKCALL                              
035547,000033: 30,2064           11233                           CADR     R02BOTH                               #  CHECK THE STATUS OF THE IMU.
035548,000034: 30,2065           06011                           TC       CLRADMOD                              #  INITIALIZE RADMODES FOR R29.
035549,000035: 30,2066           36000                           CAF      THRESH2                               #  INITIALIZE DVMON
035550,000036: 30,2067           55250                           TS       DVTHRUSH                              
035551,000037: 30,2070           34751                           CAF      FOUR                                  
035552,000038: 30,2071           55515                           TS       DVCNTR                                
035553,000039: 
035554,000040: 30,2072           34755                           CA       ZERO                                  
035555,000041: 30,2073           55462                           TS       TRKMKCNT                              #  SHOW THAT R29 DOWNLINK DATA IS NOT READY
035556,000042: 
035557,000043: 30,2074           33022                           CAF      V06N33A                               
035558,000044: 30,2075           04616                           TC       BANKCALL                              #  FLASH TIG
035559,000045: 30,2076           20477                           CADR     GOFLASH                               
035560,000046: 30,2077           16001                           TCF      GOTOPOOH                              
035561,000047: 30,2100           12102                           TCF      +2                                    #  PROCEED
035562,000048: 30,2101           12074                           TCF      -5                                    #  ENTER
035563,000049: 
035564,000050: 30,2102           05353                           TC       PHASCHNG                              
035565,000051: 30,2103           04024                           OCT      04024                                 
035566,000052: 
035567,000053: 30,2104           06042                           TC       INTPRET                               
035568,000054: 30,2105           43014                           SET      SET                                   
035569,000055: 30,2106           03067                                    MUNFLAG                               
035570,000056: 30,2107           06464                                    ACC4-2FL                              
035571,000057: 30,2110           43014                           SET      CLEAR                                 
035572,000058: 30,2111           00075                                    R10FLAG                               
035573,000059: 30,2112           00270                                    RNDVZFLG                              
035574,000060: 30,2113           43014                           SET      SET                                   
035575,000061: 30,2114           04464                                    FLPI                                  
035576,000062: 30,2115           04461                                    FLVR                                  
035577,000063: 30,2116           77624                           CALL                                           #  INITIALIZE WM AND /LAND/
035578,000064: 30,2117           71343                                    GUIDINIT                              
035579,000065: 30,2120           77624                           CALL                                           
035580,000066: 30,2121           60251                                    P12INIT                               
035581,000067: 30,2122           77745        P12LMB             DLOAD                                          
035582,000068: 30,2123           25740                                    (TGO)A                                #  SET TGO TO AN INITIAL NOMINAL VALUE.
035583,000069: 30,2124           17517                           STODL    TGO                                   

Page 832

035585,000071: 30,2125           03442                                    TIG                                   
035586,000072: 30,2126           34041                           STCALL   TDEC1                                 
035587,000073: 30,2127           27056                                    LEMPREC                               #  ROTATE THE STATE VECTORS TO THE
035588,000074: 30,2130           64375                           VLOAD    MXV                                   #  IGNITION TIME.
035589,000075: 30,2131           00007                                    VATT                                  
035590,000076: 30,2132           01734                                    REFSMMAT                              
035591,000077: 30,2133           77772                           VSL1                                           
035592,000078: 30,2134           27601                           STOVL    V1S                                   #  COMPUTE V1S = VEL(TIG)*2(-7) M/CS.
035593,000079: 30,2135           00001                                    RATT                                  
035594,000080: 30,2136           52521                           MXV      VSL6                                  
035595,000081: 30,2137           01734                                    REFSMMAT                              
035596,000082: 30,2140           37521                           STCALL   R                                     #  COMPUTE R = POS(TIG)*2(-24) M.
035597,000083: 30,2141           67067                                    MUNGRAV                               #  COMPUTE GDT1/2(TIG)*2(-7)M/CS.
035598,000084: 30,2142           53575                           VLOAD    UNIT                                  
035599,000085: 30,2143           03521                                    R                                     
035600,000086: 30,2144           37537                           STCALL   UNIT/R/                               #  COMPUTE UNIT/R/ FOR YCOMP.
035601,000087: 30,2145           57313                                    YCOMP                                 
035602,000088: 30,2146           57461                           SR       DCOMP                                 
035603,000089: 30,2147           20606                                    5D                                    
035604,000090: 30,2150           17643                           STODL    XRANGE                                #  INITIALIZE XRANGE FOR NOUN 76.
035605,000091: 30,2151           31367                                    VINJNOM                               
035606,000092: 30,2152           16277                           STODL    ZDOTD                                 
035607,000093: 30,2153           31371                                    RDOTDNOM                              
035608,000094: 30,2154           02273                           STORE    RDOTD                                 
035609,000095: 30,2155           77776                           EXIT                                           
035610,000096: 
035611,000097: 30,2156           05353                           TC       PHASCHNG                              
035612,000098: 30,2157           04024                           OCT      04024                                 
035613,000099: 
035614,000100: 30,2160           33021        NEWLOAD            CAF      V06N76                                #  FLASH CROSS-RANGE AND APOLUNE VALUES.
035615,000101: 30,2161           04616                           TC       BANKCALL                              
035616,000102: 30,2162           20477                           CADR     GOFLASH                               
035617,000103: 30,2163           16001                           TCF      GOTOPOOH                              
035618,000104: 30,2164           12166                           TCF      +2                                    #  PROCEED
035619,000105: 30,2165           12160                           TCF      NEWLOAD                               #  ENTER NEW DATA.
035620,000106: 
035621,000107: 30,2166           32314                           CAF      P12ADRES                              
035622,000108: 30,2167           55455                           TS       WHICH                                 
035623,000109: 
035624,000110: 30,2170           05353                           TC       PHASCHNG                              
035625,000111: 30,2171           04024                           OCT      04024                                 
035626,000112: 
035627,000113: 30,2172           06042                           TC       INTPRET                               
035628,000114: 30,2173           54345                           DLOAD    SL                                    
035629,000115: 30,2174           03643                                    XRANGE                                
035630,000116: 30,2175           20206                                    5D                                    
035631,000117: 30,2176           77615                           DAD                                            
035632,000118: 30,2177           02335                                    Y                                     
035633,000119: 30,2200           27633                           STOVL    YCO                                   
035634,000120: 30,2201           03537                                    UNIT/R/                               

Page 833

035636,000122: 30,2202           53361                           VXSC     VAD                                   
035637,000123: 30,2203           31365                                    49FPS                                 
035638,000124: 30,2204           03601                                    V1S                                   
035639,000125: 30,2205           03527                           STORE    V                                     #  V(TIPOVER) = V(IGN) + 57FPS (UNIT/R/)
035640,000126: 30,2206           72441                           DOT      SL1                                   
035641,000127: 30,2207           03537                                    UNIT/R/                               
035642,000128: 30,2210           27474                           STOVL    RDOT                                  #  RDOT * 2(-7)
035643,000129: 30,2211           03537                                    UNIT/R/                               
035644,000130: 30,2212           53435                           VXV      UNIT                                  
035645,000131: 30,2213           03720                                    QAXIS                                 
035646,000132: 30,2214           37726                           STCALL   ZAXIS1                                
035647,000133: 30,2215           60315                                    ASCENT                                
035648,000134: 30,2216           77745        P12RET             DLOAD                                          
035649,000135: 30,2217           02361                                    ATP                                   #  ATP(2)*2(18)
035650,000136: 30,2220           65316                           DSQ      PDDL                                  
035651,000137: 30,2221           02355                                    ATY                                   #  ATY(2)*2(18)
035652,000138: 30,2222           43316                           DSQ      DAD                                   
035653,000139: 30,2223           75454                           BZE      SQRT                                  
035654,000140: 30,2224           60230                                    YAWDUN                                
035655,000141: 30,2225           55352                           SL1      BDDV                                  
035656,000142: 30,2226           02355                                    ATY                                   
035657,000143: 30,2227           77736                           ARCSIN                                         
035658,000144: 30,2230           26363        YAWDUN             STOVL    YAW                                   
035659,000145: 30,2231           03253                                    UNFC/2                                
035660,000146: 30,2232           50256                           UNIT     DOT                                   
035661,000147: 30,2233           03537                                    UNIT/R/                               
035662,000148: 30,2234           65552                           SL1      ARCCOS                                
035663,000149: 30,2235           77676                           DCOMP                                          
035664,000150: 30,2236           02365                           STORE    PITCH                                 
035665,000151: 30,2237           77776                           EXIT                                           
035666,000152: 30,2240           05353                           TC       PHASCHNG                              
035667,000153: 30,2241           04024                           OCT      04024                                 
035668,000154: 
035669,000155: 30,2242           00004                           INHINT                                         
035670,000156: 30,2243           04674                           TC       IBNKCALL                              
035671,000157: 30,2244           40143                           CADR     PFLITEDB                              
035672,000158: 30,2245           05516                           TC       DOWNFLAG                              
035673,000159: 30,2246           00213                           ADRES    FLPI                                  
035674,000160: 
035675,000161: 30,2247           04635                           TC       POSTJUMP                              
035676,000162: 30,2250           74130                           CADR     BURNBABY                              
035677,000163: 
035678,000164: 30,2251           77745        P12INIT            DLOAD                                          #  INITIALIZE ENGINE DATA.  USED FOR P12 AND
035679,000165: 30,2252           16013                                    (1/DV)A                               #  P71.
035680,000166: 30,2253           03641                           STORE    1/DV3                                 
035681,000167: 30,2254           03637                           STORE    1/DV2                                 
035682,000168: 30,2255           17635                           STODL    1/DV1                                 
035683,000169: 30,2256           16017                                    (AT)A                                 
035684,000170: 30,2257           16263                           STODL    AT                                    
035685,000171: 30,2260           16021                                    (TBUP)A                               

Page 834

035687,000173: 30,2261           16271                           STODL    TBUP                                  
035688,000174: 30,2262           34013                                    ATDECAY                               
035689,000175: 30,2263           54276                           DCOMP    SL                                    
035690,000176: 30,2264           20214                                    11D                                   
035691,000177: 30,2265           02267                           STORE    TTO                                   
035692,000178: 30,2266           57535                           SLOAD    DCOMP                                 
035693,000179: 30,2267           26001                                    APSVEX                                
035694,000180: 30,2270           77702                           SR2                                            
035695,000181: 30,2271           02265                           STORE    VE                                    
035696,000182: 30,2272           43414                           BOFF     RVQ                                   
035697,000183: 30,2273           04747                                    FLAP                                  
035698,000184: 30,2274           60275                                    COMMINIT                              
035699,000185: 30,2275           43345        COMMINIT           DLOAD    DAD                                   #  INITIALIZE TARGET DATA.  USED BY P12, P70
035700,000186: 30,2276           25736                                    HINJECT                               #  AND P71 IF IT DOES NOT FOLLOW P70.
035701,000187: 30,2277           02333                                    /LAND/                                
035702,000188: 30,2300           17631                           STODL    RCO                                   
035703,000189: 30,2301           06524                                    HI6ZEROS                              
035704,000190: 30,2302           03654                           STORE    TXO                                   
035705,000191: 30,2303           03633                           STORE    YCO                                   
035706,000192: 30,2304           26275                           STOVL    YDOTD                                 
035707,000193: 30,2305           01563                                    VRECTCSM                              
035708,000194: 30,2306           64235                           VXV      MXV                                   
035709,000195: 30,2307           01555                                    RRECTCSM                              
035710,000196: 30,2310           01734                                    REFSMMAT                              
035711,000197: 30,2311           77656                           UNIT                                           
035712,000198: 30,2312           03720                           STORE    QAXIS                                 
035713,000199: 30,2313           77616                           RVQ                                            
035714,000200: 
035715,000201: 30,2314           02024        P12ADRES           REMADR   P12TABLE                              
035716,000202: 
035717,000203: 34,2000                                           SETLOC   ASENT8                                
035718,000204: 34,2000                                           BANK                                           
035719,000205: 34,3343                                           COUNT*   $$/P12                                
035720,000206: 
035721,000207: 34,3343           40220        GUIDINIT           STQ      SETPD                                 
035722,000208: 34,3344           01163                                    TEMPR60                               
035723,000209: 34,3345           00001                                    0D                                    
035724,000210: 34,3346           41575                           VLOAD    PUSH                                  
035725,000211: 34,3347           06516                                    UNITZ                                 
035726,000212: 34,3350           41434                           RTB      PUSH                                  
035727,000213: 34,3351           21574                                    LOADTIME                              
035728,000214: 34,3352           77624                           CALL                                           
035729,000215: 34,3353           55716                                    RP-TO-R                               
035730,000216: 34,3354           74321                           MXV      VXSC                                  
035731,000217: 34,3355           01734                                    REFSMMAT                              
035732,000218: 34,3356           16027                                    MOONRATE                              
035733,000219: 34,3357           26325                           STOVL    WM                                    
035734,000220: 34,3360           02023                                    RLS                                   
035735,000221: 34,3361           52446                           ABVAL    SL3                                   
035736,000222: 34,3362           36333                           STCALL   /LAND/                                

Page 835

035738,000224: 34,3363           01163                                    TEMPR60                               
035739,000225: 
035740,000226: 34,3364           00046 07374  49FPS              2DEC     .149352    B-6                        #  EXPECTED RDOT AT TIPOVER
035741,000227: 34,3366           04145 15527  VINJNOM            2DEC     16.7924    B-7                        #  5509.5 FPS(APO=30NM WITH RDOT=19.5FPS)
035742,000228: 34,3370           00007 23346  RDOTDNOM           2DEC     .059436    B-7                        #  19.5 FPS
035743,000229: 
035744,000230: 

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