Source Code

These source-code files were transcribed from scans made from Don Eyles's personal copy of Luminary 069. They were scanned at archive.org's Boston facility, and the scanning was sponsored by Onno Hommes. The code was transcribed from these scans by a team of volunteers who are referenced in the program comments. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". In some cases, where similar code blocks exist in previously-transcribed AGC programs (primarily Luminary 99, from Apollo 11) those code blocks were used as a starting point and then corrected to agree with the Luminary 69 scans. The full scans are available at the Virtual AGC project's collection at archive.org, while more-convenient reduced-size (but reduced-quality) images are available at the main Virtual AGC website. Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 069 OF AGC PROGRAM LUMINARY BY NASA 2021112-011
	19:02 NOV. 25,1968
Note that the date is the date of the printout, not the date of the program revision.

063967,000002:                                                                                                  ## Copyright:   Public domain.
063968,000003:                                                                                                  ## Filename:    TRIM_GIMBAL_CONTROL_SYSTEM.agc
063969,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
063970,000005:                                                                                                  ##              It is part of the source code for the original release
063971,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
063972,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
063973,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
063974,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
063975,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
063976,000011:                                                                                                  ##              that the code format has been changed to conform to the
063977,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
063978,000013:                                                                                                  ##              original YUL assembler.
063979,000014:                                                                                                  ## Reference:   pp. 1467-1478
063980,000015:                                                                                                  ## Assembler:   yaYUL
063981,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
063982,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
063983,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
063984,000019:                                                                                                  ##              2016-12-18 MAS  Updated from comment-proofed Luminary 99 version.
063985,000020:                                                                                                  ##              2016-12-29 RRB  Updated for Luminary 69.
063986,000021:                                                                                                  ##              2017-01-21 HG   Fix operand BIT 12 -> BIT12
063987,000022:                                                                                                  ##                                          NEGSUM -> NEGUSUM
063988,000023:                                                                                                  ##              2017-01-23 Fix operator TC -> TCF
063989,000024:                                                                                                  ##              2017-01-28 RSB  Proofed comment text using octopus/prooferComments
063990,000025:                                                                                                  ##                              and fixed errors found.
063991,000026:                                                                                                  ##              2021-05-30 ABS  GTSGO+DN -> GTSGO+ON
063992,000027:                                                                                                  ##                              MAXISHIFT -> MAXISHFT
063993,000028:                                                                                                  ##                              MINISHIFT -> MINISHFT
063994,000029: 

Page 1467

063996,000031: 21,3263                                           BANK     21                                    
063997,000032: 21,3263  E6,1446                                  EBANK=   QDIFF                                 
063998,000033: 21,2000                                           SETLOC   DAPS4                                 
063999,000034: 21,2000                                           BANK                                           
064000,000035: 
064001,000036: 21,3263                                           COUNT*   $$/DAPGT                              
064002,000037: 
064003,000038:                                                                                                  #  CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
064004,000039:                                                                                                  #  AUTOPILOT ARE BOTH ON:
064005,000040:                                                                                                  #        A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
064006,000041:                                                                                                  #           INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
064007,000042:                                                                                                  #        B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
064008,000043:                                                                                                  #           ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
064009,000044:                                                                                                  #  GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
064010,000045: 
064011,000046: 21,3263           37746        GTS                CAF      NEGONE                                #  MAKE THE NEXT PASS THROUGH THE DAP BE
064012,000047: 21,3264           55627                           TS       COTROLER                              #        THROUGH RCS CONTROL,
064013,000048: 21,3265           34751                           CAF      FOUR                                  #        AND ENSURE THAT IT IS NOT A SKIP.
064014,000049: 21,3266           55535                           TS       SKIPU                                 
064015,000050: 21,3267           55536                           TS       SKIPV                                 
064016,000051: 
064017,000052: 21,3270           34752                           CAF      TWO                                   
064018,000053: 21,3271           55631                           TS       INGTS                                 #  SET INDICATOR OF GTS CONTROL POSITIVE.
064019,000054: 21,3272           55630                           TS       QGIMTIMR                              #  SET TIMERS TO 200 MSEC TO AVOID BOTH
064020,000055: 21,3273           55632                           TS       RGIMTIMR                              #  RUNAWAY AND INTERFERENCE BY NULLING.
064021,000056: 
064022,000057:                                                                                                  #  THE DRIVE SETTING ALGORITHM
064023,000058: 
064024,000059:                                                                                                  #        DEL = SGN(OMEGA*K + ALPHA*ABS(ALPHA)/2).
064025,000060: 
064026,000061:                                                                                                  #        NEGUSUM = ERROR.K(2) + DEL(OMEGA.K.DEL + ALPHA(2)/2)(3/2) + ALPHA(OMEGA.K.DEL + ALPHA(2)/3)
064027,000062: 
064028,000063:                                                                                                  #        DRIVE = -SGN(NEGUSUM)
064029,000064: 
064030,000065: 21,3274           30021                           CA       SR                                    #  SAVE THE SR.  SHIFT IT LEFT TO CORRECT
064031,000066: 21,3275           60000                           AD       A                                     #  FOR THE RIGHT SHIFT DUE TO EDITING.
064032,000067: 21,3276           55476                           TS       SAVESR                                
064033,000068: 
064034,000069: 21,3277           34752        GTSGO+ON           CAF      TWO                                   #  SET INDEXER FOR R-AXIS CALCULATIONS.
064035,000070: 21,3300           55746                           TS       QRCNTR                                
064036,000071: 21,3301           31541                           CA       AOSR                                  
064037,000072: 21,3302           00006                           EXTEND                                         
064038,000073: 21,3303           74751                           MP       BIT3                                  
064039,000074: 21,3304           31435                           CA       EDOTR                                 
064040,000075: 21,3305           13314                           TCF      GTSQAXIS                              
064041,000076: 
064042,000077: 21,3306           34755        GOQTRIMG           CAF      ZERO                                  #  SET INDEXER FOR Q-AXIS CALCULATIONS
064043,000078: 21,3307           55746                           TS       QRCNTR                                

Page 1468

064045,000080: 21,3310           31537                           CA       AOSQ                                  
064046,000081: 21,3311           00006                           EXTEND                                         
064047,000082: 21,3312           74751                           MP       BIT3                                  
064048,000083: 21,3313           31434                           CA       EDOTQ                                 
064049,000084: 21,3314           53744        GTSQAXIS           DXCH     WCENTRAL                              
064050,000085: 21,3315           00006                           EXTEND                                         
064051,000086: 21,3316           51746                           INDEX    QRCNTR                                #  PICK UP K AND K(2) FOR THIS AXIS
064052,000087: 21,3317           31504                           DCA      KQ                                    
064053,000088: 21,3320           53742                           DXCH     KCENTRAL                              
064054,000089: 
064055,000090: 21,3321           51746                           INDEX    QRCNTR                                #  QDIFF, RDIFF ARE STORED IN D.P.
064056,000091: 21,3322           31446                           CAE      QDIFF                                 
064057,000092: 
064058,000093: 21,3323           00006        ALGORTHM           EXTEND                                         #  Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
064059,000094: 21,3324           71742                           MP       K2CNTRAL                              #  FORM K(2)*THETA IN D.P.
064060,000095: 21,3325           23735                           LXCH     K2THETA                               
064061,000096: 21,3326           00006                           EXTEND                                         #  FORM K(2)*THETA*SF2 IN D.P.
064062,000097: 21,3327           74743                           MP       BIT9                                  
064063,000098: 21,3330           53736                           DXCH     K2THETA                               
064064,000099: 21,3331           00006                           EXTEND                                         
064065,000100: 21,3332           74743                           MP       BIT9                                  
064066,000101: 21,3333           27736                           ADS      K2THETA    +1                         
064067,000102: 
064068,000103: 21,3334           31743                           CAE      WCENTRAL                              #  GET OMEGA
064069,000104: 21,3335           00006                           EXTEND                                         
064070,000105: 21,3336           71741                           MP       KCENTRAL                              #  FORM K*OMEGA IN D.P.
064071,000106: 21,3337           23741                           LXCH     OMEGA.K                               
064072,000107: 21,3340           00006                           EXTEND                                         #  FORM OMEGA*K*SF1 IN D.P.
064073,000108: 21,3341           74740                           MP       BIT12                                 
064074,000109: 21,3342           53742                           DXCH     OMEGA.K                               
064075,000110: 21,3343           00006                           EXTEND                                         
064076,000111: 21,3344           74740                           MP       BIT12                                 
064077,000112: 21,3345           27742                           ADS      OMEGA.K    +1                         
064078,000113: 
064079,000114: 21,3346           31744                           CAE      ACENTRAL                              #  FORM ALPHA(2)/2 IN D.P.
064080,000115: 21,3347           00006                           EXTEND                                         
064081,000116: 21,3350           70000                           SQUARE                                         
064082,000117: 21,3351           53740                           DXCH     A2CNTRAL                              
064083,000118: 
064084,000119: 21,3352           31744                           CAE      ACENTRAL                              #  GET ALPHA*ABS(ALPHA)/2, IF ALPHA GREATER
064085,000120:                                                                                                  #  THAN 0. OTHERWISE TAKE NEGATIVE OF ABOVE
064086,000121: 21,3353           00006                           EXTEND                                         
064087,000122: 21,3354           63360                           BZMF     +4                                    
064088,000123: 21,3355           00006                           EXTEND                                         
064089,000124: 21,3356           31740                           DCA      A2CNTRAL                              
064090,000125: 21,3357           13362                           TCF      +3                                    
064091,000126: 21,3360           00006                           EXTEND                                         
064092,000127: 21,3361           41740                           DCS      A2CNTRAL                              
064093,000128: 21,3362           53750                           DXCH     FUNCTION                              #  SAVE AS SGN(ALPHA)*ALPHA(2)/2

Page 1469

064095,000130: 21,3363           00006                           EXTEND                                         
064096,000131: 21,3364           31742                           DCA      OMEGA.K                               
064097,000132: 21,3365           21750                           DAS      FUNCTION                              #  FORM FUNCT1
064098,000133: 
064099,000134: 21,3366           11747                           CCS      FUNCTION                              #  DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
064100,000135: 21,3367           13373                           TCF      POSFNCT1                              #  OTHERWISE DEL = -1
064101,000136: 21,3370           13372                           TCF      +2                                    
064102,000137: 21,3371           13375                           TCF      NEGFNCT1                              
064103,000138: 
064104,000139: 21,3372           11750                           CCS      FUNCTION   +1                         #  USE LOW ORDER WORD SINCE HIGH IS ZERO
064105,000140: 21,3373           34753        POSFNCT1           CAF      BIT1                                  
064106,000141: 21,3374           13376                           TCF      +2                                    
064107,000142: 21,3375           44753        NEGFNCT1           CS       BIT1                                  
064108,000143: 21,3376           55745                           TS       DEL                                   
064109,000144: 
064110,000145: 21,3377           11745                           CCS      DEL                                   #  MAKE OMEGA*K REALLY DEL*OMEGA*K
064111,000146: 21,3400           13405                           TCF      FUNCT2                                #  (NOTHING NEED BE DONE)
064112,000147: 21,3401           13405                           TCF      FUNCT2                                
064113,000148: 21,3402           00006                           EXTEND                                         
064114,000149: 21,3403           41742                           DCS      OMEGA.K                               
064115,000150: 21,3404           53742                           DXCH     OMEGA.K                               #  CHANGE SIGN OF OMEGA*K
064116,000151: 
064117,000152: 21,3405           00006        FUNCT2             EXTEND                                         
064118,000153: 21,3406           31742                           DCA      OMEGA.K                               
064119,000154: 21,3407           53750                           DXCH     FUNCTION                              #  DEL*OMEGA*K
064120,000155: 21,3410           00006                           EXTEND                                         
064121,000156: 21,3411           31740                           DCA      A2CNTRAL                              
064122,000157: 21,3412           21750                           DAS      FUNCTION                              #  DEL*OMEGA*K + ALPHA(2)/2
064123,000158: 21,3413           31737        FUNCT3             CAE      A2CNTRAL                              #  CALCULATE (2/3)*ALPHA(2)/2 = ALPHA(2)/3
064124,000159: 21,3414           00006                           EXTEND                                         
064125,000160: 21,3415           73446                           MP       .66667                                
064126,000161: 21,3416           53740                           DXCH     A2CNTRAL                              
064127,000162: 21,3417           56001                           XCH      L                                     
064128,000163: 21,3420           00006                           EXTEND                                         
064129,000164: 21,3421           73446                           MP       .66667                                
064130,000165: 21,3422           27740                           ADS      A2CNTRAL   +1                         
064131,000166: 21,3423           54001                           TS       L                                     
064132,000167: 21,3424           13426                           TCF      +2                                    
064133,000168: 21,3425           27737                           ADS      A2CNTRAL                              
064134,000169: 21,3426           53742                           DXCH     OMEGA.K                               #  DEL*OMEGA*K + ALPHA(2)/3 = G
064135,000170: 21,3427           21740                           DAS      A2CNTRAL                              
064136,000171: 21,3430           31737                           CAE      A2CNTRAL                              #  G*ALPHA IN D.P.
064137,000172: 21,3431           00006                           EXTEND                                         
064138,000173: 21,3432           71744                           MP       ACENTRAL                              
064139,000174: 21,3433           53740                           DXCH     A2CNTRAL                              
064140,000175: 21,3434           56001                           XCH      L                                     
064141,000176: 21,3435           00006                           EXTEND                                         
064142,000177: 21,3436           71744                           MP       ACENTRAL                              
064143,000178: 21,3437           27740                           ADS      A2CNTRAL   +1                         
064144,000179: 21,3440           54001                           TS       L                                     

Page 1470

064146,000181: 21,3441           13443                           TCF      +2                                    
064147,000182: 21,3442           27737                           ADS      A2CNTRAL                              
064148,000183: 
064149,000184: 21,3443           53740                           DXCH     A2CNTRAL                              #  FIRST AND THIRD TERMS
064150,000185: 21,3444           21736                           DAS      K2THETA                               #  SUMMED IN D.P.
064151,000186: 
064152,000187: 21,3445           13561                           TCF      RSTOFGTS                              
064153,000188: 
064154,000189: 21,3446           25253        .66667             DEC      .66667                                
064155,000190: 
064156,000191: 16,3720                                           BANK     16                                    
064157,000192: 16,3720  E6,1500                                  EBANK=   NEGUQ                                 
064158,000193: 16,2000                                           SETLOC   DAPS1                                 
064159,000194: 16,2000                                           BANK                                           
064160,000195: 
064161,000196:                                                                                                  #  THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
064162,000197:                                                                                                  #  THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES.  ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
064163,000198: 
064164,000199:                                                                                                  #  WARNING:  ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
064165,000200: 
064166,000201: 16,3720           07400        BGIM               OCTAL    07400                                 
064167,000202: 16,3721     0066               CHNL12             EQUALS   ITEMP6                                
064168,000203: 16,3721           41500        ACDT+C12           CS       NEGUQ                                 
064169,000204: 16,3722           00006                           EXTEND                                         #  GIMBAL DRIVE REQUESTS.
064170,000205: 16,3723           71507                           MP       ACCDOTQ                               
064171,000206: 16,3724           23510                           LXCH     QACCDOT                               
064172,000207: 16,3725           41502                           CS       NEGUR                                 
064173,000208: 16,3726           00006                           EXTEND                                         
064174,000209: 16,3727           71511                           MP       ACCDOTR                               
064175,000210: 16,3730           23512                           LXCH     RACCDOT                               
064176,000211: 
064177,000212: 16,3731           11500                           CCS      NEGUQ                                 
064178,000213: 16,3732           34742                           CAF      BIT10                                 
064179,000214: 16,3733           13735                           TCF      +2                                    
064180,000215: 16,3734           34743                           CAF      BIT9                                  
064181,000216: 16,3735           54066                           TS       CHNL12                                
064182,000217: 
064183,000218: 16,3736           11502                           CCS      NEGUR                                 
064184,000219: 16,3737           34740                           CAF      BIT12                                 
064185,000220: 16,3740           13742                           TCF      +2                                    
064186,000221: 16,3741           34741                           CAF      BIT11                                 
064187,000222: 16,3742           26066                           ADS      CHNL12                                #  (STORED RESULT NOT USED AT PRESENT)
064188,000223: 
064189,000224: 16,3743           43720                           CS       BGIM                                  
064190,000225: 16,3744           00006                           EXTEND                                         
064191,000226: 16,3745           02012                           RAND     CHAN12                                
064192,000227: 16,3746           60066                           AD       CHNL12                                
064193,000228: 16,3747           00006                           EXTEND                                         
064194,000229: 16,3750           01012                           WRITE    CHAN12                                

Page 1471

064196,000231: 16,3751           44747                           CS       CALLGMBL                              #  TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
064197,000232: 16,3752           71273                           MASK     RCSFLAGS                              
064198,000233: 16,3753           55273                           TS       RCSFLAGS                              
064199,000234: 
064200,000235: 16,3754           00002                           TC       Q                                     #  RETURN TO CALLER.
064201,000236: 
064202,000237: 21,3447                                           BANK     21                                    
064203,000238: 21,3447  E6,1446                                  EBANK=   QDIFF                                 
064204,000239: 21,2000                                           SETLOC   DAPS4                                 
064205,000240: 21,2000                                           BANK                                           
064206,000241: 

Page 1472

064208,000243:                                                                                                  #  SUBROUTINE TIMEGMBL:  MOD 0, OCTOBER 1967, CRAIG WORK
064209,000244: 
064210,000245:                                                                                                  #  TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
064211,000246:                                                                                                  #  THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS.  INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
064212,000247:                                                                                                  #  SCALED AT PI/8.                         FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT).  A ZERO
064213,000248:                                                                                                  #  ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY.  OTHERWISE, THE GIMBAL IS TURNED ON
064214,000249:                                                                                                  #  DRIVING IN THE CORRECT DIRECTION. THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
064215,000250:                                                                                                  #  IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE.  NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
064216,000251:                                                                                                  #  WHICH IS NEGATIVE, ZERO, OR POSITIVE.
064217,000252: 
064218,000253:                                                                                                  #  INPUTS:       AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7).     PI/2(7).
064219,000254: 
064220,000255:                                                                                                  #  OUTPUTS:      NEW GIMBAL DRIVE BITS IN CHANNEL 12,NEGUQ,NEGUR,QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
064221,000256:                                                                                                  #                Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
064222,000257: 
064223,000258:                                                                                                  #  DEBRIS:       A,L,Q, ITEMPS 2,3,6, RUPTREG2 AND ACDT+C12 DEBRIS.
064224,000259: 
064225,000260:                                                                                                  #  EXITS:        VIA TC Q.
064226,000261: 
064227,000262:                                                                                                  #  ALARMS, ABORTS, :  NONE
064228,000263: 
064229,000264:                                                                                                  #  SUBROUTINES:  ACDT+C12, IBNKCALL
064230,000265: 
064231,000266:                                                                                                  #  WARNING:      THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS.  THEREFORE IT MAY ONLY BE CALLED WITH
064232,000267:                                                                                                  #  INTERRUPT INHIBITED.
064233,000268: 
064234,000269:                                                                                                  #  ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
064235,000270:                                                                                                  #        NEGUQ           ERASE   +2              NEGATIVE OF Q-AXIS GIMBAL DRIVE
064236,000271:                                                                                                  #        (SPWORD)        EQUALS  NEGUQ +1        ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
064237,000272:                                                                                                  #        NEGUR           EQUALS  NEGUQ +2        NEGATIVE OF R-AXIS GIMBAL DRIVE
064238,000273: 
064239,000274:                                                                                                  #        ACCDOTQ         ERASE   +2              Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
064240,000275:                                                                                                  #        (SPWORD)        EQUALS  ACCDOTQ +1      ANY S.P. ERASABLE NUMBER NOW QACCDOT
064241,000276:                                                                                                  #        ACCDOTR         EQUALS  ACCDOTQ +2      R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
064242,000277:                                                                                                  #                                                ACCDOTQ, ACCDOTR ARE MAGNITUDES.
064243,000278:                                                                                                  #        AOSQ            ERASE   +4              Q-AXIS ACC., D.P. AT PI/2 R/SEC(2)
064244,000279:                                                                                                  #        AOSR            EQUALS  AOSQ +2         R-AXIS ACCELERATION SCALED AT PI/2 R/S2
064245,000280: 
064246,000281: 21,3447     0066               QRNDXER            EQUALS   ITEMP6                                
064247,000282: 21,3447           23146        OCT23146           OCTAL    23146                                 #  DECIMAL .6
064248,000283: 21,3450     0063               NZACCDOT           EQUALS   ITEMP3                                
064249,000284: 
064250,000285: 21,3450           34753        TIMEGMBL           CAF      ONE                                   #  INITIALIZE ALLOWGTS.
064251,000286: 21,3451           55501                           TS       ALLOWGTS                              
064252,000287: 
064253,000288: 21,3452           34752                           CAF      TWO                                   #  SET UP LOOP FOR R AXIS.
064254,000289: 21,3453           22002                           LXCH     Q                                     #  SAVE RETURN ADDRESS.
064255,000290: 21,3454           22071                           LXCH     RUPTREG2                              

Page 1473

064257,000292: 21,3455           13457                           TCF      +2                                    
064258,000293: 21,3456           34755        TIMQGMBL           CAF      ZERO                                  #  NOW DO THE Q-AXIS
064259,000294: 21,3457           54066                           TS       QRNDXER                               
064260,000295: 21,3460           50066                           INDEX    QRNDXER                               
064261,000296: 21,3461           31507                           CA       ACCDOTQ                               #  ACCDOT IS PRESUMED TO BE AT PI/2(7).
064262,000297: 21,3462           00006                           EXTEND                                         
064263,000298: 21,3463           63533                           BZMF     TGOFFNOW                              #  IS ACCDOT LESS THAN OR EQUAL TO 0?
064264,000299: 21,3464           54063                           TS       NZACCDOT                              #  NO.  STORE NON-ZERO, POSITIVE ACCDOT.
064265,000300: 
064266,000301: 21,3465           50066        ALPHATRY           INDEX    QRNDXER                               
064267,000302: 21,3466           41537                           CS       AOSQ                                  
064268,000303: 21,3467           00006                           EXTEND                                         
064269,000304: 21,3470           13533                           BZF      TGOFFNOW                              #  IS ALPHA ZERO?
064270,000305: 
064271,000306: 21,3471           54002                           TS       Q                                     #  SAVE A COPY OF -AOS.
064272,000307: 21,3472           00006                           EXTEND                                         #  NO.  RESCALE FOR TIMEGMBL USE.
064273,000308: 21,3473           73447                           MP       OCT23146                              #  OCTAL 23146 IS DECIMAL .6
064274,000309: 21,3474           60002                           AD       Q                                     #  -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
064275,000310: 21,3475           54001                           TS       L                                     #  WAS THERE OVERFLOW?
064276,000311: 21,3476           13503                           TCF      SETNEGU                               #  NO.  COMPUTE DRIVE TIME.
064277,000312: 
064278,000313: 21,3477           40000                           CS       A                                     #  RECOVER  -SGN(AOS) IN THE A REGISTER.
064279,000314: 21,3500           50066                           INDEX    QRNDXER                               #  YES.  START DRIVE WITHOUT WAITLIST.
064280,000315: 21,3501           57500                           XCH      NEGUQ                                 
064281,000316: 21,3502           13537                           TCF      NOTALLOW                              #  KNOCK DOWN THE ALLOWGTS FLAG.
064282,000317: 
064283,000318: 21,3503           00006        SETNEGU            EXTEND                                         
064284,000319: 21,3504           63511                           BZMF     POSALPH                               
064285,000320: 
064286,000321: 21,3505           40000                           COM                                            
064287,000322: 21,3506           54062                           TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
064288,000323: 21,3507           44753                           CS       BIT1                                  
064289,000324: 21,3510           13513                           TCF      POSALPH    +2                         
064290,000325: 21,3511           54062        POSALPH            TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
064291,000326: 21,3512           34753                           CA       BIT1                                  
064292,000327: 21,3513           50066                 +2        INDEX    QRNDXER                               #  SGN(AOS) INTO NEGU
064293,000328: 21,3514           55500                           TS       NEGUQ                                 #  STORE SGN(APLHA) AS NEGU
064294,000329: 
064295,000330: 21,3515           30063                           CA       NZACCDOT                              
064296,000331: 21,3516           00006                           EXTEND                                         
064297,000332: 21,3517           74740                           MP       BIT12                                 #  2*ACCDOT, SCALED AT PI/8.
064298,000333: 21,3520           60062                           AD       ITEMP2                                #  -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
064299,000334: 21,3521           00006                           EXTEND                                         
064300,000335: 21,3522           63537                           BZMF     NOTALLOW                              #  IS DRIVE TIME MORE THAN TWO SECONDS?
064301,000336: 21,3523           40062                           CS       ITEMP2                                #  NO.  COMPUTE DRIVE TIME.
064302,000337: 21,3524           00006                           EXTEND                                         #  ABS(ALPHA) AT PI/8.
064303,000338: 21,3525           73560                           MP       OCT00240                              #  DECIMAL 10/1024
064304,000339: 21,3526           00006                           EXTEND                                         #  QUOTIENT IS DRIVE TIME AT WAITLIST.
064305,000340: 21,3527           10063                           DV       NZACCDOT                              #  ABS(ALPHA)/ACCDOT AT 2(14)/100

Page 1474

064307,000342: 21,3530           00006                           EXTEND                                         
064308,000343: 21,3531           13533                           BZF      TGOFFNOW                              #  DRIVE TIME MUST BE GREATER THAN ZERO.
064309,000344: 
064310,000345: 21,3532           13545                           TCF      DRIVEON                               
064311,000346: 
064312,000347: 21,3533           34755        TGOFFNOW           CAF      ZERO                                  #  TURN OFF GIMBAL NOW.
064313,000348: 21,3534           50066                           INDEX    QRNDXER                               
064314,000349: 21,3535           55500                           TS       NEGUQ                                 
064315,000350: 
064316,000351: 21,3536           13547                           TCF      DONEYET                               
064317,000352: 
064318,000353: 21,3537           36010        NOTALLOW           CAF      OCT31                                 
064319,000354: 21,3540           50066                           INDEX    QRNDXER                               
064320,000355: 21,3541           55630                           TS       QGIMTIMR                              
064321,000356: 21,3542           34755                           CAF      ZERO                                  #  DRIVE TIME IS MORE THAN 2 SECONDS, SO
064322,000357: 21,3543           55501                           TS       ALLOWGTS                              #  DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
064323,000358:                                                                                                  #  CONTROL UNTIL AOSTASK APPROVES.
064324,000359: 21,3544           13547                           TCF      DONEYET                               #  NO WAITLIST CALL IS MADE.
064325,000360: 
064326,000361: 21,3545           50066        DRIVEON            INDEX    QRNDXER                               
064327,000362: 21,3546           55630                           TS       QGIMTIMR                              #  CHOOSE Q OR R AXIS.
064328,000363: 
064329,000364: 21,3547           10066        DONEYET            CCS      QRNDXER                               
064330,000365: 21,3550           13456                           TCF      TIMQGMBL                              
064331,000366: 
064332,000367: 21,3551           52073                           DXCH     RUPTREG3                              #  PROTECT IBNKCALL ERASABLES.  ACDT+C12
064333,000368: 21,3552           52063                           DXCH     ITEMP2                                #  LEAVES ITEMPS2,3 ALONE.
064334,000369: 
064335,000370: 21,3553           04674                           TC       IBNKCALL                              #  TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
064336,000371: 21,3554           35721                           CADR     ACDT+C12                              
064337,000372: 
064338,000373: 21,3555           52063                           DXCH     ITEMP2                                #  RESTORE ERASABLES FOR IBNKCALL.
064339,000374: 21,3556           52073                           DXCH     RUPTREG3                              
064340,000375: 
064341,000376: 21,3557           00071                           TC       RUPTREG2                              #  RETURN TO CALLER.
064342,000377: 
064343,000378: 21,3560           00240        OCT00240           OCTAL    00240                                 #  DECIMAL 10/1024
064344,000379: 

Page 1475

064346,000381:                                                                                                  #  THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY.  THE QUANTITY NEGUSUM
064347,000382:                                                                                                  #  IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM.  NEW DRIVES ARE ENTERED TO CH 12.
064348,000383: 
064349,000384: 21,3561           11747        RSTOFGTS           CCS      FUNCTION                              
064350,000385: 21,3562           13603                           TCF      GOODARG                               #  FUNCTION IS POSITIVE.  GET 3/2 POWER.
064351,000386: 21,3563           13565                           TCF      +2                                    #  HIGH ORDER WORD IS ZERO.  TRY THE LOWER.
064352,000387: 21,3564           13571                           TCF      ZEROOT                                #  NEGATIVE.  USE ZERO FOR 3/2 POWER.
064353,000388: 
064354,000389: 21,3565           41750                           CS       FUNCTION   +1                         #  IF ARG IS LESS THAN 2(-18), THEN THE 3/2
064355,000390: 21,3566           64741                           AD       BIT11                                 #  POWER IS LESS THAN 2(-27).  USE ZERO.
064356,000391: 21,3567           00006                           EXTEND                                         
064357,000392: 21,3570           63574                           BZMF     ZEROHIGH                              #  BRANCH IF ARG NOT LESS THAN 2(-18).
064358,000393: 
064359,000394: 21,3571           00006        ZEROOT             EXTEND                                         
064360,000395: 21,3572           34756                           DCA      ZERO                                  
064361,000396: 21,3573           13714                           TCF      NEGUSUM                               
064362,000397: 
064363,000398: 21,3574           34317        ZEROHIGH           CA       FOURTEEN                              #  ARG LESS THAN 2(-14) MEANS 3/2 POWER
064364,000399:                                                                                                  #  WILL BE LESS THAN 2(-21).
064365,000400: 21,3575           55737                           TS       SHFTFLAG                              
064366,000401: 
064367,000402: 21,3576           34752                           CA       TWO                                   
064368,000403: 21,3577           55740                           TS       ININDEX                               #  INITIALIZE THE SHIFT LOOP.
064369,000404: 
064370,000405:                                                                                                  #  COLLECT THE 14 MOST SIGNIFICANT BITS OF
064371,000406: 21,3600           57750                           XCH      FUNCTION   +1                         #  THE 28 INTO THE HIGH ORDER WORD.
064372,000407: 21,3601           57747                           XCH      FUNCTION                              
064373,000408: 21,3602           13616                           TCF      SCALLOOP                              
064374,000409: 21,3603           35742        GOODARG            CA       TWELVE                                
064375,000410: 21,3604           55740                           TS       ININDEX                               #  INITIALIZE THE SHIFT LOOP.
064376,000411: 21,3605           34755                           CA       ZERO                                  #  THERE ARE SIGNIFICANT BITS IN THE HIGH
064377,000412: 21,3606           55737                           TS       SHFTFLAG                              #  ORDER WORD, SO SET SHFTFLAG TO ZERO.
064378,000413: 
064379,000414: 21,3607           13616                           TCF      SCALLOOP                              
064380,000415: 
064381,000416: 21,3610           31747        SCALSTRT           CA       FUNCTION                              
064382,000417: 21,3611           13633                           TCF      SCALDONE                              
064383,000418: 
064384,000419: 21,3612           37745        MULBUSH            CA       NEG2                                  #  IF ARG IS NOT LESS THAN 1/4, INDEX IS
064385,000420: 21,3613           27740                           ADS      ININDEX                               #  ZERO, INDICATING NO SHIFT NEEDED.
064386,000421: 21,3614           00006                           EXTEND                                         #  BRANCH IF ARG IS NOT LESS THAN 1/4.
064387,000422: 21,3615           63610                           BZMF     SCALSTRT                              #  OTHERWISE COMPARE ARG WITH A REFERENCE
064388,000423:                                                                                                  #  WHICH IS 4 TIMES LARGER THAN THE LAST.
064389,000424: 21,3616           41747        SCALLOOP           CS       FUNCTION                              
064390,000425: 21,3617           51740                           INDEX    ININDEX                               
064391,000426: 21,3620           64735                           AD       BIT15                                 #  REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
064392,000427: 21,3621           00006                           EXTEND                                         
064393,000428: 21,3622           63612                           BZMF     MULBUSH                               #  IF ARG IS NOT LESS THAN REFERENCE, GO
064394,000429:                                                                                                  #  AROUND THE MULBERRY BUSH ONCE MORE.
064395,000430: 21,3623           51740                           INDEX    ININDEX                               

Page 1476

064397,000432: 21,3624           34735                           CA       BIT15                                 #  THIS IS THE SCALE MAGNITUDE
064398,000433: 21,3625           56002                           XCH      Q                                     #  2**(-ININDEX) IS THE SHIFT DIVISOR.
064399,000434: 21,3626           00006                           EXTEND                                         #  RESCALE ARGUMENT.
064400,000435: 21,3627           31750                           DCA      FUNCTION                              
064401,000436: 21,3630           00006                           EXTEND                                         
064402,000437: 21,3631           10002                           DV       Q                                     
064403,000438: 21,3632           55747                           TS       FUNCTION                              #  ININDEX AND SHFTFLAG PRESERVE INFO FOR
064404,000439:                                                                                                  #  RESCALING AFTER ROOT PROCESS.
064405,000440: 21,3633           00006        SCALDONE           EXTEND                                         #  AFTER 3/2 POWER IS TAKEN, SCALE FACTOR
064406,000441: 21,3634           74737                           MP       BIT13                                 #  OF SQRT(1/2) WILL BE NEEDED, SO FACTOR
064407,000442: 21,3635           55743                           TS       HALFARG                               #  OF 1/2 IS INCLUDED NOW, BEFORE SQRT.
064408,000443: 
064409,000444: 21,3636           33761                           CA       STARTER                               #  INITIAL GUESS FOR SQRT ALGORITHM.
064410,000445: 21,3637           03763                           TC       ROOTCYCL                              
064411,000446: 21,3640           03763                           TC       ROOTCYCL                              
064412,000447: 21,3641           03763                           TC       ROOTCYCL                              
064413,000448: 
064414,000449: 21,3642           00006                           EXTEND                                         #  SQRT(1/2)*SQRT(ARG) IN A.
064415,000450: 21,3643           71747                           MP       FUNCTION                              #  SQRT(1/2)*ARG*SQRT(ARG) IN A,L.
064416,000451: 21,3644           53750                           DXCH     FUNCTION                              
064417,000452: 
064418,000453: 21,3645           31737        DOSHIFT            CA       SHFTFLAG                              #  HOW MANY SHIFT BITS ARE THERE?
064419,000454: 21,3646           61740                           AD       ININDEX                               #  2**(-ININDEX) WAS SHIFT DIVISOR.
064420,000455: 21,3647           54021                           TS       SR                                    
064421,000456: 21,3650           60021                           AD       SR                                    #  THIS MANY SHIFTS ARE REQUIRED.
064422,000457: 21,3651           54002        SAVESHFT           TS       Q                                     #  Q BOUNDS ARE ZERO AND 24 (DECIMAL).
064423,000458: 21,3652           00006                           EXTEND                                         
064424,000459: 21,3653           63701                           BZMF     SUMNEGU                               #  BRANCH IF SHIFTING IS UNNECESSARY.
064425,000460: 
064426,000461: 21,3654           44317                           CS       FOURTEEN                              
064427,000462: 21,3655           60002                           AD       Q                                     
064428,000463: 21,3656           00006                           EXTEND                                         #  Q = 0(MOD 3), SO A REG IS NON-ZERO.
064429,000464: 21,3657           63664                           BZMF     MINISHFT                              #  BRANCH IF SMALL SHIFT SUFFICES.
064430,000465: 
064431,000466: 21,3660           54002        MAXISHFT           TS       Q                                     #  14 BIT SHIFT RIGHT NOW.
064432,000467: 21,3661           34755                           CA       ZERO                                  
064433,000468: 21,3662           57747                           XCH      FUNCTION                              
064434,000469: 21,3663           55750                           TS       FUNCTION   +1                         
064435,000470: 
064436,000471: 21,3664           50002        MINISHFT           INDEX    Q                                     #  C(Q) ARE GREATER THAN ZERO.
064437,000472: 21,3665           34735                           CA       BIT15                                 
064438,000473: 21,3666           54002                           TS       Q                                     #  2**(-Q) WILL BE SHIFT MULTIPLIER.
064439,000474: 21,3667           00006                           EXTEND                                         
064440,000475: 21,3670           71750                           MP       FUNCTION   +1                         
064441,000476: 21,3671           56001                           XCH      L                                     
064442,000477: 21,3672           34755                           CA       ZERO                                  
064443,000478: 21,3673           53750                           DXCH     FUNCTION                              #  LOWER WORD SHIFTED NOW.
064444,000479: 21,3674           00006                           EXTEND                                         
064445,000480: 21,3675           63701                           BZMF     SUMNEGU                               #  BRANCH IF UPPER WORD WAS ZERO.

Page 1477

064447,000482: 21,3676           00006                           EXTEND                                         #  SHIFT UPPER WORD.
064448,000483: 21,3677           70002                           MP       Q                                     
064449,000484: 21,3700           21750                           DAS      FUNCTION                              #  NO OVERFLOW POSSIBLE.
064450,000485: 
064451,000486: 21,3701           41745        SUMNEGU            CS       DEL                                   #  INCLUDE DEL FACTOR IN PRODUCT TERM.
064452,000487: 21,3702           00006                           EXTEND                                         
064453,000488: 21,3703           63707                           BZMF     SUMTERMS                              
064454,000489: 
064455,000490: 21,3704           00006                           EXTEND                                         #  DEL FACTOR IS MINUS ONE.
064456,000491: 21,3705           41750                           DCS      FUNCTION                              
064457,000492: 21,3706           13713                           TCF      NEGUSUM    -1                         #  NOW ADD IN THE K2THETA TERM.
064458,000493: 
064459,000494: 21,3707           00006        SUMTERMS           EXTEND                                         
064460,000495: 21,3710           13714                           BZF      NEGUSUM                               #  BRANCH IF DEL IS ZERO.
064461,000496: 
064462,000497: 21,3711           00006                           EXTEND                                         #  DEL FACTOR IS +1.
064463,000498: 21,3712           31750                           DCA      FUNCTION                              
064464,000499: 21,3713           21736                           DAS      K2THETA                               #  NOW ADD IN THE K2THETA TERM.
064465,000500: 21,3714           11735        NEGUSUM            CCS      K2THETA                               #  TEST SIGN OF HIGH ORDER PART.
064466,000501: 21,3715           13721                           TCF      NEGDRIVE                              
064467,000502: 21,3716           13720                           TCF      +2                                    
064468,000503: 21,3717           13723                           TCF      POSDRIVE                              
064469,000504: 
064470,000505: 21,3720           11736                           CCS      K2THETA    +1                         #  SIGN TEST FOR LOW ORDER PART.
064471,000506: 21,3721           34753        NEGDRIVE           CA       BIT1                                  
064472,000507: 21,3722           13724                           TCF      +2                                    #  STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
064473,000508: 21,3723           44753        POSDRIVE           CS       BIT1                                  
064474,000509: 21,3724           54001                           TS       L                                     #  SAVE FOR DRIVE REVERSAL TEST.
064475,000510: 21,3725           51746                           INDEX    QRCNTR                                
064476,000511: 21,3726           57500                           XCH      NEGUQ                                 
064477,000512: 
064478,000513: 21,3727           00006                           EXTEND                                         
064479,000514: 21,3730           70001                           MP       L                                     #  MULTIPLY OLD NEGU AND NEW NEGU.
064480,000515: 21,3731           10001                           CCS      L                                     
064481,000516: 21,3732           13747                           TCF      LOUPE                                 #  NON-ZERO GIMBAL DRIVE BEING CONTINUED.
064482,000517: 
064483,000518: 21,3733           13744                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
064484,000519: 
064485,000520: 21,3734           13736                           TCF      REVERSAL                              #  NON-ZERO GIMBAL DRIVE BEING REVERSED.
064486,000521: 21,3735           13744                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
064487,000522: 
064488,000523: 21,3736           51746        REVERSAL           INDEX    QRCNTR                                #  A ZERO-DRIVE PAUSE IS NEEDED HERE.  ZERO
064489,000524: 21,3737           55510                           TS       QACCDOT                               #  IS IN A REGISTER FROM CCS ON (-1).
064490,000525: 21,3740           51746                           INDEX    QRCNTR                                
064491,000526: 21,3741           43760                           CS       GMBLBITA                              
064492,000527: 21,3742           00006                           EXTEND                                         
064493,000528: 21,3743           03012                           WAND     CHAN12                                
064494,000529: 
064495,000530: 21,3744           41273        ZEROLOUP           CS       RCSFLAGS                              #  SET UP REQUEST FOR ACDT+C12 CALL.
064496,000531: 21,3745           74747                           MASK     CALLGMBL                              

Page 1478

064498,000533: 21,3746           27273                           ADS      RCSFLAGS                              
064499,000534: 
064500,000535: 21,3747           11746        LOUPE              CCS      QRCNTR                                #  HAVE BOTH AXES BEEN PROCESSED?
064501,000536: 21,3750           13306                           TCF      GOQTRIMG                              #  NO.  DO Q AXIS NEXT.
064502,000537: 
064503,000538: 21,3751           31476                           CA       SAVESR                                #  RESTORE THE SR
064504,000539: 21,3752           54021                           TS       SR                                    
064505,000540: 
064506,000541: 21,3753           00006        GOCLOSE            EXTEND                                         #  TERMINATE THE JASK.
064507,000542: 21,3754           33757                           DCA      CLOSEADR                              
064508,000543: 21,3755           52006                           DTCB                                           
064509,000544: 
064510,000545: 21,3756  E6,1537                                  EBANK=   AOSQ                                  
064511,000546: 21,3756           03173 36106  CLOSEADR           2CADR    CLOSEOUT                              #  TERMINATE THE JASK.
064512,000547: 
064513,000548: 21,3760     5742               TWELVE             EQUALS   OCT14                                 
064514,000549: 21,3760           01400        GMBLBITA           OCTAL    01400                                 #  INDEXED WRT GMBLBITB   DO NOT MOVE ******
064515,000550: 21,3761           20761        STARTER            DEC      .53033                                #  INITIAL VALUE FOR SQRT ALGORITHM.
064516,000551: 21,3762           06000        GMBLBITB           OCTAL    06000                                 #  INDEXED WRT GMBLBITA   DO NOT MOVE ******
064517,000552: 
064518,000553:                                                                                                  #  SUBROUTINE ROOTCYCL:  BY CRAIG WORK,3 APRIL 68
064519,000554: 
064520,000555:                                                                                                  #  ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION.  THE INITIAL GUESS AT THE
064521,000556:                                                                                                  #  SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG.  THE NEW APPROXI-
064522,000557:                                                                                                  #  MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER.  DEBRIS:  A,L,SR,SCRATCH.   ROOTCYCL IS CALLED FROM
064523,000558:                                                                                                  #  LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
064524,000559: 
064525,000560:                                                                                                  #  WARNING:  IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
064526,000561: 
064527,000562: 21,3763           55742        ROOTCYCL           TS       SCRATCH                               #  STORE X
064528,000563: 21,3764           54021                           TS       SR                                    #  X/2 NOW IN SR
064529,000564: 21,3765           31743                           CA       HALFARG                               #  ARG/2 IN THE A REG
064530,000565: 21,3766           22007                           ZL                                             #  PREPARE FOR DIVISION
064531,000566: 21,3767           00006                           EXTEND                                         
064532,000567: 21,3770           11742                           DV       SCRATCH                               #  (ARG/X)/2
064533,000568: 21,3771           60021                           AD       SR                                    #  (X + ARG/X)/2 IN THE A REG
064534,000569: 21,3772           00002                           TC       Q                                     
064535,000570: 
064536,000571: 

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