Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97. A bug (which had been around since at least Apollo 10, Luminary 69) was discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute revision into Rev 1, which is what actually flew rather than the Rev 0 presented here. A hardcopy of Rev 0 is known to exist — it belonged to AGC developer Allan Klumpp for many years — but unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus the code you see here had been reconstructed (we believe accurately) rather than transcribed. The first step of the reconstruction of the Rev 0 source code was the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection. The process of reverting the active portion of the source code (i.e., other than program comments) from Rev 1 to Rev 0 was very minor, consisting only of moving the position of the STARTSB1 label in FRESH START AND RESTART. Allan had previously given us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read, in part:

	GAP:  ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051

A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here.

021310,000002:                                                                                                  ## Copyright:   Public domain.
021311,000003:                                                                                                  ## Filename:    S-BAND_ANTENNA_FOR_LM.agc
021312,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
021313,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the third release
021314,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
021315,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
021316,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
021317,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
021318,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
021319,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
021320,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
021321,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
021322,000014:                                                                                                  ##              the original YUL assembler.
021323,000015:                                                                                                  ##
021324,000016:                                                                                                  ## Assembler:   yaYUL
021325,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
021326,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
021327,000019:                                                                                                  ## Pages:       486-489
021328,000020:                                                                                                  ## Mod history: 2009-05-17 RSB  Adapted from the corresponding 
021329,000021:                                                                                                  ##                              Luminary131 file, using page 
021330,000022:                                                                                                  ##                              images from Luminary 1A.
021331,000023:                                                                                                  ##              2009-06-07 RSB  Corrected a misprint.
021332,000024:                                                                                                  ##              2016-12-14 RSB  Proofed text comments with octopus/ProoferComments
021333,000025:                                                                                                  ##                              and corrected the errors found.
021334,000026:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
021335,000027: 
021336,000028:                                                                                                  ## This source code has been transcribed or otherwise adapted from
021337,000029:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
021338,000030:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
021339,000031:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
021340,000032:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
021341,000033:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
021342,000034:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
021343,000035:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
021344,000036:                                                                                                  ## actually created.
021345,000037:                                                                                                  ##
021346,000038:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
021347,000039:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
021348,000040:                                                                                                  ## the listing from which it was transcribed. It has been verified to
021349,000041:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
021350,000042:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
021351,000043:                                                                                                  ##
021352,000044:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
021353,000045:                                                                                                  ##
021354,000046:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
021355,000047: 

Page 486

021357,000049:                                                                                                  #  SUBROUTINE NAME: R05 - S-BAND ANTENNA FOR LM
021358,000050: 
021359,000051:                                                                                                  #  MOD0 BY T. JAMES
021360,000052:                                                                                                  #  MOD1 BY P. SHAKIR
021361,000053: 
021362,000054:                                                                                                  #  FUNCTIONAL DESCRIPTION
021363,000055: 
021364,000056:                                                                                                  #  THE S-BAND ANTENNA ROUTINE, R05, COMPUTES AND DISPLAYS THE PITCH AND
021365,000057:                                                                                                  #  YAW ANTENNA GIMBAL ANGLES REQUIRED TO POINT THE LM STEERABLE ANTENNA
021366,000058:                                                                                                  #  TOWARD THE CENTER OF THE EARTH.  THIS ROUTINE IS SELECTED BY THE ASTRO-
021367,000059:                                                                                                  #  NAUT VIA DSKY ENTRY DURING COASTING FLIGHT OR WHEN THE LM IS ON THE MOON
021368,000060:                                                                                                  #  SURFACE.  THE EARTH OR MOON REFERENCE COORDINATE SYSTEM IS USED DEPENDING
021369,000061:                                                                                                  #  ON WHETHER THE LM IS ABOUT TO ENTER OR HAS ALREADY ENTERED THE MOON
021370,000062:                                                                                                  #  SPHERE OF INFLUENCE, RESPECTIVELY
021371,000063: 
021372,000064:                                                                                                  #  TO CALL SUBROUTINE, ASTRONAUT KEYS IN V 64 E
021373,000065: 
021374,000066:                                                                                                  #  SUBROUTINES CALLED -
021375,000067:                                                                                                  #        R02BOTH
021376,000068:                                                                                                  #        INTPRET
021377,000069:                                                                                                  #        LOADTIME
021378,000070:                                                                                                  #        LEMCONIC
021379,000071:                                                                                                  #        LUNPOS
021380,000072:                                                                                                  #        CDUTRIG
021381,000073:                                                                                                  #        *SMNB*
021382,000074:                                                                                                  #        BANKCALL
021383,000075:                                                                                                  #        B5OFF
021384,000076:                                                                                                  #        ENDOFJOB
021385,000077:                                                                                                  #        BLANKET
021386,000078: 
021387,000079:                                                                                                  #  RETURNS WITH
021388,000080:                                                                                                  #        PITCH ANGLE IN PITCHANG         REV. B0
021389,000081:                                                                                                  #        YAW ANGLE IN YAWANG             REV. B0
021390,000082: 
021391,000083:                                                                                                  #  ERASABLES USED
021392,000084:                                                                                                  #        PITCHANG
021393,000085:                                                                                                  #        YAWANG
021394,000086:                                                                                                  #        RLM
021395,000087:                                                                                                  #        VAC AREA
021396,000088: 
021397,000089: 41,3731                                           BANK     41                                    
021398,000090: 42,2000                                           SETLOC   SBAND                                 
021399,000091: 42,2000                                           BANK                                           
021400,000092: 
021401,000093: 42,3606  E7,1471                                  EBANK=   WHOCARES                              
021402,000094: 42,3606                                           COUNT*   $$/R05                                
021403,000095: 42,3606           04616        SBANDANT           TC       BANKCALL                              

Page 487

021405,000097: 42,3607           11254                           CADR     R02BOTH                               #  CHECK IF IMU IS ON AND ALIGNED
021406,000098: 42,3610           06037                           TC       INTPRET                               
021407,000099: 42,3611           47001                           SETPD    RTB                                   
021408,000100: 42,3612           00001                                    0D                                    
021409,000101: 42,3613           21573                                    LOADTIME                              #  PICK UP CURRENT TIME
021410,000102: 42,3614           34041                           STCALL   TDEC1                                 #  ADVANCE INTEGRATION TO TIME IN TDEC1
021411,000103: 42,3615           27100                                    LEMCONIC                              #  USING CONIC INTEGRATION
021412,000104: 42,3616           46135                           SLOAD    BHIZ                                  
021413,000105: 42,3617           00050                                    X2                                    #  X2 =0 EARTH SPHERE, X2 =2 MOON SPHERE
021414,000106: 42,3620           65636                                    CONV4                                 
021415,000107: 42,3621           77775                           VLOAD                                          
021416,000108: 42,3622           00001                                    RATT                                  
021417,000109: 42,3623           16205                           STODL    RLM                                   
021418,000110: 42,3624           00015                                    TAT                                   
021419,000111: 42,3625           77624        CONV3              CALL                                           
021420,000112: 42,3626           33664                                    LUNPOS                                #  UNIT POSITION VECTOR FROM EARTH TO MOON
021421,000113: 42,3627           74375                           VLOAD    VXSC                                  
021422,000114: 42,3630           02723                                    VMOON                                 
021423,000115: 42,3631           24001                                    REMDIST                               #  MEAN DISTANCE FROM EARTH TO MOON
021424,000116: 42,3632           53372                           VSL1     VAD                                   
021425,000117: 42,3633           02205                                    RLM                                   
021426,000118: 42,3634           77650                           GOTO                                           
021427,000119: 42,3635           65640                                    CONV5                                 
021428,000120: 42,3636           77775        CONV4              VLOAD                                          
021429,000121: 42,3637           00001                                    RATT                                  #  UE = -UNIT(RATT)              EARTH SPHERE
021430,000122: 42,3640           53401        CONV5              SETPD    UNIT                                  #  UE = -UNIT((REM)(UEM) + RL)   MOON SPHERE
021431,000123: 42,3641           00001                                    0D                                    #  SET PL POINTER TO 0
021432,000124: 42,3642           45076                           VCOMP    CALL                                  
021433,000125: 42,3643           47537                                    CDUTRIG                               #  COMPUTE SINES AND COSINES OF CDU ANGLES
021434,000126: 42,3644           76521                           MXV      VSL1                                  #  TRANSFORM REF. COORDINATE SYSTEM TO
021435,000127: 42,3645           01734                                    REFSMMAT                              #  STABLE MEMBER B-1 X B-1 X B+1 = B-1
021436,000128: 42,3646           71206                           PUSH     DLOAD                                 #  8D
021437,000129: 42,3647           06522                                    HI6ZEROS                              
021438,000130: 42,3650           02201                           STORE    PITCHANG                              
021439,000131: 42,3651           26203                           STOVL    YAWANG                                #  ZERO OUT ANGLES
021440,000132: 42,3652           77624                           CALL                                           
021441,000133: 42,3653           47671                                    *SMNB*                                
021442,000134: 42,3654           16205                           STODL    RLM                                   #  PRE-MULTIPLY RLM BY (NBSA) MATRIX(B0)
021443,000135: 42,3655           02207                                    RLM        +2                         
021444,000136: 42,3656           45206                           PUSH     DSU                                   
021445,000137: 42,3657           02205                                    RLM                                   
021446,000138: 42,3660           77605                           DMP                                            
021447,000139: 42,3661           25771                                    1OVSQRT2                              
021448,000140: 42,3662           16207                           STODL    RLM        +2                         
021449,000141: 42,3663           41215                           DAD      DMP                                   
021450,000142: 42,3664           02205                                    RLM                                   
021451,000143: 42,3665           25771                                    1OVSQRT2                              
021452,000144: 42,3666           26205                           STOVL    RLM                                   #  R B-1
021453,000145: 42,3667           02205                                    RLM                                   
021454,000146: 42,3670           63256                           UNIT     PDVL                                  

Page 488

021456,000148: 42,3671           02205                                    RLM                                   
021457,000149: 42,3672           72431                           VPROJ    VSL2                                  #  PROJECTION OF R ONTO LM XZ PLANE
021458,000150: 42,3673           06516                                    HIUNITY                               
021459,000151: 42,3674           40045                           BVSU     BOV                                   #  CLEAR OVERFLOW INDICATOR IF ON
021460,000152: 42,3675           02205                                    RLM                                   
021461,000153: 42,3676           65677                                    COVCNV                                
021462,000154: 42,3677           40056        COVCNV             UNIT     BOV                                   #  EXIT ON OVERFLOW
021463,000155: 42,3700           65745                                    SBANDEX                               
021464,000156: 42,3701           47206                           PUSH     VXV                                   #  URP VECTOR B-1
021465,000157: 42,3702           06514                                    HIUNITZ                               
021466,000158: 42,3703           57572                           VSL1     VCOMP                                 #  UZ X URP = -(URP X UZ)
021467,000159: 42,3704           02205                           STORE    RLM                                   #  X VEC B-1
021468,000160: 42,3705           63241                           DOT      PDVL                                  #  SGN(X.UY) UNSCALED
021469,000161: 42,3706           06516                                    HIUNITY                               
021470,000162: 42,3707           02205                                    RLM                                   
021471,000163: 42,3710           75246                           ABVAL    SIGN                                  
021472,000164: 42,3711           77736                           ASIN                                           #  ASIN((SGN(X.UY))ABV(X))       REV B0
021473,000165: 42,3712           26201                           STOVL    PITCHANG                              
021474,000166: 42,3713           00007                                    URP                                   
021475,000167: 42,3714           51041                           DOT      BPL                                   
021476,000168: 42,3715           06514                                    HIUNITZ                               
021477,000169: 42,3716           65723                                    NOADJUST                              #  YES, -90 TO +90
021478,000170: 42,3717           45345                           DLOAD    DSU                                   
021479,000171: 42,3720           06520                                    HIDPHALF                              
021480,000172: 42,3721           02201                                    PITCHANG                              
021481,000173: 42,3722           02201                           STORE    PITCHANG                              
021482,000174: 42,3723           47375        NOADJUST           VLOAD    VXV                                   
021483,000175: 42,3724           00001                                    UR                                    #  Z = (UR X URP)
021484,000176: 42,3725           00007                                    URP                                   
021485,000177: 42,3726           77772                           VSL1                                           
021486,000178: 42,3727           16205                           STODL    RLM                                   #  Z VEC B-1
021487,000179: 42,3730           02201                                    PITCHANG                              
021488,000180: 42,3731           74356                           SIN      VXSC                                  
021489,000181: 42,3732           06514                                    HIUNITZ                               
021490,000182: 42,3733           71525                           PDDL     COS                                   
021491,000183: 42,3734           02201                                    PITCHANG                              
021492,000184: 42,3735           52361                           VXSC     VSU                                   
021493,000185: 42,3736           06520                                    HIUNITX                               #  (UX COS ALPHA) - (UZ SIN ALPHA)
021494,000186: 42,3737           63241                           DOT      PDVL                                  #  YAW.Z
021495,000187: 42,3740           02205                                    RLM                                   
021496,000188: 42,3741           02205                                    RLM                                   
021497,000189: 42,3742           75246                           ABVAL    SIGN                                  
021498,000190: 42,3743           77736                           ASIN                                           
021499,000191: 42,3744           02203                           STORE    YAWANG                                
021500,000192: 42,3745           77776        SBANDEX            EXIT                                           
021501,000193: 42,3746           31044                           CA       EXTVBACT                              
021502,000194: 42,3747           74747                           MASK     BIT5                                  #  IS BIT5 STILL ON
021503,000195: 42,3750           00006                           EXTEND                                         
021504,000196: 42,3751           15472                           BZF      ENDEXT                                #  NO
021505,000197: 42,3752           35017                           CAF      PRIO5                                 

Page 489

021507,000199: 42,3753           05146                           TC       PRIOCHNG                              
021508,000200: 42,3754           33767                           CAF      V06N51                                #  DISPLAY ANGLES
021509,000201: 42,3755           04616                           TC       BANKCALL                              
021510,000202: 42,3756           20353                           CADR     GOMARKFR                              
021511,000203: 42,3757           05563                           TC       B5OFF                                 #  TERMINATE
021512,000204: 42,3760           05563                           TC       B5OFF                                 #  PROCEED
021513,000205: 42,3761           05155                           TC       ENDOFJOB                              #  RECYCLE
021514,000206: 42,3762           34751                           CAF      BIT3                                  #  IMMEDIATE RETURN
021515,000207: 42,3763           05464                           TC       BLANKET                               #  BLANK R3
021516,000208: 42,3764           34740                           CAF      PRIO4                                 
021517,000209: 42,3765           05146                           TC       PRIOCHNG                              
021518,000210: 42,3766           03610                           TC       SBANDANT   +2                         #  YES, CONTINUE DISPLAYING ANGLES
021519,000211: 42,3767           01463        V06N51             VN       0651                                  
021520,000212: 42,3770           26501 07463  1OVSQRT2           2DEC     .7071067815                            #  1/SQRT(2)
021521,000213: 
021522,000214: 42,3772                        UR                 EQUALS   0D                                    
021523,000215: 42,3772                        URP                EQUALS   6D                                    
021524,000216: 42,3772  30,2000                                  SBANK=   LOWSUPER                              
021525,000217: 

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