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.

022119,000002:                                                                                                  ## Copyright:   Public domain.
022120,000003:                                                                                                  ## Filename:    S-BAND_ANTENNA_FOR_LM.agc
022121,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
022122,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
022123,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
022124,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
022125,000008:                                                                                                  ##              that the code format has been changed to conform to the
022126,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
022127,000010:                                                                                                  ##              original YUL assembler.
022128,000011:                                                                                                  ## Reference:   pp. 501-504
022129,000012:                                                                                                  ## Assembler:   yaYUL
022130,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
022131,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
022132,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
022133,000016:                                                                                                  ##              2016-11-27 HG   Transcribed
022134,000017:                                                                                                  ##              2016-12-25 RSB  Comment-text proofed using ProoferComments
022135,000018:                                                                                                  ##                              and corrected errors found.
022136,000019: 

Page 501

022138,000021:                                                                                                  #  SUBROUTINE NAME: R05 - S-BAND ANTENNA FOR LM
022139,000022: 
022140,000023:                                                                                                  #  MOD0 BY T. JAMES
022141,000024:                                                                                                  #  MOD1 BY P. SHAKIR
022142,000025: 
022143,000026:                                                                                                  #  FUNCTIONAL DESCRIPTION
022144,000027: 
022145,000028:                                                                                                  #      THE S-BAND ANTENNA ROUTINE, R05, COMPUTES AND DISPLAYS THE PITCH AND
022146,000029:                                                                                                  #  YAW ANTENNA GIMBAL ANGLES REQUIRED TO POINT THE LM STEERABLE ANTENNA
022147,000030:                                                                                                  #  TOWARD THE CENTER OF THE EARTH. THIS ROUTINE IS SELECTED BY THE ASTRO-
022148,000031:                                                                                                  #  NAUT VIA DSKY ENTRY DURING COASTING FLIGHT OR WHEN THE LM IS ON THE MOON
022149,000032:                                                                                                  #  SURFACE. THE EARTH OR MOON REFERENCE COORDINATE SYSTEM IS USED DEPENDING
022150,000033:                                                                                                  #  ON WHETHER THE LM IS ABOUT TO ENTER OR HAS ALREADY ENTERED THE MOON
022151,000034:                                                                                                  #  SPHERE OF INFLUENCE, RESPECTIVELY.  CAN BE CALLED ANY TIME EXCEPT WHEN
022152,000035:                                                                                                  #  ANOTHER EXTENDED VERB IS IN USE. DISPLAY IS MEANINGLESS WITH IMU OFF.
022153,000036: 
022154,000037:                                                                                                  #  TO CALL SUBROUTINE, ASTRONAUT KEYS IN V 64 E
022155,000038: 
022156,000039:                                                                                                  #  SUBROUTINES CALLED-
022157,000040: 
022158,000041:                                                                                                  #      INTPRET
022159,000042:                                                                                                  #      LOADTIME
022160,000043:                                                                                                  #      LEMCONIC
022161,000044:                                                                                                  #      LUNPOS
022162,000045:                                                                                                  #      CDUTRIG
022163,000046:                                                                                                  #      *SMNB*
022164,000047:                                                                                                  #      BANKCALL
022165,000048:                                                                                                  #      B5OFF
022166,000049:                                                                                                  #      ENDOFJOB
022167,000050:                                                                                                  #      BLANKET
022168,000051: 
022169,000052:                                                                                                  #  RETURNS WITH
022170,000053: 
022171,000054:                                                                                                  #      PITCH ANGLE IN PITCHANG  REV. B0
022172,000055:                                                                                                  #      YAW ANGLE IN YAWANG  REV. B0
022173,000056: 
022174,000057:                                                                                                  #  ERASABLES USED
022175,000058: 
022176,000059:                                                                                                  #      PITCHANG
022177,000060:                                                                                                  #      YAWANG
022178,000061:                                                                                                  #      RLM
022179,000062:                                                                                                  #      VAC AREA
022180,000063: 
022181,000064: 41,3777                                           BANK     41                                    
022182,000065: 42,2000                                           SETLOC   SBAND                                 
022183,000066: 42,2000                                           BANK                                           
022184,000067: 
022185,000068: 42,3617  E7,1471                                  EBANK=   WHOCARES                              
022186,000069: 42,3617                                           COUNT*   $$/R05                                
022187,000070: 42,3617           06060        SBANDANT           TC       INTPRET                               
022188,000071: 

Page 502

022190,000073: 42,3620           47001                           SETPD    RTB                                   
022191,000074: 42,3621           00001                                    0D                                    
022192,000075: 42,3622           21603                                    LOADTIME                              #  PICK UP CURRENT TIME
022193,000076: 42,3623           34041                           STCALL   TDEC1                                 #  ADVANCE INTEGRATION TO TIME IN TDEC1
022194,000077: 42,3624           27136                                    LEMCONIC                              #  USING CONIC INTEGRATION
022195,000078: 42,3625           46135                           SLOAD    BHIZ                                  
022196,000079: 42,3626           00050                                    X2                                    #  X2 =0 EARTH SPHERE, X2 =2 MOON SPHERE
022197,000080: 42,3627           65645                                    CONV4                                 
022198,000081: 42,3630           77775                           VLOAD                                          
022199,000082: 42,3631           00001                                    RATT                                  
022200,000083: 42,3632           16176                           STODL    RLM                                   
022201,000084: 42,3633           00015                                    TAT                                   
022202,000085: 42,3634           77624        CONV3              CALL                                           
022203,000086: 42,3635           33646                                    LUNPOS                                #  UNIT POSITION VECTOR FROM EARTH TO MOON
022204,000087: 42,3636           74375                           VLOAD    VXSC                                  
022205,000088: 42,3637           02723                                    VMOON                                 
022206,000089: 42,3640           24001                                    REMDIST                               #  MEAN DISTANCE FROM EARTH TO MOON
022207,000090: 42,3641           53372                           VSL1     VAD                                   
022208,000091: 42,3642           02176                                    RLM                                   
022209,000092: 42,3643           77650                           GOTO                                           
022210,000093: 42,3644           65647                                    CONV5                                 
022211,000094: 42,3645           77775        CONV4              VLOAD                                          
022212,000095: 42,3646           00001                                    RATT                                  #  UE = -UNIT(RATT)  EARTH SPHERE
022213,000096: 42,3647           53401        CONV5              SETPD    UNIT                                  #  UE = -UNIT((REM)(UEM) + RL)  MOON SPHERE
022214,000097: 42,3650           00001                                    0D                                    #  SET PL POINTER TO 0
022215,000098: 42,3651           45076                           VCOMP    CALL                                  
022216,000099: 42,3652           47522                                    CDUTRIG                               #  COMPUTE SINES AND COSINES OF CDU ANGLES
022217,000100: 42,3653           76521                           MXV      VSL1                                  #  TRANSFORM REF. COORDINATE SYSTEM TO
022218,000101: 42,3654           01732                                    REFSMMAT                              #  STABLE MEMBER B-1 X B-1 X B+1 = B-1
022219,000102: 42,3655           71206                           PUSH     DLOAD                                 #  8D
022220,000103: 42,3656           06505                                    HI6ZEROS                              
022221,000104: 42,3657           02172                           STORE    PITCHANG                              
022222,000105: 42,3660           26174                           STOVL    YAWANG                                #  ZERO OUT ANGLES
022223,000106: 42,3661           77624                           CALL                                           
022224,000107: 42,3662           47663                                    *SMNB*                                
022225,000108: 42,3663           16176                           STODL    RLM                                   #  PRE-MULTIPLY RLM BY (NBSA) MATRIX(B0)
022226,000109: 42,3664           02200                                    RLM        +2                         
022227,000110: 42,3665           45206                           PUSH     DSU                                   
022228,000111: 42,3666           02176                                    RLM                                   
022229,000112: 42,3667           77605                           DMP                                            
022230,000113: 42,3670           21740                                    1OVSQRT2                              
022231,000114: 42,3671           16200                           STODL    RLM        +2                         
022232,000115: 42,3672           41215                           DAD      DMP                                   
022233,000116: 42,3673           02176                                    RLM                                   
022234,000117: 42,3674           21740                                    1OVSQRT2                              
022235,000118: 42,3675           26176                           STOVL    RLM                                   #  R  B-1
022236,000119: 42,3676           02176                                    RLM                                   
022237,000120: 42,3677           63256                           UNIT     PDVL                                  
022238,000121: 42,3700           02176                                    RLM                                   
022239,000122: 42,3701           72431                           VPROJ    VSL2                                  #  PROJECTION OF R ONTO LM XZ PLANE
022240,000123: 

Page 503

022242,000125: 42,3702           06501                                    HIUNITY                               
022243,000126: 42,3703           40045                           BVSU     BOV                                   #  CLEAR OVERFLOW INDICATOR IF ON
022244,000127: 42,3704           02176                                    RLM                                   
022245,000128: 42,3705           65706                                    COVCNV                                
022246,000129: 42,3706           40056        COVCNV             UNIT     BOV                                   #  EXIT ON OVERFLOW
022247,000130: 42,3707           65754                                    SBANDEX                               
022248,000131: 42,3710           47206                           PUSH     VXV                                   #  URP VECTOR  B-1
022249,000132: 42,3711           06477                                    HIUNITZ                               
022250,000133: 42,3712           57572                           VSL1     VCOMP                                 #  UZ X URP = -(URP X UZ)
022251,000134: 42,3713           02176                           STORE    RLM                                   #  X VEC  B-1
022252,000135: 42,3714           63241                           DOT      PDVL                                  #  SGN(X.UY) UNSCALED
022253,000136: 42,3715           06501                                    HIUNITY                               
022254,000137: 42,3716           02176                                    RLM                                   
022255,000138: 42,3717           75246                           ABVAL    SIGN                                  
022256,000139: 42,3720           77736                           ASIN                                           #  ASIN((SGN(X.UY))ABV(X)) REV B0
022257,000140: 42,3721           26172                           STOVL    PITCHANG                              
022258,000141: 42,3722           00007                                    URP                                   
022259,000142: 42,3723           51041                           DOT      BPL                                   
022260,000143: 42,3724           06477                                    HIUNITZ                               
022261,000144: 42,3725           65732                                    NOADJUST                              #  YES, -90 TO +90
022262,000145: 42,3726           45345                           DLOAD    DSU                                   
022263,000146: 42,3727           06503                                    HIDPHALF                              
022264,000147: 42,3730           02172                                    PITCHANG                              
022265,000148: 42,3731           02172                           STORE    PITCHANG                              
022266,000149: 42,3732           47375        NOADJUST           VLOAD    VXV                                   
022267,000150: 42,3733           00001                                    UR                                    #  Z = (UR X URP)
022268,000151: 42,3734           00007                                    URP                                   
022269,000152: 42,3735           77772                           VSL1                                           
022270,000153: 42,3736           16176                           STODL    RLM                                   #  Z VEC  B-1
022271,000154: 42,3737           02172                                    PITCHANG                              
022272,000155: 42,3740           74356                           SIN      VXSC                                  
022273,000156: 42,3741           06477                                    HIUNITZ                               
022274,000157: 42,3742           71525                           PDDL     COS                                   
022275,000158: 42,3743           02172                                    PITCHANG                              
022276,000159: 42,3744           52361                           VXSC     VSU                                   
022277,000160: 42,3745           06503                                    HIUNITX                               #  (UX COS ALPHA) - (UZ SIN ALPHA)
022278,000161: 42,3746           63241                           DOT      PDVL                                  #  YAW.Z
022279,000162: 42,3747           02176                                    RLM                                   
022280,000163: 42,3750           02176                                    RLM                                   
022281,000164: 42,3751           75246                           ABVAL    SIGN                                  
022282,000165: 42,3752           77736                           ASIN                                           
022283,000166: 42,3753           02174                           STORE    YAWANG                                
022284,000167: 42,3754           77776        SBANDEX            EXIT                                           
022285,000168: 42,3755           31043                           CA       EXTVBACT                              
022286,000169: 42,3756           74740                           MASK     BIT5                                  #  IS BIT5 STILL ON
022287,000170: 42,3757           00006                           EXTEND                                         
022288,000171: 42,3760           15474                           BZF      ENDEXT                                #  NO
022289,000172: 42,3761           35010                           CAF      PRIO5                                 
022290,000173: 42,3762           05137                           TC       PRIOCHNG                              
022291,000174: 42,3763           33776                           CAF      V06N51                                #  DISPLAY ANGLES
022292,000175: 

Page 504

022294,000177: 42,3764           04607                           TC       BANKCALL                              
022295,000178: 42,3765           20345                           CADR     GOMARKFR                              
022296,000179: 42,3766           05565                           TC       B5OFF                                 #  TERMINATE
022297,000180: 42,3767           05565                           TC       B5OFF                                 #  PROCEED
022298,000181: 42,3770           05146                           TC       ENDOFJOB                              #  RECYCLE
022299,000182: 42,3771           34742                           CAF      BIT3                                  #  IMMEDIATE RETURN
022300,000183: 42,3772           05466                           TC       BLANKET                               #  BLANK R3
022301,000184: 42,3773           34731                           CAF      PRIO4                                 
022302,000185: 42,3774           05137                           TC       PRIOCHNG                              
022303,000186: 42,3775           03617                           TC       SBANDANT                              #  YES, CONTINUE DISPLAYING ANGLES.
022304,000187: 42,3776           01463        V06N51             VN       0651                                  
022305,000188: 
022306,000189: 40,2000                                           SETLOC   SBAND40                               
022307,000190: 40,2000                                           BANK                                           
022308,000191: 
022309,000192: 40,3737           26501 07463  1OVSQRT2           2DEC     .7071067815                            #  1/SQRT(2)
022310,000193: 
022311,000194: 40,3741                        UR                 EQUALS   0D                                    
022312,000195: 40,3741                        URP                EQUALS   6D                                    
022313,000196: 40,3741  30,2000                                  SBANK=   LOWSUPER                              

End of include-file S-BAND_ANTENNA_FOR_LM.agc.  Parent file is MAIN.agc