Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
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.

021890,000002:                                                                                                  ## Copyright:   Public domain.
021891,000003:                                                                                                  ## Filename:    S-BAND_ANTENNA_FOR_LM.agc
021892,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
021893,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
021894,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
021895,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
021896,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
021897,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
021898,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
021899,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
021900,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
021901,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
021902,000014:                                                                                                  ## Reference:   pp. 498-501
021903,000015:                                                                                                  ## Assembler:   yaYUL
021904,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
021905,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
021906,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
021907,000019: 

Page 498

021909,000021:                                                                                                  #  SUBROUTINE NAME: R05 - S-BAND ANTENNA FOR LM
021910,000022: 
021911,000023:                                                                                                  #  MOD0 BY T. JAMES
021912,000024:                                                                                                  #  MOD1 BY P. SHAKIR
021913,000025: 
021914,000026:                                                                                                  #  FUNCTIONAL DESCRIPTION
021915,000027: 
021916,000028:                                                                                                  #        THE S-BAND ANTENNA ROUTINE, R05, COMPUTES AND DISPLAYS THE PITCH AND
021917,000029:                                                                                                  #  YAW ANTENNA GIMBAL ANGLES REQUIRED TO POINT THE LM STEERABLE ANTENNA
021918,000030:                                                                                                  #  TOWARD THE CENTER OF THE EARTH.  THIS ROUTINE IS SELECTED BY THE ASTRO-
021919,000031:                                                                                                  #  NAUT VIA DSKY ENTRY DURING COASTING FLIGHT OR WHEN THE LM IS ON THE MOON
021920,000032:                                                                                                  #  SURFACE.  THE EARTH OR MOON REFERENCE COORDINATE SYSTEM IS USED DEPENDING
021921,000033:                                                                                                  #  ON WHETHER THE LM IS ABOUT TO ENTER OR HAS ALREADY ENTERED THE MOON
021922,000034:                                                                                                  #  SPHERE OF INFLUENCE, RESPECTIVELY
021923,000035: 
021924,000036:                                                                                                  #  TO CALL SUBROUTINE, ASTRONAUT KEYS IN V 64 E
021925,000037: 
021926,000038:                                                                                                  #  SUBROUTINES CALLED-
021927,000039:                                                                                                  #        R02BOTH
021928,000040:                                                                                                  #        INTPRET
021929,000041:                                                                                                  #        LOADTIME
021930,000042:                                                                                                  #        LEMCONIC
021931,000043:                                                                                                  #        LUNPOS
021932,000044:                                                                                                  #        CDUTRIG
021933,000045:                                                                                                  #        *SMNB*
021934,000046:                                                                                                  #        BANKCALL
021935,000047:                                                                                                  #        B5OFF
021936,000048:                                                                                                  #        ENDOFJOB
021937,000049:                                                                                                  #        BLANKET
021938,000050: 
021939,000051:                                                                                                  #  RETURNS WITH
021940,000052:                                                                                                  #        PITCH ANGLE IN PITCHANG  REV. B0
021941,000053:                                                                                                  #        YAW ANGLE IN YAWANG  REV. B0
021942,000054: 
021943,000055:                                                                                                  #  ERASABLES USED
021944,000056:                                                                                                  #        PITCHANG
021945,000057:                                                                                                  #        YAWANG
021946,000058:                                                                                                  #        RLM
021947,000059:                                                                                                  #        VAC AREA
021948,000060: 
021949,000061: 41,3731                                           BANK     41                                    
021950,000062: 42,2000                                           SETLOC   SBAND                                 
021951,000063: 42,2000                                           BANK                                           
021952,000064: 
021953,000065: 42,3602  E7,1467                                  EBANK=   WHOCARES                              
021954,000066: 42,3602                                           COUNT*   $$/R05                                
021955,000067: 42,3602           04616        SBANDANT           TC       BANKCALL                              

Page 499

021957,000069: 42,3603           11175                           CADR     R02BOTH                               #  CHECK IF IMU IS ON AND ALIGNED
021958,000070: 42,3604           06036                           TC       INTPRET                               
021959,000071: 42,3605           47001                           SETPD    RTB                                   
021960,000072: 42,3606           00001                                    0D                                    
021961,000073: 42,3607           21462                                    LOADTIME                              #  PICK UP CURRENT TIME
021962,000074: 42,3610           34041                           STCALL   TDEC1                                 #  ADVANCE INTEGRATION TO TIME IN TDEC1
021963,000075: 42,3611           27100                                    LEMCONIC                              #  USING CONIC INTEGRATION
021964,000076: 42,3612           46135                           SLOAD    BHIZ                                  
021965,000077: 42,3613           00050                                    X2                                    #  X2 =0 EARTH SPHERE, X2 =2 MOON SPHERE
021966,000078: 42,3614           65632                                    CONV4                                 
021967,000079: 42,3615           77775                           VLOAD                                          
021968,000080: 42,3616           00001                                    RATT                                  
021969,000081: 42,3617           16211                           STODL    RLM                                   
021970,000082: 42,3620           00015                                    TAT                                   
021971,000083: 42,3621           77624        CONV3              CALL                                           
021972,000084: 42,3622           33663                                    LUNPOS                                #  UNIT POSITION VECTOR FROM EARTH TO MOON
021973,000085: 42,3623           74375                           VLOAD    VXSC                                  
021974,000086: 42,3624           02723                                    VMOON                                 
021975,000087: 42,3625           24001                                    REMDIST                               #  MEAN DISTANCE FROM EARTH TO MOON
021976,000088: 42,3626           53372                           VSL1     VAD                                   
021977,000089: 42,3627           02211                                    RLM                                   
021978,000090: 42,3630           77650                           GOTO                                           
021979,000091: 42,3631           65634                                    CONV5                                 
021980,000092: 42,3632           77775        CONV4              VLOAD                                          
021981,000093: 42,3633           00001                                    RATT                                  #  UE = -UNIT(RATT)  EARTH SPHERE
021982,000094: 42,3634           53401        CONV5              SETPD    UNIT                                  #  UE = -UNIT((REM)(UEM) + RL)  MOON SPHERE
021983,000095: 42,3635           00001                                    0D                                    #  SET PL POINTER TO 0
021984,000096: 42,3636           45076                           VCOMP    CALL                                  
021985,000097: 42,3637           47443                                    CDUTRIG                               #  COMPUTE SINES AND COSINES OF CDU ANGLES
021986,000098: 42,3640           76521                           MXV      VSL1                                  #  TRANSFORM REF. COORDINATE SYSTEM TO
021987,000099: 42,3641           01734                                    REFSMMAT                              #  STABLE MEMBER B-1 X B-1 X B+1 = B-1
021988,000100: 42,3642           71206                           PUSH     DLOAD                                 #  8D
021989,000101: 42,3643           06424                                    HI6ZEROS                              
021990,000102: 42,3644           02205                           STORE    PITCHANG                              
021991,000103: 42,3645           26207                           STOVL    YAWANG                                #  ZERO OUT ANGLES
021992,000104: 42,3646           77624                           CALL                                           
021993,000105: 42,3647           47575                                    *SMNB*                                
021994,000106: 42,3650           16211                           STODL    RLM                                   #  PRE-MULTIPLY RLM BY (NBSA) MATRIX(B0)
021995,000107: 42,3651           02213                                    RLM        +2                         
021996,000108: 42,3652           45206                           PUSH     DSU                                   
021997,000109: 42,3653           02211                                    RLM                                   
021998,000110: 42,3654           77605                           DMP                                            
021999,000111: 42,3655           25765                                    1OVSQRT2                              
022000,000112: 42,3656           16213                           STODL    RLM        +2                         
022001,000113: 42,3657           41215                           DAD      DMP                                   
022002,000114: 42,3660           02211                                    RLM                                   
022003,000115: 42,3661           25765                                    1OVSQRT2                              
022004,000116: 42,3662           26211                           STOVL    RLM                                   #  R B-1
022005,000117: 42,3663           02211                                    RLM                                   
022006,000118: 42,3664           63256                           UNIT     PDVL                                  

Page 500

022008,000120: 42,3665           02211                                    RLM                                   
022009,000121: 42,3666           72431                           VPROJ    VSL2                                  #  PROJECTION OF R ONTO LM XZ PLANE
022010,000122: 42,3667           06420                                    HIUNITY                               
022011,000123: 42,3670           40045                           BVSU     BOV                                   #  CLEAR OVERFLOW INDICATOR IF ON
022012,000124: 42,3671           02211                                    RLM                                   
022013,000125: 42,3672           65673                                    COVCNV                                
022014,000126: 42,3673           40056        COVCNV             UNIT     BOV                                   #  EXIT ON OVERFLOW
022015,000127: 42,3674           65741                                    SBANDEX                               
022016,000128: 42,3675           47206                           PUSH     VXV                                   #  URP VECTOR B-1
022017,000129: 42,3676           06416                                    HIUNITZ                               
022018,000130: 42,3677           57572                           VSL1     VCOMP                                 #  UZ X URP = -(URP X UZ)
022019,000131: 42,3700           02211                           STORE    RLM                                   #  X VEC B-1
022020,000132: 42,3701           63241                           DOT      PDVL                                  #  SGN(X.UY) UNSCALED
022021,000133: 42,3702           06420                                    HIUNITY                               
022022,000134: 42,3703           02211                                    RLM                                   
022023,000135: 42,3704           75246                           ABVAL    SIGN                                  
022024,000136: 42,3705           77736                           ASIN                                           #  ASIN((SGN(X.UY))ABV(X)) REV B0
022025,000137: 42,3706           26205                           STOVL    PITCHANG                              
022026,000138: 42,3707           00007                                    URP                                   
022027,000139: 42,3710           51041                           DOT      BPL                                   
022028,000140: 42,3711           06416                                    HIUNITZ                               
022029,000141: 42,3712           65717                                    NOADJUST                              #  YES, -90 TO +90
022030,000142: 42,3713           45345                           DLOAD    DSU                                   
022031,000143: 42,3714           06422                                    HIDPHALF                              
022032,000144: 42,3715           02205                                    PITCHANG                              
022033,000145: 42,3716           02205                           STORE    PITCHANG                              
022034,000146: 42,3717           47375        NOADJUST           VLOAD    VXV                                   
022035,000147: 42,3720           00001                                    UR                                    #  Z = (UR X URP)
022036,000148: 42,3721           00007                                    URP                                   
022037,000149: 42,3722           77772                           VSL1                                           
022038,000150: 42,3723           16211                           STODL    RLM                                   #  Z VEC B-1
022039,000151: 42,3724           02205                                    PITCHANG                              
022040,000152: 42,3725           74356                           SIN      VXSC                                  
022041,000153: 42,3726           06416                                    HIUNITZ                               
022042,000154: 42,3727           71525                           PDDL     COS                                   
022043,000155: 42,3730           02205                                    PITCHANG                              
022044,000156: 42,3731           52361                           VXSC     VSU                                   
022045,000157: 42,3732           06422                                    HIUNITX                               #  (UX COS ALPHA) - (UZ SIN ALPHA)
022046,000158: 42,3733           63241                           DOT      PDVL                                  #  YAW.Z
022047,000159: 42,3734           02211                                    RLM                                   
022048,000160: 42,3735           02211                                    RLM                                   
022049,000161: 42,3736           75246                           ABVAL    SIGN                                  
022050,000162: 42,3737           77736                           ASIN                                           
022051,000163: 42,3740           02207                           STORE    YAWANG                                
022052,000164: 42,3741           77776        SBANDEX            EXIT                                           
022053,000165: 42,3742           31044                           CA       EXTVBACT                              
022054,000166: 42,3743           74747                           MASK     BIT5                                  #  IS BIT5 STILL ON
022055,000167: 42,3744           00006                           EXTEND                                         
022056,000168: 42,3745           15472                           BZF      ENDEXT                                #  NO
022057,000169: 42,3746           35017                           CAF      PRIO5                                 

Page 501

022059,000171: 42,3747           05146                           TC       PRIOCHNG                              
022060,000172: 42,3750           33763                           CAF      V06N51                                #  DISPLAY ANGLES
022061,000173: 42,3751           04616                           TC       BANKCALL                              
022062,000174: 42,3752           20231                           CADR     GOMARKFR                              
022063,000175: 42,3753           05563                           TC       B5OFF                                 #  TERMINATE
022064,000176: 42,3754           05563                           TC       B5OFF                                 #  PROCEED
022065,000177: 42,3755           05155                           TC       ENDOFJOB                              #  RECYCLE
022066,000178: 42,3756           34751                           CAF      BIT3                                  #  IMMEDIATE RETURN
022067,000179: 42,3757           05464                           TC       BLANKET                               #  BLANK R3
022068,000180: 42,3760           34740                           CAF      PRIO4                                 
022069,000181: 42,3761           05146                           TC       PRIOCHNG                              
022070,000182: 42,3762           03604                           TC       SBANDANT   +2                         #  YES, CONTINUE DISPLAYING ANGLES
022071,000183: 42,3763           01463        V06N51             VN       0651                                  
022072,000184: 42,3764           26501 07463  1OVSQRT2           2DEC     .7071067815                            #  1/SQRT(2)
022073,000185: 
022074,000186: 42,3766                        UR                 EQUALS   0D                                    
022075,000187: 42,3766                        URP                EQUALS   6D                                    
022076,000188: 42,3766  30,2000                                  SBANK=   LOWSUPER                              

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