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.

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

Page 501

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

Page 502

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

Page 503

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

Page 504

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

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