Source Code

These source code files are a reconstruction of Sundance, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
This means that source code does not represent a specific historical revision of Sundance, but rather a mixture of the three released versions. Nonetheless, it is capable of flying the whole Apollo 9 mission. This source code matches the binary dumps, as closely as feasible, but 100% match is not possible, due mostly to changes in memory addresses at which code and variables were allocated in different revisions of Sundance. Refer to this list of explanations for each binary mismatch.

Since only binary dumps (rather than listings) of Sundance are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

018891,000002:                                                                                                  ## Copyright:   Public domain.
018892,000003:                                                                                                  ## Filename:    S-BAND_ANTENNA_FOR_LM.agc
018893,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
018894,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
018895,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
018896,000007:                                                                                                  ##              No original listings of this program are available;
018897,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
018898,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
018899,000010:                                                                                                  ## Assembler:   yaYUL
018900,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
018901,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
018902,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
018903,000014: 
018904,000015:                                                                                                  ## Sundance 306
018905,000016: 
018906,000017:                                                                                                  #  SUBROUTINE NAME: R05 - S-BAND ANTENNA FOR LM
018907,000018: 
018908,000019:                                                                                                  #  MOD0 BY T. JAMES
018909,000020:                                                                                                  #  MOD1 BY P. SHAKIR
018910,000021: 
018911,000022:                                                                                                  #  FUNCTIONAL DESCRIPTION
018912,000023: 
018913,000024:                                                                                                  #        THE S-BAND ANTENNA ROUTINE, R05, COMPUTES AND DISPLAYS THE PITCH AND
018914,000025:                                                                                                  #  YAW ANTENNA GIMBAL ANGLES REQUIRED TO POINT THE LM STEERABLE ANTENNA
018915,000026:                                                                                                  #  TOWARD THE CENTER OF THE EARTH.  THIS ROUTINE IS SELECTED BY THE ASTRO-
018916,000027:                                                                                                  #  NAUT VIA DSKY ENTRY DURING COASTING FLIGHT OR WHEN THE LM IS ON THE MOON
018917,000028:                                                                                                  #  SURFACE.  THE EARTH OR MOON REFERENCE COORDINATE SYSTEM IS USED DEPENDING
018918,000029:                                                                                                  #  ON WHETHER THE LM IS ABOUT TO ENTER OR HAS ALREADY ENTERED THE MOON
018919,000030:                                                                                                  #  SPHERE OF INFLUENCE, RESPECTIVELY
018920,000031: 
018921,000032:                                                                                                  #  TO CALL SUBROUTINE, ASTRONAUT KEYS IN V 64 E
018922,000033: 
018923,000034:                                                                                                  #  SUBROUTINES CALLED-
018924,000035:                                                                                                  #        R02BOTH
018925,000036:                                                                                                  #        INTPRET
018926,000037:                                                                                                  #        LOADTIME
018927,000038:                                                                                                  #        LEMCONIC
018928,000039:                                                                                                  #        LUNPOS
018929,000040:                                                                                                  #        CDUTRIG
018930,000041:                                                                                                  #        *SMNB*
018931,000042:                                                                                                  #        BANKCALL
018932,000043:                                                                                                  #        B5OFF
018933,000044:                                                                                                  #        ENDOFJOB
018934,000045:                                                                                                  #        BLANKET
018935,000046: 
018936,000047:                                                                                                  #  RETURNS WITH
018937,000048:                                                                                                  #        PITCH ANGLE IN PITCHANG  REV. B0
018938,000049:                                                                                                  #        YAW ANGLE IN YAWANG  REV. B0
018939,000050: 
018940,000051:                                                                                                  #  ERASABLES USED
018941,000052:                                                                                                  #        PITCHANG
018942,000053:                                                                                                  #        YAWANG
018943,000054:                                                                                                  #        RLM
018944,000055:                                                                                                  #        VAC AREA
018945,000056: 
018946,000057: 41,3724                                           BANK     41                                    
018947,000058: 42,2000                                           SETLOC   SBAND                                 
018948,000059: 42,2000                                           BANK                                           
018949,000060: 
018950,000061: 42,3563  E7,1456                                  EBANK=   WHOCARES                              
018951,000062: 42,3563                                           COUNT*   $$/R05                                
018952,000063: 42,3563           35022        SBANDANT           CAF      BIT5                                  
018953,000064: 42,3564           27045                           ADS      EXTVBACT                              
018954,000065: 42,3565           04655                           TC       BANKCALL                              
018955,000066: 42,3566           11064                           CADR     R02BOTH                               #  CHECK IF IMU IS ON AND ALIGNED
018956,000067: 42,3567           06014                           TC       INTPRET                               
018957,000068: 42,3570           45034                           RTB      CALL                                  
018958,000069: 42,3571           21454                                    LOADTIME                              #  PICK UP CURRENT TIME
018959,000070: 42,3572           47251                                    CDUTRIG                               
018960,000071: 42,3573           34041                           STCALL   TDEC1                                 #  ADVANCE INTEGRATION TO TIME IN TDEC1
018961,000072: 42,3574           27051                                    LEMCONIC                              #  USING CONIC INTEGRATION
018962,000073: 42,3575           77775                           VLOAD                                          
018963,000074: 42,3576           00001                                    RATT                                  
018964,000075: 42,3577           02213                           STORE    RLM                                   
018965,000076: 42,3600           77745                           DLOAD                                          
018966,000077: 42,3601           00015                                    TAT                                   
018967,000078: 42,3602           77624        CONV3              CALL                                           
018968,000079: 42,3603           33236                                    LUNPOS                                #  UNIT POSITION VECTOR FROM EARTH TO MOON
018969,000080: 42,3604           57455                           VAD      VCOMP                                 
018970,000081: 42,3605           02213                                    RLM                                   
018971,000082: 42,3606           76521                           MXV      VSL1                                  #  TRANSFORM REF. COORDINATE SYSTEM TO
018972,000083: 42,3607           01736                                    REFSMMAT                              #  STABLE MEMBER B-1 X B-1 X B+1 = B-1
018973,000084: 42,3610           71206                           PUSH     DLOAD                                 #  8D
018974,000085: 42,3611           06233                                    HI6ZEROS                              
018975,000086: 42,3612           02207                           STORE    PITCHANG                              
018976,000087: 42,3613           26211                           STOVL    YAWANG                                #  ZERO OUT ANGLES
018977,000088: 42,3614           02213                                    RLM                                   
018978,000089: 42,3615           77624                           CALL                                           
018979,000090: 42,3616           47413                                    *SMNB*                                
018980,000091: 42,3617           02213                           STORE    RLM                                   #  PRE-MULTIPLY RLM BY (NBSA) MATRIX(B0)
018981,000092: 42,3620           63256                           UNIT     PDVL                                  
018982,000093: 42,3621           02213                                    RLM                                   
018983,000094: 42,3622           72431                           VPROJ    VSL2                                  #  PROJECTION OF R ONTO LM XZ PLANE
018984,000095: 42,3623           06227                                    HIUNITY                               
018985,000096: 42,3624           40045                           BVSU     BOV                                   #  CLEAR OVERFLOW INDICATOR IF ON
018986,000097: 42,3625           02213                                    RLM                                   
018987,000098: 42,3626           65627                                    COVCNV                                
018988,000099: 42,3627           40056        COVCNV             UNIT     BOV                                   #  EXIT ON OVERFLOW
018989,000100: 42,3630           65707                                    SBANDEX                               
018990,000101: 42,3631           47206                           PUSH     VXV                                   #  URP VECTOR B-1
018991,000102: 42,3632           06225                                    HIUNITZ                               
018992,000103: 42,3633           57572                           VSL1     VCOMP                                 #  UZ X URP = -(URP X UZ)
018993,000104: 42,3634           02213                           STORE    RLM                                   #  X VEC B-1
018994,000105: 42,3635           77646                           ABVAL                                          
018995,000106: 42,3636           26207                           STOVL    PITCHANG                              
018996,000107: 42,3637           02213                                    RLM                                   
018997,000108: 42,3640           72441                           DOT      SL1                                   #  SGN(X.UY) UNSCALED
018998,000109: 42,3641           06227                                    HIUNITY                               
018999,000110: 42,3642           16213                           STODL    RLM                                   
019000,000111: 42,3643           02207                                    PITCHANG                              
019001,000112: 42,3644           67565                           SIGN     ASIN                                  #  ASIN((SGN(X.UY))ABV(X)) REV B0
019002,000113: 42,3645           02213                                    RLM                                   
019003,000114: 42,3646           26207                           STOVL    PITCHANG                              
019004,000115: 42,3647           00017                                    URP                                   
019005,000116: 42,3650           72441                           DOT      SL1                                   
019006,000117: 42,3651           06225                                    HIUNITZ                               
019007,000118: 42,3652           71244                           BPL      DLOAD                                 
019008,000119: 42,3653           65660                                    NOADJUST                              #  YES, -90 TO +90
019009,000120: 42,3654           06231                                    HIDPHALF                              
019010,000121: 42,3655           77625                           DSU                                            
019011,000122: 42,3656           02207                                    PITCHANG                              
019012,000123: 42,3657           02207                           STORE    PITCHANG                              
019013,000124: 42,3660           47375        NOADJUST           VLOAD    VXV                                   
019014,000125: 42,3661           00011                                    UR                                    #  Z = (UR X URP)
019015,000126: 42,3662           00017                                    URP                                   
019016,000127: 42,3663           77772                           VSL1                                           
019017,000128: 42,3664           02213                           STORE    RLM                                   #  Z VEC B-1
019018,000129: 42,3665           73545                           DLOAD    SIN                                   
019019,000130: 42,3666           02207                                    PITCHANG                              
019020,000131: 42,3667           76561                           VXSC     VSL1                                  
019021,000132: 42,3670           06225                                    HIUNITZ                               
019022,000133: 42,3671           14011                           STODL    UR                                    
019023,000134: 42,3672           02207                                    PITCHANG                              
019024,000135: 42,3673           74346                           COS      VXSC                                  
019025,000136: 42,3674           06231                                    HIUNITX                               #  (UX COS ALPHA) - (UZ SIN ALPHA)
019026,000137: 42,3675           52372                           VSL1     VSU                                   
019027,000138: 42,3676           00011                                    UR                                    
019028,000139: 42,3677           72441                           DOT      SL1                                   #  YAW.Z
019029,000140: 42,3700           02213                                    RLM                                   
019030,000141: 42,3701           24011                           STOVL    UR                                    
019031,000142: 42,3702           02213                                    RLM                                   
019032,000143: 42,3703           75246                           ABVAL    SIGN                                  
019033,000144: 42,3704           00011                                    UR                                    
019034,000145: 42,3705           77736                           ASIN                                           
019035,000146: 42,3706           02211                           STORE    YAWANG                                
019036,000147: 42,3707           77776        SBANDEX            EXIT                                           
019037,000148: 42,3710           33725                           CAF      V06N51                                #  DISPLAY ANGLES
019038,000149: 42,3711           04655                           TC       BANKCALL                              
019039,000150: 42,3712           20245                           CADR     GOMARKFR                              
019040,000151: 42,3713           05642                           TC       B5OFF                                 #  TERMINATE
019041,000152: 42,3714           05225                           TC       ENDOFJOB                              #  PROCEED
019042,000153: 42,3715           05225                           TC       ENDOFJOB                              #  RECYCLE
019043,000154: 42,3716           35024                           CAF      BIT3                                  #  IMMEDIATE RETURN
019044,000155: 42,3717           05553                           TC       BLANKET                               #  BLANK R3
019045,000156: 42,3720           31045                           CA       EXTVBACT                              
019046,000157: 42,3721           75022                           MASK     BIT5                                  #  IS BIT5 STILL ON
019047,000158: 42,3722           00006                           EXTEND                                         
019048,000159: 42,3723           15561                           BZF      ENDEXT                                #  NO
019049,000160: 42,3724           03565                           TC       SBANDANT   +2                         #  YES, CONTINUE DISPLAYING ANGLES
019050,000161: 42,3725           01463        V06N51             VN       0651                                  
019051,000162: 
019052,000163: 42,3726                        UR                 EQUALS   8D                                    
019053,000164: 42,3726                        URP                EQUALS   14D                                   
019054,000165: 42,3726  30,2000                                  SBANK=   LOWSUPER                              

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