Source Code

This source code is very close to the Apollo Guidance Computer software for the Apollo 13 Lunar module. This revision of the Luminary 131 program is from December of 1969, whereas there was a later revision in January of 1970, and still another revision in February, which is the code that flew on the mission. As far as this transcription is concerned, it was originally from a copy made in 1991 of a printout from the collection of AGC developer Don Eyles for collector David Craig. It was subsequently scanned by Gary Neff, reprocessed for online presentation at the now-discontinued History of Recent Science and Technology (HRST) website of MIT's Dibner Institute (the full-quality scans being discarded in the process), and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a high-quality replacement scan for a completely illegible page was later provided by Gary Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many errors to be introduced into the transcription. Accordingly, a second scan of the same physical printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive, and used to correct the transcription errors. All of the scanned materials mentioned, as well as other Luminary 131 related material, are available online. Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017, so the two scans are not identical in that respect. The page-headings in the printout read, in part:
	GAP:  ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091
	17:53 DEC. 19, 1969
Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together.

062234,000002:                                                                                                  ## Copyright:   Public domain.
062235,000003:                                                                                                  ## Filename:    TRIM_GIMBAL_CNTROL_SYSTEM.agc
062236,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
062237,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
062238,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
062239,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
062240,000008:                                                                                                  ##              that the code format has been changed to conform to the
062241,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
062242,000010:                                                                                                  ##              original YUL assembler.
062243,000011:                                                                                                  ## Reference:   pp. 1464-1476
062244,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
062245,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
062246,000014:                                                                                                  ## Mod history: 06/08/03 RSB.   Began transcribing.
062247,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
062248,000016:                                                                                                  ##              2010-10-25 JL   Indentation fixes.
062249,000017:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
062250,000018:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
062251,000019:                                                                                                  ##                              numbers in 1701.pdf.
062252,000020:                                                                                                  ##              2017-02-28 RSB  Proofed comment text using octopus/ProoferComments.
062253,000021:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes noted in proofing Luminary 116.
062254,000022:                                                                                                  ##              2021-05-30 ABS  GTSGO+DN -> GTSGO+ON
062255,000023: 

Page 1464

062257,000025: 21,3076                                           BANK     21                                    
062258,000026: 21,3076  E6,1450                                  EBANK=   QDIFF                                 
062259,000027: 21,2000                                           SETLOC   DAPS4                                 
062260,000028: 21,2000                                           BANK                                           
062261,000029: 
062262,000030: 21,3076                                           COUNT*   $$/DAPGT                              
062263,000031: 
062264,000032:                                                                                                  #  CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
062265,000033:                                                                                                  #  AUTOPILOT ARE BOTH ON:
062266,000034:                                                                                                  #        A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
062267,000035:                                                                                                  #           INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
062268,000036:                                                                                                  #        B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
062269,000037:                                                                                                  #           ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
062270,000038:                                                                                                  #  GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
062271,000039: 
062272,000040: 21,3076           37752        GTS                CAF      NEGONE                                #  MAKE THE NEXT PASS THROUGH THE DAP BE
062273,000041: 21,3077           55630                           TS       COTROLER                              #        THROUGH RCS CONTROL,
062274,000042: 21,3100           34751                           CAF      FOUR                                  #        AND ENSURE THAT IT IS NOT A SKIP.
062275,000043: 21,3101           55534                           TS       SKIPU                                 
062276,000044: 21,3102           55535                           TS       SKIPV                                 
062277,000045: 
062278,000046: 21,3103           34752                           CAF      TWO                                   
062279,000047: 21,3104           55632                           TS       INGTS                                 #  SET INDICATOR OF GTS CONTROL POSITIVE.
062280,000048: 21,3105           55631                           TS       QGIMTIMR                              #  SET TIMERS TO 200 MSEC TO AVOID BOTH
062281,000049: 21,3106           55633                           TS       RGIMTIMR                              #  RUNAWAY AND INTERFERENCE BY NULLING.
062282,000050: 
062283,000051:                                                                                                  #  THE DRIVE SETTING ALGORITHM
062284,000052:                                                                                                  #        DEL = SGN(OMEGA + ALPHA*ABS(ALPHA)/(2*K))
062285,000053:                                                                                                  #                                                    2               1/2                  2       3/2
062286,000054:                                                                                                  #        NEGUSUM = ERROR*K + ALPHA*(DEL*OMEGA + ALPHA /(3*K)) + DEL*K   (DEL*OMEGA + ALPHA /(2*K))
062287,000055:                                                                                                  #        DRIVE = -SGN(NEGUSUM)
062288,000056: 
062289,000057: 21,3107           30021                           CA       SR                                    #  SAVE THE SR.  SHIFT IT LEFT TO CORRECT
062290,000058: 21,3110           60000                           AD       A                                     #  FOR THE RIGHT SHIFT DUE TO EDITING.
062291,000059: 21,3111           55505                           TS       SAVESR                                
062292,000060: 
062293,000061: 21,3112           34752        GTSGO+ON           CAF      TWO                                   #  SET INDEXER FOR R-AXIS CALCULATIONS.
062294,000062: 21,3113           13115                           TCF      GOQTRIMG   +1                         
062295,000063: 
062296,000064: 21,3114           34755        GOQTRIMG           CAF      ZERO                                  #  SET INDEXER FOR Q-AXIS CALCULATIONS
062297,000065: 21,3115           55747                           TS       QRCNTR                                
062298,000066: 
062299,000067: 21,3116           51747                           INDEX    QRCNTR                                #  AOS SCALED AT PI/2
062300,000068: 21,3117           31536                           CA       AOSQ                                  
062301,000069: 21,3120           00006                           EXTEND                                         
062302,000070: 21,3121           74752                           MP       BIT2                                  #  RESCALE AOS TO PI/4

Page 1465

062304,000072: 21,3122           00006                           EXTEND                                         
062305,000073: 21,3123           13127                           BZF      GTSQAXIS   -3                         #  USE FULL SCALE FOR LARGER AOS ESTIMATES.
062306,000074: 
062307,000075: 21,3124           50000                           INDEX    A                                     
062308,000076: 21,3125           44734                           CS       LIMITS                                #  LIMITS +1 CONTAINS NEGMAX.
062309,000077: 21,3126           56001                           XCH      L                                     #  LIMITS -1 CONTAINS POSMAX.
062310,000078: 
062311,000079: 21,3127           11747                           CCS      QRCNTR                                #  PICK UP RATE FOR THIS AXIS.  RATE CELLS
062312,000080: 21,3130           50000                           INDEX    A                                     #  ARE ADJACENT, NOT SEPARATED.  AT PI/4
062313,000081: 21,3131           31436                           CA       EDOTQ                                 
062314,000082: 21,3132           53743        GTSQAXIS           DXCH     WCENTRAL                              
062315,000083: 
062316,000084: 21,3133           51747                           INDEX    QRCNTR                                #  COLLECT K FOR THIS AXIS
062317,000085: 21,3134           31504                           CA       KQ                                    
062318,000086: 21,3135           55740                           TS       KCENTRAL                              
062319,000087: 
062320,000088: 21,3136           00006                           EXTEND                                         #  CONTROL AUTHORITY ZERO.  AVOID DRIVING
062321,000089: 21,3137           13575                           BZF      POSDRIVE   +1                         #  ENGINE BELL TO THE STOPS.
062322,000090: 
062323,000091: 21,3140           51747                           INDEX    QRCNTR                                #  QDIFF, RDIFF ARE STORED IN D.P.
062324,000092: 21,3141           31450                           CAE      QDIFF                                 
062325,000093: 
062326,000094: 21,3142           00006        ALGORTHM           EXTEND                                         #  Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
062327,000095: 21,3143           71740                           MP       KCENTRAL                              #  FORM K*ERROR AT PI(2)/2(8), IN D.P.
062328,000096: 21,3144           23736                           LXCH     K2THETA                               
062329,000097: 21,3145           00006                           EXTEND                                         
062330,000098: 21,3146           74747                           MP       BIT5                                  #  RESCALE TO 4*PI(2)
062331,000099: 21,3147           53737                           DXCH     K2THETA                               
062332,000100: 21,3150           00006                           EXTEND                                         
062333,000101: 21,3151           74747                           MP       BIT5                                  #  FIRST TERM OF NEGUSUM IN K2THETA.
062334,000102: 21,3152           27737                           ADS      K2THETA    +1                         #  NO CARRY NEEDED       D.P. AT 4*PI(2)
062335,000103: 
062336,000104: 21,3153           41743                           CS       ACENTRAL                              #  FORM ALPHA(2)/(2*K) AT 16*PI, IN D.P.,
062337,000105: 21,3154           00006                           EXTEND                                         #  LIMITING QUOTIENT TO AVOID OVERFLOW.
062338,000106: 21,3155           74736                           MP       BIT14                                 #  -ALPHA/2 IN A, SCALED AT PI/4
062339,000107: 21,3156           00006                           EXTEND                                         
062340,000108: 21,3157           71743                           MP       ACENTRAL                              #  -ALPHA(2)/2 IN A,L, SCALED AT PI(2)/16
062341,000109: 21,3160           61740                           AD       KCENTRAL                              
062342,000110: 21,3161           00006                           EXTEND                                         
062343,000111: 21,3162           63177                           BZMF     HUGEQUOT                              #  K-ALPHA(2)/2 SHOULD BE PNZ FO DIVISION
062344,000112: 
062345,000113: 21,3163           00006                           EXTEND                                         
062346,000114: 21,3164           40001                           DCS      A                                     #  ALPHA(2)/2 - K
062347,000115: 21,3165           61740                           AD       KCENTRAL                              
062348,000116: 21,3166           00006                           EXTEND                                         
062349,000117: 21,3167           11740                           DV       KCENTRAL                              #  HIGH ORDER OF QUOTIENT.
062350,000118: 21,3170           57745                           XCH      A2CNTRAL                              
062351,000119: 21,3171           30001                           CA       L                                     #  SHIFT UP THE REMAINDER.
062352,000120: 21,3172           22007                           LXCH     7                                     #  ZERO LOW-ORDER DIVIDEND.
062353,000121: 21,3173           00006                           EXTEND                                         

Page 1466

062355,000123: 21,3174           11740                           DV       KCENTRAL                              
062356,000124: 21,3175           57746                           XCH      A2CNTRAL   +1                         #  QUOTIENT STORED AT 16*PI, D.P.
062357,000125: 21,3176           13202                           TCF      HAVEQUOT                              
062358,000126: 
062359,000127: 21,3177           34733        HUGEQUOT           CA       POSMAX                                
062360,000128: 21,3200           54001                           TS       L                                     
062361,000129: 21,3201           53746                           DXCH     A2CNTRAL                              #  LIMITED QUOTIENT STORED AT 16*PI, D.P.
062362,000130: 
062363,000131: 21,3202           31742        HAVEQUOT           CA       WCENTRAL                              
062364,000132: 21,3203           00006                           EXTEND                                         
062365,000133: 21,3204           74743                           MP       BIT9                                  #  RESCALE OMEGA AT 16*PI IN D.P.
062366,000134: 21,3205           53742                           DXCH     K2CNTRAL                              #  LOWER WORD OVERLAYS OMEGA IN WCENTRAL
062367,000135: 
062368,000136: 21,3206           00006                           EXTEND                                         
062369,000137: 21,3207           31742                           DCA      K2CNTRAL                              
062370,000138: 21,3210           53751                           DXCH     FUNCTION                              
062371,000139: 
062372,000140: 21,3211           31743                           CA       ACENTRAL                              #  GET ALPHA*ABS(ALPHA)/(2*K)
062373,000141: 21,3212           00006                           EXTEND                                         
062374,000142: 21,3213           63217                           BZMF     +4                                    
062375,000143: 
062376,000144: 21,3214           00006                           EXTEND                                         
062377,000145: 21,3215           31746                           DCA      A2CNTRAL                              
062378,000146: 21,3216           13221                           TCF      +3                                    
062379,000147: 
062380,000148: 21,3217           00006                           EXTEND                                         
062381,000149: 21,3220           41746                           DCS      A2CNTRAL                              
062382,000150: 
062383,000151: 21,3221           21751                           DAS      FUNCTION                              #  OMEGA + ALPHA*ABS(ALPHA)/2*K) AT 16*PI
062384,000152: 
062385,000153: 21,3222           11750                           CCS      FUNCTION                              #  DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
062386,000154: 21,3223           13227                           TCF      POSFNCT1                              #  OTHERWISE DEL = -1
062387,000155: 21,3224           13226                           TCF      +2                                    
062388,000156: 21,3225           13231                           TCF      NEGFNCT1                              
062389,000157: 
062390,000158: 21,3226           11751                           CCS      FUNCTION   +1                         #  USE LOW ORDER WORD SINCE HIGH IS ZERO
062391,000159: 21,3227           34753        POSFNCT1           CAF      BIT1                                  
062392,000160: 21,3230           13232                           TCF      +2                                    
062393,000161: 21,3231           44753        NEGFNCT1           CS       BIT1                                  
062394,000162: 21,3232           55744                           TS       DEL                                   
062395,000163: 
062396,000164: 21,3233           11744                           CCS      DEL                                   #  REPLACE OMEGA BY DEL*OMEGA
062397,000165: 21,3234           13246                           TCF      FUNCT2                                #  POSITIVE DEL VALUE.  PROCEED.
062398,000166: 21,3235           13237                           TCF      DEFUNCT                               
062399,000167: 21,3236           13243                           TCF      NEGFNCT2                              
062400,000168: 
062401,000169: 21,3237           55741        DEFUNCT            TS       K2CNTRAL                              
062402,000170: 21,3240           55742                           TS       K2CNTRAL   +1                         
062403,000171: 21,3241           13246                           TCF      FUNCT2                                
062404,000172: 

Page 1467

062406,000174: 21,3242           65252        NEG1/3             DEC      -.33333                               
062407,000175: 
062408,000176: 21,3243           00006        NEGFNCT2           EXTEND                                         
062409,000177: 21,3244           41742                           DCS      K2CNTRAL                              
062410,000178: 21,3245           53742                           DXCH     K2CNTRAL                              
062411,000179: 
062412,000180: 21,3246           00006        FUNCT2             EXTEND                                         
062413,000181: 21,3247           31746                           DCA      A2CNTRAL                              
062414,000182: 21,3250           21742                           DAS      K2CNTRAL                              #  DEL*OMEGA + ALPHA(2)/(2*K) AT 16*PI, D.P.
062415,000183: 
062416,000184: 21,3251           31745        FUNCT3             CA       A2CNTRAL                              
062417,000185: 21,3252           00006                           EXTEND                                         
062418,000186: 21,3253           73242                           MP       NEG1/3                                
062419,000187: 21,3254           53746                           DXCH     A2CNTRAL                              
062420,000188: 21,3255           30001                           CA       L                                     
062421,000189: 21,3256           00006                           EXTEND                                         
062422,000190: 21,3257           73242                           MP       NEG1/3                                
062423,000191: 21,3260           27746                           ADS      A2CNTRAL   +1                         
062424,000192: 21,3261           54001                           TS       L                                     
062425,000193: 21,3262           13264                           TCF      +2                                    #  A2CNTRAL NOW CONTAINS -ALPHA(2)/(6*K),
062426,000194: 21,3263           27745                           ADS      A2CNTRAL                              #  SCALED AT 16*PI, IN D.P.
062427,000195: 
062428,000196: 21,3264           00006                           EXTEND                                         
062429,000197: 21,3265           31742                           DCA      K2CNTRAL                              #  DEL*OMEGA + ALPHA(2)/(3*K) IN A2CNTRAL,
062430,000198: 21,3266           21746                           DAS      A2CNTRAL                              #  SCALED AT 16*PI, D.P.
062431,000199: 
062432,000200: 21,3267           31745                           CA       A2CNTRAL                              
062433,000201: 21,3270           00006                           EXTEND                                         
062434,000202: 21,3271           71743                           MP       ACENTRAL                              
062435,000203: 21,3272           21737                           DAS      K2THETA                               
062436,000204: 21,3273           31746                           CA       A2CNTRAL   +1                         
062437,000205: 21,3274           00006                           EXTEND                                         
062438,000206: 21,3275           71743                           MP       ACENTRAL                              #  ACENTRAL MAY NOW BE OVERLAID.
062439,000207: 21,3276           27737                           ADS      K2THETA    +1                         
062440,000208: 21,3277           54001                           TS       L                                     
062441,000209: 21,3300           13302                           TCF      +2                                    #  TWO TERMS OF NEGUSUM ACCUMULATED, SO FAR
062442,000210: 21,3301           27736                           ADS      K2THETA                               #  SCALED AT 4*PI(2), IN D.P.
062443,000211: 
062444,000212: 21,3302           31741        GETROOT            CA       K2CNTRAL                              #  K*(DEL*OMEGA + ALPHA(2)/(2*K)) IS THE
062445,000213: 21,3303           00006                           EXTEND                                         #  TERM FOR WHICH A SQUARE ROOT IS NEEDED.
062446,000214: 21,3304           71740                           MP       KCENTRAL                              #  K AT PI/2(8)
062447,000215: 21,3305           53751                           DXCH     FUNCTION                              
062448,000216: 21,3306           31742                           CA       K2CNTRAL   +1                         
062449,000217: 21,3307           00006                           EXTEND                                         
062450,000218: 21,3310           71740                           MP       KCENTRAL                              
062451,000219: 21,3311           27751                           ADS      FUNCTION   +1                         
062452,000220: 21,3312           54001                           TS       L                                     
062453,000221: 21,3313           13315                           TCF      +2                                    
062454,000222: 21,3314           27750                           ADS      FUNCTION                              #  DESIRED TERM IN FUNCTION, AT PI(2)/16

Page 1468

062456,000224: 21,3315           11744                           CCS      DEL                                   
062457,000225: 21,3316           13523                           TCF      RSTOFGTS                              
062458,000226: 21,3317           13565                           TCF      NEGUSUM                               
062459,000227: 21,3320           13322                           TCF      NEGATE                                
062460,000228: 21,3321           13565                           TCF      NEGUSUM                               
062461,000229: 
062462,000230: 21,3322           00006        NEGATE             EXTEND                                         
062463,000231: 21,3323           41742                           DCS      K2CNTRAL                              
062464,000232: 21,3324           53742                           DXCH     K2CNTRAL                              
062465,000233: 21,3325           13523                           TCF      RSTOFGTS                              
062466,000234: 
062467,000235: 16,3741                                           BANK     16                                    
062468,000236: 16,3741  E6,1501                                  EBANK=   NEGUQ                                 
062469,000237: 16,2000                                           SETLOC   DAPS1                                 
062470,000238: 16,2000                                           BANK                                           
062471,000239: 
062472,000240:                                                                                                  #  THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
062473,000241:                                                                                                  #  THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES.  ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
062474,000242: 
062475,000243:                                                                                                  #  WARNING:  ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
062476,000244: 
062477,000245: 16,3741           07400        BGIM               OCTAL    07400                                 
062478,000246: 16,3742     0066               CHNL12             EQUALS   ITEMP6                                
062479,000247: 16,3742           41501        ACDT+C12           CS       NEGUQ                                 
062480,000248: 16,3743           00006                           EXTEND                                         #  GIMBAL DRIVE REQUESTS.
062481,000249: 16,3744           71507                           MP       ACCDOTQ                               
062482,000250: 16,3745           23510                           LXCH     QACCDOT                               
062483,000251: 16,3746           41503                           CS       NEGUR                                 
062484,000252: 16,3747           00006                           EXTEND                                         
062485,000253: 16,3750           71511                           MP       ACCDOTR                               
062486,000254: 16,3751           23512                           LXCH     RACCDOT                               
062487,000255: 
062488,000256: 16,3752           11501                           CCS      NEGUQ                                 
062489,000257: 16,3753           34742                           CAF      BIT10                                 
062490,000258: 16,3754           13756                           TCF      +2                                    
062491,000259: 16,3755           34743                           CAF      BIT9                                  
062492,000260: 16,3756           54066                           TS       CHNL12                                
062493,000261: 
062494,000262: 16,3757           11503                           CCS      NEGUR                                 
062495,000263: 16,3760           34740                           CAF      BIT12                                 
062496,000264: 16,3761           13763                           TCF      +2                                    
062497,000265: 16,3762           34741                           CAF      BIT11                                 
062498,000266: 16,3763           26066                           ADS      CHNL12                                #  (STORED RESULT NOT USED AT PRESENT)
062499,000267: 
062500,000268: 16,3764           43741                           CS       BGIM                                  
062501,000269: 16,3765           00006                           EXTEND                                         
062502,000270: 16,3766           02012                           RAND     CHAN12                                
062503,000271: 16,3767           60066                           AD       CHNL12                                
062504,000272: 16,3770           00006                           EXTEND                                         
062505,000273: 16,3771           01012                           WRITE    CHAN12                                

Page 1469

062507,000275: 16,3772           44747                           CS       CALLGMBL                              #  TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
062508,000276: 16,3773           71262                           MASK     RCSFLAGS                              
062509,000277: 16,3774           55262                           TS       RCSFLAGS                              
062510,000278: 
062511,000279: 16,3775           00002                           TC       Q                                     #  RETURN TO CALLER.
062512,000280: 
062513,000281: 21,3326                                           BANK     21                                    
062514,000282: 21,3326  E6,1450                                  EBANK=   QDIFF                                 
062515,000283: 21,2000                                           SETLOC   DAPS4                                 
062516,000284: 21,2000                                           BANK                                           
062517,000285: 

Page 1470

062519,000287:                                                                                                  #  SUBROUTINE TIMEGMBL:  MOD 0, OCTOBER 1967, CRAIG WORK
062520,000288: 
062521,000289:                                                                                                  #  TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
062522,000290:                                                                                                  #  THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS.  INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
062523,000291:                                                                                                  #  SCALED AT PI/8.  FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT).  A ZERO
062524,000292:                                                                                                  #  ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY.  OTHERWISE, THE GIMBAL IS TURNED ON
062525,000293:                                                                                                  #  DRIVING IN THE CORRECT DIRECTION.  THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
062526,000294:                                                                                                  #  IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE.  NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
062527,000295:                                                                                                  #  WHICH IS NEGATIVE, ZERO, OR POSITIVE.
062528,000296: 
062529,000297:                                                                                                  #  INPUTS:       AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7).     PI/2(7).
062530,000298: 
062531,000299:                                                                                                  #  OUTPUTS:      NEW GIMBAL DRIVE BITS IN CHANNEL 12, NEGUQ, NEGUR, QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
062532,000300:                                                                                                  #                Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
062533,000301: 
062534,000302:                                                                                                  #  DEBRIS:       A, L, Q, ITEMPS 2, 3, 6, RUPTREG2 AND ACDT+C12 DEBRIS.
062535,000303: 
062536,000304:                                                                                                  #  EXITS:        VIA TC Q.
062537,000305: 
062538,000306:                                                                                                  #  ALARMS, ABORTS, :  NONE
062539,000307: 
062540,000308:                                                                                                  #  SUBROUTINES:  ACDT+C12, IBNKCALL
062541,000309: 
062542,000310:                                                                                                  #  WARNING:      THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS.  THEREFORE IT MAY ONLY BE CALLED WITH
062543,000311:                                                                                                  #                INTERRUPT INHIBITED.
062544,000312: 
062545,000313:                                                                                                  #  ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
062546,000314:                                                                                                  #        NEGUQ           ERASE   +2              NEGATIVE OF Q-AXIS GIMBAL DRIVE
062547,000315:                                                                                                  #        (SPWORD)        EQUALS  NEGUQ +1        ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
062548,000316:                                                                                                  #        NEGUR           EQUALS  NEGUQ +2        NEGATIVE OF R-AXIS GIMBAL DRIVE
062549,000317:                                                                                                  #        ACCDOTQ         ERASE   +2              Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
062550,000318:                                                                                                  #        (SPWORD)        EQUALS  ACCDOTQ +1      ANY S.P. ERASABLE NUMBER NOW QACCDOT
062551,000319:                                                                                                  #        ACCDOTR         EQUALS  ACCDOTQ +2      R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
062552,000320:                                                                                                  #                                                ACCDOTQ, ACCDOTR ARE MAGNITUDES.
062553,000321:                                                                                                  #        AOSQ            ERASE   +4              Q-AXIS ACC., D.P. AT PI/2 R/SEC(2)
062554,000322:                                                                                                  #        AOSR            EQUALS  AOSQ +2         R-AXIS ACCELERATION SCALED AT PI/2 R/S2
062555,000323: 
062556,000324: 21,3326     0066               QRNDXER            EQUALS   ITEMP6                                
062557,000325: 21,3326           23146        OCT23146           OCTAL    23146                                 #  DECIMAL .6
062558,000326: 21,3327     0063               NZACCDOT           EQUALS   ITEMP3                                
062559,000327: 
062560,000328: 21,3327           34753        TIMEGMBL           CAF      ONE                                   #  INITIALIZE ALLOWGTS.
062561,000329: 21,3330           55502                           TS       ALLOWGTS                              
062562,000330: 
062563,000331: 21,3331           34752                           CAF      TWO                                   #  SET UP LOOP FOR R AXIS.
062564,000332: 21,3332           22002                           LXCH     Q                                     #  SAVE RETURN ADDRESS.
062565,000333: 21,3333           22071                           LXCH     RUPTREG2                              

Page 1471

062567,000335: 21,3334           13336                           TCF      +2                                    
062568,000336: 21,3335           34755        TIMQGMBL           CAF      ZERO                                  #  NOW DO THE Q-AXIS
062569,000337: 21,3336           54066                           TS       QRNDXER                               
062570,000338: 21,3337           50066                           INDEX    QRNDXER                               
062571,000339: 21,3340           31507                           CA       ACCDOTQ                               #  ACCDOT IS PRESUMED TO BE AT PI/2(7).
062572,000340: 21,3341           00006                           EXTEND                                         
062573,000341: 21,3342           63412                           BZMF     TGOFFNOW                              #  IS ACCDOT LESS THAN OR EQUAL TO 0?
062574,000342: 21,3343           54063                           TS       NZACCDOT                              #  NO.  STORE NON-ZERO, POSITIVE ACCDOT.
062575,000343: 
062576,000344: 21,3344           50066        ALPHATRY           INDEX    QRNDXER                               
062577,000345: 21,3345           41536                           CS       AOSQ                                  
062578,000346: 21,3346           00006                           EXTEND                                         
062579,000347: 21,3347           13412                           BZF      TGOFFNOW                              #  IS ALPHA ZERO?
062580,000348: 
062581,000349: 21,3350           54002                           TS       Q                                     #  SAVE A COPY OF -AOS.
062582,000350: 21,3351           00006                           EXTEND                                         #  NO.  RESCALE FOR TIMEGMBL USE.
062583,000351: 21,3352           73326                           MP       OCT23146                              #  OCTAL 23146 IS DECIMAL .6
062584,000352: 21,3353           60002                           AD       Q                                     #  -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
062585,000353: 21,3354           54001                           TS       L                                     #  WAS THERE OVERFLOW?
062586,000354: 21,3355           13362                           TCF      SETNEGU                               #  NO.  COMPUTE DRIVE TIME.
062587,000355: 
062588,000356: 21,3356           40000                           CS       A                                     #  RECOVER -SGN(AOS) IN THE A REGISTER.
062589,000357: 21,3357           50066                           INDEX    QRNDXER                               #  YES.  START DRIVE WITHOUT WAITLIST.
062590,000358: 21,3360           57501                           XCH      NEGUQ                                 
062591,000359: 21,3361           13416                           TCF      NOTALLOW                              #  KNOCK DOWN THE ALLOWGTS FLAG.
062592,000360: 
062593,000361: 21,3362           00006        SETNEGU            EXTEND                                         
062594,000362: 21,3363           63370                           BZMF     POSALPH                               
062595,000363: 
062596,000364: 21,3364           40000                           COM                                            
062597,000365: 21,3365           54062                           TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
062598,000366: 21,3366           44753                           CS       BIT1                                  
062599,000367: 21,3367           13372                           TCF      POSALPH    +2                         
062600,000368: 21,3370           54062        POSALPH            TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
062601,000369: 21,3371           34753                           CA       BIT1                                  
062602,000370: 21,3372           50066                 +2        INDEX    QRNDXER                               #  SGN(AOS) INTO NEGU
062603,000371: 21,3373           55501                           TS       NEGUQ                                 #  STORE SGN(APLHA) AS NEGU
062604,000372: 
062605,000373: 21,3374           30063                           CA       NZACCDOT                              
062606,000374: 21,3375           00006                           EXTEND                                         
062607,000375: 21,3376           74740                           MP       BIT12                                 #  2*ACCDOT, SCALED AT PI/8.
062608,000376: 21,3377           60062                           AD       ITEMP2                                #  -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
062609,000377: 21,3400           00006                           EXTEND                                         
062610,000378: 21,3401           63416                           BZMF     NOTALLOW                              #  IS DRIVE TIME MORE THAN TWO SECONDS?
062611,000379: 21,3402           40062                           CS       ITEMP2                                #  NO.  COMPUTE DRIVE TIME.
062612,000380: 21,3403           00006                           EXTEND                                         #  ABS(ALPHA) AT PI/8.
062613,000381: 21,3404           73437                           MP       OCT00240                              #  DECIMAL 10/1024
062614,000382: 21,3405           00006                           EXTEND                                         #  QUOTIENT IS DRIVE TIME AT WAITLIST.
062615,000383: 21,3406           10063                           DV       NZACCDOT                              #  ABS(ALPHA)/ACCDOT AT 2(14)/100

Page 1472

062617,000385: 21,3407           00006                           EXTEND                                         
062618,000386: 21,3410           13412                           BZF      TGOFFNOW                              #  DRIVE TIME MUST BE GREATER THAN ZERO.
062619,000387: 
062620,000388: 21,3411           13424                           TCF      DRIVEON                               
062621,000389: 
062622,000390: 21,3412           34755        TGOFFNOW           CAF      ZERO                                  #  TURN OFF GIMBAL NOW.
062623,000391: 21,3413           50066                           INDEX    QRNDXER                               
062624,000392: 21,3414           55501                           TS       NEGUQ                                 
062625,000393: 
062626,000394: 21,3415           13426                           TCF      DONEYET                               
062627,000395: 
062628,000396: 21,3416           36010        NOTALLOW           CAF      OCT31                                 
062629,000397: 21,3417           50066                           INDEX    QRNDXER                               
062630,000398: 21,3420           55631                           TS       QGIMTIMR                              
062631,000399: 21,3421           34755                           CAF      ZERO                                  #  DRIVE TIME IS MORE THAN 2 SECONDS, SO
062632,000400: 21,3422           55502                           TS       ALLOWGTS                              #  DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
062633,000401:                                                                                                  #  CONTROL UNTIL AOSTASK APPROVES.
062634,000402: 21,3423           13426                           TCF      DONEYET                               #  NO WAITLIST CALL IS MADE.
062635,000403: 
062636,000404: 21,3424           50066        DRIVEON            INDEX    QRNDXER                               
062637,000405: 21,3425           55631                           TS       QGIMTIMR                              #  CHOOSE Q OR R AXIS.
062638,000406: 
062639,000407: 21,3426           10066        DONEYET            CCS      QRNDXER                               
062640,000408: 21,3427           13335                           TCF      TIMQGMBL                              
062641,000409: 
062642,000410: 21,3430           52073                           DXCH     RUPTREG3                              #  PROTECT IBNKCALL ERASABLES.  ACDT+C12
062643,000411: 21,3431           52063                           DXCH     ITEMP2                                #  LEAVES ITEMPS2,3 ALONE.
062644,000412: 
062645,000413: 21,3432           04674                           TC       IBNKCALL                              #  TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
062646,000414: 21,3433           35742                           CADR     ACDT+C12                              
062647,000415: 
062648,000416: 21,3434           52063                           DXCH     ITEMP2                                #  RESTORE ERASABLES FOR IBNKCALL.
062649,000417: 21,3435           52073                           DXCH     RUPTREG3                              
062650,000418: 
062651,000419: 21,3436           00071                           TC       RUPTREG2                              #  RETURN TO CALLER.
062652,000420: 
062653,000421: 21,3437           00240        OCT00240           OCTAL    00240                                 #  DECIMAL 10/1024
062654,000422: 

Page 1473

062656,000424:                                                                                                  #  THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY.  THE QUANTITY NEGUSUM
062657,000425:                                                                                                  #  IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM.  NEW DRIVES ARE ENTERED TO CH 12.
062658,000426: 
062659,000427:                                                                                                  #  THE SUBROUTINE GTSQRT ACCEPTS A DOUBLE PRECISION VALUE IN FUNCTION, FUNCTION +1 AND RETURNS A SINGLE-PRECISION
062660,000428:                                                                                                  #  SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF THE ARGUMENT.  ALSO, THE CELL SHFTFLAG CONTAINS A BINARY
062661,000429:                                                                                                  #  EXPONENT S, SUCH THAT THE SQUARE ROOT (RETURNED IN THE A REGISTER) MUST BE SHIFTED RIGHT (MULTIPLIED BY 2 TO THE
062662,000430:                                                                                                  #  POWER (-S)) IN ORDER TO BE THE TRUE SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF FUNCTION, FUNCTION +1.
062663,000431:                                                                                                  #  SQUARE ROOT ERROR IS NOT MORE THAN 2 IN THE 14TH SIGNIFICANT BIT.  CELLS CLOBBERED ARE A, L, SHFTFLAG, ININDEX,
062664,000432:                                                                                                  #  HALFARG, SCRATCH, SR, FUNCTION, FUNCTION +1.  GTSQRT IS CALLED BY TC GTSQRT AND RETURNS VIA TC Q OR TC FUNCTION +1.
062665,000433:                                                                                                  #  ZERO OR NEGATIVE ARGUMENTS YIELD ZERO FOR SQUARE ROOTS.
062666,000434: 
062667,000435: 21,3440           11750        GTSQRT             CCS      FUNCTION                              
062668,000436: 21,3441           13457                           TCF      GOODARG                               #  FUNCTION IS POSITIVE.  TAKE SQUARE ROOT.
062669,000437: 21,3442           13444                           TCF      +2                                    #  HIGH ORDER WORD IS ZERO.  TRY THE LOWER.
062670,000438: 21,3443           13450                           TCF      ZEROOT                                #  NEGATIVE.  USE ZERO FOR 1/2 POWER.
062671,000439: 
062672,000440: 21,3444           31751                           CA       FUNCTION   +1                         
062673,000441: 21,3445           00006                           EXTEND                                         
062674,000442: 21,3446           63450                           BZMF     ZEROOT                                
062675,000443: 
062676,000444: 21,3447           13453                           TCF      ZEROHIGH                              #  PROCEED.
062677,000445: 21,3450           34755        ZEROOT             CA       ZERO                                  
062678,000446: 21,3451           55740                           TS       SHFTFLAG                              
062679,000447: 21,3452           00002                           TC       Q                                     
062680,000448: 
062681,000449: 21,3453           57750        ZEROHIGH           XCH      FUNCTION                              #  14 MOST SIGNIFICANT BITS ARE IN THE
062682,000450: 21,3454           57751                           XCH      FUNCTION   +1                         #  LOWER WORD.  EXCHANGE THEM.
062683,000451: 21,3455           34757                           CA       SEVEN                                 
062684,000452: 21,3456           13460                           TCF      GOODARG    +1                         
062685,000453: 
062686,000454: 21,3457           34755        GOODARG            CA       ZERO                                  
062687,000455: 21,3460           55740                           TS       SHFTFLAG                              
062688,000456: 21,3461           35741                           CA       TWELVE                                #  INITIALIZE THE SCALING LOOP.
062689,000457: 21,3462           55743                           TS       ININDEX                               
062690,000458: 21,3463           13472                           TCF      SCALLOOP                              
062691,000459: 
062692,000460: 21,3464           31750        SCALSTRT           CA       FUNCTION                              
062693,000461: 21,3465           13506                           TCF      SCALDONE                              
062694,000462: 
062695,000463: 21,3466           37751        MULBUSH            CA       NEG2                                  #  IF ARG IS NOT LESS THAN 1/4, INDEX IS
062696,000464: 21,3467           27743                           ADS      ININDEX                               #  ZERO, INDICATING NO SHIFT NEEDED.
062697,000465: 21,3470           00006                           EXTEND                                         #  BRANCH IF ARG IS NOT LESS THAN 1/4.
062698,000466: 21,3471           63464                           BZMF     SCALSTRT                              #  OTHERWISE COMPARE ARG WITH A REFERENCE
062699,000467:                                                                                                  #  WHICH IS 4 TIMES LARGER THAN THE LAST.
062700,000468: 21,3472           41750        SCALLOOP           CS       FUNCTION                              
062701,000469: 21,3473           51743                           INDEX    ININDEX                               
062702,000470: 21,3474           64735                           AD       BIT15                                 #  REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
062703,000471: 21,3475           00006                           EXTEND                                         
062704,000472: 21,3476           63466                           BZMF     MULBUSH                               #  IF ARG IS NOT LESS THAN REFERENCE, GO
062705,000473:                                                                                                  #  AROUND THE MULBERRY BUSH ONCE MORE.

Page 1474

062707,000475: 21,3477           51743                           INDEX    ININDEX                               
062708,000476: 21,3500           34735                           CA       BIT15                                 #  THIS IS THE SCALE MAGNITUDE
062709,000477: 21,3501           57746                           XCH      HALFARG                               #  2**(-ININDEX) IS THE SHIFT DIVISOR.
062710,000478: 21,3502           00006                           EXTEND                                         #  RESCALE ARGUMENT.
062711,000479: 21,3503           31751                           DCA      FUNCTION                              
062712,000480: 21,3504           00006                           EXTEND                                         
062713,000481: 21,3505           11746                           DV       HALFARG                               
062714,000482:                                                                                                  #  ININDEX AND SHFTFLAG PRESERVE INFO FOR
062715,000483:                                                                                                  #  RESCALING AFTER ROOT PROCESS.
062716,000484: 21,3506           00006        SCALDONE           EXTEND                                         
062717,000485: 21,3507           23751                           QXCH     FUNCTION   +1                         #  SAVE Q FOR RETURN
062718,000486: 21,3510           00006                           EXTEND                                         
062719,000487: 21,3511           74736                           MP       BIT14                                 
062720,000488: 21,3512           55746                           TS       HALFARG                               
062721,000489: 21,3513           74737                           MASK     BIT13                                 
062722,000490: 21,3514           10000                           CCS      A                                     
062723,000491: 21,3515           33633                           CA       OCT11276                              
062724,000492: 21,3516           63631                           AD       ROOTHALF                              #  INITIAL GUESS IS ROOT 1/2 OR POSMAX
062725,000493: 21,3517           03635                           TC       ROOTCYCL                              
062726,000494: 21,3520           03635                           TC       ROOTCYCL                              
062727,000495: 21,3521           03635                           TC       ROOTCYCL                              
062728,000496: 21,3522           01751                           TC       FUNCTION   +1                         
062729,000497: 
062730,000498:                                                                                                  #  ****************************************************************************************************************
062731,000499: 
062732,000500: 21,3523           03440        RSTOFGTS           TC       GTSQRT                                
062733,000501: 21,3524           57741        PRODUCT            XCH      K2CNTRAL                              
062734,000502: 21,3525           00006                           EXTEND                                         
062735,000503: 21,3526           71741                           MP       K2CNTRAL                              
062736,000504: 21,3527           53742                           DXCH     K2CNTRAL                              
062737,000505: 21,3530           00006                           EXTEND                                         #                THE PRODUCT OF
062738,000506: 21,3531           70001                           MP       L                                     #   1/2                   2       1/2
062739,000507: 21,3532           27742                           ADS      K2CNTRAL   +1                         #  K   *(DEL*OMEGA + ALPHA /(2*K))
062740,000508: 21,3533           54001                           TS       L                                     #                      AND
062741,000509: 21,3534           13536                           TCF      +2                                    #                        2
062742,000510: 21,3535           27741                           ADS      K2CNTRAL                              #   DEL*(DEL*OMEGA + ALPHA /(2*K)) NOW IN 
062743,000511:                                                                                                  #  K2CNTRAL
062744,000512: 
062745,000513: 21,3536           31743        DOSHIFT            CA       ININDEX                               
062746,000514: 21,3537           00006                           EXTEND                                         #  MULTIPLY IN THE FACTOR 2(-S), RETURNED
062747,000515: 21,3540           74736                           MP       BIT14                                 #  BY THE GTSQRT SUBROUTINE
062748,000516: 21,3541           27740                           ADS      SHFTFLAG                              
062749,000517: 21,3542           00006                           EXTEND                                         
062750,000518: 21,3543           13562                           BZF      ADDITIN                               
062751,000519: 21,3544           51740                           INDEX    SHFTFLAG                              
062752,000520: 21,3545           34735                           CA       BIT15                                 

Page 1475

062754,000522: 21,3546           57741                           XCH      K2CNTRAL                              
062755,000523: 21,3547           00006                           EXTEND                                         
062756,000524: 21,3550           71741                           MP       K2CNTRAL                              
062757,000525: 21,3551           21737                           DAS      K2THETA                               
062758,000526: 21,3552           57741                           XCH      K2CNTRAL                              
062759,000527: 21,3553           00006                           EXTEND                                         
062760,000528: 21,3554           71742                           MP       K2CNTRAL   +1                         
062761,000529: 21,3555           27737                           ADS      K2THETA    +1                         
062762,000530: 21,3556           54001                           TS       L                                     
062763,000531: 21,3557           13561                           TCF      +2                                    
062764,000532: 21,3560           27736                           ADS      K2THETA                               
062765,000533: 
062766,000534: 21,3561           13565                           TCF      NEGUSUM                               
062767,000535: 
062768,000536: 21,3562           00006        ADDITIN            EXTEND                                         
062769,000537: 21,3563           31742                           DCA      K2CNTRAL                              
062770,000538: 21,3564           21737                           DAS      K2THETA                               #  NOW ADD IN THE K2THETA TERM.
062771,000539: 21,3565           11736        NEGUSUM            CCS      K2THETA                               #  TEST SIGN OF HIGH ORDER PART.
062772,000540: 21,3566           13572                           TCF      NEGDRIVE                              
062773,000541: 21,3567           13571                           TCF      +2                                    
062774,000542: 21,3570           13574                           TCF      POSDRIVE                              
062775,000543: 
062776,000544: 21,3571           11737                           CCS      K2THETA    +1                         #  SIGN TEST FOR LOW ORDER PART.
062777,000545: 21,3572           34753        NEGDRIVE           CA       BIT1                                  
062778,000546: 21,3573           13575                           TCF      +2                                    #  STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
062779,000547: 21,3574           44753        POSDRIVE           CS       BIT1                                  
062780,000548: 21,3575           54001                           TS       L                                     #  SAVE FOR DRIVE REVERSAL TEST.
062781,000549: 21,3576           51747                           INDEX    QRCNTR                                
062782,000550: 21,3577           57501                           XCH      NEGUQ                                 
062783,000551: 
062784,000552: 21,3600           00006                           EXTEND                                         
062785,000553: 21,3601           70001                           MP       L                                     #  MULTIPLY OLD NEGU AND NEW NEGU.
062786,000554: 21,3602           10001                           CCS      L                                     
062787,000555: 21,3603           13620                           TCF      LOUPE                                 #  NON-ZERO GIMBAL DRIVE BEING CONTINUED.
062788,000556: 
062789,000557: 21,3604           13615                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
062790,000558: 
062791,000559: 21,3605           13607                           TCF      REVERSAL                              #  NON-ZERO GIMBAL DRIVE BEING REVERSED.
062792,000560: 21,3606           13615                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
062793,000561: 
062794,000562: 21,3607           51747        REVERSAL           INDEX    QRCNTR                                #  A ZERO-DRIVE PAUSE IS NEEDED HERE.  ZERO
062795,000563: 21,3610           55510                           TS       QACCDOT                               #  IS IN A REGISTER FROM CCS ON (-1).
062796,000564: 21,3611           51747                           INDEX    QRCNTR                                
062797,000565: 21,3612           43632                           CS       GMBLBITA                              
062798,000566: 21,3613           00006                           EXTEND                                         
062799,000567: 21,3614           03012                           WAND     CHAN12                                
062800,000568: 
062801,000569: 21,3615           41262        ZEROLOUP           CS       RCSFLAGS                              #  SET UP REQUEST FOR ACDT+C12 CALL.
062802,000570: 21,3616           74747                           MASK     CALLGMBL                              
062803,000571: 21,3617           27262                           ADS      RCSFLAGS                              

Page 1476

062805,000573: 21,3620           11747        LOUPE              CCS      QRCNTR                                #  HAVE BOTH AXES BEEN PROCESSED?
062806,000574: 21,3621           13114                           TCF      GOQTRIMG                              #  NO.  DO Q AXIS NEXT.
062807,000575: 
062808,000576: 21,3622           31505                           CA       SAVESR                                #  RESTORE THE SR
062809,000577: 21,3623           54021                           TS       SR                                    
062810,000578: 
062811,000579: 21,3624           00006        GOCLOSE            EXTEND                                         #  TERMINATE THE JASK.
062812,000580: 21,3625           33630                           DCA      CLOSEADR                              
062813,000581: 21,3626           52006                           DTCB                                           
062814,000582: 
062815,000583: 21,3627  E6,1536                                  EBANK=   AOSQ                                  
062816,000584: 21,3627           03270 36106  CLOSEADR           2CADR    CLOSEOUT                              #  TERMINATE THE JASK.
062817,000585: 
062818,000586: 21,3631     5741               TWELVE             EQUALS   OCT14                                 
062819,000587: 21,3631           26501        ROOTHALF           OCTAL    26501                                 #  SQUARE ROOT OF 1/2
062820,000588: 21,3632           01400        GMBLBITA           OCTAL    01400                                 #  INDEXED WRT GMBLBITB  DO NOT MOVE ******
062821,000589: 21,3633           11276        OCT11276           OCTAL    11276                                 #  POSMAX - ROOTHALF
062822,000590: 21,3634           06000        GMBLBITB           OCTAL    06000                                 #  INDEXED WRT GMBLBITA  DO NOT MOVE ******
062823,000591: 
062824,000592:                                                                                                  #  SUBROUTINE ROOTCYCL:  BY CRAIG WORK, 3 APRIL 68
062825,000593: 
062826,000594:                                                                                                  #  ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION.  THE INITIAL GUESS AT THE
062827,000595:                                                                                                  #  SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG.  THE NEW APPROXI-
062828,000596:                                                                                                  #  MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER.  DEBRIS:  A, L, SR, SCRATCH.  ROOTCYCL IS CALLED FROM
062829,000597:                                                                                                  #  LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
062830,000598: 
062831,000599:                                                                                                  #  WARNING:  IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
062832,000600: 
062833,000601: 21,3635           55745        ROOTCYCL           TS       SCRATCH                               #  STORE X
062834,000602: 21,3636           54021                           TS       SR                                    #  X/2 NOW IN SR
062835,000603: 21,3637           31746                           CA       HALFARG                               #  ARG/2 IN THE A REG
062836,000604: 21,3640           22007                           ZL                                             #  PREPARE FOR DIVISION
062837,000605: 21,3641           00006                           EXTEND                                         
062838,000606: 21,3642           11745                           DV       SCRATCH                               #  (ARG/X)/2
062839,000607: 21,3643           60021                           AD       SR                                    #  (X + ARG/X)/2 IN THE A REG
062840,000608: 21,3644           00002                           TC       Q                                     
062841,000609: 
062842,000610: 

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