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.

059527,000002:                                                                                                  ## Copyright:   Public domain.
059528,000003:                                                                                                  ## Filename:    DAPIDLER_PROGRAM.agc
059529,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
059530,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM) 
059531,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
059532,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
059533,000008:                                                                                                  ##              that the code format has been changed to conform to the
059534,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
059535,000010:                                                                                                  ##              original YUL assembler.
059536,000011:                                                                                                  ## Reference:   pp. 1400-1410
059537,000012:                                                                                                  ## Assembler:   yaYUL
059538,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
059539,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
059540,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
059541,000016:                                                                                                  ##              2017-01-28 RSB  Comment-text fixes identified for Luminary 69.
059542,000017:                                                                                                  ##              2017-02-23 RRB  Updated for Luminary 116.
059543,000018:                                                                                                  ##              2017-03-01 HG   Fix operator CAE  ->  CS
059544,000019:                                                                                                  ##                                           CAF  ->  CAE
059545,000020:                                                                                                  ##              2017-03-10 RSB  Proofed comment text via 3-way diff vs
059546,000021:                                                                                                  ##                              Luminary 99 and 132.
059547,000022: 

Page 1400

059549,000024:                                                                                                  #  THE DAPIDLER PROGRAM IS STARTED BY FRESH START AND RESTART.             THE DAPIDLER PROGRAM IS DONE 10 TIMES
059550,000025:                                                                                                  #  PER SECOND UNTIL THE ASTRONAUT DESIRES THE DAP TO WAKE UP, AND THE IMU AND CDUS ARE READY FOR USE BY THE DAP.
059551,000026:                                                                                                  #  THE NECESSARY INITIALIZATION OF THE DAP IS DONE BY THE DAPIDLER PROGRAM.
059552,000027: 
059553,000028: 16,2000                                           BANK     16                                    
059554,000029: 16,2000                                           SETLOC   DAPS1                                 
059555,000030: 16,2000                                           BANK                                           
059556,000031: 
059557,000032: 16,2000  E6,1537                                  EBANK=   AOSQ                                  
059558,000033: 
059559,000034: 16,2000                                           COUNT*   $$/DAPID                              
059560,000035: 
059561,000036: 16,2000           00006        CHEKBITS           EXTEND                                         
059562,000037: 16,2001           00031                           READ     CHAN31                                #  IF BOTH BIT13 AND BIT14 ARE ONE, THEN
059563,000038: 16,2002           40000                           COM                                            #  THE MODE SELECT SWITCH IS IN THE OFF
059564,000039: 16,2003           74355                           MASK     BIT13-14                              #  POSITION, AND SO THE DAP SHOULD BE OFF,
059565,000040: 16,2004           00006                           EXTEND                                         #  WITH NO ATTITUDE ERROR DISPLAY.
059566,000041: 16,2005           12157                           BZF      MOREIDLE                              
059567,000042: 
059568,000043: 16,2006           41300                           CS       IMODES33                              
059569,000044: 16,2007           74746                           MASK     BIT6                                  
059570,000045: 16,2010           10000                           CCS      A                                     
059571,000046: 16,2011           12206                           TCF      JUMPDSP                               
059572,000047: 16,2012           41262                           CS       RCSFLAGS                              #  IMU NOT USABLE.  SET UP INITIALIZATION
059573,000048: 16,2013           74751                           MASK     BIT3                                  #  FLAG FOR ATT ERROR DISPLAY ROUTINE.
059574,000049: 16,2014           27262                           ADS      RCSFLAGS                              
059575,000050: 16,2015           12163                           TCF      SHUTDOWN                              
059576,000051: 
059577,000052: 16,2016           34742        CHEKMORE           CAF      BIT10                                 #  BIT 10 OF 30 IS PGNCS CONTROL OF S/C
059578,000053: 16,2017           00006                           EXTEND                                         
059579,000054: 16,2020           02030                           RAND     CHAN30                                #  BITS IN 30 ARE INVERTED
059580,000055: 16,2021           10000                           CCS      A                                     
059581,000056: 16,2022           12157                           TCF      MOREIDLE                              
059582,000057: 
059583,000058: 16,2023           00002                           RETURN                                         
059584,000059: 

Page 1401

059586,000061:                                                                                                  #  DAPIDLER ENTRY.
059587,000062: 
059588,000063: 16,2024           22016        DAPIDLER           LXCH     BANKRUPT                              #  INTERRUPT LEAD INS (CONTINUED)
059589,000064: 16,2025           00006                           EXTEND                                         
059590,000065: 16,2026           22012                           QXCH     QRUPT                                 
059591,000066: 
059592,000067: 16,2027           31262                           CA       RCSFLAGS                              
059593,000068: 16,2030           74737                           MASK     BIT13                                 
059594,000069: 16,2031           10000                           CCS      A                                     #  CHECK IF 1/ACCJOB HAS BEEN SET UP SINCE
059595,000070: 16,2032           12041                           TCF      CHECKUP                               #  THE LAST FRESH START OR RESTART.
059596,000071: 16,2033           34737                           CA       BIT13                                 
059597,000072: 16,2034           27262                           ADS      RCSFLAGS                              #  BIT 13 IS 1.
059598,000073: 16,2035           37720                           CAF      PRIO27                                
059599,000074: 16,2036           05072                           TC       NOVAC                                 #  SET UP JOB TO DO A LITTLE INITIALIZATION
059600,000075: 16,2037  E6,1537                                  EBANK=   AOSQ                                  #    AND EXECUTE 1/ACCS.
059601,000076: 16,2037           03637 42106                     2CADR    1/ACCSET                              #  (WILL BRANCH TO MOREIDLE ON ACCSOKAY)
059602,000077: 
059603,000078: 16,2041           02000        CHECKUP            TC       CHEKBITS                              #  CHECK TO SEE IF LM DAP IS TO GO ON AND
059604,000079:                                                                                                  #    DO ERROR DISPLAY.
059605,000080: 
059606,000081: 16,2042           30111                           CAE      DAPBOOLS                              #  IF 1/ACCS HAS NOT BEEN COMPLETED, IDLE.
059607,000082: 16,2043           74751                           MASK     ACCSOKAY                              #    NOTE: ONLY FRESH START AND RESTART
059608,000083: 16,2044           00006                           EXTEND                                         #          KNOCK THIS BIT DOWN.
059609,000084: 16,2045           12157                           BZF      MOREIDLE                              
059610,000085: 
059611,000086: 16,2046           04674        STARTDAP           TC       IBNKCALL                              #  ZERO ATTITUDE ERROR AND DESIRED RATES.
059612,000087: 16,2047           40154                           FCADR    ZATTEROR                              
059613,000088: 16,2050           34755                           CAF      ZERO                                  #  ********** INITIALIZE: **********
059614,000089: 16,2051           55524                           TS       TJP                                   
059615,000090: 16,2052           55525                           TS       TJU                                   
059616,000091: 16,2053           55526                           TS       TJV                                   
059617,000092: 16,2054           55421                           TS       OMEGAP                                #  RATES IN BODY (PILOT) COORDINATES.
059618,000093: 16,2055           55422                           TS       OMEGAQ                                
059619,000094: 16,2056           55423                           TS       OMEGAR                                
059620,000095: 16,2057           55430                           TS       TRAPEDP                               
059621,000096: 16,2060           55431                           TS       TRAPEDQ                               
059622,000097: 16,2061           55432                           TS       TRAPEDR                               
059623,000098: 16,2062           55537                           TS       AOSQ                                  #  OFFSET ACCELERATION ESTIMATES.
059624,000099: 16,2063           55540                           TS       AOSQ       +1                         
059625,000100: 16,2064           55541                           TS       AOSR                                  
059626,000101: 16,2065           55542                           TS       AOSR       +1                         
059627,000102: 16,2066           55424                           TS       ALPHAQ                                #  COPIES OF OFFSET ESTIMATES FOR DOWNLIST.
059628,000103: 16,2067           55425                           TS       ALPHAR                                
059629,000104: 16,2070           55501                           TS       NEGUQ                                 
059630,000105: 16,2071           55503                           TS       NEGUR                                 
059631,000106: 16,2072           55545                           TS       AOSQTERM                              #  QRAXIS RATE DERIVATION TERMS AND KALMAN
059632,000107: 16,2073           55546                           TS       AOSRTERM                              #  FILTER INITIALIZATION TERMS.
059633,000108: 16,2074           55510                           TS       QACCDOT                               #  DESCENT ACCELERATION DERIVATIVE EST.
059634,000109: 16,2075           55512                           TS       RACCDOT                               

Page 1402

059636,000111: 16,2076           55502                           TS       ALLOWGTS                              #  AOSTASK FLAG FOR QRAXIS RCS CONTROL USE.
059637,000112: 16,2077           55631                           TS       COTROLER                              #  DO TRYGTS ON FIRST PASS (WILL GO TO RCS)
059638,000113: 16,2100           55633                           TS       INGTS                                 #  RECOGNIZE FIRST GTS PASS AS SUCH.
059639,000114: 16,2101           55632                           TS       QGIMTIMR                              #  STOP GIMBAL DRIVES.  (PROBABLY WOULD BE
059640,000115: 16,2102           55634                           TS       RGIMTIMR                              #    GOOD ENOUGH JUST TO INACTIVATE TIMERS)
059641,000116: 16,2103           55460                           TS       OLDPMIN                               #  MINIMUM IMPULSE MODE ERASABLES
059642,000117: 16,2104           55461                           TS       OLDQRMIN                              
059643,000118: 16,2105           55767                           TS       PJETCTR                               #  INITIALIZE DOCKED JET INHIBITION
059644,000119: 16,2106           55770                           TS       UJETCTR                               #  COUNTERS
059645,000120: 16,2107           55771                           TS       VJETCTR                               
059646,000121: 16,2110     4747               CALLGMBL           EQUALS   BIT5                                  #  RCSFLAGS INITIALIZATION.
059647,000122: 16,2110           42202                           CS       MANFLAG                               
059648,000123: 16,2111           71262                           MASK     RCSFLAGS                              #  NEGUQ(R) HAVE BEEN GENERATED.
059649,000124: 16,2112           55262                           TS       RCSFLAGS                              
059650,000125: 
059651,000126:                                                                                                  #  SET UP "OLD" MEASURED CDU ANGLES:
059652,000127: 
059653,000128: 16,2113           00006                           EXTEND                                         
059654,000129: 16,2114           30033                           DCA      CDUX                                  #  OLDXFORP AND OLDYFORP
059655,000130: 16,2115           53441                           DXCH     OLDXFORP                              
059656,000131: 16,2116           30034                           CA       CDUZ                                  
059657,000132: 16,2117           55442                           TS       OLDZFORQ                              
059658,000133: 16,2120           41262                           CS       RCSFLAGS                              
059659,000134: 16,2121           74740                           MASK     BIT12                                 
059660,000135: 16,2122           27262                           ADS      RCSFLAGS                              #  BIT 12 SET TO 1.
059661,000136: 16,2123           34751                           CA       FOUR                                  
059662,000137: 16,2124           55535                           TS       SKIPU                                 
059663,000138: 16,2125           55536                           TS       SKIPV                                 
059664,000139: 16,2126           34733                           CA       POSMAX                                
059665,000140: 16,2127           54031                           TS       TIME6                                 
059666,000141: 16,2130           55466                           TS       T6NEXT                                
059667,000142: 16,2131           55470                           TS       T6FURTHA                              
059668,000143: 16,2132           34755                           CA       ZERO                                  
059669,000144: 16,2133           55467                           TS       T6NEXT     +1                         
059670,000145: 16,2134           55471                           TS       T6FURTHA   +1                         
059671,000146: 16,2135           55465                           TS       NXT6ADR                               
059672,000147: 16,2136           55472                           TS       NEXTP                                 
059673,000148: 16,2137           55473                           TS       NEXTU                                 
059674,000149: 16,2140           55474                           TS       NEXTV                                 
059675,000150: 16,2141           44363                           CS       TEN                                   
059676,000151: 16,2142           55757                           TS       DAPZRUPT                              #  JASK NOT IN PROGRESS, INITIALIZE NEG.
059677,000152: 16,2143           34752                           CA       TWO                                   
059678,000153: 16,2144           55433                           TS       NPTRAPS                               
059679,000154: 16,2145           55434                           TS       NQTRAPS                               
059680,000155: 16,2146           55435                           TS       NRTRAPS                               
059681,000156: 16,2147           00006                           EXTEND                                         
059682,000157: 16,2150           32205                           DCA      PAXADIDL                              
059683,000158: 16,2151           53264                           DXCH     T5ADR                                 
059684,000159: 16,2152           37732        SETTIME5           CAF      MS100                                 
059685,000160: 16,2153           54030                           TS       TIME5                                 

Page 1403

059687,000162: 16,2154           15270                           TCF      RESUME                                
059688,000163: 16,2155  E6,1537                                  EBANK=   AOSQ                                  
059689,000164: 16,2155           02024 34106  IDLERADR           2CADR    DAPIDLER                              
059690,000165: 
059691,000166: 16,2157           04674        MOREIDLE           TC       IBNKCALL                              #  CALCULATE Q,R-AXES ATTITUDE ERRORS.
059692,000167: 16,2160           36655                           CADR     QERRCALC                              
059693,000168: 
059694,000169: 16,2161           04674                           TC       IBNKCALL                              
059695,000170: 16,2162           35452                           CADR     CALCPERR                              #  CALCULATE P AXIS ATTITUDE ERRORS.
059696,000171: 
059697,000172: 16,2163           00006        SHUTDOWN           EXTEND                                         
059698,000173: 16,2164           32156                           DCA      IDLERADR                              
059699,000174: 16,2165           53264                           DXCH     T5ADR                                 
059700,000175: 
059701,000176: 16,2166           34755                           CAF      ZERO                                  #  KILL ANY POSSIBLE JET REQUESTS
059702,000177: 16,2167           55472                           TS       NEXTP                                 
059703,000178: 16,2170           55473                           TS       NEXTU                                 
059704,000179: 16,2171           55474                           TS       NEXTV                                 
059705,000180: 16,2172           00006                           EXTEND                                         #  COMMAND JETS OFF.
059706,000181: 16,2173           01005                           WRITE    CHAN5                                 
059707,000182: 16,2174           00006                           EXTEND                                         
059708,000183: 16,2175           01006                           WRITE    CHAN6                                 
059709,000184: 16,2176           42203                           CS       BGIM23                                #  TURN TRIM GIMBAL OFF
059710,000185: 16,2177           00006                           EXTEND                                         
059711,000186: 16,2200           03012                           WAND     CHAN12                                
059712,000187: 16,2201           12152                           TCF      SETTIME5                              #  RETURN IN 100 MSEC.
059713,000188: 
059714,000189: 16,2202           03021        MANFLAG            OCT      03021                                 
059715,000190: 16,2203           07400        BGIM23             OCTAL    07400                                 
059716,000191: 16,2204  E6,1421                                  EBANK=   OMEGAP                                
059717,000192: 16,2204           02213 34106  PAXADIDL           2CADR    PAXIS                                 
059718,000193: 
059719,000194: 16,2206     7732               MS100              =        OCT37766                              
059720,000195: 16,2206     0061               COSMG              =        ITEMP1                                
059721,000196: 16,2206           00006        JUMPDSP            EXTEND                                         #  TRANSFER TO BANK 20
059722,000197: 16,2207           32212                           DCA      DSPCADR                               #  FOR ATTITUDE ERROR DISPLAYS
059723,000198: 16,2210           52006                           DTCB                                           
059724,000199: 
059725,000200: 16,2211  E6,1761                                  EBANK=   AK                                    
059726,000201: 16,2211           02227 40106  DSPCADR            2CADR    ALTDSPLY                              
059727,000202: 

Page 1404

059729,000204: 20,2227                                           BANK     20                                    
059730,000205: 20,2000                                           SETLOC   DAPS3                                 
059731,000206: 20,2000                                           BANK                                           
059732,000207: 20,2227                                           COUNT*   $$/NEEDL                              
059733,000208: 
059734,000209:                                                                                                  #  PROGRAM: ALTDSPLY
059735,000210:                                                                                                  #  MOD 0.  6 DEC 1967
059736,000211:                                                                                                  #  AUTHOR:  CRAIG WORK, DON KEENE, MIT IL
059737,000212:                                                                                                  #  MOD 3 BY DON KEENE AUG 1, 1968 MOVED PROGRAM TO BANK 20
059738,000213: 
059739,000214:                                                                                                  #  PROGRAM DESCRIPTION:
059740,000215:                                                                                                  #  ALTDSPLY REVERSES THE DSPLYALT BIT OF RCSFLAGS EACH TIME IT IS CALLED, WHICH IS PRESUMABLY EVERY 100 MS.
059741,000216:                                                                                                  #  IF THE REVERSED BIT IS ONE, NEEDLER IS CALLED TO DISPLAY ATTITUDE ERRORS.  IF THE BIT IS ZERO, THE ATTITUDE ERR-
059742,000217:                                                                                                  #  ORS ARE CALCULATED AS 1) ESTIMATED RATES (FOLLOWING) IF NEED2FLG = 1, OTHERWISE AS 2) DAP FOLLOWING ERRORS FOR
059743,000218:                                                                                                  #  NEEDLFLG = 0 AND 3) TOTAL ATTITUDE ERRORS FOR NEEDLFLG = 1.
059744,000219: 
059745,000220:                                                                                                  #  WARNING:  ALTDSPLY MAY ONLY BE CALLED WITH INTERRUPT INHIBITED.
059746,000221: 
059747,000222:                                                                                                  #  WARNING:  EBANK MUST BE SET TO 6 WHEN USING THIS ROUTINE.
059748,000223: 
059749,000224:                                                                                                  #  INPUT:  RCSFLAGS AND 1) IF NEEDLFLG = 0, INPUT PERROR, QERROR, RERROR.
059750,000225:                                                                                                  #                       2) IF NEEDLFLG = 1, INPUT CPHI,CTHETA,CPSI,CDUX,CDUY,CDUZ,M11,M21,M32,M22,M32.  (GPMATRIX)
059751,000226:                                                                                                  #               3) IF NEED2FLG = 1, INPUT OMEGAP, OMEGAQ, AND OMEGAR.
059752,000227: 
059753,000228:                                                                                                  #  OUTPUTS:  RCSFLAGS WITH DSPLYALT REVERSED,AK,AK1,AK2,+ NEEDLER OUTPUTS.
059754,000229: 
059755,000230:                                                                                                  #  ENTRY:  TCF     ALTDSPLY
059756,000231: 
059757,000232:                                                                                                  #  EXIT:   TCF     CHEKMORE
059758,000233: 
059759,000234:                                                                                                  #  ALARM OR ABORT EXITS: NONE
059760,000235: 
059761,000236:                                                                                                  #  SUBPROGRAMS CALLED:  NEEDLER, OVERSUB2
059762,000237: 
059763,000238:                                                                                                  #  DEBRIS:       A,L,AND NEEDLER DEBRIS.
059764,000239: 
059765,000240: 20,2227           31262        ALTDSPLY           CA       RCSFLAGS                              #  INVERT THE DISPLAY ALTERNATION BIT.
059766,000241: 20,2230           54001                           TS       L                                     
059767,000242: 20,2231           34750                           CA       DSPLYALT                              
059768,000243: 20,2232           00006                           EXTEND                                         
059769,000244: 20,2233           06001                           RXOR     LCHAN                                 
059770,000245: 20,2234           55262                           TS       RCSFLAGS                              
059771,000246: 
059772,000247: 20,2235           74750                           MASK     DSPLYALT                              
059773,000248: 20,2236           10000                           CCS      A                                     #  IS ALTERNATION FLAG ZERO?

Page 1405

059775,000250: 20,2237           12336                           TCF      NEEDLER                               
059776,000251: 
059777,000252: 20,2240           40074                           CS       FLAGWRD0                              #  CHECK FOR RATE DISPLAY TO ERROR NEEDLES
059778,000253: 20,2241           74735                           MASK     NEED2BIT                              #  VIA EXTENDED VERB 60
059779,000254: 20,2242           00006                           EXTEND                                         
059780,000255: 20,2243           12257                           BZF      DISPRATE                              
059781,000256: 
059782,000257: 20,2244           30074                           CAE      FLAGWRD0                              #  NEEDLFLG WILL INDICATE TOTAL OR DAP AT-
059783,000258: 20,2245           74750                           MASK     NEEDLBIT                              #  TITUDE ERROR DISPLAY REQUEST.
059784,000259: 20,2246           10000                           CCS      A                                     
059785,000260: 20,2247           12266                           TCF      DSPLYTOT                              #  TOTAL ERROR IS NEEDED IN AK,AK +1,AK +2
059786,000261: 
059787,000262: 20,2250           41450                           CS       QERROR                                #  YES. DISPLAY ATT ERRORS ON THE ,-BALL.
059788,000263: 20,2251           55762                           TS       AK         +1                         #  ERROR COMPLEMENTS ARE INPUT TO NEEDLER.
059789,000264: 20,2252           41452                           CS       RERROR                                
059790,000265: 20,2253           55763                           TS       AK         +2                         
059791,000266: 20,2254           41464                           CS       PERROR                                
059792,000267: 20,2255           57761                           XCH      AK                                    
059793,000268: 
059794,000269: 20,2256           12456                           TCF      RETNMORE                              #  DISPLAY THESE THE NEXT TIME THROUGH
059795,000270: 
059796,000271: 20,2257           41422        DISPRATE           CS       OMEGAQ                                #  LOAD ESTIMATED RATES (FOLLOWING)
059797,000272: 20,2260           55762                           TS       AK         +1                         
059798,000273: 20,2261           41423                           CS       OMEGAR                                
059799,000274: 20,2262           55763                           TS       AK         +2                         
059800,000275: 20,2263           41421                           CS       OMEGAP                                
059801,000276: 20,2264           57761                           XCH      AK                                    
059802,000277: 20,2265           12456                           TCF      RETNMORE                              
059803,000278: 
059804,000279:                                                                                                  #  CALCULATE GIMBAL ANGLE TOTAL ERRORS, RESOLVE INTO PILOT AXES, STORE TOTAL ERRORS FOR NEEDLER.  Q-AXIS FIRST.
059805,000280: 
059806,000281: 20,2266           00006        DSPLYTOT           EXTEND                                         
059807,000282: 20,2267           22061                           QXCH     ITEMP1                                #  SAVE Q FOR CHEKBITS RETURN.
059808,000283: 
059809,000284: 20,2270           30322                           CA       CTHETA                                #  DESIRED ATTITUDE, Y-AXIS, 2'S COMP.
059810,000285: 20,2271           00006                           EXTEND                                         #  SUBTRACT CURRENT ATTITUDE.
059811,000286: 20,2272           20033                           MSU      CDUY                                  #  DIFFERENCE SCALED AT PI, 1'S COMP.
059812,000287: 20,2273           55761                           TS       AK                                    #  SAVE FOR R-ERROR CALCULATION.
059813,000288: 20,2274           00006                           EXTEND                                         
059814,000289: 20,2275           71415                           MP       M21                                   #  (CHTETA-CDUY)*M21 SCALED AT PI RADIANS.
059815,000290: 20,2276           57762                           XCH      AK         +1                         #  STORE FIRST TERM OF Q ERROR.
059816,000291: 20,2277           30323                           CA       CPSI                                  #  DESIRED ATTITUDE, Z-AXIS, 2'S COMP.
059817,000292: 20,2300           00006                           EXTEND                                         #  SUBTRACT CURRENT ATTITUDE.
059818,000293: 20,2301           20034                           MSU      CDUZ                                  #  DIFFERENCE SCALED AT PI, 1'S COMP.
059819,000294: 20,2302           55763                           TS       AK         +2                         #  SAVE Z-AXIS TERM FOR R ERROR CALCULATION
059820,000295: 20,2303           00006                           EXTEND                                         
059821,000296: 20,2304           71417                           MP       M22                                   #  (CPSI-CDUZ)*M22, SCALED AT PI RADIANS.
059822,000297: 20,2305           61762                           AD       AK         +1                         #  Q ERROR COMPLETE         , AT PI RAD.
059823,000298: 20,2306           02451                           TC       OVERSUB2                              #  PIN NEEDLES IN CASE OF OVERFLOW.
059824,000299: 20,2307           55762                           TS       AK         +1                         

Page 1406

059826,000301:                                                                                                  #  R ERROR CALCULATION NEXT.
059827,000302: 
059828,000303: 20,2310           31761                           CA       AK                                    #  Y-AXIS DIFFERENCE STORED BY Q-AXIS CALC.
059829,000304: 20,2311           00006                           EXTEND                                         
059830,000305: 20,2312           71416                           MP       M31                                   #  (CTHETA-CDUY)*M31, SCALED AT PI RADIANS.
059831,000306: 20,2313           57763                           XCH      AK         +2                         #  FIRST TERM OF R ERROR.
059832,000307:                                                                                                  #  Z-AXIS DIFFERENCE, STORED BY A CALC. IS
059833,000308: 20,2314           00006                           EXTEND                                         #  RECOVERED BY THE EXCHANGE.
059834,000309: 20,2315           71420                           MP       M32                                   #  (CPSI-CDUZ)*M32, SCALED AT PI RADIANS.
059835,000310: 20,2316           61763                           AD       AK         +2                         #  R ERROR COMPLETE         , AT PI RAD.
059836,000311: 20,2317           02451                           TC       OVERSUB2                              #  PIN NEEDLES IN CASE OF OVERFLOW.
059837,000312: 20,2320           55763                           TS       AK         +2                         
059838,000313: 
059839,000314:                                                                                                  #  NOW CALCULATE P ERROR.  (NOTE THAT M13 = 1, SCALED AT 1, SO THE MULTIPLICATION IS BY-PASSED.)
059840,000315: 
059841,000316: 20,2321           31761                           CA       AK                                    #  Y-AXIS DIFFERENCE STORED BY Q AXIS CALC.
059842,000317: 20,2322           00006                           EXTEND                                         
059843,000318: 20,2323           71414                           MP       M11                                   #  (CTHETA-CDUY)*M11 SCALED AT PI RADIANS.
059844,000319: 20,2324           57761                           XCH      AK                                    #  FIRST TERM OF P ERROR IN AK, AT PI RAD.
059845,000320: 20,2325           30321                           CAE      CPHI                                  #  DESIRED ATTITUDE, X-AXIS, 2'S COMP.
059846,000321: 20,2326           00006                           EXTEND                                         #  SUBTRACT CURRENT X ATTITUDE.
059847,000322: 20,2327           20032                           MSU      CDUX                                  #  X-AXIS DIFFERENCE, 1'S COMP, AT PI RAD.
059848,000323: 
059849,000324:                                                                                                  #  M13 = 1, SO BYPASS THE MULTIPLICATION.
059850,000325:                                                                                                  #           EXTEND
059851,000326:                                                                                                  #           MP     M13             (CPHI-CDUX)*M13 SCALED AT PI RADIANS.
059852,000327: 
059853,000328: 20,2330           61761                           AD       AK                                    #  P ERROR COMPLETE      , SCALED AT PI RAD
059854,000329: 20,2331           02451                           TC       OVERSUB2                              #  PIN NEEDLES IN CASE OF OVERFLOW.
059855,000330: 20,2332           55761                           TS       AK                                    
059856,000331: 
059857,000332: 20,2333           00006                           EXTEND                                         
059858,000333: 20,2334           22061                           QXCH     ITEMP1                                #  RESTORE Q FOR CHEKBITS RETURN.
059859,000334: 
059860,000335: 20,2335           12456                           TCF      RETNMORE                              #  DISPLAY THESE THE NEXT TIME THROUGH
059861,000336: 

Page 1407

059863,000338:                                                                                                  #  FDAI ATTITUDE ERROR DISPLAY SUBROUTINE
059864,000339: 
059865,000340:                                                                                                  #  PROGRAM DESCRIPTION:    D. KEENE   5/24/67
059866,000341:                                                                                                  #  MOD 1 BY CRAIG WORK, 12 DEC 67
059867,000342:                                                                                                  #  MOD 2 BY CRAIG WORK, 6 APRIL 68 CONVERTS ATTITUDE ERROR DISPLAY SCALING FROM 16 7/8 DEG. TO 42 3/16 DEGREES.
059868,000343: 
059869,000344:                                                                                                  #      THIS SUBROUTINE IS USED TO DISPLAY ATTITUDE ERRORS ON THE FDAI VIA THE DIGITAL TO ANALOG CONVERTERS (DACS)
059870,000345:                                                                                                  #  IN THE CDUS.  CARE IS TAKEN TO METER OUT THE APPROPRIATE NUMBER OF PULSES TO THE IMU ERROR COUNTERS AND PREVENT
059871,000346:                                                                                                  #  OVERFLOW, TO CONTROL THE RELAY SEQUENCING, AND TO AVOID INTERFERENCE WITH THE COARSE ALIGN LOOP WHICH ALSO USES
059872,000347:                                                                                                  #  THE DACS.
059873,000348: 
059874,000349:                                                                                                  #  CALLING SEQUENCE:
059875,000350:                                                                                                  #      DURING THE INITIALIZATION SECTION OF THE USER'S PROGRAM, BIT3 OF RCSFLAGS SHOULD BE SET TO INITIATE THE
059876,000351:                                                                                                  #  TURN-ON SEQUENCE WITHIN THE NEEDLES PROGRAM:
059877,000352:                                                                                                  #           CS     RCSFLAGS        IN EBANK6
059878,000353:                                                                                                  #           MASK   BIT3
059879,000354:                                                                                                  #           ADS    RCSFLAGS
059880,000355:                                                                                                  #  THEREAFTER, THE ATTITUDE ERRORS GENERATED BY THE USER SHOULD BE TRANSFERED TO THE FOLLOWING LOCATIONS IN EBANK6:
059881,000356:                                                                                                  #           AK     SCALED 180 DEGREES  NOTE: THESE LOCATIONS ARE SUBJECT
059882,000357:                                                                                                  #           AK1    SCALED 180 DEGREES        TO CHANGE
059883,000358:                                                                                                  #           AK2    SCALED 180 DEGREES
059884,000359:                                                                                                  #  FULL SCALED DEFLECTION OF THE NEEDLES CORRESPONDS TO 5 1/16 DEGREES, WHILE 384 BITS IN THE IMU ERROR COUNTER
059885,000360:                                                                                                  #  CORRESPONDS TO 42 3/16 DEGREES.  (DAC MAXIMUM CAPACITY IS 384 BITS.) 46 BITS EFFECTIVELY PIN THE NEEDLES.
059886,000361: 
059887,000362:                                                                                                  #  A CALL TO NEEDLER WILL THEN UPDATE THE DISPLAY:
059888,000363:                                                                                                  #           INHINT
059889,000364:                                                                                                  #           TC     IBNKCALL        NOTE: EBANK SHOULD BE SET TO E6
059890,000365:                                                                                                  #           CADR   NEEDLER
059891,000366:                                                                                                  #           RELINT
059892,000367:                                                                                                  #      THIS PROCESS SHOULD BE REPEATED EACH TIME THE ERRORS ARE UPDATED.   AT LEAST 3 PASSES THRU THE PROGRAM ARE
059893,000368:                                                                                                  #  REQUIRED BEFORE ANYTHING IS ACTUALLY DISPLAYED ON THE ERROR METERS.
059894,000369:                                                                                                  #  NOTE: EACH CALL TO NEEDLER MUST BE SEPARATED BY AT LEAST 50 MS TO ASSURE PROPER RELAY SEQUENCING.
059895,000370: 
059896,000371:                                                                                                  #  ERASABLE USED:
059897,000372:                                                                                                  #                       AK         CDUXCMD
059898,000373:                                                                                                  #                       AK1        CDUYCMD
059899,000374:                                                                                                  #                       AK2        CDUZCMD
059900,000375:                                                                                                  #                       EDRIVEX    A,L,Q
059901,000376:                                                                                                  #                       EDRIVEY    T5TEMP

Page 1408

059903,000378:                                                                                                  #                       EDRIVEZ    DINDX
059904,000379: 
059905,000380: 
059906,000381:                                                                                                  #  SWITCHES:            RCSFLAGS   BITS 3,2
059907,000382: 
059908,000383:                                                                                                  #  I/O CHANNELS:        CHAN12     BIT 4 (COARSE ALIGN - READ ONLY)
059909,000384:                                                                                                  #                       CHAN12     BIT 6 (IMU ERROR COUNTER ENABLE)
059910,000385:                                                                                                  #                       CHAN14     BIT 13,14,15 (DAC ACTIVITY)
059911,000386: 
059912,000387:                                                                                                  #  SIGN CONVENTION<   AK = THETAC - THETA
059913,000388:                                                                                                  #            WHERE    THETAC = COMMAND ANGLE
059914,000389:                                                                                                  #                     THETA = PRESENT ANGLE
059915,000390: 
059916,000391: 20,2336           31262        NEEDLER            CA       RCSFLAGS                              
059917,000392: 20,2337           76245                           MASK     SIX                                   
059918,000393: 20,2340           00006                           EXTEND                                         
059919,000394: 20,2341           12376                           BZF      NEEDLES3                              
059920,000395: 20,2342           74751                           MASK     BIT3                                  
059921,000396: 20,2343           00006                           EXTEND                                         
059922,000397: 20,2344           12367                           BZF      NEEDLER2                              #  BIT3 = 0, BIT2 = 1
059923,000398: 
059924,000399: 20,2345           44746                           CS       BIT6                                  #  FIRST PASS BIT3 = 1
059925,000400: 20,2346           00006                           EXTEND                                         #  DISABLE IMU ERROR COUNTER TO ZERO DACS
059926,000401: 20,2347           03012                           WAND     CHAN12                                #  MUST WAIT AT LEAST 60 MS BEFORE
059927,000402: 20,2350           44755        NEEDLE11           CS       ZERO                                  #  ENABLING COUNTERS.
059928,000403: 20,2351           55761                           TS       AK                                    #  ZERO THE INPUTS ON FIRST PASS
059929,000404: 20,2352           55762                           TS       AK1                                   
059930,000405: 20,2353           55763                           TS       AK2                                   
059931,000406: 20,2354           55764                           TS       EDRIVEX                               #  ZERO THE DISPLAY REGISTERS
059932,000407: 20,2355           55765                           TS       EDRIVEY                               
059933,000408: 20,2356           55766                           TS       EDRIVEZ                               
059934,000409: 20,2357           54050                           TS       CDUXCMD                               #  ZERO THE OUT COUNTERS
059935,000410: 20,2360           54051                           TS       CDUYCMD                               
059936,000411: 20,2361           54052                           TS       CDUZCMD                               
059937,000412: 20,2362           46245                           CS       SIX                                   #  RESET RCSFLAGS FOR PASS2
059938,000413: 20,2363           71262                           MASK     RCSFLAGS                              
059939,000414: 20,2364           64752                           AD       BIT2                                  
059940,000415: 20,2365           55262                           TS       RCSFLAGS                              
059941,000416: 20,2366           12456                           TCF      RETNMORE                              
059942,000417: 
059943,000418: 20,2367           34746        NEEDLER2           CAF      BIT6                                  #  ENABLE IMU ERROR COUNTERS
059944,000419: 20,2370           00006                           EXTEND                                         
059945,000420: 20,2371           05012                           WOR      CHAN12                                
059946,000421: 20,2372           46245                           CS       SIX                                   #  RESET RCSFLAGS TO DISPLAY ATTITUDE
059947,000422: 20,2373           71262                           MASK     RCSFLAGS                              #  ERRORS    WAIT AT LEAST 4 MS FOR
059948,000423: 20,2374           55262                           TS       RCSFLAGS                              #  RELAY CLOSURE
059949,000424: 20,2375           12456                           TCF      RETNMORE                              
059950,000425: 
059951,000426: 20,2376           34746        NEEDLES3           CAF      BIT6                                  #  CHECK TO SEE IF IMU ERROR COUNTER

Page 1409

059953,000428: 20,2377           00006                           EXTEND                                         #  IS ENABLED
059954,000429: 20,2400           02012                           RAND     CHAN12                                
059955,000430: 20,2401           10000                           CCS      A                                     #  IF NOT, RE-INITIALIZE NEEDLER.
059956,000431: 20,2402           12407                           TCF      NEEDLES                               
059957,000432: 
059958,000433: 20,2403           41262                           CS       RCSFLAGS                              #  SET UP INITIALIZATION FLAG IN RCSFLAGS.
059959,000434: 20,2404           74751                           MASK     BIT3                                  
059960,000435: 20,2405           27262                           ADS      RCSFLAGS                              
059961,000436: 20,2406           12456                           TCF      RETNMORE                              
059962,000437: 
059963,000438: 20,2407           34752        NEEDLES            CAF      TWO                                   
059964,000439: 20,2410           54063        DACLOOP            TS       DINDX                                 
059965,000440: 20,2411           42450                           CS       ONETENTH                              #  RESCALE INPUTS TO + OR - 1800 DEGREES.
059966,000441: 20,2412           00006                           EXTEND                                         
059967,000442: 20,2413           50063                           INDEX    DINDX                                 
059968,000443: 20,2414           71761                           MP       AK                                    
059969,000444: 20,2415           54001                           TS       L                                     
059970,000445: 20,2416           10000                           CCS      A                                     
059971,000446: 20,2417           32446                           CA       DACLIMIT                              
059972,000447: 20,2420           12422                           TCF      +2                                    
059973,000448: 20,2421           42446                           CS       DACLIMIT                              
059974,000449: 20,2422           60001                           AD       L                                     
059975,000450: 20,2423           54061                           TS       T5TEMP                                #  OVFLO CHK
059976,000451: 20,2424           12430                           TCF      +4                                    
059977,000452: 20,2425           50000                           INDEX    A                                     #  ON OVERFLOW LIMIT OUTPUT TO +-384
059978,000453: 20,2426           32446                           CAF      DACLIMIT                              
059979,000454: 20,2427           54001                           TS       L                                     
059980,000455: 20,2430           50063                           INDEX    DINDX                                 
059981,000456: 20,2431           41764                           CS       EDRIVEX                               #  CURRENT VALUE OF DAC
059982,000457: 20,2432           60001                           AD       L                                     
059983,000458: 20,2433           50063                           INDEX    DINDX                                 
059984,000459: 20,2434           26050                           ADS      CDUXCMD                               
059985,000460: 20,2435           50063                           INDEX    DINDX                                 
059986,000461: 20,2436           23764                           LXCH     EDRIVEX                               
059987,000462: 20,2437           10063                           CCS      DINDX                                 
059988,000463: 20,2440           12410                           TCF      DACLOOP                               
059989,000464: 20,2441           37743                           CAF      13,14,15                              
059990,000465: 20,2442           00006                           EXTEND                                         
059991,000466: 20,2443           05014                           WOR      CHAN14                                #  SET DAC ACTIVITY BITS
059992,000467: 20,2444           12456                           TCF      RETNMORE                              
059993,000468: 
059994,000469: 20,2445           77177                           DEC      -384       B-14                       
059995,000470: 20,2446           37200        DACLIMIT           DEC      16000      B-14                       
059996,000471: 20,2447           00600                           DEC      384        B-14                       
059997,000472: 
059998,000473: 20,2450           03146        ONETENTH           OCT      03146                                 #  DECIMAL  +0.1, SCALED AT 1.
059999,000474: 20,2451     4750               DSPLYALT           EQUALS   BIT4                                  #  100 MS ALTERNATION BIT IN RCSFLAGS
060000,000475: 
060001,000476: 20,2451           54007        OVERSUB2           TS       7                                     #  RETURNS  A  UNCHANGED OR LIMITED TO

Page 1410

060003,000478: 20,2452           00002                           TC       Q                                     #  POSMAX OR NEGMAX IF A HAS OVERFLOW
060004,000479: 20,2453           50000                           INDEX    A                                     
060005,000480: 20,2454           44734                           CS       LIMITS                                #  DUPLICATE CODING IN BANK 16
060006,000481: 20,2455           00002                           TC       Q                                     
060007,000482: 
060008,000483: 20,2456           00006        RETNMORE           EXTEND                                         #  RETURN TO CHEKMORE
060009,000484: 20,2457           32462                           DCA      MORECADR                              
060010,000485: 20,2460           52006                           DTCB                                           
060011,000486: 
060012,000487: 20,2461  E6,1537                                  EBANK=   AOSQ                                  
060013,000488: 20,2461           02016 34106  MORECADR           2CADR    CHEKMORE                              
060014,000489: 

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