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.

062580,000002:                                                                                                  ## Copyright:   Public domain.
062581,000003:                                                                                                  ## Filename:    TRIM_GIMBAL_CONTROL_SYSTEM.agc
062582,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
062583,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM) 
062584,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
062585,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
062586,000008:                                                                                                  ##              that the code format has been changed to conform to the
062587,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
062588,000010:                                                                                                  ##              original YUL assembler.
062589,000011:                                                                                                  ## Reference:   pp. 1462-1474
062590,000012:                                                                                                  ## Assembler:   yaYUL
062591,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
062592,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
062593,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
062594,000016:                                                                                                  ##              2017-01-30 RRB  Updated for Luminary 116.
062595,000017:                                                                                                  ##              2017-03-14 RSB  Proofed comment text via 3-way diff vs
062596,000018:                                                                                                  ##                              Luminary 99 and 131.
062597,000019:                                                                                                  ##              2021-05-30 ABS  GTSGO+DN -> GTSGO+ON
062598,000020: 

Page 1462

062600,000022: 21,3070                                           BANK     21                                    
062601,000023: 21,3070  E6,1450                                  EBANK=   QDIFF                                 
062602,000024: 21,2000                                           SETLOC   DAPS4                                 
062603,000025: 21,2000                                           BANK                                           
062604,000026: 
062605,000027: 21,3070                                           COUNT*   $$/DAPGT                              
062606,000028: 
062607,000029:                                                                                                  #  CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
062608,000030:                                                                                                  #  AUTOPILOT ARE BOTH ON:
062609,000031:                                                                                                  #           A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
062610,000032:                                                                                                  #              INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
062611,000033:                                                                                                  #           B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
062612,000034:                                                                                                  #              ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
062613,000035: 
062614,000036:                                                                                                  #  GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
062615,000037: 
062616,000038: 21,3070           37752        GTS                CAF      NEGONE                                #  MAKE THE NEXT PASS THROUGH THE DAP BE
062617,000039: 21,3071           55631                           TS       COTROLER                              #    THROUGH RCS CONTROL,
062618,000040: 21,3072           34751                           CAF      FOUR                                  #    AND ENSURE THAT IT IS NOT A SKIP.
062619,000041: 21,3073           55535                           TS       SKIPU                                 
062620,000042: 21,3074           55536                           TS       SKIPV                                 
062621,000043: 
062622,000044: 21,3075           34752                           CAF      TWO                                   
062623,000045: 21,3076           55633                           TS       INGTS                                 #  SET INDICATOR OF GTS CONTROL POSITIVE.
062624,000046: 21,3077           55632                           TS       QGIMTIMR                              #  SET TIMERS TO 200 MSEC TO AVOID BOTH
062625,000047: 21,3100           55634                           TS       RGIMTIMR                              #  RUNAWAY AND INTERFERENCE BY NULLING.
062626,000048: 
062627,000049:                                                                                                  #  THE DRIVE SETTING ALGORITHM
062628,000050: 
062629,000051:                                                                                                  #  DEL = SGN(OMEGA + ALPHA*ABS(ALPHA)/(2*K))
062630,000052:                                                                                                  #                                              2               1/2                  2       3/2
062631,000053:                                                                                                  #  NEGUSUM = ERROR*K + ALPHA*(DEL*OMEGA + ALPHA /(3*K)) + DEL*K   (DEL*OMEGA + ALPHA /(2*K))
062632,000054: 
062633,000055:                                                                                                  #  DRIVE = -SGN(NEGUSUM)
062634,000056: 
062635,000057: 21,3101           30021                           CA       SR                                    #  SAVE THE SR.  SHIFT IT LEFT TO CORRECT
062636,000058: 21,3102           60000                           AD       A                                     #  FOR THE RIGHT SHIFT DUE TO EDITING.
062637,000059: 21,3103           55505                           TS       SAVESR                                
062638,000060: 
062639,000061: 21,3104           34752        GTSGO+ON           CAF      TWO                                   #  SET INDEXER FOR R-AXIS CALCULATIONS.
062640,000062: 21,3105           13107                           TCF      GOQTRIMG   +1                         
062641,000063: 
062642,000064: 21,3106           34755        GOQTRIMG           CAF      ZERO                                  #  SET INDEXER FOR Q-AXIS CALCULATIONS
062643,000065: 21,3107           55750                           TS       QRCNTR                                
062644,000066: 
062645,000067: 21,3110           51750                           INDEX    QRCNTR                                #  AOS SCALED AT PI/2
062646,000068: 21,3111           31537                           CA       AOSQ                                  
062647,000069: 21,3112           00006                           EXTEND                                         
062648,000070: 21,3113           74752                           MP       BIT2                                  #  RESCALE AOS TO PI/4

Page 1463

062650,000072: 21,3114           00006                           EXTEND                                         
062651,000073: 21,3115           13121                           BZF      GTSQAXIS   -3                         #  USE FULL SCALE FOR LARGER AOS ESTIMATES.
062652,000074: 
062653,000075: 21,3116           50000                           INDEX    A                                     
062654,000076: 21,3117           44734                           CS       LIMITS                                #  LIMITS +1 CONTAINS NEGMAX.
062655,000077: 21,3120           56001                           XCH      L                                     #  LIMITS -1 CONTAINS POSMAX.
062656,000078: 
062657,000079: 21,3121           11750                           CCS      QRCNTR                                #  PICK UP RATE FOR THIS AXIS.  RATE CELLS
062658,000080: 21,3122           50000                           INDEX    A                                     #  ARE ADJACENT, NOT SEPARATED.  AT PI/4
062659,000081: 21,3123           31436                           CA       EDOTQ                                 
062660,000082: 21,3124           53744        GTSQAXIS           DXCH     WCENTRAL                              
062661,000083: 
062662,000084: 21,3125           51750                           INDEX    QRCNTR                                #  COLLECT K FOR THIS AXIS
062663,000085: 21,3126           31504                           CA       KQ                                    
062664,000086: 21,3127           55741                           TS       KCENTRAL                              
062665,000087: 
062666,000088: 21,3130           00006                           EXTEND                                         #  CONTROL AUTHORITY ZERO.  AVOID DRIVING
062667,000089: 21,3131           13567                           BZF      POSDRIVE   +1                         #  ENGINE BELL TO THE STOPS.
062668,000090: 
062669,000091: 21,3132           51750                           INDEX    QRCNTR                                #  QDIFF, RDIFF ARE STORED IN D.P.
062670,000092: 21,3133           31450                           CAE      QDIFF                                 
062671,000093: 
062672,000094: 21,3134           00006        ALGORTHM           EXTEND                                         #  Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
062673,000095: 21,3135           71741                           MP       KCENTRAL                              #  FORM K*ERROR AT PI(2)/2(8), IN D.P.
062674,000096: 21,3136           23737                           LXCH     K2THETA                               
062675,000097: 21,3137           00006                           EXTEND                                         
062676,000098: 21,3140           74747                           MP       BIT5                                  #  RESCALE TO 4*PI(2)
062677,000099: 21,3141           53740                           DXCH     K2THETA                               
062678,000100: 21,3142           00006                           EXTEND                                         
062679,000101: 21,3143           74747                           MP       BIT5                                  #  FIRST TERM OF NEGUSUM IN K2THETA.
062680,000102: 21,3144           27740                           ADS      K2THETA    +1                         #  NO CARRY NEEDED    D.P. AT 4*PI(2)
062681,000103: 
062682,000104: 21,3145           41744                           CS       ACENTRAL                              #  FORM ALPHA(2)/(2*K) AT 16*PI, IN D.P.,
062683,000105: 21,3146           00006                           EXTEND                                         #  LIMITING QUOTIENT TO AVOID OVERFLOW.
062684,000106: 21,3147           74736                           MP       BIT14                                 #  -ALPHA/2 IN A, SCALED AT PI/4
062685,000107: 21,3150           00006                           EXTEND                                         
062686,000108: 21,3151           71744                           MP       ACENTRAL                              #  -ALPHA(2)/2 IN A,L, SCALED AT PI(2)/16
062687,000109: 21,3152           61741                           AD       KCENTRAL                              
062688,000110: 21,3153           00006                           EXTEND                                         
062689,000111: 21,3154           63171                           BZMF     HUGEQUOT                              #  K-ALPHA(2)/2 SHOULD BE PNZ FO DIVISION
062690,000112: 
062691,000113: 21,3155           00006                           EXTEND                                         
062692,000114: 21,3156           40001                           DCS      A                                     #  ALPHA(2)/2 - K
062693,000115: 21,3157           61741                           AD       KCENTRAL                              
062694,000116: 21,3160           00006                           EXTEND                                         
062695,000117: 21,3161           11741                           DV       KCENTRAL                              #  HIGH ORDER OF QUOTIENT.
062696,000118: 21,3162           57746                           XCH      A2CNTRAL                              
062697,000119: 21,3163           30001                           CA       L                                     #  SHIFT UP THE REMAINDER.
062698,000120: 21,3164           22007                           LXCH     7                                     #  ZERO LOW-ORDER DIVIDEND.
062699,000121: 21,3165           00006                           EXTEND                                         

Page 1464

062701,000123: 21,3166           11741                           DV       KCENTRAL                              
062702,000124: 21,3167           57747                           XCH      A2CNTRAL   +1                         #  QUOTIENT STORED AT 16*PI, D.P.
062703,000125: 21,3170           13174                           TCF      HAVEQUOT                              
062704,000126: 
062705,000127: 21,3171           34733        HUGEQUOT           CA       POSMAX                                
062706,000128: 21,3172           54001                           TS       L                                     
062707,000129: 21,3173           53747                           DXCH     A2CNTRAL                              #  LIMITED QUOTIENT STORED AT 16*PI, D.P.
062708,000130: 
062709,000131: 21,3174           31743        HAVEQUOT           CA       WCENTRAL                              
062710,000132: 21,3175           00006                           EXTEND                                         
062711,000133: 21,3176           74743                           MP       BIT9                                  #  RESCALE OMEGA AT 16*PI IN D.P.
062712,000134: 21,3177           53743                           DXCH     K2CNTRAL                              #  LOWER WORD OVERLAYS OMEGA IN WCENTRAL
062713,000135: 
062714,000136: 21,3200           00006                           EXTEND                                         
062715,000137: 21,3201           31743                           DCA      K2CNTRAL                              
062716,000138: 21,3202           53752                           DXCH     FUNCTION                              
062717,000139: 
062718,000140: 21,3203           31744                           CA       ACENTRAL                              #  GET ALPHA*ABS(ALPHA)/(2*K)
062719,000141: 21,3204           00006                           EXTEND                                         
062720,000142: 21,3205           63211                           BZMF     +4                                    
062721,000143: 
062722,000144: 21,3206           00006                           EXTEND                                         
062723,000145: 21,3207           31747                           DCA      A2CNTRAL                              
062724,000146: 21,3210           13213                           TCF      +3                                    
062725,000147: 
062726,000148: 21,3211           00006                           EXTEND                                         
062727,000149: 21,3212           41747                           DCS      A2CNTRAL                              
062728,000150: 
062729,000151: 21,3213           21752                           DAS      FUNCTION                              #  OMEGA + ALPHA*ABS(ALPHA)/2*K) AT 16*PI
062730,000152: 
062731,000153: 21,3214           11751                           CCS      FUNCTION                              #  DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
062732,000154: 21,3215           13221                           TCF      POSFNCT1                              #  OTHERWISE DEL = -1
062733,000155: 21,3216           13220                           TCF      +2                                    
062734,000156: 21,3217           13223                           TCF      NEGFNCT1                              
062735,000157: 
062736,000158: 21,3220           11752                           CCS      FUNCTION   +1                         #  USE LOW ORDER WORD SINCE HIGH IS ZERO
062737,000159: 21,3221           34753        POSFNCT1           CAF      BIT1                                  
062738,000160: 21,3222           13224                           TCF      +2                                    
062739,000161: 21,3223           44753        NEGFNCT1           CS       BIT1                                  
062740,000162: 21,3224           55745                           TS       DEL                                   
062741,000163: 
062742,000164: 21,3225           11745                           CCS      DEL                                   #  REPLACE OMEGA BY DEL*OMEGA
062743,000165: 21,3226           13240                           TCF      FUNCT2                                #  POSITIVE DEL VALUE.  PROCEED.
062744,000166: 21,3227           13231                           TCF      DEFUNCT                               
062745,000167: 21,3230           13235                           TCF      NEGFNCT2                              
062746,000168: 
062747,000169: 21,3231           55742        DEFUNCT            TS       K2CNTRAL                              
062748,000170: 21,3232           55743                           TS       K2CNTRAL   +1                         
062749,000171: 21,3233           13240                           TCF      FUNCT2                                
062750,000172: 

Page 1465

062752,000174: 21,3234           65252        NEG1/3             DEC      -.33333                               
062753,000175: 
062754,000176: 21,3235           00006        NEGFNCT2           EXTEND                                         
062755,000177: 21,3236           41743                           DCS      K2CNTRAL                              
062756,000178: 21,3237           53743                           DXCH     K2CNTRAL                              
062757,000179: 
062758,000180: 21,3240           00006        FUNCT2             EXTEND                                         
062759,000181: 21,3241           31747                           DCA      A2CNTRAL                              
062760,000182: 21,3242           21743                           DAS      K2CNTRAL                              #  DEL*OMEGA + ALPHA(2)/(2*K) AT 16*PI, D.P.
062761,000183: 
062762,000184: 21,3243           31746        FUNCT3             CA       A2CNTRAL                              
062763,000185: 21,3244           00006                           EXTEND                                         
062764,000186: 21,3245           73234                           MP       NEG1/3                                
062765,000187: 21,3246           53747                           DXCH     A2CNTRAL                              
062766,000188: 21,3247           30001                           CA       L                                     
062767,000189: 21,3250           00006                           EXTEND                                         
062768,000190: 21,3251           73234                           MP       NEG1/3                                
062769,000191: 21,3252           27747                           ADS      A2CNTRAL   +1                         
062770,000192: 21,3253           54001                           TS       L                                     
062771,000193: 21,3254           13256                           TCF      +2                                    #  A2CNTRAL NOW CONTAINS -ALPHA(2)/(6*K),
062772,000194: 21,3255           27746                           ADS      A2CNTRAL                              #  SCALED AT 16*PI, IN D.P.
062773,000195: 
062774,000196: 21,3256           00006                           EXTEND                                         
062775,000197: 21,3257           31743                           DCA      K2CNTRAL                              #  DEL*OMEGA + ALPHA(2)/(3*K) IN A2CNTRAL,
062776,000198: 21,3260           21747                           DAS      A2CNTRAL                              #  SCALED AT 16*PI, D.P.
062777,000199: 
062778,000200: 21,3261           31746                           CA       A2CNTRAL                              
062779,000201: 21,3262           00006                           EXTEND                                         
062780,000202: 21,3263           71744                           MP       ACENTRAL                              
062781,000203: 21,3264           21740                           DAS      K2THETA                               
062782,000204: 21,3265           31747                           CA       A2CNTRAL   +1                         
062783,000205: 21,3266           00006                           EXTEND                                         
062784,000206: 21,3267           71744                           MP       ACENTRAL                              #  ACENTRAL MAY NOW BE OVERLAID.
062785,000207: 21,3270           27740                           ADS      K2THETA    +1                         
062786,000208: 21,3271           54001                           TS       L                                     
062787,000209: 21,3272           13274                           TCF      +2                                    #  TWO TERMS OF NEGUSUM ACCUMULATED, SO FAR
062788,000210: 21,3273           27737                           ADS      K2THETA                               #  SCALED AT 4*PI(2), IN D.P.
062789,000211: 
062790,000212: 21,3274           31742        GETROOT            CA       K2CNTRAL                              #  K*(DEL*OMEGA + ALPHA(2)/(2*K)) IS THE
062791,000213: 21,3275           00006                           EXTEND                                         #  TERM FOR WHICH A SQUARE ROOT IS NEEDED.
062792,000214: 21,3276           71741                           MP       KCENTRAL                              #  K AT PI/2(8)
062793,000215: 21,3277           53752                           DXCH     FUNCTION                              
062794,000216: 21,3300           31743                           CA       K2CNTRAL   +1                         
062795,000217: 21,3301           00006                           EXTEND                                         
062796,000218: 21,3302           71741                           MP       KCENTRAL                              
062797,000219: 21,3303           27752                           ADS      FUNCTION   +1                         
062798,000220: 21,3304           54001                           TS       L                                     
062799,000221: 21,3305           13307                           TCF      +2                                    
062800,000222: 21,3306           27751                           ADS      FUNCTION                              #  DESIRED TERM IN FUNCTION, AT PI(2)/16

Page 1466

062802,000224: 21,3307           11745                           CCS      DEL                                   
062803,000225: 21,3310           13515                           TCF      RSTOFGTS                              
062804,000226: 21,3311           13557                           TCF      NEGUSUM                               
062805,000227: 21,3312           13314                           TCF      NEGATE                                
062806,000228: 21,3313           13557                           TCF      NEGUSUM                               
062807,000229: 
062808,000230: 21,3314           00006        NEGATE             EXTEND                                         
062809,000231: 21,3315           41743                           DCS      K2CNTRAL                              
062810,000232: 21,3316           53743                           DXCH     K2CNTRAL                              
062811,000233: 21,3317           13515                           TCF      RSTOFGTS                              
062812,000234: 
062813,000235: 16,3741                                           BANK     16                                    
062814,000236: 16,3741  E6,1501                                  EBANK=   NEGUQ                                 
062815,000237: 16,2000                                           SETLOC   DAPS1                                 
062816,000238: 16,2000                                           BANK                                           
062817,000239: 
062818,000240:                                                                                                  #  THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
062819,000241:                                                                                                  #  THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES.  ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
062820,000242: 
062821,000243:                                                                                                  #  WARNING:  ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
062822,000244: 
062823,000245: 16,3741           07400        BGIM               OCTAL    07400                                 
062824,000246: 16,3742     0066               CHNL12             EQUALS   ITEMP6                                
062825,000247: 16,3742           41501        ACDT+C12           CS       NEGUQ                                 
062826,000248: 16,3743           00006                           EXTEND                                         #  GIMBAL DRIVE REQUESTS.
062827,000249: 16,3744           71507                           MP       ACCDOTQ                               
062828,000250: 16,3745           23510                           LXCH     QACCDOT                               
062829,000251: 16,3746           41503                           CS       NEGUR                                 
062830,000252: 16,3747           00006                           EXTEND                                         
062831,000253: 16,3750           71511                           MP       ACCDOTR                               
062832,000254: 16,3751           23512                           LXCH     RACCDOT                               
062833,000255: 
062834,000256: 16,3752           11501                           CCS      NEGUQ                                 
062835,000257: 16,3753           34742                           CAF      BIT10                                 
062836,000258: 16,3754           13756                           TCF      +2                                    
062837,000259: 16,3755           34743                           CAF      BIT9                                  
062838,000260: 16,3756           54066                           TS       CHNL12                                
062839,000261: 
062840,000262: 16,3757           11503                           CCS      NEGUR                                 
062841,000263: 16,3760           34740                           CAF      BIT12                                 
062842,000264: 16,3761           13763                           TCF      +2                                    
062843,000265: 16,3762           34741                           CAF      BIT11                                 
062844,000266: 16,3763           26066                           ADS      CHNL12                                #  (STORED RESULT NOT USED AT PRESENT)
062845,000267: 
062846,000268: 16,3764           43741                           CS       BGIM                                  
062847,000269: 16,3765           00006                           EXTEND                                         
062848,000270: 16,3766           02012                           RAND     CHAN12                                
062849,000271: 16,3767           60066                           AD       CHNL12                                
062850,000272: 16,3770           00006                           EXTEND                                         
062851,000273: 16,3771           01012                           WRITE    CHAN12                                

Page 1467

062853,000275: 16,3772           44747                           CS       CALLGMBL                              #  TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
062854,000276: 16,3773           71262                           MASK     RCSFLAGS                              
062855,000277: 16,3774           55262                           TS       RCSFLAGS                              
062856,000278: 
062857,000279: 16,3775           00002                           TC       Q                                     #  RETURN TO CALLER.
062858,000280: 
062859,000281: 21,3320                                           BANK     21                                    
062860,000282: 21,3320  E6,1450                                  EBANK=   QDIFF                                 
062861,000283: 21,2000                                           SETLOC   DAPS4                                 
062862,000284: 21,2000                                           BANK                                           
062863,000285: 

Page 1468

062865,000287:                                                                                                  #  SUBROUTINE TIMEGMBL:  MOD 0, OCTOBER 1967, CRAIG WORK
062866,000288: 
062867,000289:                                                                                                  #  TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
062868,000290:                                                                                                  #  THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS.  INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
062869,000291:                                                                                                  #  SCALED AT PI/8.                         FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT).  A ZERO
062870,000292:                                                                                                  #  ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY.  OTHERWISE, THE GIMBAL IS TURNED ON
062871,000293:                                                                                                  #  DRIVING IN THE CORRECT DIRECTION.  THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
062872,000294:                                                                                                  #  IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE.  NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
062873,000295:                                                                                                  #  WHICH IS NEGATIVE, ZERO, OR POSITIVE.
062874,000296: 
062875,000297:                                                                                                  #  INPUTS:  AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7).       PI/2(7).
062876,000298: 
062877,000299:                                                                                                  #  OUTPUTS:   NEW GIMBAL DRIVE BITS IN CHANNEL 12, NEGUQ, NEGUR, QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
062878,000300:                                                                                                  #             Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
062879,000301: 
062880,000302:                                                                                                  #  DEBRIS:   A, L, Q, ITEMPS 2, 3, 6, RUPTREG2 AND ACDT+C12 DEBRIS.
062881,000303: 
062882,000304:                                                                                                  #  EXITS:   VIA TC Q.
062883,000305: 
062884,000306:                                                                                                  #  ALARMS, ABORTS, :  NONE
062885,000307: 
062886,000308:                                                                                                  #  SUBROUTINES:  ACDT+C12, IBNKCALL
062887,000309: 
062888,000310:                                                                                                  #  WARNING:  THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS.  THEREFORE IT MAY ONLY BE CALLED WITH
062889,000311:                                                                                                  #  INTERRUPT INHIBITED.
062890,000312: 
062891,000313:                                                                                                  #  ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
062892,000314:                                                                                                  #        NEGUQ           ERASE   +2              NEGATIVE OF Q-AXIS GIMBAL DRIVE
062893,000315:                                                                                                  #        (SPWORD)        EQUALS  NEGUQ +1        ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
062894,000316:                                                                                                  #        NEGUR           EQUALS  NEGUQ +2        NEGATIVE OF R-AXIS GIMBAL DRIVE
062895,000317:                                                                                                  #        ACCDOTQ         ERASE   +2              Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
062896,000318:                                                                                                  #        (SPWORD)        EQUALS  ACCDOTQ +1      ANY S.P. ERASABLE NUMBER NOW QACCDOT
062897,000319:                                                                                                  #        ACCDOTR         EQUALS  ACCDOTQ +2      R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
062898,000320:                                                                                                  #                                                ACCDOTQ, ACCDOTR ARE MAGNITUDES.
062899,000321:                                                                                                  #        AOSQ            ERASE   +4              Q-AXIS ACC., D.P. AT PI/2 R/SEC(2)
062900,000322:                                                                                                  #        AOSR            EQUALS  AOSQ +2         R-AXIS ACCELERATION SCALED AT PI/2 R/S2
062901,000323: 
062902,000324: 21,3320     0066               QRNDXER            EQUALS   ITEMP6                                
062903,000325: 21,3320           23146        OCT23146           OCTAL    23146                                 #  DECIMAL .6
062904,000326: 21,3321     0063               NZACCDOT           EQUALS   ITEMP3                                
062905,000327: 
062906,000328: 21,3321           34753        TIMEGMBL           CAF      ONE                                   #  INITIALIZE ALLOWGTS.
062907,000329: 21,3322           55502                           TS       ALLOWGTS                              
062908,000330: 
062909,000331: 21,3323           34752                           CAF      TWO                                   #  SET UP LOOP FOR R AXIS.
062910,000332: 21,3324           22002                           LXCH     Q                                     #  SAVE RETURN ADDRESS.
062911,000333: 21,3325           22071                           LXCH     RUPTREG2                              

Page 1469

062913,000335: 21,3326           13330                           TCF      +2                                    
062914,000336: 21,3327           34755        TIMQGMBL           CAF      ZERO                                  #  NOW DO THE Q-AXIS
062915,000337: 21,3330           54066                           TS       QRNDXER                               
062916,000338: 21,3331           50066                           INDEX    QRNDXER                               
062917,000339: 21,3332           31507                           CA       ACCDOTQ                               #  ACCDOT IS PRESUMED TO BE AT PI/2(7).
062918,000340: 21,3333           00006                           EXTEND                                         
062919,000341: 21,3334           63404                           BZMF     TGOFFNOW                              #  IS ACCDOT LESS THAN OR EQUAL TO 0?
062920,000342: 21,3335           54063                           TS       NZACCDOT                              #  NO.  STORE NON-ZERO, POSITIVE ACCDOT.
062921,000343: 
062922,000344: 21,3336           50066        ALPHATRY           INDEX    QRNDXER                               
062923,000345: 21,3337           41537                           CS       AOSQ                                  
062924,000346: 21,3340           00006                           EXTEND                                         
062925,000347: 21,3341           13404                           BZF      TGOFFNOW                              #  IS ALPHA ZERO?
062926,000348: 
062927,000349: 21,3342           54002                           TS       Q                                     #  SAVE A COPY OF -AOS.
062928,000350: 21,3343           00006                           EXTEND                                         #  NO.  RESCALE FOR TIMEGMBL USE.
062929,000351: 21,3344           73320                           MP       OCT23146                              #  OCTAL 23146 IS DECIMAL .6
062930,000352: 21,3345           60002                           AD       Q                                     #  -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
062931,000353: 21,3346           54001                           TS       L                                     #  WAS THERE OVERFLOW?
062932,000354: 21,3347           13354                           TCF      SETNEGU                               #  NO.  COMPUTE DRIVE TIME.
062933,000355: 
062934,000356: 21,3350           40000                           CS       A                                     #  RECOVER  -SGN(AOS) IN THE A REGISTER.
062935,000357: 21,3351           50066                           INDEX    QRNDXER                               #  YES.  START DRIVE WITHOUT WAITLIST.
062936,000358: 21,3352           57501                           XCH      NEGUQ                                 
062937,000359: 21,3353           13410                           TCF      NOTALLOW                              #  KNOCK DOWN THE ALLOWGTS FLAG.
062938,000360: 
062939,000361: 21,3354           00006        SETNEGU            EXTEND                                         
062940,000362: 21,3355           63362                           BZMF     POSALPH                               
062941,000363: 
062942,000364: 21,3356           40000                           COM                                            
062943,000365: 21,3357           54062                           TS       ITEMP2                                #  STORE  -ABS(.4*AOS) SCALED AT PI/8.
062944,000366: 21,3360           44753                           CS       BIT1                                  
062945,000367: 21,3361           13364                           TCF      POSALPH    +2                         
062946,000368: 21,3362           54062        POSALPH            TS       ITEMP2                                #  STORE  -ABS(.4*AOS) SCALED AT PI/8.
062947,000369: 21,3363           34753                           CA       BIT1                                  
062948,000370: 21,3364           50066                 +2        INDEX    QRNDXER                               #  SGN(AOS) INTO NEGU
062949,000371: 21,3365           55501                           TS       NEGUQ                                 #  STORE SGN(APLHA) AS NEGU
062950,000372: 
062951,000373: 21,3366           30063                           CA       NZACCDOT                              
062952,000374: 21,3367           00006                           EXTEND                                         
062953,000375: 21,3370           74740                           MP       BIT12                                 #  2*ACCDOT, SCALED AT PI/8.
062954,000376: 21,3371           60062                           AD       ITEMP2                                #  -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
062955,000377: 21,3372           00006                           EXTEND                                         
062956,000378: 21,3373           63410                           BZMF     NOTALLOW                              #  IS DRIVE TIME MORE THAN TWO SECONDS?
062957,000379: 21,3374           40062                           CS       ITEMP2                                #  NO.  COMPUTE DRIVE TIME.
062958,000380: 21,3375           00006                           EXTEND                                         #  ABS(ALPHA) AT PI/8.
062959,000381: 21,3376           73431                           MP       OCT00240                              #  DECIMAL 10/1024
062960,000382: 21,3377           00006                           EXTEND                                         #  QUOTIENT IS DRIVE TIME AT WAITLIST.
062961,000383: 21,3400           10063                           DV       NZACCDOT                              #  ABS(ALPHA)/ACCDOT AT 2(14)/100

Page 1470

062963,000385: 21,3401           00006                           EXTEND                                         
062964,000386: 21,3402           13404                           BZF      TGOFFNOW                              #  DRIVE TIME MUST BE GREATER THAN ZERO.
062965,000387: 
062966,000388: 21,3403           13416                           TCF      DRIVEON                               
062967,000389: 
062968,000390: 21,3404           34755        TGOFFNOW           CAF      ZERO                                  #  TURN OFF GIMBAL NOW.
062969,000391: 21,3405           50066                           INDEX    QRNDXER                               
062970,000392: 21,3406           55501                           TS       NEGUQ                                 
062971,000393: 
062972,000394: 21,3407           13420                           TCF      DONEYET                               
062973,000395: 
062974,000396: 21,3410           36010        NOTALLOW           CAF      OCT31                                 
062975,000397: 21,3411           50066                           INDEX    QRNDXER                               
062976,000398: 21,3412           55632                           TS       QGIMTIMR                              
062977,000399: 21,3413           34755                           CAF      ZERO                                  #  DRIVE TIME IS MORE THAN 2 SECONDS, SO
062978,000400: 21,3414           55502                           TS       ALLOWGTS                              #  DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
062979,000401:                                                                                                  #  CONTROL UNTIL AOSTASK APPROVES.
062980,000402: 21,3415           13420                           TCF      DONEYET                               #  NO WAITLIST CALL IS MADE.
062981,000403: 
062982,000404: 21,3416           50066        DRIVEON            INDEX    QRNDXER                               
062983,000405: 21,3417           55632                           TS       QGIMTIMR                              #  CHOOSE Q OR R AXIS.
062984,000406: 
062985,000407: 21,3420           10066        DONEYET            CCS      QRNDXER                               
062986,000408: 21,3421           13327                           TCF      TIMQGMBL                              
062987,000409: 
062988,000410: 21,3422           52073                           DXCH     RUPTREG3                              #  PROTECT IBNKCALL ERASABLES.  ACDT+C12
062989,000411: 21,3423           52063                           DXCH     ITEMP2                                #  LEAVES ITEMPS2,3 ALONE.
062990,000412: 
062991,000413: 21,3424           04674                           TC       IBNKCALL                              #  TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
062992,000414: 21,3425           35742                           CADR     ACDT+C12                              
062993,000415: 
062994,000416: 21,3426           52063                           DXCH     ITEMP2                                #  RESTORE ERASABLES FOR IBNKCALL.
062995,000417: 21,3427           52073                           DXCH     RUPTREG3                              
062996,000418: 
062997,000419: 21,3430           00071                           TC       RUPTREG2                              #  RETURN TO CALLER.
062998,000420: 
062999,000421: 21,3431           00240        OCT00240           OCTAL    00240                                 #  DECIMAL 10/1024
063000,000422: 

Page 1471

063002,000424:                                                                                                  #  THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY. THE QUANTITY NEGUSUM
063003,000425:                                                                                                  #  IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM.  NEW DRIVES ARE ENTERED TO CH 12.
063004,000426: 
063005,000427:                                                                                                  #  THE SUBROUTINE GTSQRT ACCEPTS A DOUBLE PRECISION VALUE IN FUNCTION, FUNCTION +1 AND RETURNS A SINGLE-PRECISION
063006,000428:                                                                                                  #  SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF THE ARGUMENT.  ALSO, THE CELL SHFTFLAG CONTAINS A BINARY
063007,000429:                                                                                                  #  EXPONENT S, SUCH THAT THE SQUARE ROOT (RETURNED IN THE A REGISTER) MUST BE SHIFTED RIGHT (MULTIPLIED BY 2 TO THE
063008,000430:                                                                                                  #  POWER (-S)) IN ORDER TO BE THE TRUE SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF FUNCTION, FUNCTION +1.
063009,000431:                                                                                                  #  SQUARE ROOT ERROR IS NOT MORE THAN 2 IN THE 14TH SIGNIFICANT BIT.  CELLS CLOBBERED ARE A, L, SHFTFLAG, ININDEX,
063010,000432:                                                                                                  #  HALFARG, SCRATCH, SR, FUNCTION, FUNCTION +1.  GTSQRT IS CALLED BY TC GTSQRT AND RETURNS VIA TC Q OR TC FUNCTION +1.
063011,000433:                                                                                                  #  ZERO OR NEGATIVE ARGUMENTS YIELD ZERO FOR SQUARE ROOTS.
063012,000434: 
063013,000435: 21,3432           11751        GTSQRT             CCS      FUNCTION                              
063014,000436: 21,3433           13451                           TCF      GOODARG                               #  FUNCTION IS POSITIVE.  TAKE SQUARE ROOT.
063015,000437: 21,3434           13436                           TCF      +2                                    #  HIGH ORDER WORD IS ZERO.  TRY THE LOWER.
063016,000438: 21,3435           13442                           TCF      ZEROOT                                #  NEGATIVE.  USE ZERO FOR 1/2 POWER.
063017,000439: 
063018,000440: 21,3436           31752                           CA       FUNCTION   +1                         
063019,000441: 21,3437           00006                           EXTEND                                         
063020,000442: 21,3440           63442                           BZMF     ZEROOT                                
063021,000443: 
063022,000444: 21,3441           13445                           TCF      ZEROHIGH                              #  PROCEED.
063023,000445: 21,3442           34755        ZEROOT             CA       ZERO                                  
063024,000446: 21,3443           55741                           TS       SHFTFLAG                              
063025,000447: 21,3444           00002                           TC       Q                                     
063026,000448: 
063027,000449: 21,3445           57751        ZEROHIGH           XCH      FUNCTION                              #  14 MOST SIGNIFICANT BITS ARE IN THE
063028,000450: 21,3446           57752                           XCH      FUNCTION   +1                         #  LOWER WORD.  EXCHANGE THEM.
063029,000451: 21,3447           34757                           CA       SEVEN                                 
063030,000452: 21,3450           13452                           TCF      GOODARG    +1                         
063031,000453: 
063032,000454: 21,3451           34755        GOODARG            CA       ZERO                                  
063033,000455: 21,3452           55741                           TS       SHFTFLAG                              
063034,000456: 21,3453           35741                           CA       TWELVE                                #  INITIALIZE THE SCALING LOOP.
063035,000457: 21,3454           55744                           TS       ININDEX                               
063036,000458: 21,3455           13464                           TCF      SCALLOOP                              
063037,000459: 
063038,000460: 21,3456           31751        SCALSTRT           CA       FUNCTION                              
063039,000461: 21,3457           13500                           TCF      SCALDONE                              
063040,000462: 
063041,000463: 21,3460           37751        MULBUSH            CA       NEG2                                  #  IF ARG IS NOT LESS THAN 1/4, INDEX IS
063042,000464: 21,3461           27744                           ADS      ININDEX                               #  ZERO, INDICATING NO SHIFT NEEDED.
063043,000465: 21,3462           00006                           EXTEND                                         #  BRANCH IF ARG IS NOT LESS THAN 1/4.
063044,000466: 21,3463           63456                           BZMF     SCALSTRT                              #  OTHERWISE COMPARE ARG WITH A REFERENCE
063045,000467:                                                                                                  #  WHICH IS 4 TIMES LARGER THAN THE LAST.
063046,000468: 21,3464           41751        SCALLOOP           CS       FUNCTION                              
063047,000469: 21,3465           51744                           INDEX    ININDEX                               
063048,000470: 21,3466           64735                           AD       BIT15                                 #  REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
063049,000471: 21,3467           00006                           EXTEND                                         
063050,000472: 21,3470           63460                           BZMF     MULBUSH                               #  IF ARG IS NOT LESS THAN REFERENCE, GO
063051,000473:                                                                                                  #  AROUND THE MULBERRY BUSH ONCE MORE.

Page 1472

063053,000475: 21,3471           51744                           INDEX    ININDEX                               
063054,000476: 21,3472           34735                           CA       BIT15                                 #  THIS IS THE SCALE MAGNITUDE
063055,000477: 21,3473           57747                           XCH      HALFARG                               #  2**(-ININDEX) IS THE SHIFT DIVISOR.
063056,000478: 21,3474           00006                           EXTEND                                         #  RESCALE ARGUMENT.
063057,000479: 21,3475           31752                           DCA      FUNCTION                              
063058,000480: 21,3476           00006                           EXTEND                                         
063059,000481: 21,3477           11747                           DV       HALFARG                               
063060,000482:                                                                                                  #  ININDEX AND SHFTFLAG PRESERVE INFO FOR
063061,000483: 
063062,000484:                                                                                                  #  RESCALING AFTER ROOT PROCESS.
063063,000485: 21,3500           00006        SCALDONE           EXTEND                                         
063064,000486: 21,3501           23752                           QXCH     FUNCTION   +1                         #  SAVE Q FOR RETURN
063065,000487: 21,3502           00006                           EXTEND                                         
063066,000488: 21,3503           74736                           MP       BIT14                                 
063067,000489: 21,3504           55747                           TS       HALFARG                               
063068,000490: 21,3505           74737                           MASK     BIT13                                 
063069,000491: 21,3506           10000                           CCS      A                                     
063070,000492: 21,3507           33625                           CA       OCT11276                              
063071,000493: 21,3510           63623                           AD       ROOTHALF                              #  INITIAL GUESS IS ROOT 1/2 OR POSMAX
063072,000494: 21,3511           03627                           TC       ROOTCYCL                              
063073,000495: 21,3512           03627                           TC       ROOTCYCL                              
063074,000496: 21,3513           03627                           TC       ROOTCYCL                              
063075,000497: 21,3514           01752                           TC       FUNCTION   +1                         
063076,000498: 
063077,000499:                                                                                                  #  ****************************************************************************************************************
063078,000500: 
063079,000501: 21,3515           03432        RSTOFGTS           TC       GTSQRT                                
063080,000502: 21,3516           57742        PRODUCT            XCH      K2CNTRAL                              
063081,000503: 21,3517           00006                           EXTEND                                         
063082,000504: 21,3520           71742                           MP       K2CNTRAL                              
063083,000505: 21,3521           53743                           DXCH     K2CNTRAL                              
063084,000506: 21,3522           00006                           EXTEND                                         #               THE PRODUCT OF
063085,000507: 21,3523           70001                           MP       L                                     #   1/2                   2       1/2
063086,000508: 21,3524           27743                           ADS      K2CNTRAL   +1                         #  K   *(DEL*OMEGA + ALPHA /(2*K))
063087,000509: 21,3525           54001                           TS       L                                     #                      AND
063088,000510: 21,3526           13530                           TCF      +2                                    #                         2
063089,000511: 21,3527           27742                           ADS      K2CNTRAL                              #   DEL*(DEL*OMEGA + ALPHA /(2*K)) NOW IN 
063090,000512:                                                                                                  #  K2CNTRAL
063091,000513: 
063092,000514: 21,3530           31744        DOSHIFT            CA       ININDEX                               
063093,000515: 21,3531           00006                           EXTEND                                         #  MULTIPLY IN THE FACTOR 2(-S), RETURNED
063094,000516: 21,3532           74736                           MP       BIT14                                 #  BY THE GTSQRT SUBROUTINE
063095,000517: 21,3533           27741                           ADS      SHFTFLAG                              
063096,000518: 21,3534           00006                           EXTEND                                         
063097,000519: 21,3535           13554                           BZF      ADDITIN                               
063098,000520: 21,3536           51741                           INDEX    SHFTFLAG                              
063099,000521: 21,3537           34735                           CA       BIT15                                 

Page 1473

063101,000523: 21,3540           57742                           XCH      K2CNTRAL                              
063102,000524: 21,3541           00006                           EXTEND                                         
063103,000525: 21,3542           71742                           MP       K2CNTRAL                              
063104,000526: 21,3543           21740                           DAS      K2THETA                               
063105,000527: 21,3544           57742                           XCH      K2CNTRAL                              
063106,000528: 21,3545           00006                           EXTEND                                         
063107,000529: 21,3546           71743                           MP       K2CNTRAL   +1                         
063108,000530: 21,3547           27740                           ADS      K2THETA    +1                         
063109,000531: 21,3550           54001                           TS       L                                     
063110,000532: 21,3551           13553                           TCF      +2                                    
063111,000533: 21,3552           27737                           ADS      K2THETA                               
063112,000534: 
063113,000535: 21,3553           13557                           TCF      NEGUSUM                               
063114,000536: 
063115,000537: 21,3554           00006        ADDITIN            EXTEND                                         
063116,000538: 21,3555           31743                           DCA      K2CNTRAL                              
063117,000539: 21,3556           21740                           DAS      K2THETA                               #  NOW ADD IN THE K2THETA TERM.
063118,000540: 21,3557           11737        NEGUSUM            CCS      K2THETA                               #  TEST SIGN OF HIGH ORDER PART.
063119,000541: 21,3560           13564                           TCF      NEGDRIVE                              
063120,000542: 21,3561           13563                           TCF      +2                                    
063121,000543: 21,3562           13566                           TCF      POSDRIVE                              
063122,000544: 
063123,000545: 21,3563           11740                           CCS      K2THETA    +1                         #  SIGN TEST FOR LOW ORDER PART.
063124,000546: 21,3564           34753        NEGDRIVE           CA       BIT1                                  
063125,000547: 21,3565           13567                           TCF      +2                                    #  STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
063126,000548: 21,3566           44753        POSDRIVE           CS       BIT1                                  
063127,000549: 21,3567           54001                           TS       L                                     #  SAVE FOR DRIVE REVERSAL TEST.
063128,000550: 21,3570           51750                           INDEX    QRCNTR                                
063129,000551: 21,3571           57501                           XCH      NEGUQ                                 
063130,000552: 
063131,000553: 21,3572           00006                           EXTEND                                         
063132,000554: 21,3573           70001                           MP       L                                     #  MULTIPLY OLD NEGU AND NEW NEGU.
063133,000555: 21,3574           10001                           CCS      L                                     
063134,000556: 21,3575           13612                           TCF      LOUPE                                 #  NON-ZERO GIMBAL DRIVE BEING CONTINUED.
063135,000557: 
063136,000558: 21,3576           13607                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
063137,000559: 
063138,000560: 21,3577           13601                           TCF      REVERSAL                              #  NON-ZERO GIMBAL DRIVE BEING REVERSED.
063139,000561: 21,3600           13607                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
063140,000562: 
063141,000563: 21,3601           51750        REVERSAL           INDEX    QRCNTR                                #  A ZERO-DRIVE PAUSE IS NEEDED HERE.  ZERO
063142,000564: 21,3602           55510                           TS       QACCDOT                               #  IS IN A REGISTER FROM CCS ON (-1).
063143,000565: 21,3603           51750                           INDEX    QRCNTR                                
063144,000566: 21,3604           43624                           CS       GMBLBITA                              
063145,000567: 21,3605           00006                           EXTEND                                         
063146,000568: 21,3606           03012                           WAND     CHAN12                                
063147,000569: 
063148,000570: 21,3607           41262        ZEROLOUP           CS       RCSFLAGS                              #  SET UP REQUEST FOR ACDT+C12 CALL.
063149,000571: 21,3610           74747                           MASK     CALLGMBL                              
063150,000572: 21,3611           27262                           ADS      RCSFLAGS                              

Page 1474

063152,000574: 21,3612           11750        LOUPE              CCS      QRCNTR                                #  HAVE BOTH AXES BEEN PROCESSED?
063153,000575: 21,3613           13106                           TCF      GOQTRIMG                              #  NO.  DO Q AXIS NEXT.
063154,000576: 
063155,000577: 21,3614           31505                           CA       SAVESR                                #  RESTORE THE SR
063156,000578: 21,3615           54021                           TS       SR                                    
063157,000579: 
063158,000580: 21,3616           00006        GOCLOSE            EXTEND                                         #  TERMINATE THE JASK.
063159,000581: 21,3617           33622                           DCA      CLOSEADR                              
063160,000582: 21,3620           52006                           DTCB                                           
063161,000583: 
063162,000584: 21,3621  E6,1537                                  EBANK=   AOSQ                                  
063163,000585: 21,3621           03270 36106  CLOSEADR           2CADR    CLOSEOUT                              #  TERMINATE THE JASK.
063164,000586: 
063165,000587: 21,3623     5741               TWELVE             EQUALS   OCT14                                 
063166,000588: 21,3623           26501        ROOTHALF           OCTAL    26501                                 #  SQUARE ROOT OF 1/2
063167,000589: 21,3624           01400        GMBLBITA           OCTAL    01400                                 #  INDEXED WRT GMBLBITB  DO NOT MOVE ******
063168,000590: 21,3625           11276        OCT11276           OCTAL    11276                                 #  POSMAX - ROOTHALF
063169,000591: 21,3626           06000        GMBLBITB           OCTAL    06000                                 #  INDEXED WRT GMBLBITA  DO NOT MOVE ******
063170,000592: 
063171,000593:                                                                                                  #  SUBROUTINE ROOTCYCL:  BY CRAIG WORK, 3 APRIL 68
063172,000594:                                                                                                  #  ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION.  THE INITIAL GUESS AT THE
063173,000595:                                                                                                  #  SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG.  THE NEW APPROXI-
063174,000596:                                                                                                  #  MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER.  DEBRIS:  A, L, SR, SCRATCH.  ROOTCYCL IS CALLED FROM
063175,000597:                                                                                                  #  LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
063176,000598: 
063177,000599:                                                                                                  #  WARNING:  IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
063178,000600: 
063179,000601: 21,3627           55746        ROOTCYCL           TS       SCRATCH                               #  STORE X
063180,000602: 21,3630           54021                           TS       SR                                    #  X/2 NOW IN SR
063181,000603: 21,3631           31747                           CA       HALFARG                               #  ARG/2 IN THE A REG
063182,000604: 21,3632           22007                           ZL                                             #  PREPARE FOR DIVISION
063183,000605: 21,3633           00006                           EXTEND                                         
063184,000606: 21,3634           11746                           DV       SCRATCH                               #  (ARG/X)/2
063185,000607: 21,3635           60021                           AD       SR                                    #  (X + ARG/X)/2 IN THE A REG
063186,000608: 21,3636           00002                           TC       Q                                     
063187,000609: 
063188,000610: 

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