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.

055383,000002:                                                                                                  ## Copyright:   Public domain.
055384,000003:                                                                                                  ## Filename:    DAP_INTERFACE_SUBROUTINES.agc
055385,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
055386,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
055387,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
055388,000007:                                                                                                  ##              No original listings of this program are available;
055389,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
055390,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
055391,000010:                                                                                                  ## Assembler:   yaYUL
055392,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
055393,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
055394,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
055395,000014: 
055396,000015:                                                                                                  ## Sundance 302
055397,000016: 
055398,000017: 20,2204                                           BANK     20                                    
055399,000018: 20,2000                                           SETLOC   DAPS3                                 
055400,000019: 20,2000                                           BANK                                           
055401,000020: 
055402,000021: 20,2204  E6,1632                                  EBANK=   CDUXD                                 
055403,000022: 20,2204                                           COUNT*   $$/DAPIF                              
055404,000023: 
055405,000024:                                                                                                  #  MOD 0         DATE    11/15/66        BY GEORGE W. CHERRY
055406,000025:                                                                                                  #  MOD 1                  1/23/67        MODIFICATION BY PETER ADLER
055407,000026: 
055408,000027:                                                                                                  #  FUNCTIONAL DESCRIPTION
055409,000028:                                                                                                  #        HEREIN ARE A COLLECTION OF SUBROUTINES WHICH ALLOW MISSION CONTROL PROGRAMS TO CONTROL THE MODE
055410,000029:                                                                                                  #        AND INTERFACE WITH THE DAP.
055411,000030: 
055412,000031:                                                                                                  #  CALLING SEQUENCES
055413,000032:                                                                                                  #        IN INTERRUPT OR WITH INTERRUPT INHIBITED
055414,000033:                                                                                                  #                TC      IBNKCALL
055415,000034:                                                                                                  #                FCADR   ROUTINE
055416,000035:                                                                                                  #        IN A JOB WITHOUT INTERRUPT INHIBITED
055417,000036:                                                                                                  #                INHINT
055418,000037:                                                                                                  #                TC      IBNKCALL
055419,000038:                                                                                                  #                FCADR   ROUTINE
055420,000039:                                                                                                  #                RELINT
055421,000040: 
055422,000041:                                                                                                  #  OUTPUT
055423,000042:                                                                                                  #        SEE INDIVIDUAL ROUTINES BELOW
055424,000043: 
055425,000044:                                                                                                  #  DEBRIS
055426,000045:                                                                                                  #        A, L, AND SOMETIMES MDUETEMP                    ODE     NOT IN PULSES MODE
055427,000046: 
055428,000047:                                                                                                  #  SUBROUTINE NAMES:
055429,000048:                                                                                                  #        SETMAXDB, SETMINDB, RESTORDB, PFLITEDB
055430,000049:                                                                                                  #  MODIFIED:     30 JANUARY 1968 BY P S WEISSMAN TO CREATE RESTORDB.
055431,000050:                                                                                                  #  MODIFIED:     1 MARCH 1968 BY P S WEISSMAN TO SAVE EBANK AND CREATE PFLITEDB
055432,000051: 
055433,000052:                                                                                                  #  FUNCTIONAL DESCRIPTION:
055434,000053:                                                                                                  #        SETMAXDB - SET DEADBAND TO 5.0 DEGREES
055435,000054:                                                                                                  #        SETMINDB - SET DEADBAND TO 0.3 DEGREE
055436,000055:                                                                                                  #        RESTORDB - SET DEADBAND TO MAX OR MIN ACCORDING TO SETTING OF DBSELECT BIT OF DAPBOOLS
055437,000056:                                                                                                  #        PFLITEDB - SET DEADBAND TO 1.0 DEGREE AND ZERO THE COMMANDED ATTITUDE CHANGE AND COMMANDED RATE
055438,000057: 
055439,000058:                                                                                                  #        ALL ENTRIES SET UP A NOVAC JOB TO DO 1/ACCS SO THAT THE TJETLAW SWITCH CURVES ARE POSITIONED TO
055440,000059:                                                                                                  #        REFLECT THE NEW DEADBAND.  IT SHOULD BE NOTED THAT THE DEADBAND REFERS TO THE ATTITUDE IN THE P-, U-, AND V-AXES.
055441,000060: 
055442,000061:                                                                                                  #  SUBROUTINE CALLED:    NOVAC
055443,000062: 
055444,000063:                                                                                                  #  CALLING SEQUENCE:     SAME AS ABOVE
055445,000064:                                                                                                  #                        OR      TC RESTORDB +1    FROM ALLCOAST
055446,000065: 
055447,000066:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, (ITEMPS IN NOVAC)
055448,000067: 
055449,000068:                                                                                                  #  DAPBOOLS BITS AND NAMES
055450,000069: 
055451,000070: 20,2204     5026               AUTRATE1           EQUALS   BIT1                                  #  THESE FLAGS ARE USED TOGETHER TO INIDCAT
055452,000071: 20,2204     5025               AUTRATE2           EQUALS   BIT2                                  #  ASTRONAUT-CHOSEN KALCMANU MANEUVER RATES
055453,000072:                                                                                                  #  (0,0)=(BIT2,BIT1)= 0.2 DEG/SEC
055454,000073:                                                                                                  #  (0,1)=  0.5 DEG/SEC
055455,000074: 20,2204     5024               ACCSOKAY           EQUALS   BIT3                                  #  VALUES FROM 1/ACCS USABLE FLAG
055456,000075: 20,2204     5023               DBSELECT           EQUALS   BIT4                                  #  DAP DEADBAND SELECT FLAG
055457,000076: 20,2204     5022               AORBSYST           EQUALS   BIT5                                  #  P-AXIS ROTATION JET SYSTEM (A OR B) FLAG
055458,000077: 20,2204     5021               ULLAGER            EQUALS   BIT6                                  #  INTERNAL ULLAGE REQUEST FLAG
055459,000078: 20,2204     5020               RHCSCALE           EQUALS   BIT7                                  #  RHC SCALE SELECT FLAG
055460,000079: 20,2204     5017               DRIFTBIT           EQUALS   BIT8                                  #  USE OFFSET ACCELERATION FLAG
055461,000080: 20,2204     5016               XOVINHIB           EQUALS   BIT9                                  #  X-AXIS OVERRIDE PERMITTED FLAG
055462,000081: 20,2204     5015               AORBTRAN           EQUALS   BIT10                                 #  X-TRANSLATION JET SYSTEM (A OR B) FLAG
055463,000082: 20,2204     5014               ACC4OR2X           EQUALS   BIT11                                 #  2 OR 4 JET Z-TRANSLATION MODE FLAG
055464,000083: 20,2204     5013               OURRCBIT           EQUALS   BIT12                                 #  INTERNAL DAP RATE COMMAND ACTIVITY FLAG
055465,000084: 20,2204     5012               CSMDOCKD           EQUALS   BIT13                                 #  CSM DOCKED TO LM FLAG
055466,000085: 20,2204     5011               USEQRJTS           EQUALS   BIT14                                 #  TRIM GIMBAL FLAG
055467,000086: 20,2204     5010               PULSES             EQUALS   BIT15                                 #  MINIMUM IMPULSE RHC MODE FLAG
055468,000087: 
055469,000088: 
055470,000089: 20,2204           31102        RESTORDB           CAE      DAPBOOLS                              #  DETERMINE CREW-SELECTED DEADBAND.
055471,000090: 20,2205           75023                           MASK     DBSELECT                              
055472,000091: 20,2206           00006                           EXTEND                                         
055473,000092: 20,2207           12221                           BZF      SETMINDB                              
055474,000093: 
055475,000094: 20,2210           35746        SETMAXDB           CAF      WIDEDB                                #  SET 5 DEGREE DEADBAND.
055476,000095: 20,2211           55356                 +1        TS       DB                                    
055477,000096: 
055478,000097: 20,2212           00006                           EXTEND                                         #  SET UP JOB TO RE-POSITION SWITCH CURVES.
055479,000098: 20,2213           22070                           QXCH     RUPTREG1                              
055480,000099: 20,2214           37667        CALLACCS           CAF      PRIO27                                
055481,000100: 20,2215           05142                           TC       NOVAC                                 
055482,000101: 20,2216  E6,1532                                  EBANK=   AOSQ                                  
055483,000102: 20,2216           02312 40106                     2CADR    1/ACCJOB                              
055484,000103: 
055485,000104: 20,2220           00070                           TC       RUPTREG1                              #  RETURN TO CALLER.
055486,000105: 
055487,000106: 20,2221           35745        SETMINDB           CAF      NARROWDB                              #  SET 0.3 DEGREE DEADBAND.
055488,000107: 20,2222           12211                           TCF      SETMAXDB   +1                         
055489,000108: 
055490,000109: 20,2223           00006        PFLITEDB           EXTEND                                         #  THE RETURN FROM CALLACCS IS TO RUPTREG1.
055491,000110: 20,2224           22070                           QXCH     RUPTREG1                              
055492,000111: 20,2225           02232                           TC       ZATTEROR                              #  ZERO THE ERRORS AND COMMANDED RATES.
055493,000112: 20,2226           32231                           CAF      POWERDB                               #  SET DB TO 1.0 DEG.
055494,000113: 20,2227           55356                           TS       DB                                    
055495,000114: 20,2230           12214                           TCF      CALLACCS                              #  SET UP 1/ACCS AND RETURN TO CALLER.
055496,000115: 
055497,000116: 20,2231           00554        POWERDB            DEC      .02222                                #  1.0 DEGREE SCALED AT 45.
055498,000117: 
055499,000118: 20,2232           35065        ZATTEROR           CAF      EBANK6                                
055500,000119: 20,2233           56003                           XCH      EBANK                                 
055501,000120: 20,2234           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
055502,000121: 20,2235           30032                           CAE      CDUX                                  
055503,000122: 20,2236           55632                           TS       CDUXD                                 
055504,000123: 20,2237           30033                           CAE      CDUY                                  
055505,000124: 20,2240           55633                           TS       CDUYD                                 
055506,000125: 20,2241           30034                           CAE      CDUZ                                  
055507,000126: 20,2242           55634                           TS       CDUZD                                 
055508,000127: 20,2243           12247                           TCF      STOPRATE   +3                         
055509,000128: 
055510,000129: 20,2244           35065        STOPRATE           CAF      EBANK6                                
055511,000130: 20,2245           56003                           XCH      EBANK                                 
055512,000131: 20,2246           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
055513,000132: 20,2247           35030                 +3        CAF      ZERO                                  
055514,000133: 20,2250           55640                           TS       OMEGAPD                               
055515,000134: 20,2251           55641                           TS       OMEGAQD                               
055516,000135: 20,2252           55642                           TS       OMEGARD                               
055517,000136: 20,2253           55635                           TS       DELCDUX                               
055518,000137: 20,2254           55636                           TS       DELCDUY                               
055519,000138: 20,2255           55637                           TS       DELCDUZ                               
055520,000139: 20,2256           55301                           TS       DELPEROR                              
055521,000140: 20,2257           55302                           TS       DELQEROR                              
055522,000141: 20,2260           55303                           TS       DELREROR                              
055523,000142: 20,2261           22003                           LXCH     EBANK                                 #  RESTORE CALLERS EBANK.
055524,000143: 20,2262           00002                           TC       Q                                     
055525,000144: 
055526,000145:                                                                                                  #  SUBROUTINE NAME:      ALLCOAST
055527,000146:                                                                                                  #  WILL BE CALLED BY FRESH STARTS AND ENGINE OFF ROUTINES.               .
055528,000147: 
055529,000148:                                                                                                  #  CALLING SEQUENCE:     (SAME AS ABOVE)
055530,000149: 
055531,000150:                                                                                                  #  EXIT:                 RETURN TO Q.
055532,000151: 
055533,000152:                                                                                                  #  SUBROUTINES CALLED:   STOPRATE, RESTORDB, NOVAC
055534,000153: 
055535,000154:                                                                                                  #  ZERO:                 (FOR ALL AXES) AOS, ALPHA, AOSTERM, OMEGAD, DELCDU, DELEROR
055536,000155: 
055537,000156:                                                                                                  #  OUTPUT:               DRIFTBIT/DAPBOOLS, DB, JOB TO DO 1/ACCS
055538,000157: 
055539,000158:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, RUPTREG2, (ITEMPS IN NOVAC)
055540,000159: 
055541,000160: 20,2263           35065        ALLCOAST           CAF      EBANK6                                
055542,000161: 20,2264           56003                           XCH      EBANK                                 
055543,000162: 20,2265           54066                           TS       ITEMP6                                
055544,000163: 20,2266           45030                           CS       ZERO                                  
055545,000164: 20,2267           55532                           TS       AOSQ                                  
055546,000165: 20,2270           55533                           TS       AOSQ       +1                         
055547,000166: 20,2271           55534                           TS       AOSR                                  
055548,000167: 20,2272           55535                           TS       AOSR       +1                         
055549,000168: 20,2273           55422                           TS       ALPHAQ                                #  FOR DOWNLIST.
055550,000169: 20,2274           55423                           TS       ALPHAR                                
055551,000170: 20,2275           55540                           TS       AOSQTERM                              
055552,000171: 20,2276           55541                           TS       AOSRTERM                              
055553,000172: 20,2277           30066                           CA       ITEMP6                                
055554,000173: 20,2300           54003                           TS       EBANK                                 #  RESTORE EBANK (EBANK6 NO LONGER NEEDED)
055555,000174: 
055556,000175: 20,2301           41102                           CS       DAPBOOLS                              #  SET UP DRIFTBIT
055557,000176: 20,2302           75017                           MASK     DRIFTBIT                              
055558,000177: 20,2303           27102                           ADS      DAPBOOLS                              
055559,000178: 20,2304           12205                           TCF      RESTORDB   +1                         #  RESTORE DEADBANK TO CREW-SELECTED VALUE.
055560,000179: 

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