Source Code

This source code is very close to the Apollo Guidance Computer software for the Apollo 13 Lunar module. This revision of the Luminary 131 program is from December of 1969, whereas there was a later revision in January of 1970, and still another revision in February, which is the code that flew on the mission. As far as this transcription is concerned, it was originally from a copy made in 1991 of a printout from the collection of AGC developer Don Eyles for collector David Craig. It was subsequently scanned by Gary Neff, reprocessed for online presentation at the now-discontinued History of Recent Science and Technology (HRST) website of MIT's Dibner Institute (the full-quality scans being discarded in the process), and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a high-quality replacement scan for a completely illegible page was later provided by Gary Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many errors to be introduced into the transcription. Accordingly, a second scan of the same physical printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive, and used to correct the transcription errors. All of the scanned materials mentioned, as well as other Luminary 131 related material, are available online. Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017, so the two scans are not identical in that respect. The page-headings in the printout read, in part:
	GAP:  ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091
	17:53 DEC. 19, 1969
Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together.

026300,000002:                                                                                                  ## Copyright:   Public domain.
026301,000003:                                                                                                  ## Filename:    P30_P37.agc
026302,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
026303,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
026304,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
026305,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
026306,000008:                                                                                                  ##              that the code format has been changed to conform to the
026307,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the 
026308,000010:                                                                                                  ##              original YUL assembler.
026309,000011:                                                                                                  ## Reference:   pp. 619-622
026310,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
026311,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo
026312,000014:                                                                                                  ## Mod history: 05/19/03 RSB.   Began transcribing.
026313,000015:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
026314,000016:                                                                                                  ##                              original harcopy, as opposed to the PDF page
026315,000017:                                                                                                  ##                              numbers in 1701.pdf.
026316,000018:                                                                                                  ##              2017-02-24 RSB  Proofed comment text using octopus/ProoferComments.
026317,000019:                                                                                                  ##              2017-03-09 RSB  Fixed VNP00H to VNPOOH.
026318,000020:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes noted in proofing Luminary 116.
026319,000021: 

Page 619

026321,000023:                                                                                                  #  PROGRAM DESCRIPTION P30       DATE 3-6-67
026322,000024:                                                                                                  #  MOD.1 BY RAMA AIYAWAR
026323,000025: 
026324,000026:                                                                                                  #  FUNCTIONAL DESCRIPTION
026325,000027:                                                                                                  #        ACCEPT ASTRONAUT INPUTS OF TIG,DELV(LV)
026326,000028:                                                                                                  #        CALL IMU STATUS CHECK ROUTINE (R02)
026327,000029:                                                                                                  #        DISPLAY TIME TO GO, APOGEE, PERIGEE, DELV(MAG), MGA AT IGN
026328,000030:                                                                                                  #        REQUEST BURN PROGRAM
026329,000031: 
026330,000032:                                                                                                  #  CALLING SEQUENCE VIA JOB FROM V37
026331,000033: 
026332,000034:                                                                                                  #  EXIT VIA V37 CALL OR TO GOTOPOOH (V34E)
026333,000035: 
026334,000036:                                                                                                  #  SUBROUTINE CALLS -    FLAGUP, PHASCHNG, BANKCALL, ENDOFJOB, GOFLASH, GOFLASHR
026335,000037:                                                                                                  #                        GOPERF3R, INTPRET, BLANKET, GOTOPOOH, R02BOTH, S30.1,
026336,000038:                                                                                                  #                        TTG/N35, MIDGIM, DISPMGA
026337,000039: 
026338,000040:                                                                                                  #  ERASABLE INITIALIZATION - STATE VECTOR
026339,000041: 
026340,000042:                                                                                                  #  OUTPUT -      RINIT, VINIT, +MGA, VTIG, RTIG, DELVSIN, DELVSAB, DELVSLV, HAPO,
026341,000043:                                                                                                  #                HPER, TTOGO
026342,000044: 
026343,000045:                                                                                                  #  DEBRIS - A, L, MPAC, PUSHLIST
026344,000046: 
026345,000047: 32,3000                                           BANK     32                                    
026346,000048: 35,2000                                           SETLOC   P30S                                  
026347,000049: 35,2000                                           BANK                                           
026348,000050: 35,2000  E4,1652                                  EBANK=   +MGA                                  
026349,000051: 35,2000                                           COUNT*   $$/P30                                
026350,000052: 35,2000           05504        P30                TC       UPFLAG                                #  SET UPDATE FLAG
026351,000053: 35,2001           00027                           ADRES    UPDATFLG                              
026352,000054: 35,2002           05504                           TC       UPFLAG                                #  SET TRACK FLAG
026353,000055: 35,2003           00031                           ADRES    TRACKFLG                              
026354,000056: 
026355,000057: 35,2004           32032        P30N33             CAF      V06N33                                #  T OF IGN
026356,000058: 35,2005           03621                           TC       VNPOOH                                #  RETURNS ON PROCEED, POOH ON TERMINATE
026357,000059: 
026358,000060: 35,2006           33636                           CAF      V06N81                                #  DISPLAY DELTA V (LV)
026359,000061: 35,2007           03621                           TC       VNPOOH                                #        REDISPLAY ON RECYCLE
026360,000062: 
026361,000063: 35,2010           05516                           TC       DOWNFLAG                              #  RESET UPDATE FLAG
026362,000064: 35,2011           00027                           ADRES    UPDATFLG                              
026363,000065: 35,2012           06042                           TC       INTPRET                               
026364,000066: 35,2013           77624                           CALL                                           
026365,000067: 35,2014           70000                                    S30.1                                 
026366,000068: 35,2015           43014                           SET      SET                                   
026367,000069: 35,2016           00470                                    UPDATFLG                              
026368,000070: 35,2017           01067                                    XDELVFLG                              
026369,000071: 35,2020           77776                           EXIT                                           
026370,000072: 35,2021           32033        PARAM30            CAF      V06N42                                #  DISPLAY APOGEE,PERIGEE,DELTA V

Page 620

026372,000074: 35,2022           03621                           TC       VNPOOH                                
026373,000075: 
026374,000076: 35,2023           06042                           TC       INTPRET                               
026375,000077: 35,2024           77614                           SET                                            
026376,000078: 35,2025           01071                                    FINALFLG                              
026377,000079: 35,2026           77624        REVN1645           CALL                                           
026378,000080: 35,2027           73515                                    VN1645                                
026379,000081: 35,2030           77650                           GOTO                                           #  COMES HERE ON RECYCLE RESPONSE
026380,000082: 35,2031           72026                                    REVN1645                              
026381,000083: 
026382,000084: 35,2032           01441        V06N33             VN       0633                                  
026383,000085: 35,2033           01452        V06N42             VN       0642                                  
026384,000086: 

Page 621

026386,000088:                                                                                                  #  PROGRAM DESCRIPTION S30.1     DATE 9NOV66
026387,000089:                                                                                                  #  MOD NO 1                      LOG SECTION P30,P37
026388,000090:                                                                                                  #  MOD BY RAMA AIYAWAR **
026389,000091: 
026390,000092:                                                                                                  #  FUNCTIONAL DESCRIPTION
026391,000093:                                                                                                  #        BASED ON STORED TARGET PARAMETERS (R OF IGNITION (RTIG), V OF
026392,000094:                                                                                                  #        IGNITION (VTIG), TIME OF IGNITION (TIG)), COMPUTE PERIGEE ALTITUDE
026393,000095:                                                                                                  #        APOGEE ALTITUDE AND DELTAV REQUIRED (DELVSIN).
026394,000096: 
026395,000097:                                                                                                  #  CALLING SEQUENCE
026396,000098:                                                                                                  #        L       CALL
026397,000099:                                                                                                  #        L+1             S30.1
026398,000100: 
026399,000101:                                                                                                  #  NORMAL EXIT MODE
026400,000102:                                                                                                  #        AT L+2 OR CALLING SEQUENCE (GOTO L+2)
026401,000103: 
026402,000104:                                                                                                  #  SUBROUTINES CALLED
026403,000105:                                                                                                  #        LEMPREC
026404,000106:                                                                                                  #        PERIAPO
026405,000107: 
026406,000108:                                                                                                  #  ALARM OR ABORT EXIT MODES
026407,000109:                                                                                                  #        NONE
026408,000110: 
026409,000111:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
026410,000112:                                                                                                  #        TIG             TIME OF IGNITION        DP B28CS
026411,000113:                                                                                                  #        DELVSLV         SPECIFIED DELTA-V INLOCAL VERT.
026412,000114:                                                                                                  #                        COORDS. OF ACTIVE VEHICLE AT
026413,000115:                                                                                                  #                        TIME OF IGNITION        VECTOR B+7 METERS/CS
026414,000116: 
026415,000117:                                                                                                  #  OUTPUT
026416,000118:                                                                                                  #        RTIG            POSITION AT TIG         VECTOR B+29 METERS
026417,000119:                                                                                                  #        VTIG            VELOCITY AT TIG         VECTOR B+29 METERS/CS
026418,000120:                                                                                                  #        PDL 4D          APOGEE ALTITUDE         DP B+29 M, B+27 METERS.
026419,000121:                                                                                                  #        HAPO            APOGEE ALTITUDE         DP B+29 METERS
026420,000122:                                                                                                  #        PDL 8D          PERIGEE ALTITUDE        DP B+29 M, B+27 METERS.
026421,000123:                                                                                                  #        HPER            PERIGEE ALTITUDE        DP B+29 METERS
026422,000124:                                                                                                  #        DELVSIN         SPECIFIED DELTA-V IN INERTIAL
026423,000125:                                                                                                  #                        COORD. OF ACTIVE VEHICLE AT
026424,000126:                                                                                                  #                        TIME OF IGNITION        VECTOR B+7 METERS/CS
026425,000127:                                                                                                  #        DELVSAB         MAG. OF DELVSIN         VECTOR B+7 METERS/CS
026426,000128: 
026427,000129:                                                                                                  #  DEBRIS        QTEMP   TEMP.ERASABLE
026428,000130:                                                                                                  #                QPRET, MPAC
026429,000131:                                                                                                  #                PUSHLIST
026430,000132: 
026431,000133: 34,2000                                           SETLOC   P30S1                                 
026432,000134: 34,2000                                           BANK                                           
026433,000135: 
026434,000136: 34,2000                                           COUNT*   $$/S30S                               
026435,000137: 
026436,000138: 34,2000           71220        S30.1              STQ      DLOAD                                 
026437,000139: 34,2001           03632                                    QTEMP                                 
026438,000140: 34,2002           03442                                    TIG                                   #  TIME IGNITION SCALED AT 2(+28)CS
026439,000141: 34,2003           34041                           STCALL   TDEC1                                 
026440,000142: 34,2004           27056                                    LEMPREC                               #  ENCKE ROUTINE FOR LEM
026441,000143: 
026442,000144: 34,2005           67175                           VLOAD    SXA,2                                 

Page 622

026444,000146: 34,2006           00001                                    RATT                                  
026445,000147: 34,2007           02777                                    RTX2                                  
026446,000148: 34,2010           03642                           STORE    RTIG                                  #  RADIUS VECTOR AT IGNITION TIME
026447,000149: 34,2011           57456                           UNIT     VCOMP                                 
026448,000150: 34,2012           27656                           STOVL    DELVSIN                               #  ZRF/LV IN DELVSIN SCALED AT 2
026449,000151: 34,2013           00007                                    VATT                                  #  VELOCITY VECTOR AT TIG, SCALED 2(7) M/CS
026450,000152: 34,2014           03650                           STORE    VTIG                                  
026451,000153: 34,2015           53435                           VXV      UNIT                                  
026452,000154: 34,2016           03642                                    RTIG                                  
026453,000155: 34,2017           66001                           SETPD    SXA,1                                 
026454,000156: 34,2020           00001                                    0                                     
026455,000157: 34,2021           02776                                    RTX1                                  
026456,000158: 34,2022           47206                           PUSH     VXV                                   #  YRF/LV PDL 0 SCALED AT 2
026457,000159: 34,2023           03656                                    DELVSIN                               
026458,000160: 34,2024           63372                           VSL1     PDVL                                  
026459,000161: 34,2025           63315                           PDVL     PDVL                                  #  YRF/LV PDL 6 SCALED AT 2
026460,000162: 34,2026           03656                                    DELVSIN                               #  ZRF/LV PDL 12D SCALED AT 2
026461,000163: 34,2027           03434                                    DELVSLV                               
026462,000164: 34,2030           76505                           VXM      VSL1                                  
026463,000165: 34,2031           00001                                    0                                     
026464,000166: 34,2032           03656                           STORE    DELVSIN                               #  DELTAV IN INERT. COOR. SCALED TO B+7M/CS
026465,000167: 34,2033           77646                           ABVAL                                          
026466,000168: 34,2034           27664                           STOVL    DELVSAB                               #  DELTA V MAG.
026467,000169: 34,2035           03642                                    RTIG                                  #  (FOR PERIAPO)
026468,000170: 34,2036           53315                           PDVL     VAD                                   #  VREQUIRED = VTIG + DELVSIN (FOR PERIAPO)
026469,000171: 34,2037           03650                                    VTIG                                  
026470,000172: 34,2040           03656                                    DELVSIN                               
026471,000173: 34,2041           77624                           CALL                                           
026472,000174: 34,2042           46341                                    PERIAPO1                              
026473,000175: 34,2043           77624                           CALL                                           
026474,000176: 34,2044           46451                                    SHIFTR1                               #  RESCALE IF NEEDED
026475,000177: 34,2045           77624                           CALL                                           #  LIMIT DISPLAY TO 9999.9 N. MI.
026476,000178: 34,2046           45636                                    MAXCHK                                
026477,000179: 34,2047           16321                           STODL    HPER                                  #  PERIGEE ALT 2(29) METERS, FOR DISPLAY
026478,000180: 34,2050           00005                                    4D                                    
026479,000181: 34,2051           77624                           CALL                                           
026480,000182: 34,2052           46451                                    SHIFTR1                               #  RESCALE IF NEEDED
026481,000183: 34,2053           77624                           CALL                                           #  LIMIT DISPLAY TO 9999.9 N. MI.
026482,000184: 34,2054           45636                                    MAXCHK                                
026483,000185: 34,2055           36317                           STCALL   HAPO                                  #  APOGEE ALT 2(29) METERS, FOR DISPLAY
026484,000186: 34,2056           03632                                    QTEMP                                 
026485,000187: 
026486,000188: 

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