Source Code

These source-code files are part of a reconstructed copy of Luminary 97, the second release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software. It was created to fix two incorrect ephemeris constants in Luminary 96, as described by anomaly report LNY-59.

The reconstruction began with source code of Luminary 99 revision 1 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes described in original Luminary memos 83 and 85, using asterisks indicating changed lines in the listing as a guide. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 97 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

020529,000002:                                                                                                  ## Copyright:   Public domain.
020530,000003:                                                                                                  ## Filename:    S-BAND_ANTENNA_FOR_LM.agc
020531,000004:                                                                                                  ## Purpose:     A section of Luminary revision 97.
020532,000005:                                                                                                  ##              It is part of the reconstructed source code for the
020533,000006:                                                                                                  ##              second release of the flight software for the Lunar 
020534,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
020535,000008:                                                                                                  ##              It was created to fix two incorrect ephemeris constants in
020536,000009:                                                                                                  ##              Luminary 96, as described by anomaly report LNY-59.
020537,000010:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
020538,000011:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
020539,000012:                                                                                                  ##              the listing and Luminary Memos #83 and #85, which list 
020540,000013:                                                                                                  ##              changes between Luminary 97 and 98, and 98 and 99. The
020541,000014:                                                                                                  ##              code has been adapted such that the resulting bugger words
020542,000015:                                                                                                  ##              exactly match those specified for Luminary 97 in NASA drawing
020543,000016:                                                                                                  ##              2021152D, which gives relatively high confidence that the
020544,000017:                                                                                                  ##              reconstruction is correct.
020545,000018:                                                                                                  ## Reference:   pp. 486-489
020546,000019:                                                                                                  ## Assembler:   yaYUL
020547,000020:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
020548,000021:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
020549,000022:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
020550,000023: 

Page 486

020552,000025:                                                                                                  #  SUBROUTINE NAME: R05 - S-BAND ANTENNA FOR LM
020553,000026: 
020554,000027:                                                                                                  #  MOD0 BY T. JAMES
020555,000028:                                                                                                  #  MOD1 BY P. SHAKIR
020556,000029: 
020557,000030:                                                                                                  #  FUNCTIONAL DESCRIPTION
020558,000031: 
020559,000032:                                                                                                  #  THE S-BAND ANTENNA ROUTINE, R05, COMPUTES AND DISPLAYS THE PITCH AND
020560,000033:                                                                                                  #  YAW ANTENNA GIMBAL ANGLES REQUIRED TO POINT THE LM STEERABLE ANTENNA
020561,000034:                                                                                                  #  TOWARD THE CENTER OF THE EARTH.  THIS ROUTINE IS SELECTED BY THE ASTRO-
020562,000035:                                                                                                  #  NAUT VIA DSKY ENTRY DURING COASTING FLIGHT OR WHEN THE LM IS ON THE MOON
020563,000036:                                                                                                  #  SURFACE.  THE EARTH OR MOON REFERENCE COORDINATE SYSTEM IS USED DEPENDING
020564,000037:                                                                                                  #  ON WHETHER THE LM IS ABOUT TO ENTER OR HAS ALREADY ENTERED THE MOON
020565,000038:                                                                                                  #  SPHERE OF INFLUENCE, RESPECTIVELY
020566,000039: 
020567,000040:                                                                                                  #  TO CALL SUBROUTINE, ASTRONAUT KEYS IN V 64 E
020568,000041: 
020569,000042:                                                                                                  #  SUBROUTINES CALLED -
020570,000043:                                                                                                  #        R02BOTH
020571,000044:                                                                                                  #        INTPRET
020572,000045:                                                                                                  #        LOADTIME
020573,000046:                                                                                                  #        LEMCONIC
020574,000047:                                                                                                  #        LUNPOS
020575,000048:                                                                                                  #        CDUTRIG
020576,000049:                                                                                                  #        *SMNB*
020577,000050:                                                                                                  #        BANKCALL
020578,000051:                                                                                                  #        B5OFF
020579,000052:                                                                                                  #        ENDOFJOB
020580,000053:                                                                                                  #        BLANKET
020581,000054: 
020582,000055:                                                                                                  #  RETURNS WITH
020583,000056:                                                                                                  #        PITCH ANGLE IN PITCHANG         REV. B0
020584,000057:                                                                                                  #        YAW ANGLE IN YAWANG             REV. B0
020585,000058: 
020586,000059:                                                                                                  #  ERASABLES USED
020587,000060:                                                                                                  #        PITCHANG
020588,000061:                                                                                                  #        YAWANG
020589,000062:                                                                                                  #        RLM
020590,000063:                                                                                                  #        VAC AREA
020591,000064: 
020592,000065: 41,3731                                           BANK     41                                    
020593,000066: 42,2000                                           SETLOC   SBAND                                 
020594,000067: 42,2000                                           BANK                                           
020595,000068: 
020596,000069: 42,3606  E7,1471                                  EBANK=   WHOCARES                              
020597,000070: 42,3606                                           COUNT*   $$/R05                                
020598,000071: 42,3606           04616        SBANDANT           TC       BANKCALL                              

Page 487

020600,000073: 42,3607           11254                           CADR     R02BOTH                               #  CHECK IF IMU IS ON AND ALIGNED
020601,000074: 42,3610           06037                           TC       INTPRET                               
020602,000075: 42,3611           47001                           SETPD    RTB                                   
020603,000076: 42,3612           00001                                    0D                                    
020604,000077: 42,3613           21573                                    LOADTIME                              #  PICK UP CURRENT TIME
020605,000078: 42,3614           34041                           STCALL   TDEC1                                 #  ADVANCE INTEGRATION TO TIME IN TDEC1
020606,000079: 42,3615           27100                                    LEMCONIC                              #  USING CONIC INTEGRATION
020607,000080: 42,3616           46135                           SLOAD    BHIZ                                  
020608,000081: 42,3617           00050                                    X2                                    #  X2 =0 EARTH SPHERE, X2 =2 MOON SPHERE
020609,000082: 42,3620           65636                                    CONV4                                 
020610,000083: 42,3621           77775                           VLOAD                                          
020611,000084: 42,3622           00001                                    RATT                                  
020612,000085: 42,3623           16205                           STODL    RLM                                   
020613,000086: 42,3624           00015                                    TAT                                   
020614,000087: 42,3625           77624        CONV3              CALL                                           
020615,000088: 42,3626           33664                                    LUNPOS                                #  UNIT POSITION VECTOR FROM EARTH TO MOON
020616,000089: 42,3627           74375                           VLOAD    VXSC                                  
020617,000090: 42,3630           02723                                    VMOON                                 
020618,000091: 42,3631           24001                                    REMDIST                               #  MEAN DISTANCE FROM EARTH TO MOON
020619,000092: 42,3632           53372                           VSL1     VAD                                   
020620,000093: 42,3633           02205                                    RLM                                   
020621,000094: 42,3634           77650                           GOTO                                           
020622,000095: 42,3635           65640                                    CONV5                                 
020623,000096: 42,3636           77775        CONV4              VLOAD                                          
020624,000097: 42,3637           00001                                    RATT                                  #  UE = -UNIT(RATT)              EARTH SPHERE
020625,000098: 42,3640           53401        CONV5              SETPD    UNIT                                  #  UE = -UNIT((REM)(UEM) + RL)   MOON SPHERE
020626,000099: 42,3641           00001                                    0D                                    #  SET PL POINTER TO 0
020627,000100: 42,3642           45076                           VCOMP    CALL                                  
020628,000101: 42,3643           47537                                    CDUTRIG                               #  COMPUTE SINES AND COSINES OF CDU ANGLES
020629,000102: 42,3644           76521                           MXV      VSL1                                  #  TRANSFORM REF. COORDINATE SYSTEM TO
020630,000103: 42,3645           01734                                    REFSMMAT                              #  STABLE MEMBER B-1 X B-1 X B+1 = B-1
020631,000104: 42,3646           71206                           PUSH     DLOAD                                 #  8D
020632,000105: 42,3647           06522                                    HI6ZEROS                              
020633,000106: 42,3650           02201                           STORE    PITCHANG                              
020634,000107: 42,3651           26203                           STOVL    YAWANG                                #  ZERO OUT ANGLES
020635,000108: 42,3652           77624                           CALL                                           
020636,000109: 42,3653           47671                                    *SMNB*                                
020637,000110: 42,3654           16205                           STODL    RLM                                   #  PRE-MULTIPLY RLM BY (NBSA) MATRIX(B0)
020638,000111: 42,3655           02207                                    RLM        +2                         
020639,000112: 42,3656           45206                           PUSH     DSU                                   
020640,000113: 42,3657           02205                                    RLM                                   
020641,000114: 42,3660           77605                           DMP                                            
020642,000115: 42,3661           25771                                    1OVSQRT2                              
020643,000116: 42,3662           16207                           STODL    RLM        +2                         
020644,000117: 42,3663           41215                           DAD      DMP                                   
020645,000118: 42,3664           02205                                    RLM                                   
020646,000119: 42,3665           25771                                    1OVSQRT2                              
020647,000120: 42,3666           26205                           STOVL    RLM                                   #  R B-1
020648,000121: 42,3667           02205                                    RLM                                   
020649,000122: 42,3670           63256                           UNIT     PDVL                                  

Page 488

020651,000124: 42,3671           02205                                    RLM                                   
020652,000125: 42,3672           72431                           VPROJ    VSL2                                  #  PROJECTION OF R ONTO LM XZ PLANE
020653,000126: 42,3673           06516                                    HIUNITY                               
020654,000127: 42,3674           40045                           BVSU     BOV                                   #  CLEAR OVERFLOW INDICATOR IF ON
020655,000128: 42,3675           02205                                    RLM                                   
020656,000129: 42,3676           65677                                    COVCNV                                
020657,000130: 42,3677           40056        COVCNV             UNIT     BOV                                   #  EXIT ON OVERFLOW
020658,000131: 42,3700           65745                                    SBANDEX                               
020659,000132: 42,3701           47206                           PUSH     VXV                                   #  URP VECTOR B-1
020660,000133: 42,3702           06514                                    HIUNITZ                               
020661,000134: 42,3703           57572                           VSL1     VCOMP                                 #  UZ X URP = -(URP X UZ)
020662,000135: 42,3704           02205                           STORE    RLM                                   #  X VEC B-1
020663,000136: 42,3705           63241                           DOT      PDVL                                  #  SGN(X.UY) UNSCALED
020664,000137: 42,3706           06516                                    HIUNITY                               
020665,000138: 42,3707           02205                                    RLM                                   
020666,000139: 42,3710           75246                           ABVAL    SIGN                                  
020667,000140: 42,3711           77736                           ASIN                                           #  ASIN((SGN(X.UY))ABV(X))       REV B0
020668,000141: 42,3712           26201                           STOVL    PITCHANG                              
020669,000142: 42,3713           00007                                    URP                                   
020670,000143: 42,3714           51041                           DOT      BPL                                   
020671,000144: 42,3715           06514                                    HIUNITZ                               
020672,000145: 42,3716           65723                                    NOADJUST                              #  YES, -90 TO +90
020673,000146: 42,3717           45345                           DLOAD    DSU                                   
020674,000147: 42,3720           06520                                    HIDPHALF                              
020675,000148: 42,3721           02201                                    PITCHANG                              
020676,000149: 42,3722           02201                           STORE    PITCHANG                              
020677,000150: 42,3723           47375        NOADJUST           VLOAD    VXV                                   
020678,000151: 42,3724           00001                                    UR                                    #  Z = (UR X URP)
020679,000152: 42,3725           00007                                    URP                                   
020680,000153: 42,3726           77772                           VSL1                                           
020681,000154: 42,3727           16205                           STODL    RLM                                   #  Z VEC B-1
020682,000155: 42,3730           02201                                    PITCHANG                              
020683,000156: 42,3731           74356                           SIN      VXSC                                  
020684,000157: 42,3732           06514                                    HIUNITZ                               
020685,000158: 42,3733           71525                           PDDL     COS                                   
020686,000159: 42,3734           02201                                    PITCHANG                              
020687,000160: 42,3735           52361                           VXSC     VSU                                   
020688,000161: 42,3736           06520                                    HIUNITX                               #  (UX COS ALPHA) - (UZ SIN ALPHA)
020689,000162: 42,3737           63241                           DOT      PDVL                                  #  YAW.Z
020690,000163: 42,3740           02205                                    RLM                                   
020691,000164: 42,3741           02205                                    RLM                                   
020692,000165: 42,3742           75246                           ABVAL    SIGN                                  
020693,000166: 42,3743           77736                           ASIN                                           
020694,000167: 42,3744           02203                           STORE    YAWANG                                
020695,000168: 42,3745           77776        SBANDEX            EXIT                                           
020696,000169: 42,3746           31044                           CA       EXTVBACT                              
020697,000170: 42,3747           74747                           MASK     BIT5                                  #  IS BIT5 STILL ON
020698,000171: 42,3750           00006                           EXTEND                                         
020699,000172: 42,3751           15472                           BZF      ENDEXT                                #  NO
020700,000173: 42,3752           35017                           CAF      PRIO5                                 

Page 489

020702,000175: 42,3753           05146                           TC       PRIOCHNG                              
020703,000176: 42,3754           33767                           CAF      V06N51                                #  DISPLAY ANGLES
020704,000177: 42,3755           04616                           TC       BANKCALL                              
020705,000178: 42,3756           20353                           CADR     GOMARKFR                              
020706,000179: 42,3757           05563                           TC       B5OFF                                 #  TERMINATE
020707,000180: 42,3760           05563                           TC       B5OFF                                 #  PROCEED
020708,000181: 42,3761           05155                           TC       ENDOFJOB                              #  RECYCLE
020709,000182: 42,3762           34751                           CAF      BIT3                                  #  IMMEDIATE RETURN
020710,000183: 42,3763           05464                           TC       BLANKET                               #  BLANK R3
020711,000184: 42,3764           34740                           CAF      PRIO4                                 
020712,000185: 42,3765           05146                           TC       PRIOCHNG                              
020713,000186: 42,3766           03610                           TC       SBANDANT   +2                         #  YES, CONTINUE DISPLAYING ANGLES
020714,000187: 42,3767           01463        V06N51             VN       0651                                  
020715,000188: 42,3770           26501 07463  1OVSQRT2           2DEC     .7071067815                            #  1/SQRT(2)
020716,000189: 
020717,000190: 42,3772                        UR                 EQUALS   0D                                    
020718,000191: 42,3772                        URP                EQUALS   6D                                    
020719,000192: 42,3772  30,2000                                  SBANK=   LOWSUPER                              
020720,000193: 

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