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.

026141,000002:                                                                                                  ## Copyright:   Public domain.
026142,000003:                                                                                                  ## Filename:    P30,P37.agc
026143,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
026144,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
026145,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
026146,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
026147,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
026148,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
026149,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
026150,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
026151,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
026152,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
026153,000014:                                                                                                  ##              resulting binary is.
026154,000015:                                                                                                  ## Reference:   pp. 619-622
026155,000016:                                                                                                  ## Assembler:   yaYUL
026156,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
026157,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
026158,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
026159,000020: 

Page 619

026161,000022:                                                                                                  #  PROGRAM DESCRIPTION P30       DATE 3-6-67
026162,000023:                                                                                                  #  MOD.1 BY RAMA AIYAWAR
026163,000024: 
026164,000025:                                                                                                  #  FUNCTIONAL DESCRIPTION
026165,000026:                                                                                                  #        ACCEPT ASTRONAUT INPUTS OF TIG,DELV(LV)
026166,000027:                                                                                                  #        CALL IMU STATUS CHECK ROUTINE (R02)
026167,000028:                                                                                                  #        DISPLAY TIME TO GO, APOGEE, PERIGEE, DELV(MAG), MGA AT IGN
026168,000029:                                                                                                  #        REQUEST BURN PROGRAM
026169,000030: 
026170,000031:                                                                                                  #  CALLING SEQUENCE VIA JOB FROM V37
026171,000032: 
026172,000033:                                                                                                  #  EXIT VIA V37 CALL OR TO GOTOPOOH (V34E)
026173,000034: 
026174,000035:                                                                                                  #  SUBROUTINE CALLS -    FLAGUP, PHASCHNG, BANKCALL, ENDOFJOB, GOFLASH, GOFLASHR
026175,000036:                                                                                                  #                        GOPERF3R, INTPRET, BLANKET, GOTOPOOH, R02BOTH, S30.1,
026176,000037:                                                                                                  #                        TTG/N35, MIDGIM, DISPMGA
026177,000038: 
026178,000039:                                                                                                  #  ERASABLE INITIALIZATION - STATE VECTOR
026179,000040: 
026180,000041:                                                                                                  #  OUTPUT -      RINIT, VINIT, +MGA, VTIG, RTIG, DELVSIN, DELVSAB, DELVSLV, HAPO,
026181,000042:                                                                                                  #                HPER, TTOGO
026182,000043: 
026183,000044:                                                                                                  #  DEBRIS - A, L, MPAC, PUSHLIST
026184,000045: 
026185,000046: 32,3000                                           BANK     32                                    
026186,000047: 35,2000                                           SETLOC   P30S                                  
026187,000048: 35,2000                                           BANK                                           
026188,000049: 35,2000  E4,1652                                  EBANK=   +MGA                                  
026189,000050: 35,2000                                           COUNT*   $$/P30                                
026190,000051: 35,2000           05504        P30                TC       UPFLAG                                #  SET UPDATE FLAG
026191,000052: 35,2001           00027                           ADRES    UPDATFLG                              
026192,000053: 35,2002           05504                           TC       UPFLAG                                #  SET TRACK FLAG
026193,000054: 35,2003           00031                           ADRES    TRACKFLG                              
026194,000055: 
026195,000056: 35,2004           32032        P30N33             CAF      V06N33                                #  T OF IGN
026196,000057: 35,2005           03621                           TC       VNPOOH                                #  RETURNS ON PROCEED, POOH ON TERMINATE
026197,000058: 
026198,000059: 35,2006           33636                           CAF      V06N81                                #  DISPLAY DELTA V (LV)
026199,000060: 35,2007           03621                           TC       VNPOOH                                #        REDISPLAY ON RECYCLE
026200,000061: 
026201,000062: 35,2010           05516                           TC       DOWNFLAG                              #  RESET UPDATE FLAG
026202,000063: 35,2011           00027                           ADRES    UPDATFLG                              
026203,000064: 35,2012           06042                           TC       INTPRET                               
026204,000065: 35,2013           77624                           CALL                                           
026205,000066: 35,2014           70000                                    S30.1                                 
026206,000067: 35,2015           43014                           SET      SET                                   
026207,000068: 35,2016           00470                                    UPDATFLG                              
026208,000069: 35,2017           01067                                    XDELVFLG                              
026209,000070: 35,2020           77776                           EXIT                                           
026210,000071: 35,2021           32033        PARAM30            CAF      V06N42                                #  DISPLAY APOGEE,PERIGEE,DELTA V

Page 620

026212,000073: 35,2022           03621                           TC       VNPOOH                                
026213,000074: 
026214,000075: 35,2023           06042                           TC       INTPRET                               
026215,000076: 35,2024           77614                           SET                                            
026216,000077: 35,2025           01071                                    FINALFLG                              
026217,000078: 35,2026           77624        REVN1645           CALL                                           
026218,000079: 35,2027           73515                                    VN1645                                
026219,000080: 35,2030           77650                           GOTO                                           #  COMES HERE ON RECYCLE RESPONSE
026220,000081: 35,2031           72026                                    REVN1645                              
026221,000082: 
026222,000083: 35,2032           01441        V06N33             VN       0633                                  
026223,000084: 35,2033           01452        V06N42             VN       0642                                  
026224,000085: 

Page 621

026226,000087:                                                                                                  #  PROGRAM DESCRIPTION S30.1     DATE 9NOV66
026227,000088:                                                                                                  #  MOD NO 1                      LOG SECTION P30,P37
026228,000089:                                                                                                  #  MOD BY RAMA AIYAWAR **
026229,000090: 
026230,000091:                                                                                                  #  FUNCTIONAL DESCRIPTION
026231,000092:                                                                                                  #        BASED ON STORED TARGET PARAMETERS (R OF IGNITION (RTIG), V OF
026232,000093:                                                                                                  #        IGNITION (VTIG), TIME OF IGNITION (TIG)), COMPUTE PERIGEE ALTITUDE
026233,000094:                                                                                                  #        APOGEE ALTITUDE AND DELTAV REQUIRED (DELVSIN).
026234,000095: 
026235,000096:                                                                                                  #  CALLING SEQUENCE
026236,000097:                                                                                                  #        L       CALL
026237,000098:                                                                                                  #        L+1             S30.1
026238,000099: 
026239,000100:                                                                                                  #  NORMAL EXIT MODE
026240,000101:                                                                                                  #        AT L+2 OR CALLING SEQUENCE (GOTO L+2)
026241,000102: 
026242,000103:                                                                                                  #  SUBROUTINES CALLED
026243,000104:                                                                                                  #        LEMPREC
026244,000105:                                                                                                  #        PERIAPO
026245,000106: 
026246,000107:                                                                                                  #  ALARM OR ABORT EXIT MODES
026247,000108:                                                                                                  #        NONE
026248,000109: 
026249,000110:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
026250,000111:                                                                                                  #        TIG             TIME OF IGNITION        DP B28CS
026251,000112:                                                                                                  #        DELVSLV         SPECIFIED DELTA-V INLOCAL VERT.
026252,000113:                                                                                                  #                        COORDS. OF ACTIVE VEHICLE AT
026253,000114:                                                                                                  #                        TIME OF IGNITION        VECTOR B+7 METERS/CS
026254,000115: 
026255,000116:                                                                                                  #  OUTPUT
026256,000117:                                                                                                  #        RTIG            POSITION AT TIG         VECTOR B+29 METERS
026257,000118:                                                                                                  #        VTIG            VELOCITY AT TIG         VECTOR B+29 METERS/CS
026258,000119:                                                                                                  #        PDL 4D          APOGEE ALTITUDE         DP B+29 M, B+27 METERS.
026259,000120:                                                                                                  #        HAPO            APOGEE ALTITUDE         DP B+29 METERS
026260,000121:                                                                                                  #        PDL 8D          PERIGEE ALTITUDE        DP B+29 M, B+27 METERS.
026261,000122:                                                                                                  #        HPER            PERIGEE ALTITUDE        DP B+29 METERS
026262,000123:                                                                                                  #        DELVSIN         SPECIFIED DELTA-V IN INERTIAL
026263,000124:                                                                                                  #                        COORD. OF ACTIVE VEHICLE AT
026264,000125:                                                                                                  #                        TIME OF IGNITION        VECTOR B+7 METERS/CS
026265,000126:                                                                                                  #        DELVSAB         MAG. OF DELVSIN         VECTOR B+7 METERS/CS
026266,000127: 
026267,000128:                                                                                                  #  DEBRIS        QTEMP   TEMP.ERASABLE
026268,000129:                                                                                                  #                QPRET, MPAC
026269,000130:                                                                                                  #                PUSHLIST
026270,000131: 
026271,000132: 34,2000                                           SETLOC   P30S1                                 
026272,000133: 34,2000                                           BANK                                           
026273,000134: 
026274,000135: 34,2000                                           COUNT*   $$/S30S                               
026275,000136: 
026276,000137: 34,2000           71220        S30.1              STQ      DLOAD                                 
026277,000138: 34,2001           03632                                    QTEMP                                 
026278,000139: 34,2002           03442                                    TIG                                   #  TIME IGNITION SCALED AT 2(+28)CS
026279,000140: 34,2003           34041                           STCALL   TDEC1                                 
026280,000141: 34,2004           27056                                    LEMPREC                               #  ENCKE ROUTINE FOR LEM
026281,000142: 
026282,000143: 34,2005           67175                           VLOAD    SXA,2                                 

Page 622

026284,000145: 34,2006           00001                                    RATT                                  
026285,000146: 34,2007           02777                                    RTX2                                  
026286,000147: 34,2010           03642                           STORE    RTIG                                  #  RADIUS VECTOR AT IGNITION TIME
026287,000148: 34,2011           57456                           UNIT     VCOMP                                 
026288,000149: 34,2012           27656                           STOVL    DELVSIN                               #  ZRF/LV IN DELVSIN SCALED AT 2
026289,000150: 34,2013           00007                                    VATT                                  #  VELOCITY VECTOR AT TIG, SCALED 2(7) M/CS
026290,000151: 34,2014           03650                           STORE    VTIG                                  
026291,000152: 34,2015           53435                           VXV      UNIT                                  
026292,000153: 34,2016           03642                                    RTIG                                  
026293,000154: 34,2017           66001                           SETPD    SXA,1                                 
026294,000155: 34,2020           00001                                    0                                     
026295,000156: 34,2021           02776                                    RTX1                                  
026296,000157: 34,2022           47206                           PUSH     VXV                                   #  YRF/LV PDL 0 SCALED AT 2
026297,000158: 34,2023           03656                                    DELVSIN                               
026298,000159: 34,2024           63372                           VSL1     PDVL                                  
026299,000160: 34,2025           63315                           PDVL     PDVL                                  #  YRF/LV PDL 6 SCALED AT 2
026300,000161: 34,2026           03656                                    DELVSIN                               #  ZRF/LV PDL 12D SCALED AT 2
026301,000162: 34,2027           03434                                    DELVSLV                               
026302,000163: 34,2030           76505                           VXM      VSL1                                  
026303,000164: 34,2031           00001                                    0                                     
026304,000165: 34,2032           03656                           STORE    DELVSIN                               #  DELTAV IN INERT. COOR. SCALED TO B+7M/CS
026305,000166: 34,2033           77646                           ABVAL                                          
026306,000167: 34,2034           27664                           STOVL    DELVSAB                               #  DELTA V MAG.
026307,000168: 34,2035           03642                                    RTIG                                  #  (FOR PERIAPO)
026308,000169: 34,2036           53315                           PDVL     VAD                                   #  VREQUIRED = VTIG + DELVSIN (FOR PERIAPO)
026309,000170: 34,2037           03650                                    VTIG                                  
026310,000171: 34,2040           03656                                    DELVSIN                               
026311,000172: 34,2041           77624                           CALL                                           
026312,000173: 34,2042           46341                                    PERIAPO1                              
026313,000174: 34,2043           77624                           CALL                                           
026314,000175: 34,2044           46451                                    SHIFTR1                               #  RESCALE IF NEEDED
026315,000176: 34,2045           77624                           CALL                                           #  LIMIT DISPLAY TO 9999.9 N. MI.
026316,000177: 34,2046           45636                                    MAXCHK                                
026317,000178: 34,2047           16321                           STODL    HPER                                  #  PERIGEE ALT 2(29) METERS, FOR DISPLAY
026318,000179: 34,2050           00005                                    4D                                    
026319,000180: 34,2051           77624                           CALL                                           
026320,000181: 34,2052           46451                                    SHIFTR1                               #  RESCALE IF NEEDED
026321,000182: 34,2053           77624                           CALL                                           #  LIMIT DISPLAY TO 9999.9 N. MI.
026322,000183: 34,2054           45636                                    MAXCHK                                
026323,000184: 34,2055           36317                           STCALL   HAPO                                  #  APOGEE ALT 2(29) METERS, FOR DISPLAY
026324,000185: 34,2056           03632                                    QTEMP                                 
026325,000186: 
026326,000187: 

End of include-file P30,P37.agc.  Parent file is MAIN.agc