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.

012228,000002:                                                                                                  ## Copyright:   Public domain.
012229,000003:                                                                                                  ## Filename:    R63.agc
012230,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
012231,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
012232,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
012233,000007:                                                                                                  ##              No original listings of this program are available;
012234,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
012235,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
012236,000010:                                                                                                  ## Assembler:   yaYUL
012237,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
012238,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
012239,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
012240,000014: 
012241,000015:                                                                                                  ## Sundance 302
012242,000016: 
012243,000017:                                                                                                  #  SUBROUTINE NAME:      V89CALL
012244,000018:                                                                                                  #  MOD NO:       0                       DATE:           9 JAN 1968
012245,000019:                                                                                                  #  MOD BY:       DIGITAL DEVEL GROUP     LOG SECTION:    R63
012246,000020: 
012247,000021:                                                                                                  #  FUNCTIONAL DESCRIPTION:
012248,000022: 
012249,000023:                                                                                                  #  CALLED BY VERB 89 ENTER DURING P00.  PRIO 10 USED.  CALCULATES AND
012250,000024:                                                                                                  #  DISPLAYS FINAL FDAI BALL ANGLES TO POINT LM +X OR +Z AXIS AT CSM.
012251,000025: 
012252,000026:                                                                                                  #  1. KEY IN V 89 E ONLY IF IN PROG 00.  IF NOT IN P00, OPERATOR ERROR AND
012253,000027:                                                                                                  #  EXIT R63, OTHERWISE CONTINUE.
012254,000028: 
012255,000029:                                                                                                  #  2. IF IN P00, DO IMU STATUS CHECK ROUTINE (R02BOTH).  IF IMU ON AND ITS
012256,000030:                                                                                                  #  ORIENTATION KNOWN TO LGC, CONTINUE.
012257,000031: 
012258,000032:                                                                                                  #  3. FLASH DISPLAY V 04 N 06.  R2 INDICATES WHICH SPACECRAFT AXIS IS TO
012259,000033:                                                                                                  #  BE POINTED AT CSM.  INITIAL CHOICE IS PREFERRED (+Z) AXIS (R2=1).
012260,000034:                                                                                                  #  ASTRONAUT CAN CHANGE TO (+X) AXIS (R2 NOT =1) BY V 22 E 2 E.  CONTINUE
012261,000035:                                                                                                  #  AFTER KEYING IN PROCEED.
012262,000036: 
012263,000037:                                                                                                  #  4. BOTH VEHICLE STATE VECTORS UPDATED BY CONIC EQS.
012264,000038: 
012265,000039:                                                                                                  #  5. HALF MAGNITUDE UNIT LOS VECTOR (IN STABLE MEMBER COORDINATES) AND
012266,000040:                                                                                                  #  HALF MAGNITUDE UNIT SPACECRAFT AXIS VECTOR (IN BODY COORDINATES)
012267,000041:                                                                                                  #  PREPARED FOR VECPOINT.
012268,000042: 
012269,000043:                                                                                                  #  6. GIMBAL ANGLES FROM VECPOINT TRANSFORMED INTO FDAI BALL ANGLES BY
012270,000044:                                                                                                  #  BALLANGS.  FLASH DISPLAY V 06 N 18 AND AWAIT RESPONSE.
012271,000045: 
012272,000046:                                                                                                  #  7.    RECYCLE - RETURN TO STEP 4.
012273,000047:                                                                                                  #        TERMINATE - EXIT R63.
012274,000048:                                                                                                  #        PROCEED - RESET 3AXISFLG AND CALL R60LEM FOR ATTITUDE MANEUVER.
012275,000049: 
012276,000050:                                                                                                  #  CALLING SEQUENCE:     V 89 E.
012277,000051: 
012278,000052:                                                                                                  #  SUBROUTINES CALLED:   CHKPOOH, R02BOTH, GOXDSPF, CSMCONIC, LEMCONIC,
012279,000053:                                                                                                  #                        VECPOINT, BALLANGS, R60LEM.
012280,000054: 
012281,000055:                                                                                                  #  NORMAL EXIT MODES:    TC ENDEXT
012282,000056: 
012283,000057:                                                                                                  #  ALARMS:       1. OPERATOR ERROR IF NOT IN P00.
012284,000058:                                                                                                  #                2. PROGRAM ALARM IF IMU IS OFF.
012285,000059:                                                                                                  #                3. PROGRAM ALARM IF IMU ORIENTATION IS UNKNOWN.
012286,000060: 
012287,000061:                                                                                                  #  OUTPUT:       NONE
012288,000062: 
012289,000063:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED:  NONE
012290,000064: 
012291,000065:                                                                                                  #  DEBRIS:       OPTION1, +1, TDEC1, POINTVSM, SCAXIS, CPHI, CTHETA, CPSI,
012292,000066:                                                                                                  #                3AXISFLG.
012293,000067: 
012294,000068: 06,3712  E4,1614                                  EBANK=   RONE                                  
012295,000069: 32,2000                                           BANK     32                                    
012296,000070: 26,2000                                           SETLOC   BAWLANGS                              
012297,000071: 26,2000                                           BANK                                           
012298,000072: 
012299,000073: 26,2000                                           COUNT*   $$/R63                                
012300,000074: 26,2000           04655        V89CALL            TC       BANKCALL                              #  IMU STATUS CHECK.  RETURNS IF ORIENTATION
012301,000075: 26,2001           11064                           CADR     R02BOTH                               #  KNOWN.  ALARMS IF NOT.
012302,000076: 26,2002           36221                           CAF      THREE                                 #  ALLOW ASTRONAUT TO SELECT DESIRED
012303,000077: 26,2003           55155                           TS       OPTION1                               #  TRACKING ATTITUDE AXIS.
012304,000078: 26,2004           35026                           CAF      ONE                                   
012305,000079: 26,2005           55156                           TS       OPTION1    +1                         
012306,000080: 26,2006           32101                           CAF      VB04N06*                              #  V 04 N 06
012307,000081: 26,2007           04655                           TC       BANKCALL                              
012308,000082: 26,2010           20406                           CADR     GOFLASH                               
012309,000083: 26,2011           05561                           TC       ENDEXT                                #  TERMINATE
012310,000084: 26,2012           02014                           TC       +2                                    #  PROCEED
012311,000085: 26,2013           02006                           TC       -5                                    #  DATA IN. OPTION1+1 = 1 FOR Z AXIS
012312,000086: 26,2014           06014        V89RECL            TC       INTPRET                               #                    = 2 FOR X AXIS
012313,000087: 26,2015           77634                           RTB                                            
012314,000088: 26,2016           21454                                    LOADTIME                              #  READ PRESENT TIME
012315,000089: 26,2017           02213                           STORE    TSTART82                              #  SAVE TIME FOR LEMCONIC CALL
012316,000090: 26,2020           34041                           STCALL   TDEC1                                 #  STORE TIME FOR CSMCONIC CALL
012317,000091: 26,2021           27037                                    CSMCONIC                              #  CSM STATE VECTOR UPDATE
012318,000092: 26,2022           77775                           VLOAD                                          #  CSMCONIC LEFT R VECTOR IN RATT
012319,000093: 26,2023           00001                                    RATT                                  
012320,000094: 26,2024           16215                           STODL    RONE                                  #  SAVE FOR LINE OF SIGHT (LOS) COMPUTATION
012321,000095: 26,2025           02213                                    TSTART82                              
012322,000096: 26,2026           34041                           STCALL   TDEC1                                 #  STORE TIME FOR LEMCONIC CALL
012323,000097: 26,2027           27051                                    LEMCONIC                              #  LEM STATE VECTOR UPDATE
012324,000098: 26,2030           52375                           VLOAD    VSU                                   #  CSM POSITION - LEM POSITION = LOS
012325,000099: 26,2031           02215                                    RONE                                  #  LOS VECTOR LEFT IN MPAC
012326,000100: 26,2032           00001                                    RATT                                  
012327,000101: 26,2033           40121                           MXV      BOV                                   #  (REFSMMAT X LOS).  TRANSFORMS LOS FROM
012328,000102: 26,2034           01736                                    REFSMMAT                              #  REFERENCE COORD TO STAB MEMB COORD.
012329,000103: 26,2035           54036                                    +1                                    
012330,000104: 26,2036           02223                           STORE    VONE                                  
012331,000105: 26,2037           40012                           VSL8     BOV                                   
012332,000106: 26,2040           54042                                    +2                                    
012333,000107: 26,2041           02223                           STORE    VONE                                  
012334,000108: 26,2042           53575                           VLOAD    UNIT                                  
012335,000109: 26,2043           02223                                    VONE                                  
012336,000110: 26,2044           01256                           STORE    POINTVSM                              #  STORE LOS FOR VECPOINT CALL
012337,000111: 26,2045           77776                           EXIT                                           
012338,000112: 26,2046           41156                           CS       OPTION2                               #  1 FOR Z AXIS.  2 FOR X AXIS.
012339,000113: 26,2047           65026                           AD       ONE                                   
012340,000114: 26,2050           00006                           EXTEND                                         
012341,000115: 26,2051           12075                           BZF      ALINEZ                                
012342,000116: 26,2052           06014        ALINEX             TC       INTPRET                               #  X AXIS ALIGNMENT
012343,000117: 26,2053           77775                           VLOAD                                          
012344,000118: 26,2054           06231                                    UNITX                                 #  READ (.5, 0, 0)
012345,000119: 26,2055           35250        V89CALL1           STCALL   SCAXIS                                #  STORE SELECTED ALIGNMENT AXIS
012346,000120: 26,2056           56000                                    VECPOINT                              #  PUTS DESIRED GIM ANG (OG,IG,MG) IN TMPAC
012347,000121: 26,2057           01207                           STORE    CPHI                                  #  STORE GIMBAL ANGLES FOR BALLANGS CALL.
012348,000122: 26,2060           77776                           EXIT                                           
012349,000123: 26,2061           02302                           TC       BALLANGS                              #  PUTS DESIRED BALL ANGLES IN FDAIX,Y,Z
012350,000124: 26,2062           32102                           CAF      VB06N18                               #  V 06 N 18
012351,000125: 26,2063           04655                           TC       BANKCALL                              #  NOUN 18 REFERS TO FDAIX,Y,Z
012352,000126: 26,2064           20406                           CADR     GOFLASH                               
012353,000127: 26,2065           05561                           TC       ENDEXT                                #  TERMINATE
012354,000128: 26,2066           02070                           TC       +2                                    #  PROCEED
012355,000129: 26,2067           02014                           TC       V89RECL                               #  RECYCLE
012356,000130: 26,2070           05575                           TC       DOWNFLAG                              #  RESET 3 AXIS FLAG
012357,000131: 26,2071           00124                           ADRES    3AXISFLG                              #  RESET BIT6 FLAG WORD 5
012358,000132: 26,2072           04655                           TC       BANKCALL                              #  PERFORMS LEM MANEUVER TO ALIGN SELECTED
012359,000133: 26,2073           54103                           CADR     R60LEM                                #  SPACECRAFT AXIS TO CSM.
012360,000134: 26,2074           15561                           TCF      ENDEXT                                #  TERMINATE R63
012361,000135: 
012362,000136: 26,2075           06014        ALINEZ             TC       INTPRET                               #  Z AXIS ALIGNMENT
012363,000137: 26,2076           52175                           VLOAD    GOTO                                  
012364,000138: 26,2077           06225                                    UNITZ                                 #  READ (0, 0, .5)
012365,000139: 26,2100           54055                                    V89CALL1                              
012366,000140: 
012367,000141: 26,2101           01006        VB04N06*           VN       406                                   
012368,000142: 26,2102           01422        VB06N18            VN       0618                                  
012369,000143: 

End of include-file R63.agc.  Parent file is MAIN.agc