Source Code

These source-code files are part of a reconstructed copy of LM131 revision 1, the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 listing.

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.

058844,000002:                                                                                                  ## Copyright:   Public domain.
058845,000003:                                                                                                  ## Filename:    DAP_INTERFACE_SUBROUTINES.agc
058846,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
058847,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
058848,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
058849,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
058850,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
058851,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
058852,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
058853,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
058854,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
058855,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
058856,000014:                                                                                                  ##              resulting binary is.
058857,000015:                                                                                                  ## Reference:   pp. 1398-1401
058858,000016:                                                                                                  ## Assembler:   yaYUL
058859,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058860,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058861,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
058862,000020: 

Page 1398

058864,000022: 20,2115                                           BANK     20                                    
058865,000023: 20,2000                                           SETLOC   DAPS3                                 
058866,000024: 20,2000                                           BANK                                           
058867,000025: 
058868,000026: 20,2115  E6,1634                                  EBANK=   CDUXD                                 
058869,000027: 20,2115                                           COUNT*   $$/DAPIF                              
058870,000028: 
058871,000029:                                                                                                  #  MOD 0         DATE    11/15/66        BY GEORGE W. CHERRY
058872,000030:                                                                                                  #  MOD 1                  1/23/67        MODIFICATION BY PETER ADLER
058873,000031: 
058874,000032:                                                                                                  #  FUNCTIONAL DESCRIPTION
058875,000033:                                                                                                  #        HEREIN ARE A COLLECTION OF SUBROUTINES WHICH ALLOW MISSION CONTROL PROGRAMS TO CONTROL THE MODE
058876,000034:                                                                                                  #        AND INTERFACE WITH THE DAP.
058877,000035: 
058878,000036:                                                                                                  #  CALLING SEQUENCES
058879,000037:                                                                                                  #        IN INTERRUPT OR WITH INTERRUPT INHIBITED
058880,000038:                                                                                                  #                TC      IBNKCALL
058881,000039:                                                                                                  #                FCADR   ROUTINE
058882,000040:                                                                                                  #        IN A JOB WITHOUT INTERRUPT INHIBITED
058883,000041:                                                                                                  #                INHINT
058884,000042:                                                                                                  #                TC      IBNKCALL
058885,000043:                                                                                                  #                FCADR   ROUTINE
058886,000044:                                                                                                  #                RELINT
058887,000045: 
058888,000046:                                                                                                  #  OUTPUT
058889,000047:                                                                                                  #        SEE INDIVIDUAL ROUTINES BELOW
058890,000048: 
058891,000049:                                                                                                  #  DEBRIS
058892,000050:                                                                                                  #        A, L, AND SOMETIMES MDUETEMP                                    ODE     NOT IN PULSES MODE
058893,000051: 

Page 1399

058895,000053:                                                                                                  #  SUBROUTINE NAMES:
058896,000054:                                                                                                  #        SETMAXDB, SETMINDB, RESTORDB, PFLITEDB
058897,000055:                                                                                                  #  MODIFIED:     30 JANUARY 1968 BY P S WEISSMAN TO CREATE RESTORDB.
058898,000056:                                                                                                  #  MODIFIED:     1 MARCH 1968 BY P S WEISSMAN TO SAVE EBANK AND CREATE PFLITEDB
058899,000057: 
058900,000058:                                                                                                  #  FUNCTIONAL DESCRIPTION:
058901,000059:                                                                                                  #        SETMAXDB - SET DEADBAND TO 5.0 DEGREES
058902,000060:                                                                                                  #        SETMINDB - SET DEADBAND TO 0.3 DEGREE
058903,000061:                                                                                                  #        RESTORDB - SET DEADBAND TO .3, 1, OR 5 ACCORDING TO BITS 4 AND 5 OF DAPBOOLS
058904,000062:                                                                                                  #        PFLITEDB - SET DEADBAND TO 1.0 DEGREE AND ZERO THE COMMANDED ATTITUDE CHANGE AND COMMANDED RATE
058905,000063: 
058906,000064:                                                                                                  #        ALL ENTRIES SET UP A NOVAC JOB TO DO 1/ACCS SO THAT THE TJETLAW SWITCH CURVES ARE POSITIONED TO
058907,000065:                                                                                                  #        REFLECT THE NEW DEADBAND.  IT SHOULD BE NOTED THAT THE DEADBAND REFERS TO THE ATTITUDE IN THE P-, U-, AND V-AXES.
058908,000066: 
058909,000067:                                                                                                  #  SUBROUTINE CALLED:    NOVAC
058910,000068: 
058911,000069:                                                                                                  #  CALLING SEQUENCE:     SAME AS ABOVE
058912,000070:                                                                                                  #                        OR      TC RESTORDB +1    FROM ALLCOAST
058913,000071: 
058914,000072:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, (ITEMPS IN NOVAC)
058915,000073: 
058916,000074: 20,2115           30111        RESTORDB           CAE      DAPBOOLS                              #  DETERMINE CREW-SELECTED DEADBAND.
058917,000075: 20,2116           74747                           MASK     DBSLECT2                              #  CHECK FOR MAX DB (5 DEG)
058918,000076: 20,2117           00006                           EXTEND                                         
058919,000077: 20,2120           12122                           BZF      +2                                    
058920,000078: 20,2121           12130                           TCF      SETMAXDB                              #  BIT5 DAPBOOLS IS SET - CREW WANTS 5 DEG
058921,000079: 20,2122           30111                           CAE      DAPBOOLS                              
058922,000080: 20,2123           74750                           MASK     DBSELECT                              #  CHECK FOR 1 DEG DEADBAND SELECTION
058923,000081: 20,2124           00006                           EXTEND                                         
058924,000082: 20,2125           12141                           BZF      SETMINDB                              
058925,000083: 
058926,000084: 20,2126           32153                           CAF      POWERDB                               #  BIT4 DAPBOOLS IS SET - CREW WANTS 1 DEG
058927,000085: 20,2127           12131                           TCF      SETMAXDB   +1                         
058928,000086: 20,2130           32152        SETMAXDB           CAF      WIDEDB                                #  SET 5 DEGREE DEADBAND.
058929,000087: 20,2131           55343                 +1        TS       DB                                    
058930,000088: 
058931,000089: 20,2132           00006                           EXTEND                                         #  SET UP JOB TO RE-POSITION SWITCH CURVES.
058932,000090: 20,2133           22070                           QXCH     RUPTREG1                              
058933,000091: 20,2134           37720        CALLACCS           CAF      PRIO27                                
058934,000092: 20,2135           05072                           TC       NOVAC                                 
058935,000093: 20,2136  E6,1536                                  EBANK=   AOSQ                                  
058936,000094: 20,2136           03652 42106                     2CADR    1/ACCJOB                              
058937,000095: 
058938,000096: 20,2140           00070                           TC       RUPTREG1                              #  RETURN TO CALLER.
058939,000097: 
058940,000098: 20,2141           32151        SETMINDB           CAF      NARROWDB                              #  SET 0.3 DEGREE DEADBAND.
058941,000099: 20,2142           12131                           TCF      SETMAXDB   +1                         
058942,000100: 

Page 1400

058944,000102: 20,2143           00006        PFLITEDB           EXTEND                                         #  THE RETURN FROM CALLACCS IS TO RUPTREG1.
058945,000103: 20,2144           22070                           QXCH     RUPTREG1                              
058946,000104: 20,2145           02154                           TC       ZATTEROR                              #  ZERO THE ERRORS AND COMMANDED RATES.
058947,000105: 20,2146           32153                           CAF      POWERDB                               #  SET DB TO 1.0 DEG.
058948,000106: 20,2147           55343                           TS       DB                                    
058949,000107: 20,2150           12134                           TCF      CALLACCS                              #  SET UP 1/ACCS AND RETURN TO CALLER.
058950,000108: 20,2151           00155        NARROWDB           OCTAL    00155                                 #  0.3 DEGREE SCALED AT 45.
058951,000109: 20,2152           03434        WIDEDB             OCTAL    03434                                 #  5.0 DEGREES SCALED AT 45.
058952,000110: 20,2153           00554        POWERDB            DEC      .02222                                #  1.0 DEGREE SCALED AT 45.
058953,000111: 
058954,000112: 20,2154           35015        ZATTEROR           CAF      EBANK6                                
058955,000113: 20,2155           56003                           XCH      EBANK                                 
058956,000114: 20,2156           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
058957,000115: 20,2157           30032                           CAE      CDUX                                  
058958,000116: 20,2160           55634                           TS       CDUXD                                 
058959,000117: 20,2161           30033                           CAE      CDUY                                  
058960,000118: 20,2162           55635                           TS       CDUYD                                 
058961,000119: 20,2163           30034                           CAE      CDUZ                                  
058962,000120: 20,2164           55636                           TS       CDUZD                                 
058963,000121: 20,2165           12171                           TCF      STOPRATE   +3                         
058964,000122: 
058965,000123: 20,2166           35015        STOPRATE           CAF      EBANK6                                
058966,000124: 20,2167           56003                           XCH      EBANK                                 
058967,000125: 20,2170           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
058968,000126: 20,2171           34755                 +3        CAF      ZERO                                  
058969,000127: 20,2172           55642                           TS       OMEGAPD                               
058970,000128: 20,2173           55643                           TS       OMEGAQD                               
058971,000129: 20,2174           55644                           TS       OMEGARD                               
058972,000130: 20,2175           55637                           TS       DELCDUX                               
058973,000131: 20,2176           55640                           TS       DELCDUY                               
058974,000132: 20,2177           55641                           TS       DELCDUZ                               
058975,000133: 20,2200           55274                           TS       DELPEROR                              
058976,000134: 20,2201           55275                           TS       DELQEROR                              
058977,000135: 20,2202           55276                           TS       DELREROR                              
058978,000136: 20,2203           22003                           LXCH     EBANK                                 #  RESTORE CALLERS EBANK.
058979,000137: 20,2204           00002                           TC       Q                                     
058980,000138: 
058981,000139:                                                                                                  #  SUBROUTINE NAME:      ALLCOAST
058982,000140:                                                                                                  #  WILL BE CALLED BY FRESH STARTS AND ENGINE OFF ROUTINES.               .
058983,000141: 
058984,000142:                                                                                                  #  CALLING SEQUENCE:     (SAME AS ABOVE)
058985,000143: 
058986,000144:                                                                                                  #  EXIT:                 RETURN TO Q.
058987,000145: 
058988,000146:                                                                                                  #  SUBROUTINES CALLED:   STOPRATE, RESTORDB, NOVAC
058989,000147: 
058990,000148:                                                                                                  #  ZERO:                 (FOR ALL AXES) AOS, ALPHA, AOSTERM, OMEGAD, DELCDU, DELEROR

Page 1401

058992,000150: 
058993,000151:                                                                                                  #  OUTPUT:               DRIFTBIT/DAPBOOLS, DB, JOB TO DO 1/ACCS
058994,000152: 
058995,000153:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, RUPTREG2, (ITEMPS IN NOVAC)
058996,000154: 
058997,000155: 20,2205           00006        ALLCOAST           EXTEND                                         #  SAVE Q FOR RETURN
058998,000156: 20,2206           22071                           QXCH     RUPTREG2                              
058999,000157: 20,2207           02166                           TC       STOPRATE                              #  CLEAR RATE INTERFACE.  RETURN WITH A=0
059000,000158: 20,2210           22003                           LXCH     EBANK                                 #  AND L=EBANK6.  SAVE CALLERS EBANK.
059001,000159: 20,2211           55536                           TS       AOSQ                                  
059002,000160: 20,2212           55537                           TS       AOSQ       +1                         
059003,000161: 20,2213           55540                           TS       AOSR                                  
059004,000162: 20,2214           55541                           TS       AOSR       +1                         
059005,000163: 20,2215           55424                           TS       ALPHAQ                                #  FOR DOWNLIST.
059006,000164: 20,2216           55425                           TS       ALPHAR                                
059007,000165: 20,2217           55544                           TS       AOSQTERM                              
059008,000166: 20,2220           55545                           TS       AOSRTERM                              
059009,000167: 20,2221           22003                           LXCH     EBANK                                 #  RESTORE EBANK (EBANK6 NO LONGER NEEDED)
059010,000168: 
059011,000169: 20,2222           40111                           CS       DAPBOOLS                              #  SET UP DRIFTBIT
059012,000170: 20,2223           74744                           MASK     DRIFTBIT                              
059013,000171: 20,2224           26111                           ADS      DAPBOOLS                              
059014,000172: 20,2225           02116                           TC       RESTORDB   +1                         #  RESTORE DEADBANK TO CREW-SELECTED VALUE.
059015,000173: 
059016,000174: 20,2226           00071                           TC       RUPTREG2                              #  RETURN.
059017,000175: 
059018,000176: 
059019,000177: 

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