Source Code

These source-code files are part of a reconstructed copy of Luminary 178, the final release of the Apollo 14 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Zerlina 56, Luminary 210, and Luminary 131, previously transcribed from digitized copies of those programs. The code was created by combining the three, using Zerlina 56 as a base, since it was based off of Luminary 183. The differences between the three were carefully merged using the Luminary memos as a guide, with all changes made after Luminary 178 being backed out. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 178 listing would be different.

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.

021464,000002:                                                                                                  ## Copyright:   Public domain.
021465,000003:                                                                                                  ## Filename:    S-BAND_ANTENNA_FOR_LM.agc
021466,000004:                                                                                                  ## Purpose:     A section of Luminary revision 178.
021467,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
021468,000006:                                                                                                  ##              release of the flight software for the Lunar Module's
021469,000007:                                                                                                  ##              (LM) Apollo Guidance Computer (AGC) for Apollo 14. The
021470,000008:                                                                                                  ##              code has been recreated from copies of Zerlina 56, Luminary
021471,000009:                                                                                                  ##              210, and Luminary 131, as well as many Luminary memos.
021472,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
021473,000011:                                                                                                  ##              exactly match those specified for Luminary 178 in NASA
021474,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
021475,000013:                                                                                                  ##              that the reconstruction is correct.
021476,000014:                                                                                                  ## Reference:   pp. 494-497
021477,000015:                                                                                                  ## Assembler:   yaYUL
021478,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
021479,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
021480,000018:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Zerlina 56.
021481,000019: 

Page 494

021483,000021:                                                                                                  #  SUBROUTINE NAME: R05 - S-BAND ANTENNA FOR LM
021484,000022: 
021485,000023:                                                                                                  #  MOD0 BY T. JAMES
021486,000024:                                                                                                  #  MOD1 BY P. SHAKIR
021487,000025: 
021488,000026:                                                                                                  #  FUNCTIONAL DESCRIPTION
021489,000027: 
021490,000028:                                                                                                  #      THE S-BAND ANTENNA ROUTINE, R05, COMPUTES AND DISPLAYS THE PITCH AND
021491,000029:                                                                                                  #  YAW ANTENNA GIMBAL ANGLES REQUIRED TO POINT THE LM STEERABLE ANTENNA
021492,000030:                                                                                                  #  TOWARD THE CENTER OF THE EARTH. THIS ROUTINE IS SELECTED BY THE ASTRO-
021493,000031:                                                                                                  #  NAUT VIA DSKY ENTRY DURING COASTING FLIGHT OR WHEN THE LM IS ON THE MOON
021494,000032:                                                                                                  #  SURFACE. THE EARTH OR MOON REFERENCE COORDINATE SYSTEM IS USED DEPENDING
021495,000033:                                                                                                  #  ON WHETHER THE LM IS ABOUT TO ENTER OR HAS ALREADY ENTERED THE MOON
021496,000034:                                                                                                  #  SPHERE OF INFLUENCE, RESPECTIVELY.  CAN BE CALLED ANY TIME EXCEPT WHEN
021497,000035:                                                                                                  #  ANOTHER EXTENDED VERB IS IN USE. DISPLAY IS MEANINGLESS WITH IMU OFF.
021498,000036: 
021499,000037:                                                                                                  #  TO CALL SUBROUTINE, ASTRONAUT KEYS IN V 64 E
021500,000038: 
021501,000039:                                                                                                  #  SUBROUTINES CALLED-
021502,000040: 
021503,000041:                                                                                                  #      INTPRET
021504,000042:                                                                                                  #      LOADTIME
021505,000043:                                                                                                  #      LEMCONIC
021506,000044:                                                                                                  #      LUNPOS
021507,000045:                                                                                                  #      CDUTRIG
021508,000046:                                                                                                  #      *SMNB*
021509,000047:                                                                                                  #      BANKCALL
021510,000048:                                                                                                  #      B5OFF
021511,000049:                                                                                                  #      ENDOFJOB
021512,000050:                                                                                                  #      BLANKET
021513,000051: 
021514,000052:                                                                                                  #  RETURNS WITH
021515,000053: 
021516,000054:                                                                                                  #      PITCH ANGLE IN PITCHANG  REV. B0
021517,000055:                                                                                                  #      YAW ANGLE IN YAWANG  REV. B0
021518,000056: 
021519,000057:                                                                                                  #  ERASABLES USED
021520,000058: 
021521,000059:                                                                                                  #      PITCHANG
021522,000060:                                                                                                  #      YAWANG
021523,000061:                                                                                                  #      RLM
021524,000062:                                                                                                  #      VAC AREA
021525,000063: 
021526,000064: 41,3755                                           BANK     41                                    
021527,000065: 42,2000                                           SETLOC   SBAND                                 
021528,000066: 42,2000                                           BANK                                           
021529,000067: 
021530,000068: 42,3612  E7,1471                                  EBANK=   WHOCARES                              
021531,000069: 42,3612                                           COUNT*   $$/R05                                
021532,000070: 42,3612           06042        SBANDANT           TC       INTPRET                               

Page 495

021534,000072: 42,3613           47001                           SETPD    RTB                                   
021535,000073: 42,3614           00001                                    0D                                    
021536,000074: 42,3615           21574                                    LOADTIME                              #  PICK UP CURRENT TIME
021537,000075: 42,3616           34041                           STCALL   TDEC1                                 #  ADVANCE INTEGRATION TO TIME IN TDEC1
021538,000076: 42,3617           27077                                    LEMCONIC                              #  USING CONIC INTEGRATION
021539,000077: 42,3620           46135                           SLOAD    BHIZ                                  
021540,000078: 42,3621           00050                                    X2                                    #  X2 =0 EARTH SPHERE, X2 =2 MOON SPHERE
021541,000079: 42,3622           65640                                    CONV4                                 
021542,000080: 42,3623           77775                           VLOAD                                          
021543,000081: 42,3624           00001                                    RATT                                  
021544,000082: 42,3625           16205                           STODL    RLM                                   
021545,000083: 42,3626           00015                                    TAT                                   
021546,000084: 42,3627           77624        CONV3              CALL                                           
021547,000085: 42,3630           33660                                    LUNPOS                                #  UNIT POSITION VECTOR FROM EARTH TO MOON
021548,000086: 42,3631           74375                           VLOAD    VXSC                                  
021549,000087: 42,3632           02723                                    VMOON                                 
021550,000088: 42,3633           24001                                    REMDIST                               #  MEAN DISTANCE FROM EARTH TO MOON
021551,000089: 42,3634           53372                           VSL1     VAD                                   
021552,000090: 42,3635           02205                                    RLM                                   
021553,000091: 42,3636           77650                           GOTO                                           
021554,000092: 42,3637           65642                                    CONV5                                 
021555,000093: 42,3640           77775        CONV4              VLOAD                                          
021556,000094: 42,3641           00001                                    RATT                                  #  UE = -UNIT(RATT)  EARTH SPHERE
021557,000095: 42,3642           53401        CONV5              SETPD    UNIT                                  #  UE = -UNIT((REM)(UEM) + RL)  MOON SPHERE
021558,000096: 42,3643           00001                                    0D                                    #  SET PL POINTER TO 0
021559,000097: 42,3644           45076                           VCOMP    CALL                                  
021560,000098: 42,3645           47505                                    CDUTRIG                               #  COMPUTE SINES AND COSINES OF CDU ANGLES
021561,000099: 42,3646           76521                           MXV      VSL1                                  #  TRANSFORM REF. COORDINATE SYSTEM TO
021562,000100: 42,3647           01732                                    REFSMMAT                              #  STABLE MEMBER  B-1 X B-1 X B+1 = B-1
021563,000101: 42,3650           71206                           PUSH     DLOAD                                 #  8D
021564,000102: 42,3651           06470                                    HI6ZEROS                              
021565,000103: 42,3652           02201                           STORE    PITCHANG                              
021566,000104: 42,3653           26203                           STOVL    YAWANG                                #  ZERO OUT ANGLES
021567,000105: 42,3654           77624                           CALL                                           
021568,000106: 42,3655           47646                                    *SMNB*                                
021569,000107: 42,3656           16205                           STODL    RLM                                   #  PRE-MULTIPLY RLM BY (NBSA) MATRIX(B0)
021570,000108: 42,3657           02207                                    RLM        +2                         
021571,000109: 42,3660           45206                           PUSH     DSU                                   
021572,000110: 42,3661           02205                                    RLM                                   
021573,000111: 42,3662           77605                           DMP                                            
021574,000112: 42,3663           25773                                    1OVSQRT2                              
021575,000113: 42,3664           16207                           STODL    RLM        +2                         
021576,000114: 42,3665           41215                           DAD      DMP                                   
021577,000115: 42,3666           02205                                    RLM                                   
021578,000116: 42,3667           25773                                    1OVSQRT2                              
021579,000117: 42,3670           26205                           STOVL    RLM                                   #  R  B-1
021580,000118: 42,3671           02205                                    RLM                                   
021581,000119: 42,3672           63256                           UNIT     PDVL                                  
021582,000120: 42,3673           02205                                    RLM                                   
021583,000121: 42,3674           72431                           VPROJ    VSL2                                  #  PROJECTION OF R ONTO LM XZ PLANE

Page 496

021585,000123: 42,3675           06464                                    HIUNITY                               
021586,000124: 42,3676           40045                           BVSU     BOV                                   #  CLEAR OVERFLOW INDICATOR IF ON
021587,000125: 42,3677           02205                                    RLM                                   
021588,000126: 42,3700           65701                                    COVCNV                                
021589,000127: 42,3701           40056        COVCNV             UNIT     BOV                                   #  EXIT ON OVERFLOW
021590,000128: 42,3702           65747                                    SBANDEX                               
021591,000129: 42,3703           47206                           PUSH     VXV                                   #  URP VECTOR  B-1
021592,000130: 42,3704           06462                                    HIUNITZ                               
021593,000131: 42,3705           57572                           VSL1     VCOMP                                 #  UZ X URP = -(URP X UZ)
021594,000132: 42,3706           02205                           STORE    RLM                                   #  X VEC  B-1
021595,000133: 42,3707           63241                           DOT      PDVL                                  #  SGN(X.UY) UNSCALED
021596,000134: 42,3710           06464                                    HIUNITY                               
021597,000135: 42,3711           02205                                    RLM                                   
021598,000136: 42,3712           75246                           ABVAL    SIGN                                  
021599,000137: 42,3713           77736                           ASIN                                           #  ASIN((SGN(X.UY))ABV(X)) REV B0
021600,000138: 42,3714           26201                           STOVL    PITCHANG                              
021601,000139: 42,3715           00007                                    URP                                   
021602,000140: 42,3716           51041                           DOT      BPL                                   
021603,000141: 42,3717           06462                                    HIUNITZ                               
021604,000142: 42,3720           65725                                    NOADJUST                              #  YES, -90 TO +90
021605,000143: 42,3721           45345                           DLOAD    DSU                                   
021606,000144: 42,3722           06466                                    HIDPHALF                              
021607,000145: 42,3723           02201                                    PITCHANG                              
021608,000146: 42,3724           02201                           STORE    PITCHANG                              
021609,000147: 42,3725           47375        NOADJUST           VLOAD    VXV                                   
021610,000148: 42,3726           00001                                    UR                                    #  Z = (UR X URP)
021611,000149: 42,3727           00007                                    URP                                   
021612,000150: 42,3730           77772                           VSL1                                           
021613,000151: 42,3731           16205                           STODL    RLM                                   #  Z VEC  B-1
021614,000152: 42,3732           02201                                    PITCHANG                              
021615,000153: 42,3733           74356                           SIN      VXSC                                  
021616,000154: 42,3734           06462                                    HIUNITZ                               
021617,000155: 42,3735           71525                           PDDL     COS                                   
021618,000156: 42,3736           02201                                    PITCHANG                              
021619,000157: 42,3737           52361                           VXSC     VSU                                   
021620,000158: 42,3740           06466                                    HIUNITX                               #  (UX COS ALPHA) - (UZ SIN ALPHA)
021621,000159: 42,3741           63241                           DOT      PDVL                                  #  YAW.Z
021622,000160: 42,3742           02205                                    RLM                                   
021623,000161: 42,3743           02205                                    RLM                                   
021624,000162: 42,3744           75246                           ABVAL    SIGN                                  
021625,000163: 42,3745           77736                           ASIN                                           
021626,000164: 42,3746           02203                           STORE    YAWANG                                
021627,000165: 42,3747           77776        SBANDEX            EXIT                                           
021628,000166: 42,3750           31043                           CA       EXTVBACT                              
021629,000167: 42,3751           74747                           MASK     BIT5                                  #  IS BIT5 STILL ON
021630,000168: 42,3752           00006                           EXTEND                                         
021631,000169: 42,3753           15503                           BZF      ENDEXT                                #  NO
021632,000170: 42,3754           35017                           CAF      PRIO5                                 
021633,000171: 42,3755           05146                           TC       PRIOCHNG                              
021634,000172: 42,3756           33771                           CAF      V06N51                                #  DISPLAY ANGLES
021635,000173: 

Page 497

021637,000175: 42,3757           04616                           TC       BANKCALL                              
021638,000176: 42,3760           20353                           CADR     GOMARKFR                              
021639,000177: 42,3761           05574                           TC       B5OFF                                 #  TERMINATE
021640,000178: 42,3762           05574                           TC       B5OFF                                 #  PROCEED
021641,000179: 42,3763           05155                           TC       ENDOFJOB                              #  RECYCLE
021642,000180: 42,3764           34751                           CAF      BIT3                                  #  IMMEDIATE RETURN
021643,000181: 42,3765           05475                           TC       BLANKET                               #  BLANK R3
021644,000182: 42,3766           34740                           CAF      PRIO4                                 
021645,000183: 42,3767           05146                           TC       PRIOCHNG                              
021646,000184: 42,3770           03612                           TC       SBANDANT                              #  YES, CONTINUE DISPLAYING ANGLES.
021647,000185: 42,3771           01463        V06N51             VN       0651                                  
021648,000186: 42,3772           26501 07463  1OVSQRT2           2DEC     .7071067815                            #  1/SQRT(2)
021649,000187: 
021650,000188: 42,3774                        UR                 EQUALS   0D                                    
021651,000189: 42,3774                        URP                EQUALS   6D                                    
021652,000190: 42,3774  30,2000                                  SBANK=   LOWSUPER                              

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