Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, 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 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

027240,000002:                                                                                                  ## Copyright:   Public domain.
027241,000003:                                                                                                  ## Filename:    P30,P37.agc
027242,000004:                                                                                                  ## Filename:    P30,P37.agc
027243,000005:                                                                                                  ## Purpose:     A section of Luminary revision 210.
027244,000006:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
027245,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
027246,000008:                                                                                                  ##              This file is intended to be a faithful transcription, except
027247,000009:                                                                                                  ##              that the code format has been changed to conform to the
027248,000010:                                                                                                  ##              requirements of the yaYUL assembler rather than the
027249,000011:                                                                                                  ##              original YUL assembler.
027250,000012:                                                                                                  ## Reference:   pp. 620-623
027251,000013:                                                                                                  ## Assembler:   yaYUL
027252,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
027253,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
027254,000016:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
027255,000017:                                                                                                  ##              2016-11-28 HG   Transcribed
027256,000018:                                                                                                  ##              2016-12-07 HG   fix P00 -> POO
027257,000019:                                                                                                  ##              2016-12-25 RSB  Comment-text proofed using ProoferComments
027258,000020:                                                                                                  ##                              and corrected errors found.
027259,000021:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes noted in proofing Luminary 116.
027260,000022: 

Page 620

027262,000024:                                                                                                  #  PROGRAM DESCRIPTION P30       DATE 3-6-67
027263,000025: 
027264,000026:                                                                                                  #  MOD.1  BY RAMA AIYAWAR
027265,000027:                                                                                                  #  FUNCTIONAL DESCRIPTION
027266,000028:                                                                                                  #     ACCEPT ASTRONAUT INPUTS OF TIG,DELV(LV)
027267,000029:                                                                                                  #     CALL IMU STATUS CHECK ROUTINE (R02)
027268,000030:                                                                                                  #     DISPLAY TIME TO GO, APOGEE, PERIGEE, DELV(MAG), MGA AT IGN
027269,000031:                                                                                                  #     REQUEST BURN PROGRAM
027270,000032: 
027271,000033:                                                                                                  #  CALLING SEQUENCE VIA JOB FROM V37
027272,000034: 
027273,000035:                                                                                                  #  EXIT VIA V37 CALL OR TO GOTOPOOH (V34E)
027274,000036: 
027275,000037:                                                                                                  #  SUBROUTINE CALLS-FLAGUP, PHASCHNG, BANKCALL, ENDOFJOB, GOFLASH, GOFLASHR
027276,000038:                                                                                                  #                   GOPERF3R, INTPRET, BLANKET, GOTOPOOH, R02BOTH, S30.1,
027277,000039:                                                                                                  #                   TTG/N35, MIDGIM, DISPMGA
027278,000040: 
027279,000041:                                                                                                  #  ERASABLE INITIALIZATION- STATE VECTOR
027280,000042: 
027281,000043:                                                                                                  #  OUTPUT-RINIT, VINIT, +MGA, VTIG, RTIG, DELVSIN, DELVSAB, DELVSLV, HAPO,
027282,000044:                                                                                                  #         HPER, TTOGO
027283,000045: 
027284,000046:                                                                                                  #  DEBRIS- A, L, MPAC, PUSHLIST
027285,000047: 
027286,000048: 32,2570                                           BANK     32                                    
027287,000049: 35,2000                                           SETLOC   P30S                                  
027288,000050: 35,2000                                           BANK                                           
027289,000051: 35,2000  E4,1643                                  EBANK=   +MGA                                  
027290,000052: 35,2000                                           COUNT*   $$/P30                                
027291,000053: 35,2000           05506        P30                TC       UPFLAG                                #  SET UPDATE FLAG
027292,000054: 35,2001           00027                           ADRES    UPDATFLG                              
027293,000055: 35,2002           05506                           TC       UPFLAG                                #  SET TRACK FLAG
027294,000056: 35,2003           00031                           ADRES    TRACKFLG                              
027295,000057: 
027296,000058: 35,2004           32032        P30N33             CAF      V06N33                                #  T OF IGN
027297,000059: 35,2005           03622                           TC       VNPOOH                                #  RETURNS ON PROCEED, POOH ON TERMINATE
027298,000060: 
027299,000061: 35,2006           33637                           CAF      V06N81                                #  DISPLAY DELTA V (LV)
027300,000062: 35,2007           03622                           TC       VNPOOH                                #      REDISPLAY ON RECYCLE
027301,000063: 
027302,000064: 35,2010           05520                           TC       DOWNFLAG                              #  RESET UPDATE FLAG
027303,000065: 35,2011           00027                           ADRES    UPDATFLG                              
027304,000066: 35,2012           06060                           TC       INTPRET                               
027305,000067: 35,2013           77624                           CALL                                           
027306,000068: 35,2014           70000                                    S30.1                                 
027307,000069: 35,2015           43014                           SET      SET                                   
027308,000070: 35,2016           00470                                    UPDATFLG                              
027309,000071: 35,2017           01067                                    XDELVFLG                              
027310,000072: 35,2020           77776                           EXIT                                           
027311,000073: 35,2021           32033        PARAM30            CAF      V06N42                                #  DISPLAY APOGEE,PERIGEE ,DELTA V
027312,000074: 

Page 621

027314,000076: 35,2022           03622                           TC       VNPOOH                                
027315,000077: 
027316,000078: 35,2023           06060                           TC       INTPRET                               
027317,000079: 35,2024           77614                           SET                                            
027318,000080: 35,2025           01071                                    FINALFLG                              
027319,000081: 35,2026           77624        REVN1645           CALL                                           
027320,000082: 35,2027           73516                                    VN1645                                
027321,000083: 35,2030           77650                           GOTO                                           #  COMES HERE ON RECYCLE RESPONSE
027322,000084: 35,2031           72026                                    REVN1645                              
027323,000085: 
027324,000086: 35,2032           01441        V06N33             VN       0633                                  
027325,000087: 35,2033           01452        V06N42             VN       0642                                  
027326,000088: 

Page 622

027328,000090:                                                                                                  #  PROGRAM DESCRIPTION S30.1       DATE 9NOV66
027329,000091: 
027330,000092:                                                                                                  #  MOD NO 1        LOG SECTION   P30,P37
027331,000093:                                                                                                  #  MOD  BY  RAMA AIYAWAR **
027332,000094:                                                                                                  #  FUNCTIONAL DESCRIPTION
027333,000095:                                                                                                  #           BASED ON STORED TARGET PARAMETERS(R OF IGNITION(RTIG),V OF
027334,000096:                                                                                                  #           IGNITION(VTIG),TIME OF IGNITION (TIG)),COMPUTE PERIGEE ALTITUDE
027335,000097:                                                                                                  #           APOGEE ALTITUDE AND DELTAV REQUIRED(DELVSIN).
027336,000098:                                                                                                  #  CALLING SEQUENCE
027337,000099:                                                                                                  #      L    CALL
027338,000100:                                                                                                  #      L+1  S30.1
027339,000101:                                                                                                  #  NORMAL EXIT MODE
027340,000102:                                                                                                  #      AT L+2 OR CALLING SEQUENCE (GOTO L+2)
027341,000103:                                                                                                  #  SUBROUTINES CALLED
027342,000104:                                                                                                  #           LEMPREC
027343,000105:                                                                                                  #           PERIAPO
027344,000106:                                                                                                  #  ALARM OR ABORT EXIT MODES
027345,000107:                                                                                                  #                  NONE
027346,000108:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
027347,000109:                                                                                                  #           TIG       TIME OF IGNITION                   DP     B28CS
027348,000110:                                                                                                  #           DELVSLV   SPECIFIED DELTA-V IN LOCAL VERT.
027349,000111:                                                                                                  #                     COORDS. OF ACTIVE VEHICLE AT
027350,000112:                                                                                                  #                  TIME OF IGNITION      VECTOR  B+7  METERS/CS
027351,000113:                                                                                                  #  OUTPUT
027352,000114:                                                                                                  #           RTIG   POSITION AT TIG       VECTOR  B+29 METERS
027353,000115:                                                                                                  #           VTIG   VELOCITY AT TIG       VECTOR  B+29 METERS/CS
027354,000116:                                                                                                  #           PDL 4D APOGEE ALTITUDE       DP      B+29 M ,  B+27 METERS.
027355,000117:                                                                                                  #           HAPO   APOGEE ALTITUDE       DP      B+29 METERS
027356,000118:                                                                                                  #           PDL 8D PERIGEE ALTITUDE      DP      B+29 M ,  B+27 METERS.
027357,000119:                                                                                                  #           HPER   PERIGEE ALTITUDE      DP      B+29 METERS
027358,000120:                                                                                                  #           DELVSIN   SPECIFIED DELTA-V IN INERTIAL
027359,000121:                                                                                                  #                     COORD. OF ACTIVE VEHICLE AT
027360,000122:                                                                                                  #                  TIME OF IGNITION      VECTOR  B+7  METERS/CS
027361,000123:                                                                                                  #           DELVSAB MAG. OF DELVSIN      VECTOR  B+7  METERS/CS
027362,000124:                                                                                                  #  DEBRIS QTEMP    TEMP. ERASABLE
027363,000125:                                                                                                  #         QPRET,MPAC
027364,000126:                                                                                                  #         PUSHLIST
027365,000127: 
027366,000128: 34,2000                                           SETLOC   P30S1                                 
027367,000129: 34,2000                                           BANK                                           
027368,000130: 
027369,000131: 34,2000                                           COUNT*   $$/S30S                               
027370,000132: 
027371,000133: 34,2000           71220        S30.1              STQ      DLOAD                                 
027372,000134: 34,2001           03632                                    QTEMP                                 
027373,000135: 34,2002           03442                                    TIG                                   #  TIME IGNITION SCALED AT 2(+28)CS
027374,000136: 34,2003           34041                           STCALL   TDEC1                                 
027375,000137: 34,2004           27115                                    LEMPREC                               #  ENCKE ROUTINE FOR LEM
027376,000138: 
027377,000139: 34,2005           67175                           VLOAD    SXA,2                                 
027378,000140: 

Page 623

027380,000142: 34,2006           00001                                    RATT                                  
027381,000143: 34,2007           02777                                    RTX2                                  
027382,000144: 34,2010           03642                           STORE    RTIG                                  #  RADIUS VECTOR AT IGNITION TIME
027383,000145: 34,2011           57456                           UNIT     VCOMP                                 
027384,000146: 34,2012           27656                           STOVL    DELVSIN                               #  ZRF/LV IN DELVSIN SCALED AT 2
027385,000147: 34,2013           00007                                    VATT                                  #  VELOCITY VECTOR AT TIG, SCALED 2(7) M/CS
027386,000148: 34,2014           03650                           STORE    VTIG                                  
027387,000149: 34,2015           53435                           VXV      UNIT                                  
027388,000150: 34,2016           03642                                    RTIG                                  
027389,000151: 34,2017           66001                           SETPD    SXA,1                                 
027390,000152: 34,2020           00001                                    0                                     
027391,000153: 34,2021           02776                                    RTX1                                  
027392,000154: 34,2022           47206                           PUSH     VXV                                   #  YRF/LV PDL 0   SCALED AT 2
027393,000155: 34,2023           03656                                    DELVSIN                               
027394,000156: 34,2024           63372                           VSL1     PDVL                                  
027395,000157: 34,2025           63315                           PDVL     PDVL                                  #  YRF/LV PDL 6   SCALED AT 2
027396,000158: 34,2026           03656                                    DELVSIN                               #  ZRF/LV PDL 12D SCALED AT 2
027397,000159: 34,2027           03434                                    DELVSLV                               
027398,000160: 34,2030           76505                           VXM      VSL1                                  
027399,000161: 34,2031           00001                                    0                                     
027400,000162: 34,2032           03656                           STORE    DELVSIN                               #  DELTAV IN INERT. COOR. SCALED TO B+7M/CS
027401,000163: 34,2033           77646                           ABVAL                                          
027402,000164: 34,2034           27664                           STOVL    DELVSAB                               #  DELTA V MAG.
027403,000165: 34,2035           03642                                    RTIG                                  #  (FOR PERIAPO)
027404,000166: 34,2036           53315                           PDVL     VAD                                   #  VREQUIRED = VTIG + DELVSIN (FOR PERIAPO)
027405,000167: 34,2037           03650                                    VTIG                                  
027406,000168: 34,2040           03656                                    DELVSIN                               
027407,000169: 34,2041           77624                           CALL                                           
027408,000170: 34,2042           46337                                    PERIAPO1                              
027409,000171: 34,2043           77624                           CALL                                           
027410,000172: 34,2044           46447                                    SHIFTR1                               #  RESCALE IF NEEDED
027411,000173: 34,2045           77624                           CALL                                           #  LIMIT DISPLAY TO 9999.9 N. MI.
027412,000174: 34,2046           45640                                    MAXCHK                                
027413,000175: 34,2047           16312                           STODL    HPER                                  #  PERIGEE ALT 2(29) METERS, FOR DISPLAY
027414,000176: 34,2050           00005                                    4D                                    
027415,000177: 34,2051           77624                           CALL                                           
027416,000178: 34,2052           46447                                    SHIFTR1                               #  RESCALE IF NEEDED
027417,000179: 34,2053           77624                           CALL                                           #  LIMIT DISPLAY TO 9999.9 N. MI.
027418,000180: 34,2054           45640                                    MAXCHK                                
027419,000181: 34,2055           36310                           STCALL   HAPO                                  #  APOGEE ALT 2(29) METERS, FOR DISPLAY
027420,000182: 34,2056           03632                                    QTEMP                                 

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