Source Code
![]() |
This source code is very close to the Apollo Guidance Computer software for the
Apollo 13 Lunar module. This revision of the Luminary 131 program is from December
of 1969, whereas there was a later revision in January of 1970, and still another
revision in February, which is the code that flew on the mission.
As far as this transcription is concerned, it was originally from a copy made in 1991 of
a printout from the collection of AGC developer Don Eyles for collector David Craig.
It was subsequently scanned by Gary Neff, reprocessed for online
presentation at the now-discontinued History of Recent Science and Technology (HRST) website
of MIT's Dibner Institute (the full-quality scans being discarded in the process),
and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a
high-quality replacement scan for a completely illegible page was later provided by Gary
Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many
errors to be introduced into the transcription. Accordingly, a second scan of the same physical
printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive,
and used to correct the transcription errors. All of the scanned materials mentioned,
as well as other Luminary 131 related material, are available online.
Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017,
so the two scans are not identical in that respect. The page-headings in the printout read, in part:GAP: ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091 17:53 DEC. 19, 1969Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together. |
058992,000002: ## Copyright: Public domain.
058993,000003: ## Filename: DAP_INTERFACE_SUBROUTINES.agc
058994,000004: ## Purpose: A section of Luminary 1C, revision 131.
058995,000005: ## It is part of the source code for the Lunar Module's (LM)
058996,000006: ## Apollo Guidance Computer (AGC) for Apollo 13.
058997,000007: ## This file is intended to be a faithful transcription, except
058998,000008: ## that the code format has been changed to conform to the
058999,000009: ## requirements of the yaYUL assembler rather than the
059000,000010: ## original YUL assembler.
059001,000011: ## Reference: pp. 1398-1401
059002,000012: ## Contact: Ron Burkey <info@sandroid.org>.
059003,000013: ## Website: www.ibiblio.org/apollo/index.html
059004,000014: ## Mod history: 06/07/03 RSB. Began transcribing.
059005,000015: ## 05/14/05 RSB Corrected website reference above.
059006,000016: ## 2010-10-25 JL Indentation fixes.
059007,000017: ## 2017-01-06 RSB Page numbers now agree with those on the
059008,000018: ## original hardcopy, as opposed to the PDF page
059009,000019: ## numbers in 1701.pdf.
059010,000020: ## 2017-02-28 RSB Proofed comment text using octopus/ProoferComments.
059011,000021: ## 2017-03-01 RSB Fixed lingering comment-text typos.
059012,000022: ## 2017-03-10 RSB Comment-text fixes noted in proofing Luminary 116.
059013,000023:
![]() |
Page 1398 |
059015,000025: 20,2115 BANK 20
059016,000026: 20,2000 SETLOC DAPS3
059017,000027: 20,2000 BANK
059018,000028:
059019,000029: 20,2115 E6,1634 EBANK= CDUXD
059020,000030: 20,2115 COUNT* $$/DAPIF
059021,000031:
059022,000032: # MOD 0 DATE 11/15/66 BY GEORGE W. CHERRY
059023,000033: # MOD 1 1/23/67 MODIFICATION BY PETER ADLER
059024,000034:
059025,000035: # FUNCTIONAL DESCRIPTION
059026,000036: # HEREIN ARE A COLLECTION OF SUBROUTINES WHICH ALLOW MISSION CONTROL PROGRAMS TO CONTROL THE MODE
059027,000037: # AND INTERFACE WITH THE DAP.
059028,000038:
059029,000039: # CALLING SEQUENCES
059030,000040: # IN INTERRUPT OR WITH INTERRUPT INHIBITED
059031,000041: # TC IBNKCALL
059032,000042: # FCADR ROUTINE
059033,000043: # IN A JOB WITHOUT INTERRUPT INHIBITED
059034,000044: # INHINT
059035,000045: # TC IBNKCALL
059036,000046: # FCADR ROUTINE
059037,000047: # RELINT
059038,000048:
059039,000049: # OUTPUT
059040,000050: # SEE INDIVIDUAL ROUTINES BELOW
059041,000051:
059042,000052: # DEBRIS
059043,000053: # A, L, AND SOMETIMES MDUETEMP ODE NOT IN PULSES MODE
059044,000054:
![]() |
Page 1399 |
059046,000056: # SUBROUTINE NAMES:
059047,000057: # SETMAXDB, SETMINDB, RESTORDB, PFLITEDB
059048,000058: # MODIFIED: 30 JANUARY 1968 BY P S WEISSMAN TO CREATE RESTORDB.
059049,000059: # MODIFIED: 1 MARCH 1968 BY P S WEISSMAN TO SAVE EBANK AND CREATE PFLITEDB
059050,000060:
059051,000061: # FUNCTIONAL DESCRIPTION:
059052,000062: # SETMAXDB - SET DEADBAND TO 5.0 DEGREES
059053,000063: # SETMINDB - SET DEADBAND TO 0.3 DEGREE
059054,000064: # RESTORDB - SET DEADBAND TO .3, 1, OR 5 ACCORDING TO BITS 4 AND 5 OF DAPBOOLS
059055,000065: # PFLITEDB - SET DEADBAND TO 1.0 DEGREE AND ZERO THE COMMANDED ATTITUDE CHANGE AND COMMANDED RATE
059056,000066:
059057,000067: # ALL ENTRIES SET UP A NOVAC JOB TO DO 1/ACCS SO THAT THE TJETLAW SWITCH CURVES ARE POSITIONED TO
059058,000068: # REFLECT THE NEW DEADBAND. IT SHOULD BE NOTED THAT THE DEADBAND REFERS TO THE ATTITUDE IN THE P-, U-, AND V-AXES.
059059,000069:
059060,000070: # SUBROUTINE CALLED: NOVAC
059061,000071:
059062,000072: # CALLING SEQUENCE: SAME AS ABOVE
059063,000073: # OR TC RESTORDB +1 FROM ALLCOAST
059064,000074:
059065,000075: # DEBRIS: A, L, Q, RUPTREG1, (ITEMPS IN NOVAC)
059066,000076:
059067,000077: 20,2115 30111 RESTORDB CAE DAPBOOLS # DETERMINE CREW-SELECTED DEADBAND.
059068,000078: 20,2116 74747 MASK DBSLECT2 # CHECK FOR MAX DB (5 DEG)
059069,000079: 20,2117 00006 EXTEND
059070,000080: 20,2120 12122 BZF +2
059071,000081: 20,2121 12130 TCF SETMAXDB # BIT5 DAPBOOLS IS SET - CREW WANTS 5 DEG
059072,000082: 20,2122 30111 CAE DAPBOOLS
059073,000083: 20,2123 74750 MASK DBSELECT # CHECK FOR 1 DEG DEADBAND SELECTION
059074,000084: 20,2124 00006 EXTEND
059075,000085: 20,2125 12141 BZF SETMINDB
059076,000086:
059077,000087: 20,2126 32153 CAF POWERDB # BIT4 DAPBOOLS IS SET - CREW WANTS 1 DEG
059078,000088: 20,2127 12131 TCF SETMAXDB +1
059079,000089: 20,2130 32152 SETMAXDB CAF WIDEDB # SET 5 DEGREE DEADBAND.
059080,000090: 20,2131 55343 +1 TS DB
059081,000091:
059082,000092: 20,2132 00006 EXTEND # SET UP JOB TO RE-POSITION SWITCH CURVES.
059083,000093: 20,2133 22070 QXCH RUPTREG1
059084,000094: 20,2134 37720 CALLACCS CAF PRIO27
059085,000095: 20,2135 05072 TC NOVAC
059086,000096: 20,2136 E6,1536 EBANK= AOSQ
059087,000097: 20,2136 03652 42106 2CADR 1/ACCJOB
059088,000098:
059089,000099: 20,2140 00070 TC RUPTREG1 # RETURN TO CALLER.
059090,000100:
059091,000101: 20,2141 32151 SETMINDB CAF NARROWDB # SET 0.3 DEGREE DEADBAND.
059092,000102: 20,2142 12131 TCF SETMAXDB +1
059093,000103:
![]() |
Page 1400 |
059095,000105: 20,2143 00006 PFLITEDB EXTEND # THE RETURN FROM CALLACCS IS TO RUPTREG1.
059096,000106: 20,2144 22070 QXCH RUPTREG1
059097,000107: 20,2145 02154 TC ZATTEROR # ZERO THE ERRORS AND COMMANDED RATES.
059098,000108: 20,2146 32153 CAF POWERDB # SET DB TO 1.0 DEG.
059099,000109: 20,2147 55343 TS DB
059100,000110: 20,2150 12134 TCF CALLACCS # SET UP 1/ACCS AND RETURN TO CALLER.
059101,000111: 20,2151 00155 NARROWDB OCTAL 00155 # 0.3 DEGREE SCALED AT 45.
059102,000112: 20,2152 03434 WIDEDB OCTAL 03434 # 5.0 DEGREES SCALED AT 45.
059103,000113: 20,2153 00554 POWERDB DEC .02222 # 1.0 DEGREE SCALED AT 45.
059104,000114:
059105,000115: 20,2154 35015 ZATTEROR CAF EBANK6
059106,000116: 20,2155 56003 XCH EBANK
059107,000117: 20,2156 54001 TS L # SAVE CALLERS EBANK IN L.
059108,000118: 20,2157 30032 CAE CDUX
059109,000119: 20,2160 55634 TS CDUXD
059110,000120: 20,2161 30033 CAE CDUY
059111,000121: 20,2162 55635 TS CDUYD
059112,000122: 20,2163 30034 CAE CDUZ
059113,000123: 20,2164 55636 TS CDUZD
059114,000124: 20,2165 12171 TCF STOPRATE +3
059115,000125:
059116,000126: 20,2166 35015 STOPRATE CAF EBANK6
059117,000127: 20,2167 56003 XCH EBANK
059118,000128: 20,2170 54001 TS L # SAVE CALLERS EBANK IN L.
059119,000129: 20,2171 34755 +3 CAF ZERO
059120,000130: 20,2172 55642 TS OMEGAPD
059121,000131: 20,2173 55643 TS OMEGAQD
059122,000132: 20,2174 55644 TS OMEGARD
059123,000133: 20,2175 55637 TS DELCDUX
059124,000134: 20,2176 55640 TS DELCDUY
059125,000135: 20,2177 55641 TS DELCDUZ
059126,000136: 20,2200 55274 TS DELPEROR
059127,000137: 20,2201 55275 TS DELQEROR
059128,000138: 20,2202 55276 TS DELREROR
059129,000139: 20,2203 22003 LXCH EBANK # RESTORE CALLERS EBANK.
059130,000140: 20,2204 00002 TC Q
059131,000141:
059132,000142: # SUBROUTINE NAME: ALLCOAST
059133,000143: # WILL BE CALLED BY FRESH STARTS AND ENGINE OFF ROUTINES. .
059134,000144:
059135,000145: # CALLING SEQUENCE: (SAME AS ABOVE)
059136,000146:
059137,000147: # EXIT: RETURN TO Q.
059138,000148:
059139,000149: # SUBROUTINES CALLED: STOPRATE, RESTORDB, NOVAC
059140,000150:
059141,000151: # ZERO: (FOR ALL AXES) AOS, ALPHA, AOSTERM, OMEGAD, DELCDU, DELEROR
![]() |
Page 1401 |
059143,000153:
059144,000154: # OUTPUT: DRIFTBIT/DAPBOOLS, DB, JOB TO DO 1/ACCS
059145,000155:
059146,000156: # DEBRIS: A, L, Q, RUPTREG1, RUPTREG2, (ITEMPS IN NOVAC)
059147,000157:
059148,000158: 20,2205 00006 ALLCOAST EXTEND # SAVE Q FOR RETURN
059149,000159: 20,2206 22071 QXCH RUPTREG2
059150,000160: 20,2207 02166 TC STOPRATE # CLEAR RATE INTERFACE. RETURN WITH A=0
059151,000161: 20,2210 22003 LXCH EBANK # AND L=EBANK6. SAVE CALLERS EBANK.
059152,000162: 20,2211 55536 TS AOSQ
059153,000163: 20,2212 55537 TS AOSQ +1
059154,000164: 20,2213 55540 TS AOSR
059155,000165: 20,2214 55541 TS AOSR +1
059156,000166: 20,2215 55424 TS ALPHAQ # FOR DOWNLIST.
059157,000167: 20,2216 55425 TS ALPHAR
059158,000168: 20,2217 55544 TS AOSQTERM
059159,000169: 20,2220 55545 TS AOSRTERM
059160,000170: 20,2221 22003 LXCH EBANK # RESTORE EBANK (EBANK6 NO LONGER NEEDED)
059161,000171:
059162,000172: 20,2222 40111 CS DAPBOOLS # SET UP DRIFTBIT
059163,000173: 20,2223 74744 MASK DRIFTBIT
059164,000174: 20,2224 26111 ADS DAPBOOLS
059165,000175: 20,2225 02116 TC RESTORDB +1 # RESTORE DEADBANK TO CREW-SELECTED VALUE.
059166,000176:
059167,000177: 20,2226 00071 TC RUPTREG2 # RETURN.
059168,000178:
059169,000179:
059170,000180:
End of include-file DAP_INTERFACE_SUBROUTINES.agc. Parent file is MAIN.agc