Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the second release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 97. A bug (which had been around since at least Apollo 10, Luminary 69) was discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute revision into Rev 1, which is what actually flew rather than the Rev 0 presented here. A hardcopy of Rev 0 is known to exist — it belonged to AGC developer Allan Klumpp for many years — but unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus the code you see here had been reconstructed (we believe accurately) rather than transcribed. The first step of the reconstruction of the Rev 0 source code was the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection. The process of reverting the active portion of the source code (i.e., other than program comments) from Rev 1 to Rev 0 was very minor, consisting only of moving the position of the STARTSB1 label in FRESH START AND RESTART. Allan had previously given us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read, in part:

	GAP:  ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051

A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here.

064903,000002:                                                                                                  ## Copyright:   Public domain.
064904,000003:                                                                                                  ## Filename:    TRIM_GIMBAL_CONTROL_SYSTEM.agc
064905,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
064906,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the second release
064907,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
064908,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
064909,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
064910,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
064911,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
064912,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
064913,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
064914,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
064915,000014:                                                                                                  ##              the original YUL assembler.
064916,000015:                                                                                                  ##
064917,000016:                                                                                                  ## Assembler:   yaYUL
064918,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
064919,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
064920,000019:                                                                                                  ## Pages:       1472-1485
064921,000020:                                                                                                  ## Mod history: 2009-05-27 RSB  Adapted from the corresponding 
064922,000021:                                                                                                  ##                              Luminary131 file, using page 
064923,000022:                                                                                                  ##                              images from Luminary 1A.
064924,000023:                                                                                                  ##              2011-01-06 JL   Fixed pseudo-label indentation.
064925,000024:                                                                                                  ##              2016-12-18 RSB  Proofed text comments with octopus/ProoferComments
064926,000025:                                                                                                  ##                              and corrected the errors found.
064927,000026:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes noted in proofing Luminary 116.
064928,000027:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
064929,000028: 
064930,000029:                                                                                                  ## This source code has been transcribed or otherwise adapted from
064931,000030:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
064932,000031:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
064933,000032:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
064934,000033:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
064935,000034:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
064936,000035:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
064937,000036:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
064938,000037:                                                                                                  ## actually created.
064939,000038:                                                                                                  ##
064940,000039:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
064941,000040:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
064942,000041:                                                                                                  ## the listing from which it was transcribed. It has been verified to
064943,000042:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
064944,000043:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
064945,000044:                                                                                                  ##
064946,000045:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
064947,000046:                                                                                                  ##
064948,000047:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
064949,000048: 

Page 1472

064951,000050: 21,3077                                           BANK     21                                    
064952,000051: 21,3077  E6,1450                                  EBANK=   QDIFF                                 
064953,000052: 21,2000                                           SETLOC   DAPS4                                 
064954,000053: 21,2000                                           BANK                                           
064955,000054: 
064956,000055: 21,3077                                           COUNT*   $$/DAPGT                              
064957,000056: 
064958,000057:                                                                                                  #  CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
064959,000058:                                                                                                  #  AUTOPILOT ARE BOTH ON:
064960,000059:                                                                                                  #        A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
064961,000060:                                                                                                  #           INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
064962,000061:                                                                                                  #        B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
064963,000062:                                                                                                  #           ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
064964,000063:                                                                                                  #  GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
064965,000064: 
064966,000065: 21,3077           37747        GTS                CAF      NEGONE                                #  MAKE THE NEXT PASS THROUGH THE DAP BE
064967,000066: 21,3100           55631                           TS       COTROLER                              #        THROUGH RCS CONTROL,
064968,000067: 21,3101           34751                           CAF      FOUR                                  #        AND ENSURE THAT IT IS NOT A SKIP.
064969,000068: 21,3102           55535                           TS       SKIPU                                 
064970,000069: 21,3103           55536                           TS       SKIPV                                 
064971,000070: 
064972,000071: 21,3104           34752                           CAF      TWO                                   
064973,000072: 21,3105           55633                           TS       INGTS                                 #  SET INDICATOR OF GTS CONTROL POSITIVE.
064974,000073: 21,3106           55632                           TS       QGIMTIMR                              #  SET TIMERS TO 200 MSEC TO AVOID BOTH
064975,000074: 21,3107           55634                           TS       RGIMTIMR                              #  RUNAWAY AND INTERFERENCE BY NULLING.
064976,000075: 
064977,000076:                                                                                                  #  THE DRIVE SETTING ALGORITHM
064978,000077: 
064979,000078:                                                                                                  #        DEL = SGN(OMEGA + ALPHA*ABS(ALPHA)/(2*K))
064980,000079:                                                                                                  #                                                    2               1/2                  2       3/2
064981,000080:                                                                                                  #        NEGUSUM = ERROR*K + ALPHA*(DEL*OMEGA + ALPHA /(3*K)) + DEL*K   (DEL*OMEGA + ALPHA /(2*K))
064982,000081: 
064983,000082:                                                                                                  #        DRIVE = -SGN(NEGUSUM)
064984,000083: 
064985,000084: 21,3110           30021                           CA       SR                                    #  SAVE THE SR.  SHIFT IT LEFT TO CORRECT
064986,000085: 21,3111           60000                           AD       A                                     #  FOR THE RIGHT SHIFT DUE TO EDITING.
064987,000086: 21,3112           55505                           TS       SAVESR                                
064988,000087: 
064989,000088: 21,3113           34752        GTSGO+DN           CAF      TWO                                   #  SET INDEXER FOR R-AXIS CALCULATIONS.
064990,000089: 21,3114           13116                           TCF      GOQTRIMG   +1                         
064991,000090: 
064992,000091: 21,3115           34755        GOQTRIMG           CAF      ZERO                                  #  SET INDEXER FOR Q-AXIS CALCULATIONS
064993,000092: 21,3116           55750                           TS       QRCNTR                                
064994,000093: 

RSB 2016 — Everything between this line and the corresponding line below was missing in the Luminary 099 print-out from the MIT Museum (from which the remainder of the source-code was transcribed), presumably due to some problem with the printer. It has been filled in from snapshots of page 1472 and 1473 of a different Luminary 99 print-out, thoughtfully made for us by Don Eyles.

065001,000100: 21,3117           51750                           INDEX    QRCNTR                                #  AOS SCALED AT PI/2
065002,000101: 21,3120           31537                           CA       AOSQ                                  
065003,000102: 21,3121           00006                           EXTEND                                         
065004,000103: 21,3122           74752                           MP       BIT2                                  #  RESCALE AOS TO PI/4

Page 1473

065006,000105: 21,3123           00006                           EXTEND                                         
065007,000106: 21,3124           13130                           BZF      GTSQAXIS   -3                         #  USE FULL SCALE FOR LARGER AOS ESTIMATES.
065008,000107: 
065009,000108: 21,3125           50000                           INDEX    A                                     
065010,000109: 21,3126           44734                           CS       LIMITS                                #  LIMITS +1 CONTAINS NEGMAX.
065011,000110: 21,3127           56001                           XCH      L                                     #  LIMITS -1 CONTAINS POSMAX.
065012,000111: 
065013,000112: 21,3130           11750                           CCS      QRCNTR                                #  PICK UP RATE FOR THIS AXIS.  RATE CELLS
065014,000113: 21,3131           50000                           INDEX    A                                     #  ARE ADJACENT, NOT SEPARATED.  AT PI/4
065015,000114: 21,3132           31436                           CA       EDOTQ                                 
065016,000115: 21,3133           53744        GTSQAXIS           DXCH     WCENTRAL                              
065017,000116: 
065018,000117: 21,3134           51750                           INDEX    QRCNTR                                #  COLLECT K FOR THIS AXIS
065019,000118: 21,3135           31504                           CA       KQ                                    
065020,000119: 21,3136           55741                           TS       KCENTRAL                              
065021,000120: 
065022,000121: 21,3137           00006                           EXTEND                                         #  CONTROL AUTHORITY ZERO.  AVOID DRIVING
065023,000122: 21,3140           13576                           BZF      POSDRIVE   +1                         #  ENGINE BELL TO THE STOPS.
065024,000123: 
065025,000124: 21,3141           51750                           INDEX    QRCNTR                                #  QDIFF, RDIFF ARE STORED IN D.P.
065026,000125: 21,3142           31450                           CAE      QDIFF                                 
065027,000126: 
065028,000127: 21,3143           00006        ALGORTHM           EXTEND                                         #  Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
065029,000128: 21,3144           71741                           MP       KCENTRAL                              #  FORM K*ERROR AT PI(2)/2(8), IN D.P.
065030,000129: 21,3145           23737                           LXCH     K2THETA                               
065031,000130: 21,3146           00006                           EXTEND                                         
065032,000131: 21,3147           74747                           MP       BIT5                                  #  RESCALE TO 4*PI(2)
065033,000132: 21,3150           53740                           DXCH     K2THETA                               
065034,000133: 21,3151           00006                           EXTEND                                         
065035,000134: 21,3152           74747                           MP       BIT5                                  #  FIRST TERM OF NEGUSUM IN K2THETA.
065036,000135: 21,3153           27740                           ADS      K2THETA    +1                         #  NO CARRY NEEDED       D.P. AT 4*PI(2)
065037,000136: 
065038,000137: 21,3154           41744                           CS       ACENTRAL                              #  FORM ALPHA(2)/(2*K) AT 16*PI, IN D.P.,
065039,000138: 21,3155           00006                           EXTEND                                         #  LIMITING QUOTIENT TO AVOID OVERFLOW.
065040,000139: 21,3156           74736                           MP       BIT14                                 #  -ALPHA/2 IN A, SCALED AT PI/4
065041,000140: 21,3157           00006                           EXTEND                                         
065042,000141: 21,3160           71744                           MP       ACENTRAL                              #  -ALPHA(2)/2 IN A,L, SCALED AT PI(2)/16
065043,000142: 21,3161           61741                           AD       KCENTRAL                              
065044,000143: 21,3162           00006                           EXTEND                                         
065045,000144: 21,3163           63200                           BZMF     HUGEQUOT                              #  K-ALPHA(2)/2 SHOULD BE PNZ FO DIVISION
065046,000145: 
065047,000146: 21,3164           00006                           EXTEND                                         
065048,000147: 21,3165           40001                           DCS      A                                     #  ALPHA(2)/2 - K
065049,000148: 21,3166           61741                           AD       KCENTRAL                              

RSB 2016 — End of material from Don Eyles's printout. The non-blank portion of page 1473 continues below:

065052,000151: 21,3167           00006                           EXTEND                                         
065053,000152: 21,3170           11741                           DV       KCENTRAL                              #  HIGH ORDER OF QUOTIENT.
065054,000153: 21,3171           57746                           XCH      A2CNTRAL                              
065055,000154: 21,3172           30001                           CA       L                                     #  SHIFT UP THE REMAINDER.
065056,000155: 21,3173           22007                           LXCH     7                                     #  ZERO LOW-ORDER DIVIDEND.
065057,000156: 21,3174           00006                           EXTEND                                         

Page 1474

065059,000158: 21,3175           11741                           DV       KCENTRAL                              
065060,000159: 21,3176           57747                           XCH      A2CNTRAL   +1                         #  QUOTIENT STORED AT 16*PI, D.P.
065061,000160: 21,3177           13203                           TCF      HAVEQUOT                              
065062,000161: 
065063,000162: 21,3200           34733        HUGEQUOT           CA       POSMAX                                
065064,000163: 21,3201           54001                           TS       L                                     
065065,000164: 21,3202           53747                           DXCH     A2CNTRAL                              #  LIMITED QUOTIENT STORED AT 16*PI, D.P.
065066,000165: 
065067,000166: 21,3203           31743        HAVEQUOT           CA       WCENTRAL                              
065068,000167: 21,3204           00006                           EXTEND                                         
065069,000168: 21,3205           74743                           MP       BIT9                                  #  RESCALE OMEGA AT 16*PI IN D.P.
065070,000169: 21,3206           53743                           DXCH     K2CNTRAL                              #  LOWER WORD OVERLAYS OMEGA IN WCENTRAL
065071,000170: 
065072,000171: 21,3207           00006                           EXTEND                                         
065073,000172: 21,3210           31743                           DCA      K2CNTRAL                              
065074,000173: 21,3211           53752                           DXCH     FUNCTION                              
065075,000174: 
065076,000175: 21,3212           31744                           CA       ACENTRAL                              #  GET ALPHA*ABS(ALPHA)/(2*K)
065077,000176: 21,3213           00006                           EXTEND                                         
065078,000177: 21,3214           63220                           BZMF     +4                                    
065079,000178: 
065080,000179: 21,3215           00006                           EXTEND                                         
065081,000180: 21,3216           31747                           DCA      A2CNTRAL                              
065082,000181: 21,3217           13222                           TCF      +3                                    
065083,000182: 
065084,000183: 21,3220           00006                           EXTEND                                         
065085,000184: 21,3221           41747                           DCS      A2CNTRAL                              
065086,000185: 
065087,000186: 21,3222           21752                           DAS      FUNCTION                              #  OMEGA + ALPHA*ABS(ALPHA)/2*K) AT 16*PI
065088,000187: 
065089,000188: 21,3223           11751                           CCS      FUNCTION                              #  DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
065090,000189: 21,3224           13230                           TCF      POSFNCT1                              #  OTHERWISE DEL = -1
065091,000190: 21,3225           13227                           TCF      +2                                    
065092,000191: 21,3226           13232                           TCF      NEGFNCT1                              
065093,000192: 
065094,000193: 21,3227           11752                           CCS      FUNCTION   +1                         #  USE LOW ORDER WORD SINCE HIGH IS ZERO
065095,000194: 21,3230           34753        POSFNCT1           CAF      BIT1                                  
065096,000195: 21,3231           13233                           TCF      +2                                    
065097,000196: 21,3232           44753        NEGFNCT1           CS       BIT1                                  
065098,000197: 21,3233           55745                           TS       DEL                                   
065099,000198: 
065100,000199: 21,3234           11745                           CCS      DEL                                   #  REPLACE OMEGA BY DEL*OMEGA
065101,000200: 21,3235           13247                           TCF      FUNCT2                                #  POSITIVE DEL VALUE.  PROCEED.
065102,000201: 21,3236           13240                           TCF      DEFUNCT                               
065103,000202: 21,3237           13244                           TCF      NEGFNCT2                              
065104,000203: 
065105,000204: 21,3240           55742        DEFUNCT            TS       K2CNTRAL                              
065106,000205: 21,3241           55743                           TS       K2CNTRAL   +1                         
065107,000206: 21,3242           13247                           TCF      FUNCT2                                
065108,000207: 

Page 1475

065110,000209: 21,3243           65252        NEG1/3             DEC      -.33333                               
065111,000210: 
065112,000211: 21,3244           00006        NEGFNCT2           EXTEND                                         
065113,000212: 21,3245           41743                           DCS      K2CNTRAL                              
065114,000213: 21,3246           53743                           DXCH     K2CNTRAL                              
065115,000214: 
065116,000215: 21,3247           00006        FUNCT2             EXTEND                                         
065117,000216: 21,3250           31747                           DCA      A2CNTRAL                              
065118,000217: 21,3251           21743                           DAS      K2CNTRAL                              #  DEL*OMEGA + ALPHA(2)/(2*K) AT 16*PI, D.P.
065119,000218: 
065120,000219: 21,3252           31746        FUNCT3             CA       A2CNTRAL                              
065121,000220: 21,3253           00006                           EXTEND                                         
065122,000221: 21,3254           73243                           MP       NEG1/3                                
065123,000222: 21,3255           53747                           DXCH     A2CNTRAL                              
065124,000223: 21,3256           30001                           CA       L                                     
065125,000224: 21,3257           00006                           EXTEND                                         
065126,000225: 21,3260           73243                           MP       NEG1/3                                
065127,000226: 21,3261           27747                           ADS      A2CNTRAL   +1                         
065128,000227: 21,3262           54001                           TS       L                                     
065129,000228: 21,3263           13265                           TCF      +2                                    #  A2CNTRAL NOW CONTAINS -ALPHA(2)/(6*K),
065130,000229: 21,3264           27746                           ADS      A2CNTRAL                              #  SCALED AT 16*PI, IN D.P.
065131,000230: 
065132,000231: 21,3265           00006                           EXTEND                                         
065133,000232: 21,3266           31743                           DCA      K2CNTRAL                              #  DEL*OMEGA + ALPHA(2)/(3*K) IN A2CNTRAL,
065134,000233: 21,3267           21747                           DAS      A2CNTRAL                              #  SCALED AT 16*PI, D.P.
065135,000234: 
065136,000235: 21,3270           31746                           CA       A2CNTRAL                              
065137,000236: 21,3271           00006                           EXTEND                                         
065138,000237: 21,3272           71744                           MP       ACENTRAL                              
065139,000238: 21,3273           21740                           DAS      K2THETA                               
065140,000239: 21,3274           31747                           CA       A2CNTRAL   +1                         
065141,000240: 21,3275           00006                           EXTEND                                         
065142,000241: 21,3276           71744                           MP       ACENTRAL                              #  ACENTRAL MAY NOW BE OVERLAID.
065143,000242: 21,3277           27740                           ADS      K2THETA    +1                         
065144,000243: 21,3300           54001                           TS       L                                     
065145,000244: 21,3301           13303                           TCF      +2                                    #  TWO TERMS OF NEGUSUM ACCUMULATED, SO FAR
065146,000245: 21,3302           27737                           ADS      K2THETA                               #  SCALED AT 4*PI(2), IN D.P.
065147,000246: 
065148,000247: 21,3303           31742        GETROOT            CA       K2CNTRAL                              #  K*(DEL*OMEGA + ALPHA(2)/(2*K)) IS THE
065149,000248: 21,3304           00006                           EXTEND                                         #  TERM FOR WHICH A SQUARE ROOT IS NEEDED.
065150,000249: 21,3305           71741                           MP       KCENTRAL                              #  K AT PI/2(8)
065151,000250: 21,3306           53752                           DXCH     FUNCTION                              
065152,000251: 21,3307           31743                           CA       K2CNTRAL   +1                         
065153,000252: 21,3310           00006                           EXTEND                                         
065154,000253: 21,3311           71741                           MP       KCENTRAL                              
065155,000254: 21,3312           27752                           ADS      FUNCTION   +1                         
065156,000255: 21,3313           54001                           TS       L                                     
065157,000256: 21,3314           13316                           TCF      +2                                    
065158,000257: 21,3315           27751                           ADS      FUNCTION                              #  DESIRED TERM IN FUNCTION, AT PI(2)/16

Page 1476

065160,000259: 21,3316           11745                           CCS      DEL                                   
065161,000260: 21,3317           13524                           TCF      RSTOFGTS                              
065162,000261: 21,3320           13566                           TCF      NEGUSUM                               
065163,000262: 21,3321           13323                           TCF      NEGATE                                
065164,000263: 21,3322           13566                           TCF      NEGUSUM                               
065165,000264: 
065166,000265: 21,3323           00006        NEGATE             EXTEND                                         
065167,000266: 21,3324           41743                           DCS      K2CNTRAL                              
065168,000267: 21,3325           53743                           DXCH     K2CNTRAL                              
065169,000268: 21,3326           13524                           TCF      RSTOFGTS                              
065170,000269: 
065171,000270: 16,3735                                           BANK     16                                    
065172,000271: 16,3735  E6,1501                                  EBANK=   NEGUQ                                 
065173,000272: 16,2000                                           SETLOC   DAPS1                                 
065174,000273: 16,2000                                           BANK                                           
065175,000274: 
065176,000275:                                                                                                  #  THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
065177,000276:                                                                                                  #  THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES.  ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
065178,000277: 
065179,000278:                                                                                                  #  WARNING:  ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
065180,000279: 
065181,000280: 16,3735           07400        BGIM               OCTAL    07400                                 
065182,000281: 16,3736     0066               CHNL12             EQUALS   ITEMP6                                
065183,000282: 16,3736           41501        ACDT+C12           CS       NEGUQ                                 
065184,000283: 16,3737           00006                           EXTEND                                         #  GIMBAL DRIVE REQUESTS.
065185,000284: 16,3740           71507                           MP       ACCDOTQ                               
065186,000285: 16,3741           23510                           LXCH     QACCDOT                               
065187,000286: 16,3742           41503                           CS       NEGUR                                 
065188,000287: 16,3743           00006                           EXTEND                                         
065189,000288: 16,3744           71511                           MP       ACCDOTR                               
065190,000289: 16,3745           23512                           LXCH     RACCDOT                               
065191,000290: 
065192,000291: 16,3746           11501                           CCS      NEGUQ                                 
065193,000292: 16,3747           34742                           CAF      BIT10                                 
065194,000293: 16,3750           13752                           TCF      +2                                    
065195,000294: 16,3751           34743                           CAF      BIT9                                  
065196,000295: 16,3752           54066                           TS       CHNL12                                
065197,000296: 
065198,000297: 16,3753           11503                           CCS      NEGUR                                 
065199,000298: 16,3754           34740                           CAF      BIT12                                 
065200,000299: 16,3755           13757                           TCF      +2                                    
065201,000300: 16,3756           34741                           CAF      BIT11                                 
065202,000301: 16,3757           26066                           ADS      CHNL12                                #  (STORED RESULT NOT USED AT PRESENT)
065203,000302: 
065204,000303: 16,3760           43735                           CS       BGIM                                  
065205,000304: 16,3761           00006                           EXTEND                                         
065206,000305: 16,3762           02012                           RAND     CHAN12                                
065207,000306: 16,3763           60066                           AD       CHNL12                                
065208,000307: 16,3764           00006                           EXTEND                                         
065209,000308: 16,3765           01012                           WRITE    CHAN12                                

Page 1477

065211,000310: 16,3766           44747                           CS       CALLGMBL                              #  TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
065212,000311: 16,3767           71273                           MASK     RCSFLAGS                              
065213,000312: 16,3770           55273                           TS       RCSFLAGS                              
065214,000313: 
065215,000314: 16,3771           00002                           TC       Q                                     #  RETURN TO CALLER.
065216,000315: 
065217,000316: 21,3327                                           BANK     21                                    
065218,000317: 21,3327  E6,1450                                  EBANK=   QDIFF                                 
065219,000318: 21,2000                                           SETLOC   DAPS4                                 
065220,000319: 21,2000                                           BANK                                           
065221,000320: 

Page 1478

065223,000322:                                                                                                  #  SUBROUTINE TIMEGMBL:  MOD 0, OCTOBER 1967, CRAIG WORK
065224,000323: 
065225,000324:                                                                                                  #  TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
065226,000325:                                                                                                  #  THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS.  INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
065227,000326:                                                                                                  #  SCALED AT PI/8.  FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT).  A ZERO
065228,000327:                                                                                                  #  ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY.  OTHERWISE, THE GIMBAL IS TURNED ON
065229,000328:                                                                                                  #  DRIVING IN THE CORRECT DIRECTION.  THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
065230,000329:                                                                                                  #  IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE.  NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
065231,000330:                                                                                                  #  WHICH IS NEGATIVE, ZERO, OR POSITIVE.
065232,000331: 
065233,000332:                                                                                                  #  INPUTS:       AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7).     PI/2(7).
065234,000333: 
065235,000334:                                                                                                  #  OUTPUTS:      NEW GIMBAL DRIVE BITS IN CHANNEL 12, NEGUQ, NEGUR, QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
065236,000335:                                                                                                  #                Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
065237,000336: 
065238,000337:                                                                                                  #  DEBRIS:       A, L, Q, ITEMPS 2, 3, 6, RUPTREG2 AND ACDT+C12 DEBRIS.
065239,000338: 
065240,000339:                                                                                                  #  EXITS:        VIA TC Q.
065241,000340: 
065242,000341:                                                                                                  #  ALARMS, ABORTS, :  NONE
065243,000342: 
065244,000343:                                                                                                  #  SUBROUTINES:  ACDT+C12, IBNKCALL
065245,000344: 
065246,000345:                                                                                                  #  WARNING:      THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS.  THEREFORE IT MAY ONLY BE CALLED WITH
065247,000346:                                                                                                  #                INTERRUPT INHIBITED.
065248,000347: 
065249,000348:                                                                                                  #  ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
065250,000349:                                                                                                  #        NEGUQ           ERASE   +2              NEGATIVE OF Q-AXIS GIMBAL DRIVE
065251,000350:                                                                                                  #        (SPWORD)        EQUALS  NEGUQ +1        ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
065252,000351:                                                                                                  #        NEGUR           EQUALS  NEGUQ +2        NEGATIVE OF R-AXIS GIMBAL DRIVE
065253,000352:                                                                                                  #        ACCDOTQ         ERASE   +2              Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
065254,000353:                                                                                                  #        (SPWORD)        EQUALS  ACCDOTQ +1      ANY S.P. ERASABLE NUMBER NOW QACCDOT
065255,000354:                                                                                                  #        ACCDOTR         EQUALS  ACCDOTQ +2      R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
065256,000355:                                                                                                  #                                                ACCDOTQ, ACCDOTR ARE MAGNITUDES.
065257,000356:                                                                                                  #        AOSQ            ERASE   +4              Q-AXIS ACC., D.P. AT PI/2 R/SEC(2)
065258,000357:                                                                                                  #        AOSR            EQUALS  AOSQ +2         R-AXIS ACCELERATION SCALED AT PI/2 R/S2
065259,000358: 
065260,000359: 21,3327     0066               QRNDXER            EQUALS   ITEMP6                                
065261,000360: 21,3327           23146        OCT23146           OCTAL    23146                                 #  DECIMAL .6
065262,000361: 21,3330     0063               NZACCDOT           EQUALS   ITEMP3                                
065263,000362: 
065264,000363: 21,3330           34753        TIMEGMBL           CAF      ONE                                   #  INITIALIZE ALLOWGTS.
065265,000364: 21,3331           55502                           TS       ALLOWGTS                              
065266,000365: 
065267,000366: 21,3332           34752                           CAF      TWO                                   #  SET UP LOOP FOR R AXIS.
065268,000367: 21,3333           22002                           LXCH     Q                                     #  SAVE RETURN ADDRESS.
065269,000368: 21,3334           22071                           LXCH     RUPTREG2                              

Page 1479

065271,000370: 21,3335           13337                           TCF      +2                                    
065272,000371: 21,3336           34755        TIMQGMBL           CAF      ZERO                                  #  NOW DO THE Q-AXIS
065273,000372: 21,3337           54066                           TS       QRNDXER                               
065274,000373: 21,3340           50066                           INDEX    QRNDXER                               
065275,000374: 21,3341           31507                           CA       ACCDOTQ                               #  ACCDOT IS PRESUMED TO BE AT PI/2(7).
065276,000375: 21,3342           00006                           EXTEND                                         
065277,000376: 21,3343           63413                           BZMF     TGOFFNOW                              #  IS ACCDOT LESS THAN OR EQUAL TO 0?
065278,000377: 21,3344           54063                           TS       NZACCDOT                              #  NO.  STORE NON-ZERO, POSITIVE ACCDOT.
065279,000378: 
065280,000379: 21,3345           50066        ALPHATRY           INDEX    QRNDXER                               
065281,000380: 21,3346           41537                           CS       AOSQ                                  
065282,000381: 21,3347           00006                           EXTEND                                         
065283,000382: 21,3350           13413                           BZF      TGOFFNOW                              #  IS ALPHA ZERO?
065284,000383: 
065285,000384: 21,3351           54002                           TS       Q                                     #  SAVE A COPY OF -AOS.
065286,000385: 21,3352           00006                           EXTEND                                         #  NO.  RESCALE FOR TIMEGMBL USE.
065287,000386: 21,3353           73327                           MP       OCT23146                              #  OCTAL 23146 IS DECIMAL .6
065288,000387: 21,3354           60002                           AD       Q                                     #  -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
065289,000388: 21,3355           54001                           TS       L                                     #  WAS THERE OVERFLOW?
065290,000389: 21,3356           13363                           TCF      SETNEGU                               #  NO.  COMPUTE DRIVE TIME.
065291,000390: 
065292,000391: 21,3357           40000                           CS       A                                     #  RECOVER -SGN(AOS) IN THE A REGISTER.
065293,000392: 21,3360           50066                           INDEX    QRNDXER                               #  YES.  START DRIVE WITHOUT WAITLIST.
065294,000393: 21,3361           57501                           XCH      NEGUQ                                 
065295,000394: 21,3362           13417                           TCF      NOTALLOW                              #  KNOCK DOWN THE ALLOWGTS FLAG.
065296,000395: 
065297,000396: 21,3363           00006        SETNEGU            EXTEND                                         
065298,000397: 21,3364           63371                           BZMF     POSALPH                               
065299,000398: 
065300,000399: 21,3365           40000                           COM                                            
065301,000400: 21,3366           54062                           TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
065302,000401: 21,3367           44753                           CS       BIT1                                  
065303,000402: 21,3370           13373                           TCF      POSALPH    +2                         
065304,000403: 21,3371           54062        POSALPH            TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
065305,000404: 21,3372           34753                           CA       BIT1                                  
065306,000405: 21,3373           50066                 +2        INDEX    QRNDXER                               #  SGN(AOS) INTO NEGU
065307,000406: 21,3374           55501                           TS       NEGUQ                                 #  STORE SGN(APLHA) AS NEGU
065308,000407: 
065309,000408: 21,3375           30063                           CA       NZACCDOT                              
065310,000409: 21,3376           00006                           EXTEND                                         
065311,000410: 21,3377           74740                           MP       BIT12                                 #  2*ACCDOT, SCALED AT PI/8.
065312,000411: 21,3400           60062                           AD       ITEMP2                                #  -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
065313,000412: 21,3401           00006                           EXTEND                                         
065314,000413: 21,3402           63417                           BZMF     NOTALLOW                              #  IS DRIVE TIME MORE THAN TWO SECONDS?
065315,000414: 21,3403           40062                           CS       ITEMP2                                #  NO.  COMPUTE DRIVE TIME.
065316,000415: 21,3404           00006                           EXTEND                                         #  ABS(ALPHA) AT PI/8.
065317,000416: 21,3405           73440                           MP       OCT00240                              #  DECIMAL 10/1024
065318,000417: 21,3406           00006                           EXTEND                                         #  QUOTIENT IS DRIVE TIME AT WAITLIST.
065319,000418: 21,3407           10063                           DV       NZACCDOT                              #  ABS(ALPHA)/ACCDOT AT 2(14)/100

Page 1480

065321,000420: 21,3410           00006                           EXTEND                                         
065322,000421: 21,3411           13413                           BZF      TGOFFNOW                              #  DRIVE TIME MUST BE GREATER THAN ZERO.
065323,000422: 
065324,000423: 21,3412           13425                           TCF      DRIVEON                               
065325,000424: 
065326,000425: 21,3413           34755        TGOFFNOW           CAF      ZERO                                  #  TURN OFF GIMBAL NOW.
065327,000426: 21,3414           50066                           INDEX    QRNDXER                               
065328,000427: 21,3415           55501                           TS       NEGUQ                                 
065329,000428: 
065330,000429: 21,3416           13427                           TCF      DONEYET                               
065331,000430: 
065332,000431: 21,3417           36010        NOTALLOW           CAF      OCT31                                 
065333,000432: 21,3420           50066                           INDEX    QRNDXER                               
065334,000433: 21,3421           55632                           TS       QGIMTIMR                              
065335,000434: 21,3422           34755                           CAF      ZERO                                  #  DRIVE TIME IS MORE THAN 2 SECONDS, SO
065336,000435: 21,3423           55502                           TS       ALLOWGTS                              #  DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
065337,000436:                                                                                                  #  CONTROL UNTIL AOSTASK APPROVES.
065338,000437: 21,3424           13427                           TCF      DONEYET                               #  NO WAITLIST CALL IS MADE.
065339,000438: 
065340,000439: 21,3425           50066        DRIVEON            INDEX    QRNDXER                               
065341,000440: 21,3426           55632                           TS       QGIMTIMR                              #  CHOOSE Q OR R AXIS.
065342,000441: 
065343,000442: 21,3427           10066        DONEYET            CCS      QRNDXER                               
065344,000443: 21,3430           13336                           TCF      TIMQGMBL                              
065345,000444: 
065346,000445: 21,3431           52073                           DXCH     RUPTREG3                              #  PROTECT IBNKCALL ERASABLES.  ACDT+C12
065347,000446: 21,3432           52063                           DXCH     ITEMP2                                #  LEAVES ITEMPS2,3 ALONE.
065348,000447: 
065349,000448: 21,3433           04674                           TC       IBNKCALL                              #  TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
065350,000449: 21,3434           35736                           CADR     ACDT+C12                              
065351,000450: 
065352,000451: 21,3435           52063                           DXCH     ITEMP2                                #  RESTORE ERASABLES FOR IBNKCALL.
065353,000452: 21,3436           52073                           DXCH     RUPTREG3                              
065354,000453: 
065355,000454: 21,3437           00071                           TC       RUPTREG2                              #  RETURN TO CALLER.
065356,000455: 
065357,000456: 21,3440           00240        OCT00240           OCTAL    00240                                 #  DECIMAL 10/1024
065358,000457: 

Page 1481

065360,000459:                                                                                                  #  THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY.  THE QUANTITY NEGUSUM
065361,000460:                                                                                                  #  IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM.  NEW DRIVES ARE ENTERED TO CH 12.
065362,000461: 
065363,000462:                                                                                                  #  THE SUBROUTINE GTSQRT ACCEPTS A DOUBLE PRECISION VALUE IN FUNCTION, FUNCTION +1 AND RETURNS A SINGLE-PRECISION
065364,000463:                                                                                                  #  SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF THE ARGUMENT.  ALSO, THE CELL SHFTFLAG CONTAINS A BINARY
065365,000464:                                                                                                  #  EXPONENT S, SUCH THAT THE SQUARE ROOT (RETURNED IN THE A REGISTER) MUST BE SHIFTED RIGHT (MULTIPLIED BY 2 TO THE
065366,000465:                                                                                                  #  POWER (-S)) IN ORDER TO BE THE TRUE SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF FUNCTION, FUNCTION +1.
065367,000466:                                                                                                  #  SQUARE ROOT ERROR IS NOT MORE THAN 2 IN THE 14TH SIGNIFICANT BIT.  CELLS CLOBBERED ARE A, L, SHFTFLAG, ININDEX,
065368,000467:                                                                                                  #  HALFARG, SCRATCH, SR, FUNCTION, FUNCTION +1.  GTSQRT IS CALLED BY TC GTSQRT AND RETURNS VIA TC Q OR TC FUNCTION +1.
065369,000468:                                                                                                  #  ZERO OR NEGATIVE ARGUMENTS YIELD ZERO FOR SQUARE ROOTS.
065370,000469: 
065371,000470: 21,3441           11751        GTSQRT             CCS      FUNCTION                              
065372,000471: 21,3442           13460                           TCF      GOODARG                               #  FUNCTION IS POSITIVE.  TAKE SQUARE ROOT.
065373,000472: 21,3443           13445                           TCF      +2                                    #  HIGH ORDER WORD IS ZERO.  TRY THE LOWER.
065374,000473: 21,3444           13451                           TCF      ZEROOT                                #  NEGATIVE.  USE ZERO FOR 1/2 POWER.
065375,000474: 
065376,000475: 21,3445           31752                           CA       FUNCTION   +1                         
065377,000476: 21,3446           00006                           EXTEND                                         
065378,000477: 21,3447           63451                           BZMF     ZEROOT                                
065379,000478: 
065380,000479: 21,3450           13454                           TCF      ZEROHIGH                              #  PROCEED.
065381,000480: 21,3451           34755        ZEROOT             CA       ZERO                                  
065382,000481: 21,3452           55741                           TS       SHFTFLAG                              
065383,000482: 21,3453           00002                           TC       Q                                     
065384,000483: 
065385,000484: 21,3454           57751        ZEROHIGH           XCH      FUNCTION                              #  14 MOST SIGNIFICANT BITS ARE IN THE
065386,000485: 21,3455           57752                           XCH      FUNCTION   +1                         #  LOWER WORD.  EXCHANGE THEM.
065387,000486: 21,3456           34757                           CA       SEVEN                                 
065388,000487: 21,3457           13461                           TCF      GOODARG    +1                         
065389,000488: 
065390,000489: 21,3460           34755        GOODARG            CA       ZERO                                  
065391,000490: 21,3461           55741                           TS       SHFTFLAG                              
065392,000491: 21,3462           35751                           CA       TWELVE                                #  INITIALIZE THE SCALING LOOP.
065393,000492: 21,3463           55744                           TS       ININDEX                               
065394,000493: 21,3464           13473                           TCF      SCALLOOP                              
065395,000494: 
065396,000495: 21,3465           31751        SCALSTRT           CA       FUNCTION                              
065397,000496: 21,3466           13507                           TCF      SCALDONE                              
065398,000497: 
065399,000498: 21,3467           37746        MULBUSH            CA       NEG2                                  #  IF ARG IS NOT LESS THAN 1/4, INDEX IS
065400,000499: 21,3470           27744                           ADS      ININDEX                               #  ZERO, INDICATING NO SHIFT NEEDED.
065401,000500: 21,3471           00006                           EXTEND                                         #  BRANCH IF ARG IS NOT LESS THAN 1/4.
065402,000501: 21,3472           63465                           BZMF     SCALSTRT                              #  OTHERWISE COMPARE ARG WITH A REFERENCE
065403,000502:                                                                                                  #  WHICH IS 4 TIMES LARGER THAN THE LAST.
065404,000503: 21,3473           41751        SCALLOOP           CS       FUNCTION                              
065405,000504: 21,3474           51744                           INDEX    ININDEX                               
065406,000505: 21,3475           64735                           AD       BIT15                                 #  REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
065407,000506: 21,3476           00006                           EXTEND                                         
065408,000507: 21,3477           63467                           BZMF     MULBUSH                               #  IF ARG IS NOT LESS THAN REFERENCE, GO
065409,000508:                                                                                                  #  AROUND THE MULBERRY BUSH ONCE MORE.

Page 1482

065411,000510: 21,3500           51744                           INDEX    ININDEX                               
065412,000511: 21,3501           34735                           CA       BIT15                                 #  THIS IS THE SCALE MAGNITUDE
065413,000512: 21,3502           57747                           XCH      HALFARG                               #  2**(-ININDEX) IS THE SHIFT DIVISOR.
065414,000513: 21,3503           00006                           EXTEND                                         #  RESCALE ARGUMENT.
065415,000514: 21,3504           31752                           DCA      FUNCTION                              
065416,000515: 21,3505           00006                           EXTEND                                         
065417,000516: 21,3506           11747                           DV       HALFARG                               
065418,000517:                                                                                                  #  ININDEX AND SHFTFLAG PRESERVE INFO FOR
065419,000518:                                                                                                  #  RESCALING AFTER ROOT PROCESS.
065420,000519: 21,3507           00006        SCALDONE           EXTEND                                         
065421,000520: 21,3510           23752                           QXCH     FUNCTION   +1                         #  SAVE Q FOR RETURN
065422,000521: 21,3511           00006                           EXTEND                                         
065423,000522: 21,3512           74736                           MP       BIT14                                 
065424,000523: 21,3513           55747                           TS       HALFARG                               
065425,000524: 21,3514           74737                           MASK     BIT13                                 
065426,000525: 21,3515           10000                           CCS      A                                     
065427,000526: 21,3516           33634                           CA       OCT11276                              
065428,000527: 21,3517           63632                           AD       ROOTHALF                              #  INITIAL GUESS IS ROOT 1/2 OR POSMAX
065429,000528: 21,3520           03636                           TC       ROOTCYCL                              
065430,000529: 21,3521           03636                           TC       ROOTCYCL                              
065431,000530: 21,3522           03636                           TC       ROOTCYCL                              
065432,000531: 21,3523           01752                           TC       FUNCTION   +1                         
065433,000532: 
065434,000533:                                                                                                  #  ****************************************************************************************************************
065435,000534: 
065436,000535: 21,3524           03441        RSTOFGTS           TC       GTSQRT                                
065437,000536: 21,3525           57742        PRODUCT            XCH      K2CNTRAL                              
065438,000537: 21,3526           00006                           EXTEND                                         
065439,000538: 21,3527           71742                           MP       K2CNTRAL                              
065440,000539: 21,3530           53743                           DXCH     K2CNTRAL                              
065441,000540: 21,3531           00006                           EXTEND                                         #                THE PRODUCT OF
065442,000541: 21,3532           70001                           MP       L                                     #   1/2                   2       1/2
065443,000542: 21,3533           27743                           ADS      K2CNTRAL   +1                         #  K   *(DEL*OMEGA + ALPHA /(2*K))
065444,000543: 21,3534           54001                           TS       L                                     #                      AND
065445,000544: 21,3535           13537                           TCF      +2                                    #                        2
065446,000545: 21,3536           27742                           ADS      K2CNTRAL                              #  DEL*(DEL*OMEGA + ALPHA /(2*K)) NOW IN 
065447,000546:                                                                                                  #  K2CNTRAL
065448,000547: 
065449,000548: 21,3537           31744        DOSHIFT            CA       ININDEX                               
065450,000549: 21,3540           00006                           EXTEND                                         #  MULTIPLY IN THE FACTOR 2(-S), RETURNED
065451,000550: 21,3541           74736                           MP       BIT14                                 #  BY THE GTSQRT SUBROUTINE
065452,000551: 21,3542           27741                           ADS      SHFTFLAG                              
065453,000552: 21,3543           00006                           EXTEND                                         
065454,000553: 21,3544           13563                           BZF      ADDITIN                               
065455,000554: 21,3545           51741                           INDEX    SHFTFLAG                              
065456,000555: 21,3546           34735                           CA       BIT15                                 

Page 1483

065458,000557: 21,3547           57742                           XCH      K2CNTRAL                              
065459,000558: 21,3550           00006                           EXTEND                                         
065460,000559: 21,3551           71742                           MP       K2CNTRAL                              
065461,000560: 21,3552           21740                           DAS      K2THETA                               
065462,000561: 21,3553           57742                           XCH      K2CNTRAL                              
065463,000562: 21,3554           00006                           EXTEND                                         
065464,000563: 21,3555           71743                           MP       K2CNTRAL   +1                         
065465,000564: 21,3556           27740                           ADS      K2THETA    +1                         
065466,000565: 21,3557           54001                           TS       L                                     
065467,000566: 21,3560           13562                           TCF      +2                                    
065468,000567: 21,3561           27737                           ADS      K2THETA                               
065469,000568: 
065470,000569: 21,3562           13566                           TCF      NEGUSUM                               
065471,000570: 
065472,000571: 21,3563           00006        ADDITIN            EXTEND                                         
065473,000572: 21,3564           31743                           DCA      K2CNTRAL                              
065474,000573: 21,3565           21740                           DAS      K2THETA                               #  NOW ADD IN THE K2THETA TERM.
065475,000574: 21,3566           11737        NEGUSUM            CCS      K2THETA                               #  TEST SIGN OF HIGH ORDER PART.
065476,000575: 21,3567           13573                           TCF      NEGDRIVE                              
065477,000576: 21,3570           13572                           TCF      +2                                    
065478,000577: 21,3571           13575                           TCF      POSDRIVE                              
065479,000578: 
065480,000579: 21,3572           11740                           CCS      K2THETA    +1                         #  SIGN TEST FOR LOW ORDER PART.
065481,000580: 21,3573           34753        NEGDRIVE           CA       BIT1                                  
065482,000581: 21,3574           13576                           TCF      +2                                    #  STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
065483,000582: 21,3575           44753        POSDRIVE           CS       BIT1                                  
065484,000583: 21,3576           54001                           TS       L                                     #  SAVE FOR DRIVE REVERSAL TEST.
065485,000584: 21,3577           51750                           INDEX    QRCNTR                                
065486,000585: 21,3600           57501                           XCH      NEGUQ                                 
065487,000586: 
065488,000587: 21,3601           00006                           EXTEND                                         
065489,000588: 21,3602           70001                           MP       L                                     #  MULTIPLY OLD NEGU AND NEW NEGU.
065490,000589: 21,3603           10001                           CCS      L                                     
065491,000590: 21,3604           13621                           TCF      LOUPE                                 #  NON-ZERO GIMBAL DRIVE BEING CONTINUED.
065492,000591: 
065493,000592: 21,3605           13616                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
065494,000593: 
065495,000594: 21,3606           13610                           TCF      REVERSAL                              #  NON-ZERO GIMBAL DRIVE BEING REVERSED.
065496,000595: 21,3607           13616                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
065497,000596: 
065498,000597: 21,3610           51750        REVERSAL           INDEX    QRCNTR                                #  A ZERO-DRIVE PAUSE IS NEEDED HERE.  ZERO
065499,000598: 21,3611           55510                           TS       QACCDOT                               #  IS IN A REGISTER FROM CCS ON (-1).
065500,000599: 21,3612           51750                           INDEX    QRCNTR                                
065501,000600: 21,3613           43633                           CS       GMBLBITA                              
065502,000601: 21,3614           00006                           EXTEND                                         
065503,000602: 21,3615           03012                           WAND     CHAN12                                
065504,000603: 
065505,000604: 21,3616           41273        ZEROLOUP           CS       RCSFLAGS                              #  SET UP REQUEST FOR ACDT+C12 CALL.
065506,000605: 21,3617           74747                           MASK     CALLGMBL                              
065507,000606: 21,3620           27273                           ADS      RCSFLAGS                              

Page 1484

065509,000608: 21,3621           11750        LOUPE              CCS      QRCNTR                                #  HAVE BOTH AXES BEEN PROCESSED?
065510,000609: 21,3622           13115                           TCF      GOQTRIMG                              #  NO.  DO Q AXIS NEXT.
065511,000610: 
065512,000611: 21,3623           31505                           CA       SAVESR                                #  RESTORE THE SR
065513,000612: 21,3624           54021                           TS       SR                                    
065514,000613: 
065515,000614: 21,3625           00006        GOCLOSE            EXTEND                                         #  TERMINATE THE JASK.
065516,000615: 21,3626           33631                           DCA      CLOSEADR                              
065517,000616: 21,3627           52006                           DTCB                                           
065518,000617: 
065519,000618: 21,3630  E6,1537                                  EBANK=   AOSQ                                  
065520,000619: 21,3630           03236 36106  CLOSEADR           2CADR    CLOSEOUT                              #  TERMINATE THE JASK.
065521,000620: 
065522,000621: 21,3632     5751               TWELVE             EQUALS   OCT14                                 
065523,000622: 21,3632           26501        ROOTHALF           OCTAL    26501                                 #  SQUARE ROOT OF 1/2
065524,000623: 21,3633           01400        GMBLBITA           OCTAL    01400                                 #  INDEXED WRT GMBLBITB  DO NOT MOVE ******
065525,000624: 21,3634           11276        OCT11276           OCTAL    11276                                 #  POSMAX - ROOTHALF
065526,000625: 21,3635           06000        GMBLBITB           OCTAL    06000                                 #  INDEXED WRT GMBLBITA  DO NOT MOVE ******
065527,000626: 
065528,000627:                                                                                                  #  SUBROUTINE ROOTCYCL:  BY CRAIG WORK, 3 APRIL 68
065529,000628: 
065530,000629:                                                                                                  #  ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION.  THE INITIAL GUESS AT THE
065531,000630:                                                                                                  #  SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG.  THE NEW APPROXI-
065532,000631:                                                                                                  #  MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER.  DEBRIS:  A, L, SR, SCRATCH.  ROOTCYCL IS CALLED FROM
065533,000632:                                                                                                  #  LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
065534,000633: 
065535,000634:                                                                                                  #  WARNING:  IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
065536,000635: 
065537,000636: 21,3636           55746        ROOTCYCL           TS       SCRATCH                               #  STORE X
065538,000637: 21,3637           54021                           TS       SR                                    #  X/2 NOW IN SR
065539,000638: 21,3640           31747                           CA       HALFARG                               #  ARG/2 IN THE A REG
065540,000639: 21,3641           22007                           ZL                                             #  PREPARE FOR DIVISION
065541,000640: 21,3642           00006                           EXTEND                                         
065542,000641: 21,3643           11746                           DV       SCRATCH                               #  (ARG/X)/2
065543,000642: 21,3644           60021                           AD       SR                                    #  (X + ARG/X)/2 IN THE A REG
065544,000643: 21,3645           00002                           TC       Q                                     
065545,000644: 
065546,000645: 

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