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.

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

Page 1403

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

Page 1404

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

Page 1405

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

Page 1406

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

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