Source Code

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

Notations on the program listing read, in part:

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

020821,000002:                                                                                                  ## Copyright:   Public domain.
020822,000003:                                                                                                  ## Filename:    S-BAND_ANTENNA_FOR_LM.agc
020823,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
020824,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
020825,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
020826,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
020827,000008:                                                                                                  ##              that the code format has been changed to conform to the
020828,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
020829,000010:                                                                                                  ##              original YUL assembler.
020830,000011:                                                                                                  ## Reference:   pp. 488-491
020831,000012:                                                                                                  ## Assembler:   yaYUL
020832,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
020833,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
020834,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
020835,000016:                                                                                                  ##              2017-03-09 RSB  Transcribed, and then proofed comment-text using
020836,000017:                                                                                                  ##                              3-way diff vs Luminary 99 and Luminary 131.
020837,000018:                                                                                                  ##                              (Admittedly, the former is more for detecting errors
020838,000019:                                                                                                  ##                              in Luminary 99 than the other way around.)
020839,000020:                                                                                                  ##              2017-03-13 HG   Remove operand modifier SBANDANT +2 --> SBANDANT
020840,000021: 

Page 488

020842,000023:                                                                                                  #  SUBROUTINE NAME: R05 - S-BAND ANTENNA FOR LM
020843,000024: 
020844,000025:                                                                                                  #  MOD0 BY T. JAMES
020845,000026:                                                                                                  #  MOD1 BY P. SHAKIR
020846,000027: 
020847,000028:                                                                                                  #  FUNCTIONAL DESCRIPTION
020848,000029: 
020849,000030:                                                                                                  #  THE S-BAND ANTENNA ROUTINE, R05, COMPUTES AND DISPLAYS THE PITCH AND
020850,000031:                                                                                                  #  YAW ANTENNA GIMBAL ANGLES REQUIRED TO POINT THE LM STEERABLE ANTENNA
020851,000032:                                                                                                  #  TOWARD THE CENTER OF THE EARTH.  THIS ROUTINE IS SELECTED BY THE ASTRO-
020852,000033:                                                                                                  #  NAUT VIA DSKY ENTRY DURING COASTING FLIGHT OR WHEN THE LM IS ON THE MOON
020853,000034:                                                                                                  #  SURFACE.  THE EARTH OR MOON REFERENCE COORDINATE SYSTEM IS USED DEPENDING
020854,000035:                                                                                                  #  ON WHETHER THE LM IS ABOUT TO ENTER OR HAS ALREADY ENTERED THE MOON
020855,000036:                                                                                                  #  SPHERE OF INFLUENCE, RESPECTIVELY.  CAN BE CALLED ANY TIME EXCEPT WHEN
020856,000037:                                                                                                  #  ANOTHER EXTENDED VERB IS IN USE. DISPLAY IS MEANINGLESS WITH IMU OFF.
020857,000038: 
020858,000039:                                                                                                  #  TO CALL SUBROUTINE, ASTRONAUT KEYS IN V 64 E
020859,000040: 
020860,000041:                                                                                                  #  SUBROUTINES CALLED -
020861,000042: 
020862,000043:                                                                                                  #        INTPRET
020863,000044:                                                                                                  #        LOADTIME
020864,000045:                                                                                                  #        LEMCONIC
020865,000046:                                                                                                  #        LUNPOS
020866,000047:                                                                                                  #        CDUTRIG
020867,000048:                                                                                                  #        *SMNB*
020868,000049:                                                                                                  #        BANKCALL
020869,000050:                                                                                                  #        B5OFF
020870,000051:                                                                                                  #        ENDOFJOB
020871,000052:                                                                                                  #        BLANKET
020872,000053: 
020873,000054:                                                                                                  #  RETURNS WITH
020874,000055: 
020875,000056:                                                                                                  #        PITCH ANGLE IN PITCHANG         REV. B0
020876,000057:                                                                                                  #        YAW ANGLE IN YAWANG             REV. B0
020877,000058: 
020878,000059:                                                                                                  #  ERASABLES USED
020879,000060:                                                                                                  #        PITCHANG
020880,000061:                                                                                                  #        YAWANG
020881,000062:                                                                                                  #        RLM
020882,000063:                                                                                                  #        VAC AREA
020883,000064: 
020884,000065: 41,3743                                           BANK     41                                    
020885,000066: 42,2000                                           SETLOC   SBAND                                 
020886,000067: 42,2000                                           BANK                                           
020887,000068: 
020888,000069: 42,3606  E7,1471                                  EBANK=   WHOCARES                              
020889,000070: 42,3606                                           COUNT*   $$/R05                                
020890,000071: 42,3606           06042        SBANDANT           TC       INTPRET                               

Page 489

020892,000073: 42,3607           47001                           SETPD    RTB                                   
020893,000074: 42,3610           00001                                    0D                                    
020894,000075: 42,3611           21574                                    LOADTIME                              #  PICK UP CURRENT TIME
020895,000076: 42,3612           34041                           STCALL   TDEC1                                 #  ADVANCE INTEGRATION TO TIME IN TDEC1
020896,000077: 42,3613           27101                                    LEMCONIC                              #  USING CONIC INTEGRATION
020897,000078: 42,3614           46135                           SLOAD    BHIZ                                  
020898,000079: 42,3615           00050                                    X2                                    #  X2 =0 EARTH SPHERE, X2 =2 MOON SPHERE
020899,000080: 42,3616           65634                                    CONV4                                 
020900,000081: 42,3617           77775                           VLOAD                                          
020901,000082: 42,3620           00001                                    RATT                                  
020902,000083: 42,3621           16205                           STODL    RLM                                   
020903,000084: 42,3622           00015                                    TAT                                   
020904,000085: 42,3623           77624        CONV3              CALL                                           
020905,000086: 42,3624           33647                                    LUNPOS                                #  UNIT POSITION VECTOR FROM EARTH TO MOON
020906,000087: 42,3625           74375                           VLOAD    VXSC                                  
020907,000088: 42,3626           02723                                    VMOON                                 
020908,000089: 42,3627           24001                                    REMDIST                               #  MEAN DISTANCE FROM EARTH TO MOON
020909,000090: 42,3630           53372                           VSL1     VAD                                   
020910,000091: 42,3631           02205                                    RLM                                   
020911,000092: 42,3632           77650                           GOTO                                           
020912,000093: 42,3633           65636                                    CONV5                                 
020913,000094: 42,3634           77775        CONV4              VLOAD                                          
020914,000095: 42,3635           00001                                    RATT                                  #  UE = -UNIT(RATT)              EARTH SPHERE
020915,000096: 42,3636           53401        CONV5              SETPD    UNIT                                  #  UE = -UNIT((REM)(UEM) + RL)   MOON SPHERE
020916,000097: 42,3637           00001                                    0D                                    #  SET PL POINTER TO 0
020917,000098: 42,3640           45076                           VCOMP    CALL                                  
020918,000099: 42,3641           47541                                    CDUTRIG                               #  COMPUTE SINES AND COSINES OF CDU ANGLES
020919,000100: 42,3642           76521                           MXV      VSL1                                  #  TRANSFORM REF. COORDINATE SYSTEM TO
020920,000101: 42,3643           01734                                    REFSMMAT                              #  STABLE MEMBER B-1 X B-1 X B+1 = B-1
020921,000102: 42,3644           71206                           PUSH     DLOAD                                 #  8D
020922,000103: 42,3645           06524                                    HI6ZEROS                              
020923,000104: 42,3646           02201                           STORE    PITCHANG                              
020924,000105: 42,3647           26203                           STOVL    YAWANG                                #  ZERO OUT ANGLES
020925,000106: 42,3650           77624                           CALL                                           
020926,000107: 42,3651           47673                                    *SMNB*                                
020927,000108: 42,3652           16205                           STODL    RLM                                   #  PRE-MULTIPLY RLM BY (NBSA) MATRIX(B0)
020928,000109: 42,3653           02207                                    RLM        +2                         
020929,000110: 42,3654           45206                           PUSH     DSU                                   
020930,000111: 42,3655           02205                                    RLM                                   
020931,000112: 42,3656           77605                           DMP                                            
020932,000113: 42,3657           25767                                    1OVSQRT2                              
020933,000114: 42,3660           16207                           STODL    RLM        +2                         
020934,000115: 42,3661           41215                           DAD      DMP                                   
020935,000116: 42,3662           02205                                    RLM                                   
020936,000117: 42,3663           25767                                    1OVSQRT2                              
020937,000118: 42,3664           26205                           STOVL    RLM                                   #  R B-1
020938,000119: 42,3665           02205                                    RLM                                   
020939,000120: 42,3666           63256                           UNIT     PDVL                                  
020940,000121: 42,3667           02205                                    RLM                                   
020941,000122: 42,3670           72431                           VPROJ    VSL2                                  #  PROJECTION OF R ONTO LM XZ PLANE

Page 490

020943,000124: 42,3671           06520                                    HIUNITY                               
020944,000125: 42,3672           40045                           BVSU     BOV                                   #  CLEAR OVERFLOW INDICATOR IF ON
020945,000126: 42,3673           02205                                    RLM                                   
020946,000127: 42,3674           65675                                    COVCNV                                
020947,000128: 42,3675           40056        COVCNV             UNIT     BOV                                   #  EXIT ON OVERFLOW
020948,000129: 42,3676           65743                                    SBANDEX                               
020949,000130: 42,3677           47206                           PUSH     VXV                                   #  URP VECTOR B-1
020950,000131: 42,3700           06516                                    HIUNITZ                               
020951,000132: 42,3701           57572                           VSL1     VCOMP                                 #  UZ X URP = -(URP X UZ)
020952,000133: 42,3702           02205                           STORE    RLM                                   #  X VEC B-1
020953,000134: 42,3703           63241                           DOT      PDVL                                  #  SGN(X.UY) UNSCALED
020954,000135: 42,3704           06520                                    HIUNITY                               
020955,000136: 42,3705           02205                                    RLM                                   
020956,000137: 42,3706           75246                           ABVAL    SIGN                                  
020957,000138: 42,3707           77736                           ASIN                                           #  ASIN((SGN(X.UY))ABV(X))       REV B0
020958,000139: 42,3710           26201                           STOVL    PITCHANG                              
020959,000140: 42,3711           00007                                    URP                                   
020960,000141: 42,3712           51041                           DOT      BPL                                   
020961,000142: 42,3713           06516                                    HIUNITZ                               
020962,000143: 42,3714           65721                                    NOADJUST                              #  YES, -90 TO +90
020963,000144: 42,3715           45345                           DLOAD    DSU                                   
020964,000145: 42,3716           06522                                    HIDPHALF                              
020965,000146: 42,3717           02201                                    PITCHANG                              
020966,000147: 42,3720           02201                           STORE    PITCHANG                              
020967,000148: 42,3721           47375        NOADJUST           VLOAD    VXV                                   
020968,000149: 42,3722           00001                                    UR                                    #  Z = (UR X URP)
020969,000150: 42,3723           00007                                    URP                                   
020970,000151: 42,3724           77772                           VSL1                                           
020971,000152: 42,3725           16205                           STODL    RLM                                   #  Z VEC B-1
020972,000153: 42,3726           02201                                    PITCHANG                              
020973,000154: 42,3727           74356                           SIN      VXSC                                  
020974,000155: 42,3730           06516                                    HIUNITZ                               
020975,000156: 42,3731           71525                           PDDL     COS                                   
020976,000157: 42,3732           02201                                    PITCHANG                              
020977,000158: 42,3733           52361                           VXSC     VSU                                   
020978,000159: 42,3734           06522                                    HIUNITX                               #  (UX COS ALPHA) - (UZ SIN ALPHA)
020979,000160: 42,3735           63241                           DOT      PDVL                                  #  YAW.Z
020980,000161: 42,3736           02205                                    RLM                                   
020981,000162: 42,3737           02205                                    RLM                                   
020982,000163: 42,3740           75246                           ABVAL    SIGN                                  
020983,000164: 42,3741           77736                           ASIN                                           
020984,000165: 42,3742           02203                           STORE    YAWANG                                
020985,000166: 42,3743           77776        SBANDEX            EXIT                                           
020986,000167: 42,3744           31043                           CA       EXTVBACT                              
020987,000168: 42,3745           74747                           MASK     BIT5                                  #  IS BIT5 STILL ON
020988,000169: 42,3746           00006                           EXTEND                                         
020989,000170: 42,3747           15472                           BZF      ENDEXT                                #  NO
020990,000171: 42,3750           35017                           CAF      PRIO5                                 
020991,000172: 42,3751           05146                           TC       PRIOCHNG                              
020992,000173: 42,3752           33765                           CAF      V06N51                                #  DISPLAY ANGLES

Page 491

020994,000175: 42,3753           04616                           TC       BANKCALL                              
020995,000176: 42,3754           20353                           CADR     GOMARKFR                              
020996,000177: 42,3755           05563                           TC       B5OFF                                 #  TERMINATE
020997,000178: 42,3756           05563                           TC       B5OFF                                 #  PROCEED
020998,000179: 42,3757           05155                           TC       ENDOFJOB                              #  RECYCLE
020999,000180: 42,3760           34751                           CAF      BIT3                                  #  IMMEDIATE RETURN
021000,000181: 42,3761           05464                           TC       BLANKET                               #  BLANK R3
021001,000182: 42,3762           34740                           CAF      PRIO4                                 
021002,000183: 42,3763           05146                           TC       PRIOCHNG                              
021003,000184: 42,3764           03606                           TC       SBANDANT                              #  YES, CONTINUE DISPLAYING ANGLES.
021004,000185: 42,3765           01463        V06N51             VN       0651                                  
021005,000186: 42,3766           26501 07463  1OVSQRT2           2DEC     .7071067815                            #  1/SQRT(2)
021006,000187: 
021007,000188: 42,3770                        UR                 EQUALS   0D                                    
021008,000189: 42,3770                        URP                EQUALS   6D                                    
021009,000190: 42,3770  30,2000                                  SBANK=   LOWSUPER                              

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