Source Code

These source-code files derive from a printout of Luminary 116 (the Apollo 12 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Ron Burkey, 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 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071
	19:09 AUG. 11,1969
Note that the date is the date of the printout, not the date of the program revision.

059353,000002:                                                                                                  ## Copyright:   Public domain.
059354,000003:                                                                                                  ## Filename:    DAP_INTERFACE_SUBROUTINES.agc
059355,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
059356,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM) 
059357,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
059358,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
059359,000008:                                                                                                  ##              that the code format has been changed to conform to the
059360,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
059361,000010:                                                                                                  ##              original YUL assembler.
059362,000011:                                                                                                  ## Reference:   pp. 1396-1399
059363,000012:                                                                                                  ## Assembler:   yaYUL
059364,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
059365,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
059366,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
059367,000016:                                                                                                  ##              2017-02-08 NV   Updated for Luminary 116.
059368,000017:                                                                                                  ##              2017-03-10 RSB  Proofed comment text via 3-way diff vs
059369,000018:                                                                                                  ##                              Luminary 99 and 132 ... no problems found.
059370,000019: 

Page 1396

059372,000021: 20,2115                                           BANK     20                                    
059373,000022: 20,2000                                           SETLOC   DAPS3                                 
059374,000023: 20,2000                                           BANK                                           
059375,000024: 
059376,000025: 20,2115  E6,1635                                  EBANK=   CDUXD                                 
059377,000026: 20,2115                                           COUNT*   $$/DAPIF                              
059378,000027: 
059379,000028:                                                                                                  #  MOD 0         DATE    11/15/66        BY GEORGE W. CHERRY
059380,000029:                                                                                                  #  MOD 1                  1/23/67        MODIFICATION BY PETER ADLER
059381,000030: 
059382,000031:                                                                                                  #  FUNCTIONAL DESCRIPTION
059383,000032:                                                                                                  #        HEREIN ARE A COLLECTION OF SUBROUTINES WHICH ALLOW MISSION CONTROL PROGRAMS TO CONTROL THE MODE
059384,000033:                                                                                                  #        AND INTERFACE WITH THE DAP.
059385,000034: 
059386,000035:                                                                                                  #  CALLING SEQUENCES
059387,000036:                                                                                                  #        IN INTERRUPT OR WITH INTERRUPT INHIBITED
059388,000037:                                                                                                  #                TC      IBNKCALL
059389,000038:                                                                                                  #                FCADR   ROUTINE
059390,000039:                                                                                                  #        IN A JOB WITHOUT INTERRUPT INHIBITED
059391,000040:                                                                                                  #                INHINT
059392,000041:                                                                                                  #                TC      IBNKCALL
059393,000042:                                                                                                  #                FCADR   ROUTINE
059394,000043:                                                                                                  #                RELINT
059395,000044: 
059396,000045:                                                                                                  #  OUTPUT
059397,000046:                                                                                                  #        SEE INDIVIDUAL ROUTINES BELOW
059398,000047: 
059399,000048:                                                                                                  #  DEBRIS
059400,000049:                                                                                                  #        A, L, AND SOMETIMES MDUETEMP                    ODE     NOT IN PULSES MODE
059401,000050: 

Page 1397

059403,000052:                                                                                                  #  SUBROUTINE NAMES:
059404,000053:                                                                                                  #        SETMAXDB, SETMINDB, RESTORDB, PFLITEDB
059405,000054:                                                                                                  #  MODIFIED:     30 JANUARY 1968 BY P S WEISSMAN TO CREATE RESTORDB.
059406,000055:                                                                                                  #  MODIFIED:     1 MARCH 1968 BY P S WEISSMAN TO SAVE EBANK AND CREATE PFLITEDB
059407,000056: 
059408,000057:                                                                                                  #  FUNCTIONAL DESCRIPTION:
059409,000058:                                                                                                  #        SETMAXDB - SET DEADBAND TO 5.0 DEGREES
059410,000059:                                                                                                  #        SETMINDB - SET DEADBAND TO 0.3 DEGREE
059411,000060:                                                                                                  #        RESTORDB - SET DEADBAND TO .3, 1, OR 5 ACCORDING TO BITS 4 AND 5 OF DAPBOOLS
059412,000061:                                                                                                  #        PFLITEDB - SET DEADBAND TO 1.0 DEGREE AND ZERO THE COMMANDED ATTITUDE CHANGE AND COMMANDED RATE
059413,000062: 
059414,000063:                                                                                                  #        ALL ENTRIES SET UP A NOVAC JOB TO DO 1/ACCS SO THAT THE TJETLAW SWITCH CURVES ARE POSITIONED TO
059415,000064:                                                                                                  #        REFLECT THE NEW DEADBAND.  IT SHOULD BE NOTED THAT THE DEADBAND REFERS TO THE ATTITUDE IN THE P-, U-, AND V-AXES.
059416,000065: 
059417,000066:                                                                                                  #  SUBROUTINE CALLED:    NOVAC
059418,000067: 
059419,000068:                                                                                                  #  CALLING SEQUENCE:     SAME AS ABOVE
059420,000069:                                                                                                  #                        OR      TC RESTORDB +1    FROM ALLCOAST
059421,000070: 
059422,000071:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, (ITEMPS IN NOVAC)
059423,000072: 
059424,000073: 20,2115           30111        RESTORDB           CAE      DAPBOOLS                              #  DETERMINE CREW-SELECTED DEADBAND.
059425,000074: 20,2116           74747                           MASK     DBSLECT2                              #  CHECK FOR MAX DB (5 DEG)
059426,000075: 20,2117           00006                           EXTEND                                         
059427,000076: 20,2120           12122                           BZF      +2                                    
059428,000077: 20,2121           12130                           TCF      SETMAXDB                              #  BIT5 DAPBOOLS IS SET - CREW WANTS 5 DEG
059429,000078: 20,2122           30111                           CAE      DAPBOOLS                              
059430,000079: 20,2123           74750                           MASK     DBSELECT                              #  CHECK FOR 1 DEG DEADBAND SELECTION
059431,000080: 20,2124           00006                           EXTEND                                         
059432,000081: 20,2125           12141                           BZF      SETMINDB                              
059433,000082: 
059434,000083: 20,2126           32153                           CAF      POWERDB                               #  BIT4 DAPBOOLS IS SET - CREW WANTS 1 DEG
059435,000084: 20,2127           12131                           TCF      SETMAXDB   +1                         
059436,000085: 20,2130           32152        SETMAXDB           CAF      WIDEDB                                #  SET 5 DEGREE DEADBAND.
059437,000086: 20,2131           55343                 +1        TS       DB                                    
059438,000087: 
059439,000088: 20,2132           00006                           EXTEND                                         #  SET UP JOB TO RE-POSITION SWITCH CURVES.
059440,000089: 20,2133           22070                           QXCH     RUPTREG1                              
059441,000090: 20,2134           37720        CALLACCS           CAF      PRIO27                                
059442,000091: 20,2135           05072                           TC       NOVAC                                 
059443,000092: 20,2136  E6,1537                                  EBANK=   AOSQ                                  
059444,000093: 20,2136           03644 42106                     2CADR    1/ACCJOB                              
059445,000094: 
059446,000095: 20,2140           00070                           TC       RUPTREG1                              #  RETURN TO CALLER.
059447,000096: 
059448,000097: 20,2141           32151        SETMINDB           CAF      NARROWDB                              #  SET 0.3 DEGREE DEADBAND.
059449,000098: 20,2142           12131                           TCF      SETMAXDB   +1                         

Page 1398

059451,000100: 20,2143           00006        PFLITEDB           EXTEND                                         #  THE RETURN FROM CALLACCS IS TO RUPTREG1.
059452,000101: 20,2144           22070                           QXCH     RUPTREG1                              
059453,000102: 20,2145           02154                           TC       ZATTEROR                              #  ZERO THE ERRORS AND COMMANDED RATES.
059454,000103: 20,2146           32153                           CAF      POWERDB                               #  SET DB TO 1.0 DEG.
059455,000104: 20,2147           55343                           TS       DB                                    
059456,000105: 20,2150           12134                           TCF      CALLACCS                              #  SET UP 1/ACCS AND RETURN TO CALLER.
059457,000106: 20,2151           00155        NARROWDB           OCTAL    00155                                 #  0.3 DEGREE SCALED AT 45.
059458,000107: 20,2152           03434        WIDEDB             OCTAL    03434                                 #  5.0 DEGREES SCALED AT 45.
059459,000108: 20,2153           00554        POWERDB            DEC      .02222                                #  1.0 DEGREE SCALED AT 45.
059460,000109: 
059461,000110: 20,2154           35015        ZATTEROR           CAF      EBANK6                                
059462,000111: 20,2155           56003                           XCH      EBANK                                 
059463,000112: 20,2156           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
059464,000113: 20,2157           30032                           CAE      CDUX                                  
059465,000114: 20,2160           55635                           TS       CDUXD                                 
059466,000115: 20,2161           30033                           CAE      CDUY                                  
059467,000116: 20,2162           55636                           TS       CDUYD                                 
059468,000117: 20,2163           30034                           CAE      CDUZ                                  
059469,000118: 20,2164           55637                           TS       CDUZD                                 
059470,000119: 20,2165           12171                           TCF      STOPRATE   +3                         
059471,000120: 
059472,000121: 20,2166           35015        STOPRATE           CAF      EBANK6                                
059473,000122: 20,2167           56003                           XCH      EBANK                                 
059474,000123: 20,2170           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
059475,000124: 20,2171           34755                 +3        CAF      ZERO                                  
059476,000125: 20,2172           55643                           TS       OMEGAPD                               
059477,000126: 20,2173           55644                           TS       OMEGAQD                               
059478,000127: 20,2174           55645                           TS       OMEGARD                               
059479,000128: 20,2175           55640                           TS       DELCDUX                               
059480,000129: 20,2176           55641                           TS       DELCDUY                               
059481,000130: 20,2177           55642                           TS       DELCDUZ                               
059482,000131: 20,2200           55274                           TS       DELPEROR                              
059483,000132: 20,2201           55275                           TS       DELQEROR                              
059484,000133: 20,2202           55276                           TS       DELREROR                              
059485,000134: 20,2203           22003                           LXCH     EBANK                                 #  RESTORE CALLERS EBANK.
059486,000135: 20,2204           00002                           TC       Q                                     
059487,000136: 
059488,000137:                                                                                                  #  SUBROUTINE NAME:      ALLCOAST
059489,000138:                                                                                                  #  WILL BE CALLED BY FRESH STARTS AND ENGINE OFF ROUTINES.               .
059490,000139: 
059491,000140:                                                                                                  #  CALLING SEQUENCE:     (SAME AS ABOVE)
059492,000141: 
059493,000142:                                                                                                  #  EXIT:                 RETURN TO Q.
059494,000143: 
059495,000144:                                                                                                  #  SUBROUTINES CALLED:   STOPRATE, RESTORDB, NOVAC
059496,000145: 
059497,000146:                                                                                                  #  ZERO:                 (FOR ALL AXES) AOS, ALPHA, AOSTERM, OMEGAD, DELCDU, DELEROR
059498,000147: 

Page 1399

059500,000149:                                                                                                  #  OUTPUT:               DRIFTBIT/DAPBOOLS, DB, JOB TO DO 1/ACCS
059501,000150: 
059502,000151:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, RUPTREG2, (ITEMPS IN NOVAC)
059503,000152: 
059504,000153: 20,2205           00006        ALLCOAST           EXTEND                                         #  SAVE Q FOR RETURN
059505,000154: 20,2206           22071                           QXCH     RUPTREG2                              
059506,000155: 20,2207           02166                           TC       STOPRATE                              #  CLEAR RATE INTERFACE.  RETURN WITH A=0
059507,000156: 20,2210           22003                           LXCH     EBANK                                 #  AND L=EBANK6.  SAVE CALLERS EBANK.
059508,000157: 20,2211           55537                           TS       AOSQ                                  
059509,000158: 20,2212           55540                           TS       AOSQ       +1                         
059510,000159: 20,2213           55541                           TS       AOSR                                  
059511,000160: 20,2214           55542                           TS       AOSR       +1                         
059512,000161: 20,2215           55424                           TS       ALPHAQ                                #  FOR DOWNLIST.
059513,000162: 20,2216           55425                           TS       ALPHAR                                
059514,000163: 20,2217           55545                           TS       AOSQTERM                              
059515,000164: 20,2220           55546                           TS       AOSRTERM                              
059516,000165: 20,2221           22003                           LXCH     EBANK                                 #  RESTORE EBANK (EBANK6 NO LONGER NEEDED)
059517,000166: 
059518,000167: 20,2222           40111                           CS       DAPBOOLS                              #  SET UP DRIFTBIT
059519,000168: 20,2223           74744                           MASK     DRIFTBIT                              
059520,000169: 20,2224           26111                           ADS      DAPBOOLS                              
059521,000170: 20,2225           02116                           TC       RESTORDB   +1                         #  RESTORE DEADBANK TO CREW-SELECTED VALUE.
059522,000171: 
059523,000172: 20,2226           00071                           TC       RUPTREG2                              #  RETURN.
059524,000173: 

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