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.

059376,000002:                                                                                                  ## Copyright:   Public domain.
059377,000003:                                                                                                  ## Filename:    DAP_INTERFACE_SUBROUTINES.agc
059378,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
059379,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM) 
059380,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
059381,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
059382,000008:                                                                                                  ##              that the code format has been changed to conform to the
059383,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
059384,000010:                                                                                                  ##              original YUL assembler.
059385,000011:                                                                                                  ## Reference:   pp. 1396-1399
059386,000012:                                                                                                  ## Assembler:   yaYUL
059387,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
059388,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
059389,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
059390,000016:                                                                                                  ##              2017-02-08 NV   Updated for Luminary 116.
059391,000017:                                                                                                  ##              2017-03-10 RSB  Proofed comment text via 3-way diff vs
059392,000018:                                                                                                  ##                              Luminary 99 and 132 ... no problems found.
059393,000019: 

Page 1396

059395,000021: 20,2115                                           BANK     20                                    
059396,000022: 20,2000                                           SETLOC   DAPS3                                 
059397,000023: 20,2000                                           BANK                                           
059398,000024: 
059399,000025: 20,2115  E6,1635                                  EBANK=   CDUXD                                 
059400,000026: 20,2115                                           COUNT*   $$/DAPIF                              
059401,000027: 
059402,000028:                                                                                                  #  MOD 0         DATE    11/15/66        BY GEORGE W. CHERRY
059403,000029:                                                                                                  #  MOD 1                  1/23/67        MODIFICATION BY PETER ADLER
059404,000030: 
059405,000031:                                                                                                  #  FUNCTIONAL DESCRIPTION
059406,000032:                                                                                                  #        HEREIN ARE A COLLECTION OF SUBROUTINES WHICH ALLOW MISSION CONTROL PROGRAMS TO CONTROL THE MODE
059407,000033:                                                                                                  #        AND INTERFACE WITH THE DAP.
059408,000034: 
059409,000035:                                                                                                  #  CALLING SEQUENCES
059410,000036:                                                                                                  #        IN INTERRUPT OR WITH INTERRUPT INHIBITED
059411,000037:                                                                                                  #                TC      IBNKCALL
059412,000038:                                                                                                  #                FCADR   ROUTINE
059413,000039:                                                                                                  #        IN A JOB WITHOUT INTERRUPT INHIBITED
059414,000040:                                                                                                  #                INHINT
059415,000041:                                                                                                  #                TC      IBNKCALL
059416,000042:                                                                                                  #                FCADR   ROUTINE
059417,000043:                                                                                                  #                RELINT
059418,000044: 
059419,000045:                                                                                                  #  OUTPUT
059420,000046:                                                                                                  #        SEE INDIVIDUAL ROUTINES BELOW
059421,000047: 
059422,000048:                                                                                                  #  DEBRIS
059423,000049:                                                                                                  #        A, L, AND SOMETIMES MDUETEMP                    ODE     NOT IN PULSES MODE
059424,000050: 

Page 1397

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

Page 1398

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

Page 1399

059523,000149:                                                                                                  #  OUTPUT:               DRIFTBIT/DAPBOOLS, DB, JOB TO DO 1/ACCS
059524,000150: 
059525,000151:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, RUPTREG2, (ITEMPS IN NOVAC)
059526,000152: 
059527,000153: 20,2205           00006        ALLCOAST           EXTEND                                         #  SAVE Q FOR RETURN
059528,000154: 20,2206           22071                           QXCH     RUPTREG2                              
059529,000155: 20,2207           02166                           TC       STOPRATE                              #  CLEAR RATE INTERFACE.  RETURN WITH A=0
059530,000156: 20,2210           22003                           LXCH     EBANK                                 #  AND L=EBANK6.  SAVE CALLERS EBANK.
059531,000157: 20,2211           55537                           TS       AOSQ                                  
059532,000158: 20,2212           55540                           TS       AOSQ       +1                         
059533,000159: 20,2213           55541                           TS       AOSR                                  
059534,000160: 20,2214           55542                           TS       AOSR       +1                         
059535,000161: 20,2215           55424                           TS       ALPHAQ                                #  FOR DOWNLIST.
059536,000162: 20,2216           55425                           TS       ALPHAR                                
059537,000163: 20,2217           55545                           TS       AOSQTERM                              
059538,000164: 20,2220           55546                           TS       AOSRTERM                              
059539,000165: 20,2221           22003                           LXCH     EBANK                                 #  RESTORE EBANK (EBANK6 NO LONGER NEEDED)
059540,000166: 
059541,000167: 20,2222           40111                           CS       DAPBOOLS                              #  SET UP DRIFTBIT
059542,000168: 20,2223           74744                           MASK     DRIFTBIT                              
059543,000169: 20,2224           26111                           ADS      DAPBOOLS                              
059544,000170: 20,2225           02116                           TC       RESTORDB   +1                         #  RESTORE DEADBANK TO CREW-SELECTED VALUE.
059545,000171: 
059546,000172: 20,2226           00071                           TC       RUPTREG2                              #  RETURN.
059547,000173: 

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