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.

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

Page 620

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

Page 621

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

Page 622

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

Page 623

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

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