Source Code

These source-code files derive from a printout of Luminary 116 (the Apollo 12 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Ron Burkey, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071
	19:09 AUG. 11,1969
Note that the date is the date of the printout, not the date of the program revision.

026325,000002:                                                                                                  ## Copyright:   Public domain.
026326,000003:                                                                                                  ## Filename:    P30,P37.agc
026327,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
026328,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
026329,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
026330,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
026331,000008:                                                                                                  ##              that the code format has been changed to conform to the
026332,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
026333,000010:                                                                                                  ##              original YUL assembler.
026334,000011:                                                                                                  ## Reference:   pp. 617-620
026335,000012:                                                                                                  ## Assembler:   yaYUL
026336,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
026337,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
026338,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
026339,000016:                                                                                                  ##              2017-03-02 HG   Transcribed
026340,000017:                                                                                                  ##              2017-03-14 RSB  Proofed comment text via 3-way diff vs
026341,000018:                                                                                                  ##                              Luminary 99 and 131 ... no problems found.
026342,000019: 

Page 617

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

Page 618

026396,000073: 35,2022           03621                           TC       VNPOOH                                
026397,000074: 
026398,000075: 35,2023           06042                           TC       INTPRET                               
026399,000076: 35,2024           77614                           SET                                            
026400,000077: 35,2025           01071                                    FINALFLG                              
026401,000078: 35,2026           77624        REVN1645           CALL                                           
026402,000079: 35,2027           73515                                    VN1645                                
026403,000080: 35,2030           77650                           GOTO                                           #  COMES HERE ON RECYCLE RESPONSE
026404,000081: 35,2031           72026                                    REVN1645                              
026405,000082: 
026406,000083: 35,2032           01441        V06N33             VN       0633                                  
026407,000084: 35,2033           01452        V06N42             VN       0642                                  
026408,000085: 

Page 619

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

Page 620

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

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