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. |
059034,000002: ## Copyright: Public domain. 059035,000003: ## Filename: DAP_INTERFACE_SUBROUTINES.agc 059036,000004: ## Purpose: A section of Luminary 1C, revision 131. 059037,000005: ## It is part of the source code for the Lunar Module's (LM) 059038,000006: ## Apollo Guidance Computer (AGC) for Apollo 13. 059039,000007: ## This file is intended to be a faithful transcription, except 059040,000008: ## that the code format has been changed to conform to the 059041,000009: ## requirements of the yaYUL assembler rather than the 059042,000010: ## original YUL assembler. 059043,000011: ## Reference: pp. 1398-1401 059044,000012: ## Contact: Ron Burkey <info@sandroid.org>. 059045,000013: ## Website: www.ibiblio.org/apollo/index.html 059046,000014: ## Mod history: 06/07/03 RSB. Began transcribing. 059047,000015: ## 05/14/05 RSB Corrected website reference above. 059048,000016: ## 2010-10-25 JL Indentation fixes. 059049,000017: ## 2017-01-06 RSB Page numbers now agree with those on the 059050,000018: ## original hardcopy, as opposed to the PDF page 059051,000019: ## numbers in 1701.pdf. 059052,000020: ## 2017-02-28 RSB Proofed comment text using octopus/ProoferComments. 059053,000021: ## 2017-03-01 RSB Fixed lingering comment-text typos. 059054,000022: ## 2017-03-10 RSB Comment-text fixes noted in proofing Luminary 116. 059055,000023:
![]() |
Page 1398 |
059057,000025: 20,2115 BANK 20 059058,000026: 20,2000 SETLOC DAPS3 059059,000027: 20,2000 BANK 059060,000028: 059061,000029: 20,2115 E6,1634 EBANK= CDUXD 059062,000030: 20,2115 COUNT* $$/DAPIF 059063,000031: 059064,000032: # MOD 0 DATE 11/15/66 BY GEORGE W. CHERRY 059065,000033: # MOD 1 1/23/67 MODIFICATION BY PETER ADLER 059066,000034: 059067,000035: # FUNCTIONAL DESCRIPTION 059068,000036: # HEREIN ARE A COLLECTION OF SUBROUTINES WHICH ALLOW MISSION CONTROL PROGRAMS TO CONTROL THE MODE 059069,000037: # AND INTERFACE WITH THE DAP. 059070,000038: 059071,000039: # CALLING SEQUENCES 059072,000040: # IN INTERRUPT OR WITH INTERRUPT INHIBITED 059073,000041: # TC IBNKCALL 059074,000042: # FCADR ROUTINE 059075,000043: # IN A JOB WITHOUT INTERRUPT INHIBITED 059076,000044: # INHINT 059077,000045: # TC IBNKCALL 059078,000046: # FCADR ROUTINE 059079,000047: # RELINT 059080,000048: 059081,000049: # OUTPUT 059082,000050: # SEE INDIVIDUAL ROUTINES BELOW 059083,000051: 059084,000052: # DEBRIS 059085,000053: # A, L, AND SOMETIMES MDUETEMP ODE NOT IN PULSES MODE 059086,000054:
![]() |
Page 1399 |
059088,000056: # SUBROUTINE NAMES: 059089,000057: # SETMAXDB, SETMINDB, RESTORDB, PFLITEDB 059090,000058: # MODIFIED: 30 JANUARY 1968 BY P S WEISSMAN TO CREATE RESTORDB. 059091,000059: # MODIFIED: 1 MARCH 1968 BY P S WEISSMAN TO SAVE EBANK AND CREATE PFLITEDB 059092,000060: 059093,000061: # FUNCTIONAL DESCRIPTION: 059094,000062: # SETMAXDB - SET DEADBAND TO 5.0 DEGREES 059095,000063: # SETMINDB - SET DEADBAND TO 0.3 DEGREE 059096,000064: # RESTORDB - SET DEADBAND TO .3, 1, OR 5 ACCORDING TO BITS 4 AND 5 OF DAPBOOLS 059097,000065: # PFLITEDB - SET DEADBAND TO 1.0 DEGREE AND ZERO THE COMMANDED ATTITUDE CHANGE AND COMMANDED RATE 059098,000066: 059099,000067: # ALL ENTRIES SET UP A NOVAC JOB TO DO 1/ACCS SO THAT THE TJETLAW SWITCH CURVES ARE POSITIONED TO 059100,000068: # REFLECT THE NEW DEADBAND. IT SHOULD BE NOTED THAT THE DEADBAND REFERS TO THE ATTITUDE IN THE P-, U-, AND V-AXES. 059101,000069: 059102,000070: # SUBROUTINE CALLED: NOVAC 059103,000071: 059104,000072: # CALLING SEQUENCE: SAME AS ABOVE 059105,000073: # OR TC RESTORDB +1 FROM ALLCOAST 059106,000074: 059107,000075: # DEBRIS: A, L, Q, RUPTREG1, (ITEMPS IN NOVAC) 059108,000076: 059109,000077: 20,2115 30111 RESTORDB CAE DAPBOOLS # DETERMINE CREW-SELECTED DEADBAND. 059110,000078: 20,2116 74747 MASK DBSLECT2 # CHECK FOR MAX DB (5 DEG) 059111,000079: 20,2117 00006 EXTEND 059112,000080: 20,2120 12122 BZF +2 059113,000081: 20,2121 12130 TCF SETMAXDB # BIT5 DAPBOOLS IS SET - CREW WANTS 5 DEG 059114,000082: 20,2122 30111 CAE DAPBOOLS 059115,000083: 20,2123 74750 MASK DBSELECT # CHECK FOR 1 DEG DEADBAND SELECTION 059116,000084: 20,2124 00006 EXTEND 059117,000085: 20,2125 12141 BZF SETMINDB 059118,000086: 059119,000087: 20,2126 32153 CAF POWERDB # BIT4 DAPBOOLS IS SET - CREW WANTS 1 DEG 059120,000088: 20,2127 12131 TCF SETMAXDB +1 059121,000089: 20,2130 32152 SETMAXDB CAF WIDEDB # SET 5 DEGREE DEADBAND. 059122,000090: 20,2131 55343 +1 TS DB 059123,000091: 059124,000092: 20,2132 00006 EXTEND # SET UP JOB TO RE-POSITION SWITCH CURVES. 059125,000093: 20,2133 22070 QXCH RUPTREG1 059126,000094: 20,2134 37720 CALLACCS CAF PRIO27 059127,000095: 20,2135 05072 TC NOVAC 059128,000096: 20,2136 E6,1536 EBANK= AOSQ 059129,000097: 20,2136 03652 42106 2CADR 1/ACCJOB 059130,000098: 059131,000099: 20,2140 00070 TC RUPTREG1 # RETURN TO CALLER. 059132,000100: 059133,000101: 20,2141 32151 SETMINDB CAF NARROWDB # SET 0.3 DEGREE DEADBAND. 059134,000102: 20,2142 12131 TCF SETMAXDB +1 059135,000103:
![]() |
Page 1400 |
059137,000105: 20,2143 00006 PFLITEDB EXTEND # THE RETURN FROM CALLACCS IS TO RUPTREG1. 059138,000106: 20,2144 22070 QXCH RUPTREG1 059139,000107: 20,2145 02154 TC ZATTEROR # ZERO THE ERRORS AND COMMANDED RATES. 059140,000108: 20,2146 32153 CAF POWERDB # SET DB TO 1.0 DEG. 059141,000109: 20,2147 55343 TS DB 059142,000110: 20,2150 12134 TCF CALLACCS # SET UP 1/ACCS AND RETURN TO CALLER. 059143,000111: 20,2151 00155 NARROWDB OCTAL 00155 # 0.3 DEGREE SCALED AT 45. 059144,000112: 20,2152 03434 WIDEDB OCTAL 03434 # 5.0 DEGREES SCALED AT 45. 059145,000113: 20,2153 00554 POWERDB DEC .02222 # 1.0 DEGREE SCALED AT 45. 059146,000114: 059147,000115: 20,2154 35015 ZATTEROR CAF EBANK6 059148,000116: 20,2155 56003 XCH EBANK 059149,000117: 20,2156 54001 TS L # SAVE CALLERS EBANK IN L. 059150,000118: 20,2157 30032 CAE CDUX 059151,000119: 20,2160 55634 TS CDUXD 059152,000120: 20,2161 30033 CAE CDUY 059153,000121: 20,2162 55635 TS CDUYD 059154,000122: 20,2163 30034 CAE CDUZ 059155,000123: 20,2164 55636 TS CDUZD 059156,000124: 20,2165 12171 TCF STOPRATE +3 059157,000125: 059158,000126: 20,2166 35015 STOPRATE CAF EBANK6 059159,000127: 20,2167 56003 XCH EBANK 059160,000128: 20,2170 54001 TS L # SAVE CALLERS EBANK IN L. 059161,000129: 20,2171 34755 +3 CAF ZERO 059162,000130: 20,2172 55642 TS OMEGAPD 059163,000131: 20,2173 55643 TS OMEGAQD 059164,000132: 20,2174 55644 TS OMEGARD 059165,000133: 20,2175 55637 TS DELCDUX 059166,000134: 20,2176 55640 TS DELCDUY 059167,000135: 20,2177 55641 TS DELCDUZ 059168,000136: 20,2200 55274 TS DELPEROR 059169,000137: 20,2201 55275 TS DELQEROR 059170,000138: 20,2202 55276 TS DELREROR 059171,000139: 20,2203 22003 LXCH EBANK # RESTORE CALLERS EBANK. 059172,000140: 20,2204 00002 TC Q 059173,000141: 059174,000142: # SUBROUTINE NAME: ALLCOAST 059175,000143: # WILL BE CALLED BY FRESH STARTS AND ENGINE OFF ROUTINES. . 059176,000144: 059177,000145: # CALLING SEQUENCE: (SAME AS ABOVE) 059178,000146: 059179,000147: # EXIT: RETURN TO Q. 059180,000148: 059181,000149: # SUBROUTINES CALLED: STOPRATE, RESTORDB, NOVAC 059182,000150: 059183,000151: # ZERO: (FOR ALL AXES) AOS, ALPHA, AOSTERM, OMEGAD, DELCDU, DELEROR
![]() |
Page 1401 |
059185,000153: 059186,000154: # OUTPUT: DRIFTBIT/DAPBOOLS, DB, JOB TO DO 1/ACCS 059187,000155: 059188,000156: # DEBRIS: A, L, Q, RUPTREG1, RUPTREG2, (ITEMPS IN NOVAC) 059189,000157: 059190,000158: 20,2205 00006 ALLCOAST EXTEND # SAVE Q FOR RETURN 059191,000159: 20,2206 22071 QXCH RUPTREG2 059192,000160: 20,2207 02166 TC STOPRATE # CLEAR RATE INTERFACE. RETURN WITH A=0 059193,000161: 20,2210 22003 LXCH EBANK # AND L=EBANK6. SAVE CALLERS EBANK. 059194,000162: 20,2211 55536 TS AOSQ 059195,000163: 20,2212 55537 TS AOSQ +1 059196,000164: 20,2213 55540 TS AOSR 059197,000165: 20,2214 55541 TS AOSR +1 059198,000166: 20,2215 55424 TS ALPHAQ # FOR DOWNLIST. 059199,000167: 20,2216 55425 TS ALPHAR 059200,000168: 20,2217 55544 TS AOSQTERM 059201,000169: 20,2220 55545 TS AOSRTERM 059202,000170: 20,2221 22003 LXCH EBANK # RESTORE EBANK (EBANK6 NO LONGER NEEDED) 059203,000171: 059204,000172: 20,2222 40111 CS DAPBOOLS # SET UP DRIFTBIT 059205,000173: 20,2223 74744 MASK DRIFTBIT 059206,000174: 20,2224 26111 ADS DAPBOOLS 059207,000175: 20,2225 02116 TC RESTORDB +1 # RESTORE DEADBANK TO CREW-SELECTED VALUE. 059208,000176: 059209,000177: 20,2226 00071 TC RUPTREG2 # RETURN. 059210,000178: 059211,000179: 059212,000180: End of include-file DAP_INTERFACE_SUBROUTINES.agc. Parent file is MAIN.agc