Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

060649,000002:                                                                                                  ## Copyright:   Public domain.
060650,000003:                                                                                                  ## Filename:    DAP_INTERFACE_SUBROUTINES.agc
060651,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
060652,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
060653,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
060654,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
060655,000008:                                                                                                  ##              that the code format has been changed to conform to the
060656,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
060657,000010:                                                                                                  ##              original YUL assembler.
060658,000011:                                                                                                  ## Reference:   pp. 1403-1406
060659,000012:                                                                                                  ## Assembler:   yaYUL
060660,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
060661,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
060662,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
060663,000016:                                                                                                  ##              2016-11-25 TB   Transcribed
060664,000017:                                                                                                  ##              2016-12-26 RSB  Comment-text proofed using ProoferComments
060665,000018:                                                                                                  ##                              and corrected errors found.
060666,000019:                                                                                                  ##              2017-03-15 RSB  Comment-text fixes identified in 5-way
060667,000020:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
060668,000021: 

Page 1403

060670,000023: 20,2115                                           BANK     20                                    
060671,000024: 20,2000                                           SETLOC   DAPS3                                 
060672,000025: 20,2000                                           BANK                                           
060673,000026: 
060674,000027: 20,2115  E6,1634                                  EBANK=   CDUXD                                 
060675,000028: 20,2115                                           COUNT*   $$/DAPIF                              
060676,000029: 
060677,000030:                                                                                                  #  MOD 0         DATE    11/15/66        BY GEORGE W. CHERRY
060678,000031:                                                                                                  #  MOD 1                 1/23/67         MODIFICATION BY PETER ADLER
060679,000032: 
060680,000033:                                                                                                  #  FUNCTIONAL DESCRIPTION
060681,000034:                                                                                                  #        HEREIN ARE A COLLECTION OF SUBROUTINES WHICH ALLOW MISSION CONTROL PROGRAMS TO CONTROL THE MODE
060682,000035:                                                                                                  #        AND INTERFACE WITH THE DAP.
060683,000036: 
060684,000037:                                                                                                  #  CALLING SEQUENCES
060685,000038:                                                                                                  #        IN INTERRUPT OR WITH INTERRUPT INHIBITED
060686,000039:                                                                                                  #                TC      IBNKCALL
060687,000040:                                                                                                  #                FCADR   ROUTINE
060688,000041:                                                                                                  #        IN A JOB WITHOUT INTERRUPT INHIBITED
060689,000042:                                                                                                  #                INHINT
060690,000043:                                                                                                  #                TC      IBNKCALL
060691,000044:                                                                                                  #                FCADR   ROUTINE
060692,000045:                                                                                                  #                RELINT
060693,000046: 
060694,000047:                                                                                                  #  OUTPUT
060695,000048:                                                                                                  #        SEE INDIVIDUAL ROUTINES BELOW
060696,000049: 
060697,000050:                                                                                                  #  DEBRIS
060698,000051:                                                                                                  #        A,L, AND SOMETIMES MDUETEMP                             ODE NOT IN PULSES MODE
060699,000052: 

Page 1404

060701,000054:                                                                                                  #  SUBROUTINE NAMES:
060702,000055:                                                                                                  #        SETMAXDB, SETMINDB, RESTORDB, PFLITEDB
060703,000056:                                                                                                  #  MODIFIED:     30 JANUARY 1968 BY P S WEISSMAN TO CREATE RESTORDB.
060704,000057:                                                                                                  #  MODIFIED:     1 MARCH 1968 BY P S WEISSMAN TO SAVE EBANK AND CREATE PFLITEDB
060705,000058: 
060706,000059:                                                                                                  #  FUNCTIONAL DESCRIPTION:
060707,000060:                                                                                                  #        SETMAXDB - SET DEADBAND TO 5.0 DEGREES
060708,000061:                                                                                                  #        SETMINDB - SET DEADBAND TO 0.3 DEGREE
060709,000062:                                                                                                  #        RESTORDB - SET DEADBAND TO .3,1, OR 5 ACCORDING TO BITS 4 AND 5 OF DAPBOOLS
060710,000063:                                                                                                  #        PFLITEDB - SET DEADBAND TO 1.0 DEGREE AND ZERO THE COMMANDED ATTITUDE CHANGE AND COMMANDED RATE
060711,000064:                                                                                                  #        ALL ENTRIES SET UP A NOVAC JOB TO DO 1/ACCS SO THAT THE TJETLAW SWITCH CURVES ARE POSITIONED TO
060712,000065:                                                                                                  #        REFLECT THE NEW DEADBAND.  IT SHOULD BE NOTED THAT THE DEADBAND REFERS TO THE ATTITUDE IN THE P-,U-,AND V-AXES.
060713,000066: 
060714,000067:                                                                                                  #  SUBROUTINE CALLED:    NOVAC
060715,000068: 
060716,000069:                                                                                                  #  CALLING SEQUENCE:     SAME AS ABOVE
060717,000070:                                                                                                  #                        OR      TC RESTORDB +1    FROM ALLCOAST
060718,000071: 
060719,000072:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, (ITEMPS IN NOVAC)
060720,000073: 
060721,000074: 20,2115           30111        RESTORDB           CAE      DAPBOOLS                              #  DETERMINE CREW-SELECTED DEADBAND.
060722,000075: 20,2116           74740                           MASK     DBSLECT2                              #  CHECK FOR MAX DB (5 DEG)
060723,000076: 20,2117           00006                           EXTEND                                         
060724,000077: 20,2120           12122                           BZF      +2                                    
060725,000078: 20,2121           12130                           TCF      SETMAXDB                              #  BIT5 DAPBOOLS IS SET - CREW WANTS 5 DEG
060726,000079: 20,2122           30111                           CAE      DAPBOOLS                              
060727,000080: 20,2123           74741                           MASK     DBSELECT                              #  CHECK FOR 1 DEG DEADBAND SELECTION
060728,000081: 20,2124           00006                           EXTEND                                         
060729,000082: 20,2125           12141                           BZF      SETMINDB                              
060730,000083: 
060731,000084: 20,2126           32153                           CAF      POWERDB                               #  BIT4 DAPBOOLS IS SET - CREW WANTS 1 DEG
060732,000085: 20,2127           12131                           TCF      SETMAXDB   +1                         
060733,000086: 20,2130           32152        SETMAXDB           CAF      WIDEDB                                #  SET 5 DEGREE DEADBAND.
060734,000087: 20,2131           55343                 +1        TS       DB                                    
060735,000088: 
060736,000089: 20,2132           00006                           EXTEND                                         #  SET UP JOB TO RE-POSITION SWITCH CURVES.
060737,000090: 20,2133           22070                           QXCH     RUPTREG1                              
060738,000091: 20,2134           37736        CALLACCS           CAF      PRIO27                                
060739,000092: 20,2135           05063                           TC       NOVAC                                 
060740,000093: 20,2136  E6,1536                                  EBANK=   AOSQ                                  
060741,000094: 20,2136           03603 42106                     2CADR    1/ACCJOB                              
060742,000095: 
060743,000096: 20,2140           00070                           TC       RUPTREG1                              #  RETURN TO CALLER.
060744,000097: 
060745,000098: 20,2141           32151        SETMINDB           CAF      NARROWDB                              #  SET 0.3 DEGREE DEADBAND.
060746,000099: 20,2142           12131                           TCF      SETMAXDB   +1                         
060747,000100: 

Page 1405

060749,000102: 20,2143           00006        PFLITEDB           EXTEND                                         #  THE RETURN FROM CALLACCS IS TO RUPTREG1.
060750,000103: 20,2144           22070                           QXCH     RUPTREG1                              
060751,000104: 20,2145           02154                           TC       ZATTEROR                              #  ZERO THE ERRORS AND COMMANDED RATES.
060752,000105: 20,2146           32153                           CAF      POWERDB                               #  SET DB TO 1.0 DEG.
060753,000106: 20,2147           55343                           TS       DB                                    
060754,000107: 20,2150           12134                           TCF      CALLACCS                              #  SET UP 1/ACCS AND RETURN TO CALLER.
060755,000108: 20,2151           00155        NARROWDB           OCTAL    00155                                 #  0.3 DEGREE SCALED AT 45.
060756,000109: 20,2152           03434        WIDEDB             OCTAL    03434                                 #  5.0 DEGREES SCALED AT 45.
060757,000110: 20,2153           00554        POWERDB            DEC      .02222                                #  1.0 DEGREE SCALED AT 45.
060758,000111: 
060759,000112: 20,2154           35006        ZATTEROR           CAF      EBANK6                                
060760,000113: 20,2155           56003                           XCH      EBANK                                 
060761,000114: 20,2156           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
060762,000115: 20,2157           30032                           CAE      CDUX                                  
060763,000116: 20,2160           55634                           TS       CDUXD                                 
060764,000117: 20,2161           30033                           CAE      CDUY                                  
060765,000118: 20,2162           55635                           TS       CDUYD                                 
060766,000119: 20,2163           30034                           CAE      CDUZ                                  
060767,000120: 20,2164           55636                           TS       CDUZD                                 
060768,000121: 20,2165           12171                           TCF      STOPRATE   +3                         
060769,000122: 
060770,000123: 20,2166           35006        STOPRATE           CAF      EBANK6                                
060771,000124: 20,2167           56003                           XCH      EBANK                                 
060772,000125: 20,2170           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
060773,000126: 20,2171           34746                 +3        CAF      ZERO                                  
060774,000127: 20,2172           55642                           TS       OMEGAPD                               
060775,000128: 20,2173           55643                           TS       OMEGAQD                               
060776,000129: 20,2174           55644                           TS       OMEGARD                               
060777,000130: 20,2175           55637                           TS       DELCDUX                               
060778,000131: 20,2176           55640                           TS       DELCDUY                               
060779,000132: 20,2177           55641                           TS       DELCDUZ                               
060780,000133: 20,2200           55274                           TS       DELPEROR                              
060781,000134: 20,2201           55275                           TS       DELQEROR                              
060782,000135: 20,2202           55276                           TS       DELREROR                              
060783,000136: 20,2203           22003                           LXCH     EBANK                                 #  RESTORE CALLERS EBANK.
060784,000137: 20,2204           00002                           TC       Q                                     
060785,000138: 
060786,000139:                                                                                                  #  SUBROUTINE NAME:  ALLCOAST
060787,000140: 
060788,000141:                                                                                                  #  WILL BE CALLED BY FRESH STARTS AND ENGINE OFF ROUTINES.       .
060789,000142: 
060790,000143:                                                                                                  #  CALLING SEQUENCE: (SAME AS ABOVE)
060791,000144: 
060792,000145:                                                                                                  #  EXIT:  RETURN TO Q.
060793,000146: 
060794,000147:                                                                                                  #  SUBROUTINES CALLED:  STOPRATE, RESTORDB, NOVAC
060795,000148: 
060796,000149:                                                                                                  #  ZERO:  (FOR ALL AXES) AOS, ALPHA, AOSTERM, OMEGAD, DELCDU, DELEROR
060797,000150: 

Page 1406

060799,000152:                                                                                                  #  OUTPUT:  DRIFTBIT/DAPBOOLS, DB, JOB TO DO 1/ACCS
060800,000153: 
060801,000154:                                                                                                  #  DEBRIS:  A, L, Q, RUPTREG1, RUPTREG2, (ITEMPS IN NOVAC)
060802,000155: 
060803,000156: 20,2205           00006        ALLCOAST           EXTEND                                         #  SAVE Q FOR RETURN
060804,000157: 20,2206           22071                           QXCH     RUPTREG2                              
060805,000158: 20,2207           02166                           TC       STOPRATE                              #  CLEAR RATE INTERFACE.  RETURN WITH A=0
060806,000159: 20,2210           22003                           LXCH     EBANK                                 #    AND L=EBANK6.  SAVE CALLERS EBANK.
060807,000160: 20,2211           55536                           TS       AOSQ                                  
060808,000161: 20,2212           55537                           TS       AOSQ       +1                         
060809,000162: 20,2213           55540                           TS       AOSR                                  
060810,000163: 20,2214           55541                           TS       AOSR       +1                         
060811,000164: 20,2215           55424                           TS       ALPHAQ                                #  FOR DOWNLIST.
060812,000165: 20,2216           55425                           TS       ALPHAR                                
060813,000166: 20,2217           55544                           TS       AOSQTERM                              
060814,000167: 20,2220           55545                           TS       AOSRTERM                              
060815,000168: 20,2221           22003                           LXCH     EBANK                                 #  RESTORE EBANK  (EBANK6 NO LONGER NEEDED)
060816,000169: 
060817,000170: 20,2222           40111                           CS       DAPBOOLS                              #  SET UP DRIFTBIT
060818,000171: 20,2223           74735                           MASK     DRIFTBIT                              
060819,000172: 20,2224           26111                           ADS      DAPBOOLS                              
060820,000173: 20,2225           02116                           TC       RESTORDB   +1                         #  RESTORE DEADBANK TO CREW-SELECTED VALUE.
060821,000174: 
060822,000175: 20,2226           00071                           TC       RUPTREG2                              #  RETURN.
060823,000176: 
060824,000177: 
060825,000178: 

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