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.

063938,000002:                                                                                                  ## Copyright:   Public domain.
063939,000003:                                                                                                  ## Filename:    TRIM_GIMBAL_CONTROL_SYSTEM.agc
063940,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
063941,000005:                                                                                                  ##              It is part of the source code for the original release
063942,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
063943,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
063944,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
063945,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
063946,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
063947,000011:                                                                                                  ##              that the code format has been changed to conform to the
063948,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
063949,000013:                                                                                                  ##              original YUL assembler.
063950,000014:                                                                                                  ## Reference:   pp. 1467-1478
063951,000015:                                                                                                  ## Assembler:   yaYUL
063952,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
063953,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
063954,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
063955,000019:                                                                                                  ##              2016-12-18 MAS  Updated from comment-proofed Luminary 99 version.
063956,000020:                                                                                                  ##              2016-12-29 RRB  Updated for Luminary 69.
063957,000021:                                                                                                  ##              2017-01-21 HG   Fix operand BIT 12 -> BIT12
063958,000022:                                                                                                  ##                                          NEGSUM -> NEGUSUM
063959,000023:                                                                                                  ##              2017-01-23 Fix operator TC -> TCF
063960,000024:                                                                                                  ##              2017-01-28 RSB  Proofed comment text using octopus/prooferComments
063961,000025:                                                                                                  ##                              and fixed errors found.
063962,000026: 

Page 1467

063964,000028: 21,3263                                           BANK     21                                    
063965,000029: 21,3263  E6,1446                                  EBANK=   QDIFF                                 
063966,000030: 21,2000                                           SETLOC   DAPS4                                 
063967,000031: 21,2000                                           BANK                                           
063968,000032: 
063969,000033: 21,3263                                           COUNT*   $$/DAPGT                              
063970,000034: 
063971,000035:                                                                                                  #  CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
063972,000036:                                                                                                  #  AUTOPILOT ARE BOTH ON:
063973,000037:                                                                                                  #        A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
063974,000038:                                                                                                  #           INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
063975,000039:                                                                                                  #        B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
063976,000040:                                                                                                  #           ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
063977,000041:                                                                                                  #  GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
063978,000042: 
063979,000043: 21,3263           37746        GTS                CAF      NEGONE                                #  MAKE THE NEXT PASS THROUGH THE DAP BE
063980,000044: 21,3264           55627                           TS       COTROLER                              #        THROUGH RCS CONTROL,
063981,000045: 21,3265           34751                           CAF      FOUR                                  #        AND ENSURE THAT IT IS NOT A SKIP.
063982,000046: 21,3266           55535                           TS       SKIPU                                 
063983,000047: 21,3267           55536                           TS       SKIPV                                 
063984,000048: 
063985,000049: 21,3270           34752                           CAF      TWO                                   
063986,000050: 21,3271           55631                           TS       INGTS                                 #  SET INDICATOR OF GTS CONTROL POSITIVE.
063987,000051: 21,3272           55630                           TS       QGIMTIMR                              #  SET TIMERS TO 200 MSEC TO AVOID BOTH
063988,000052: 21,3273           55632                           TS       RGIMTIMR                              #  RUNAWAY AND INTERFERENCE BY NULLING.
063989,000053: 
063990,000054:                                                                                                  #  THE DRIVE SETTING ALGORITHM
063991,000055: 
063992,000056:                                                                                                  #        DEL = SGN(OMEGA*K + ALPHA*ABS(ALPHA)/2).
063993,000057: 
063994,000058:                                                                                                  #        NEGUSUM = ERROR.K(2) + DEL(OMEGA.K.DEL + ALPHA(2)/2)(3/2) + ALPHA(OMEGA.K.DEL + ALPHA(2)/3)
063995,000059: 
063996,000060:                                                                                                  #        DRIVE = -SGN(NEGUSUM)
063997,000061: 
063998,000062: 21,3274           30021                           CA       SR                                    #  SAVE THE SR.  SHIFT IT LEFT TO CORRECT
063999,000063: 21,3275           60000                           AD       A                                     #  FOR THE RIGHT SHIFT DUE TO EDITING.
064000,000064: 21,3276           55476                           TS       SAVESR                                
064001,000065: 
064002,000066: 21,3277           34752        GTSGO+DN           CAF      TWO                                   #  SET INDEXER FOR R-AXIS CALCULATIONS.
064003,000067: 21,3300           55746                           TS       QRCNTR                                
064004,000068: 21,3301           31541                           CA       AOSR                                  
064005,000069: 21,3302           00006                           EXTEND                                         
064006,000070: 21,3303           74751                           MP       BIT3                                  
064007,000071: 21,3304           31435                           CA       EDOTR                                 
064008,000072: 21,3305           13314                           TCF      GTSQAXIS                              
064009,000073: 
064010,000074: 21,3306           34755        GOQTRIMG           CAF      ZERO                                  #  SET INDEXER FOR Q-AXIS CALCULATIONS
064011,000075: 21,3307           55746                           TS       QRCNTR                                

Page 1468

064013,000077: 21,3310           31537                           CA       AOSQ                                  
064014,000078: 21,3311           00006                           EXTEND                                         
064015,000079: 21,3312           74751                           MP       BIT3                                  
064016,000080: 21,3313           31434                           CA       EDOTQ                                 
064017,000081: 21,3314           53744        GTSQAXIS           DXCH     WCENTRAL                              
064018,000082: 21,3315           00006                           EXTEND                                         
064019,000083: 21,3316           51746                           INDEX    QRCNTR                                #  PICK UP K AND K(2) FOR THIS AXIS
064020,000084: 21,3317           31504                           DCA      KQ                                    
064021,000085: 21,3320           53742                           DXCH     KCENTRAL                              
064022,000086: 
064023,000087: 21,3321           51746                           INDEX    QRCNTR                                #  QDIFF, RDIFF ARE STORED IN D.P.
064024,000088: 21,3322           31446                           CAE      QDIFF                                 
064025,000089: 
064026,000090: 21,3323           00006        ALGORTHM           EXTEND                                         #  Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
064027,000091: 21,3324           71742                           MP       K2CNTRAL                              #  FORM K(2)*THETA IN D.P.
064028,000092: 21,3325           23735                           LXCH     K2THETA                               
064029,000093: 21,3326           00006                           EXTEND                                         #  FORM K(2)*THETA*SF2 IN D.P.
064030,000094: 21,3327           74743                           MP       BIT9                                  
064031,000095: 21,3330           53736                           DXCH     K2THETA                               
064032,000096: 21,3331           00006                           EXTEND                                         
064033,000097: 21,3332           74743                           MP       BIT9                                  
064034,000098: 21,3333           27736                           ADS      K2THETA    +1                         
064035,000099: 
064036,000100: 21,3334           31743                           CAE      WCENTRAL                              #  GET OMEGA
064037,000101: 21,3335           00006                           EXTEND                                         
064038,000102: 21,3336           71741                           MP       KCENTRAL                              #  FORM K*OMEGA IN D.P.
064039,000103: 21,3337           23741                           LXCH     OMEGA.K                               
064040,000104: 21,3340           00006                           EXTEND                                         #  FORM OMEGA*K*SF1 IN D.P.
064041,000105: 21,3341           74740                           MP       BIT12                                 
064042,000106: 21,3342           53742                           DXCH     OMEGA.K                               
064043,000107: 21,3343           00006                           EXTEND                                         
064044,000108: 21,3344           74740                           MP       BIT12                                 
064045,000109: 21,3345           27742                           ADS      OMEGA.K    +1                         
064046,000110: 
064047,000111: 21,3346           31744                           CAE      ACENTRAL                              #  FORM ALPHA(2)/2 IN D.P.
064048,000112: 21,3347           00006                           EXTEND                                         
064049,000113: 21,3350           70000                           SQUARE                                         
064050,000114: 21,3351           53740                           DXCH     A2CNTRAL                              
064051,000115: 
064052,000116: 21,3352           31744                           CAE      ACENTRAL                              #  GET ALPHA*ABS(ALPHA)/2, IF ALPHA GREATER
064053,000117:                                                                                                  #  THAN 0. OTHERWISE TAKE NEGATIVE OF ABOVE
064054,000118: 21,3353           00006                           EXTEND                                         
064055,000119: 21,3354           63360                           BZMF     +4                                    
064056,000120: 21,3355           00006                           EXTEND                                         
064057,000121: 21,3356           31740                           DCA      A2CNTRAL                              
064058,000122: 21,3357           13362                           TCF      +3                                    
064059,000123: 21,3360           00006                           EXTEND                                         
064060,000124: 21,3361           41740                           DCS      A2CNTRAL                              
064061,000125: 21,3362           53750                           DXCH     FUNCTION                              #  SAVE AS SGN(ALPHA)*ALPHA(2)/2

Page 1469

064063,000127: 21,3363           00006                           EXTEND                                         
064064,000128: 21,3364           31742                           DCA      OMEGA.K                               
064065,000129: 21,3365           21750                           DAS      FUNCTION                              #  FORM FUNCT1
064066,000130: 
064067,000131: 21,3366           11747                           CCS      FUNCTION                              #  DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
064068,000132: 21,3367           13373                           TCF      POSFNCT1                              #  OTHERWISE DEL = -1
064069,000133: 21,3370           13372                           TCF      +2                                    
064070,000134: 21,3371           13375                           TCF      NEGFNCT1                              
064071,000135: 
064072,000136: 21,3372           11750                           CCS      FUNCTION   +1                         #  USE LOW ORDER WORD SINCE HIGH IS ZERO
064073,000137: 21,3373           34753        POSFNCT1           CAF      BIT1                                  
064074,000138: 21,3374           13376                           TCF      +2                                    
064075,000139: 21,3375           44753        NEGFNCT1           CS       BIT1                                  
064076,000140: 21,3376           55745                           TS       DEL                                   
064077,000141: 
064078,000142: 21,3377           11745                           CCS      DEL                                   #  MAKE OMEGA*K REALLY DEL*OMEGA*K
064079,000143: 21,3400           13405                           TCF      FUNCT2                                #  (NOTHING NEED BE DONE)
064080,000144: 21,3401           13405                           TCF      FUNCT2                                
064081,000145: 21,3402           00006                           EXTEND                                         
064082,000146: 21,3403           41742                           DCS      OMEGA.K                               
064083,000147: 21,3404           53742                           DXCH     OMEGA.K                               #  CHANGE SIGN OF OMEGA*K
064084,000148: 
064085,000149: 21,3405           00006        FUNCT2             EXTEND                                         
064086,000150: 21,3406           31742                           DCA      OMEGA.K                               
064087,000151: 21,3407           53750                           DXCH     FUNCTION                              #  DEL*OMEGA*K
064088,000152: 21,3410           00006                           EXTEND                                         
064089,000153: 21,3411           31740                           DCA      A2CNTRAL                              
064090,000154: 21,3412           21750                           DAS      FUNCTION                              #  DEL*OMEGA*K + ALPHA(2)/2
064091,000155: 21,3413           31737        FUNCT3             CAE      A2CNTRAL                              #  CALCULATE (2/3)*ALPHA(2)/2 = ALPHA(2)/3
064092,000156: 21,3414           00006                           EXTEND                                         
064093,000157: 21,3415           73446                           MP       .66667                                
064094,000158: 21,3416           53740                           DXCH     A2CNTRAL                              
064095,000159: 21,3417           56001                           XCH      L                                     
064096,000160: 21,3420           00006                           EXTEND                                         
064097,000161: 21,3421           73446                           MP       .66667                                
064098,000162: 21,3422           27740                           ADS      A2CNTRAL   +1                         
064099,000163: 21,3423           54001                           TS       L                                     
064100,000164: 21,3424           13426                           TCF      +2                                    
064101,000165: 21,3425           27737                           ADS      A2CNTRAL                              
064102,000166: 21,3426           53742                           DXCH     OMEGA.K                               #  DEL*OMEGA*K + ALPHA(2)/3 = G
064103,000167: 21,3427           21740                           DAS      A2CNTRAL                              
064104,000168: 21,3430           31737                           CAE      A2CNTRAL                              #  G*ALPHA IN D.P.
064105,000169: 21,3431           00006                           EXTEND                                         
064106,000170: 21,3432           71744                           MP       ACENTRAL                              
064107,000171: 21,3433           53740                           DXCH     A2CNTRAL                              
064108,000172: 21,3434           56001                           XCH      L                                     
064109,000173: 21,3435           00006                           EXTEND                                         
064110,000174: 21,3436           71744                           MP       ACENTRAL                              
064111,000175: 21,3437           27740                           ADS      A2CNTRAL   +1                         
064112,000176: 21,3440           54001                           TS       L                                     

Page 1470

064114,000178: 21,3441           13443                           TCF      +2                                    
064115,000179: 21,3442           27737                           ADS      A2CNTRAL                              
064116,000180: 
064117,000181: 21,3443           53740                           DXCH     A2CNTRAL                              #  FIRST AND THIRD TERMS
064118,000182: 21,3444           21736                           DAS      K2THETA                               #  SUMMED IN D.P.
064119,000183: 
064120,000184: 21,3445           13561                           TCF      RSTOFGTS                              
064121,000185: 
064122,000186: 21,3446           25253        .66667             DEC      .66667                                
064123,000187: 
064124,000188: 16,3720                                           BANK     16                                    
064125,000189: 16,3720  E6,1500                                  EBANK=   NEGUQ                                 
064126,000190: 16,2000                                           SETLOC   DAPS1                                 
064127,000191: 16,2000                                           BANK                                           
064128,000192: 
064129,000193:                                                                                                  #  THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
064130,000194:                                                                                                  #  THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES.  ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
064131,000195: 
064132,000196:                                                                                                  #  WARNING:  ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
064133,000197: 
064134,000198: 16,3720           07400        BGIM               OCTAL    07400                                 
064135,000199: 16,3721     0066               CHNL12             EQUALS   ITEMP6                                
064136,000200: 16,3721           41500        ACDT+C12           CS       NEGUQ                                 
064137,000201: 16,3722           00006                           EXTEND                                         #  GIMBAL DRIVE REQUESTS.
064138,000202: 16,3723           71507                           MP       ACCDOTQ                               
064139,000203: 16,3724           23510                           LXCH     QACCDOT                               
064140,000204: 16,3725           41502                           CS       NEGUR                                 
064141,000205: 16,3726           00006                           EXTEND                                         
064142,000206: 16,3727           71511                           MP       ACCDOTR                               
064143,000207: 16,3730           23512                           LXCH     RACCDOT                               
064144,000208: 
064145,000209: 16,3731           11500                           CCS      NEGUQ                                 
064146,000210: 16,3732           34742                           CAF      BIT10                                 
064147,000211: 16,3733           13735                           TCF      +2                                    
064148,000212: 16,3734           34743                           CAF      BIT9                                  
064149,000213: 16,3735           54066                           TS       CHNL12                                
064150,000214: 
064151,000215: 16,3736           11502                           CCS      NEGUR                                 
064152,000216: 16,3737           34740                           CAF      BIT12                                 
064153,000217: 16,3740           13742                           TCF      +2                                    
064154,000218: 16,3741           34741                           CAF      BIT11                                 
064155,000219: 16,3742           26066                           ADS      CHNL12                                #  (STORED RESULT NOT USED AT PRESENT)
064156,000220: 
064157,000221: 16,3743           43720                           CS       BGIM                                  
064158,000222: 16,3744           00006                           EXTEND                                         
064159,000223: 16,3745           02012                           RAND     CHAN12                                
064160,000224: 16,3746           60066                           AD       CHNL12                                
064161,000225: 16,3747           00006                           EXTEND                                         
064162,000226: 16,3750           01012                           WRITE    CHAN12                                

Page 1471

064164,000228: 16,3751           44747                           CS       CALLGMBL                              #  TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
064165,000229: 16,3752           71273                           MASK     RCSFLAGS                              
064166,000230: 16,3753           55273                           TS       RCSFLAGS                              
064167,000231: 
064168,000232: 16,3754           00002                           TC       Q                                     #  RETURN TO CALLER.
064169,000233: 
064170,000234: 21,3447                                           BANK     21                                    
064171,000235: 21,3447  E6,1446                                  EBANK=   QDIFF                                 
064172,000236: 21,2000                                           SETLOC   DAPS4                                 
064173,000237: 21,2000                                           BANK                                           
064174,000238: 

Page 1472

064176,000240:                                                                                                  #  SUBROUTINE TIMEGMBL:  MOD 0, OCTOBER 1967, CRAIG WORK
064177,000241: 
064178,000242:                                                                                                  #  TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
064179,000243:                                                                                                  #  THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS.  INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
064180,000244:                                                                                                  #  SCALED AT PI/8.                         FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT).  A ZERO
064181,000245:                                                                                                  #  ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY.  OTHERWISE, THE GIMBAL IS TURNED ON
064182,000246:                                                                                                  #  DRIVING IN THE CORRECT DIRECTION. THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
064183,000247:                                                                                                  #  IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE.  NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
064184,000248:                                                                                                  #  WHICH IS NEGATIVE, ZERO, OR POSITIVE.
064185,000249: 
064186,000250:                                                                                                  #  INPUTS:       AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7).     PI/2(7).
064187,000251: 
064188,000252:                                                                                                  #  OUTPUTS:      NEW GIMBAL DRIVE BITS IN CHANNEL 12,NEGUQ,NEGUR,QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
064189,000253:                                                                                                  #                Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
064190,000254: 
064191,000255:                                                                                                  #  DEBRIS:       A,L,Q, ITEMPS 2,3,6, RUPTREG2 AND ACDT+C12 DEBRIS.
064192,000256: 
064193,000257:                                                                                                  #  EXITS:        VIA TC Q.
064194,000258: 
064195,000259:                                                                                                  #  ALARMS, ABORTS, :  NONE
064196,000260: 
064197,000261:                                                                                                  #  SUBROUTINES:  ACDT+C12, IBNKCALL
064198,000262: 
064199,000263:                                                                                                  #  WARNING:      THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS.  THEREFORE IT MAY ONLY BE CALLED WITH
064200,000264:                                                                                                  #  INTERRUPT INHIBITED.
064201,000265: 
064202,000266:                                                                                                  #  ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
064203,000267:                                                                                                  #        NEGUQ           ERASE   +2              NEGATIVE OF Q-AXIS GIMBAL DRIVE
064204,000268:                                                                                                  #        (SPWORD)        EQUALS  NEGUQ +1        ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
064205,000269:                                                                                                  #        NEGUR           EQUALS  NEGUQ +2        NEGATIVE OF R-AXIS GIMBAL DRIVE
064206,000270: 
064207,000271:                                                                                                  #        ACCDOTQ         ERASE   +2              Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
064208,000272:                                                                                                  #        (SPWORD)        EQUALS  ACCDOTQ +1      ANY S.P. ERASABLE NUMBER NOW QACCDOT
064209,000273:                                                                                                  #        ACCDOTR         EQUALS  ACCDOTQ +2      R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
064210,000274:                                                                                                  #                                                ACCDOTQ, ACCDOTR ARE MAGNITUDES.
064211,000275:                                                                                                  #        AOSQ            ERASE   +4              Q-AXIS ACC., D.P. AT PI/2 R/SEC(2)
064212,000276:                                                                                                  #        AOSR            EQUALS  AOSQ +2         R-AXIS ACCELERATION SCALED AT PI/2 R/S2
064213,000277: 
064214,000278: 21,3447     0066               QRNDXER            EQUALS   ITEMP6                                
064215,000279: 21,3447           23146        OCT23146           OCTAL    23146                                 #  DECIMAL .6
064216,000280: 21,3450     0063               NZACCDOT           EQUALS   ITEMP3                                
064217,000281: 
064218,000282: 21,3450           34753        TIMEGMBL           CAF      ONE                                   #  INITIALIZE ALLOWGTS.
064219,000283: 21,3451           55501                           TS       ALLOWGTS                              
064220,000284: 
064221,000285: 21,3452           34752                           CAF      TWO                                   #  SET UP LOOP FOR R AXIS.
064222,000286: 21,3453           22002                           LXCH     Q                                     #  SAVE RETURN ADDRESS.
064223,000287: 21,3454           22071                           LXCH     RUPTREG2                              

Page 1473

064225,000289: 21,3455           13457                           TCF      +2                                    
064226,000290: 21,3456           34755        TIMQGMBL           CAF      ZERO                                  #  NOW DO THE Q-AXIS
064227,000291: 21,3457           54066                           TS       QRNDXER                               
064228,000292: 21,3460           50066                           INDEX    QRNDXER                               
064229,000293: 21,3461           31507                           CA       ACCDOTQ                               #  ACCDOT IS PRESUMED TO BE AT PI/2(7).
064230,000294: 21,3462           00006                           EXTEND                                         
064231,000295: 21,3463           63533                           BZMF     TGOFFNOW                              #  IS ACCDOT LESS THAN OR EQUAL TO 0?
064232,000296: 21,3464           54063                           TS       NZACCDOT                              #  NO.  STORE NON-ZERO, POSITIVE ACCDOT.
064233,000297: 
064234,000298: 21,3465           50066        ALPHATRY           INDEX    QRNDXER                               
064235,000299: 21,3466           41537                           CS       AOSQ                                  
064236,000300: 21,3467           00006                           EXTEND                                         
064237,000301: 21,3470           13533                           BZF      TGOFFNOW                              #  IS ALPHA ZERO?
064238,000302: 
064239,000303: 21,3471           54002                           TS       Q                                     #  SAVE A COPY OF -AOS.
064240,000304: 21,3472           00006                           EXTEND                                         #  NO.  RESCALE FOR TIMEGMBL USE.
064241,000305: 21,3473           73447                           MP       OCT23146                              #  OCTAL 23146 IS DECIMAL .6
064242,000306: 21,3474           60002                           AD       Q                                     #  -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
064243,000307: 21,3475           54001                           TS       L                                     #  WAS THERE OVERFLOW?
064244,000308: 21,3476           13503                           TCF      SETNEGU                               #  NO.  COMPUTE DRIVE TIME.
064245,000309: 
064246,000310: 21,3477           40000                           CS       A                                     #  RECOVER  -SGN(AOS) IN THE A REGISTER.
064247,000311: 21,3500           50066                           INDEX    QRNDXER                               #  YES.  START DRIVE WITHOUT WAITLIST.
064248,000312: 21,3501           57500                           XCH      NEGUQ                                 
064249,000313: 21,3502           13537                           TCF      NOTALLOW                              #  KNOCK DOWN THE ALLOWGTS FLAG.
064250,000314: 
064251,000315: 21,3503           00006        SETNEGU            EXTEND                                         
064252,000316: 21,3504           63511                           BZMF     POSALPH                               
064253,000317: 
064254,000318: 21,3505           40000                           COM                                            
064255,000319: 21,3506           54062                           TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
064256,000320: 21,3507           44753                           CS       BIT1                                  
064257,000321: 21,3510           13513                           TCF      POSALPH    +2                         
064258,000322: 21,3511           54062        POSALPH            TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
064259,000323: 21,3512           34753                           CA       BIT1                                  
064260,000324: 21,3513           50066                 +2        INDEX    QRNDXER                               #  SGN(AOS) INTO NEGU
064261,000325: 21,3514           55500                           TS       NEGUQ                                 #  STORE SGN(APLHA) AS NEGU
064262,000326: 
064263,000327: 21,3515           30063                           CA       NZACCDOT                              
064264,000328: 21,3516           00006                           EXTEND                                         
064265,000329: 21,3517           74740                           MP       BIT12                                 #  2*ACCDOT, SCALED AT PI/8.
064266,000330: 21,3520           60062                           AD       ITEMP2                                #  -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
064267,000331: 21,3521           00006                           EXTEND                                         
064268,000332: 21,3522           63537                           BZMF     NOTALLOW                              #  IS DRIVE TIME MORE THAN TWO SECONDS?
064269,000333: 21,3523           40062                           CS       ITEMP2                                #  NO.  COMPUTE DRIVE TIME.
064270,000334: 21,3524           00006                           EXTEND                                         #  ABS(ALPHA) AT PI/8.
064271,000335: 21,3525           73560                           MP       OCT00240                              #  DECIMAL 10/1024
064272,000336: 21,3526           00006                           EXTEND                                         #  QUOTIENT IS DRIVE TIME AT WAITLIST.
064273,000337: 21,3527           10063                           DV       NZACCDOT                              #  ABS(ALPHA)/ACCDOT AT 2(14)/100

Page 1474

064275,000339: 21,3530           00006                           EXTEND                                         
064276,000340: 21,3531           13533                           BZF      TGOFFNOW                              #  DRIVE TIME MUST BE GREATER THAN ZERO.
064277,000341: 
064278,000342: 21,3532           13545                           TCF      DRIVEON                               
064279,000343: 
064280,000344: 21,3533           34755        TGOFFNOW           CAF      ZERO                                  #  TURN OFF GIMBAL NOW.
064281,000345: 21,3534           50066                           INDEX    QRNDXER                               
064282,000346: 21,3535           55500                           TS       NEGUQ                                 
064283,000347: 
064284,000348: 21,3536           13547                           TCF      DONEYET                               
064285,000349: 
064286,000350: 21,3537           36010        NOTALLOW           CAF      OCT31                                 
064287,000351: 21,3540           50066                           INDEX    QRNDXER                               
064288,000352: 21,3541           55630                           TS       QGIMTIMR                              
064289,000353: 21,3542           34755                           CAF      ZERO                                  #  DRIVE TIME IS MORE THAN 2 SECONDS, SO
064290,000354: 21,3543           55501                           TS       ALLOWGTS                              #  DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
064291,000355:                                                                                                  #  CONTROL UNTIL AOSTASK APPROVES.
064292,000356: 21,3544           13547                           TCF      DONEYET                               #  NO WAITLIST CALL IS MADE.
064293,000357: 
064294,000358: 21,3545           50066        DRIVEON            INDEX    QRNDXER                               
064295,000359: 21,3546           55630                           TS       QGIMTIMR                              #  CHOOSE Q OR R AXIS.
064296,000360: 
064297,000361: 21,3547           10066        DONEYET            CCS      QRNDXER                               
064298,000362: 21,3550           13456                           TCF      TIMQGMBL                              
064299,000363: 
064300,000364: 21,3551           52073                           DXCH     RUPTREG3                              #  PROTECT IBNKCALL ERASABLES.  ACDT+C12
064301,000365: 21,3552           52063                           DXCH     ITEMP2                                #  LEAVES ITEMPS2,3 ALONE.
064302,000366: 
064303,000367: 21,3553           04674                           TC       IBNKCALL                              #  TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
064304,000368: 21,3554           35721                           CADR     ACDT+C12                              
064305,000369: 
064306,000370: 21,3555           52063                           DXCH     ITEMP2                                #  RESTORE ERASABLES FOR IBNKCALL.
064307,000371: 21,3556           52073                           DXCH     RUPTREG3                              
064308,000372: 
064309,000373: 21,3557           00071                           TC       RUPTREG2                              #  RETURN TO CALLER.
064310,000374: 
064311,000375: 21,3560           00240        OCT00240           OCTAL    00240                                 #  DECIMAL 10/1024
064312,000376: 

Page 1475

064314,000378:                                                                                                  #  THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY.  THE QUANTITY NEGUSUM
064315,000379:                                                                                                  #  IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM.  NEW DRIVES ARE ENTERED TO CH 12.
064316,000380: 
064317,000381: 21,3561           11747        RSTOFGTS           CCS      FUNCTION                              
064318,000382: 21,3562           13603                           TCF      GOODARG                               #  FUNCTION IS POSITIVE.  GET 3/2 POWER.
064319,000383: 21,3563           13565                           TCF      +2                                    #  HIGH ORDER WORD IS ZERO.  TRY THE LOWER.
064320,000384: 21,3564           13571                           TCF      ZEROOT                                #  NEGATIVE.  USE ZERO FOR 3/2 POWER.
064321,000385: 
064322,000386: 21,3565           41750                           CS       FUNCTION   +1                         #  IF ARG IS LESS THAN 2(-18), THEN THE 3/2
064323,000387: 21,3566           64741                           AD       BIT11                                 #  POWER IS LESS THAN 2(-27).  USE ZERO.
064324,000388: 21,3567           00006                           EXTEND                                         
064325,000389: 21,3570           63574                           BZMF     ZEROHIGH                              #  BRANCH IF ARG NOT LESS THAN 2(-18).
064326,000390: 
064327,000391: 21,3571           00006        ZEROOT             EXTEND                                         
064328,000392: 21,3572           34756                           DCA      ZERO                                  
064329,000393: 21,3573           13714                           TCF      NEGUSUM                               
064330,000394: 
064331,000395: 21,3574           34317        ZEROHIGH           CA       FOURTEEN                              #  ARG LESS THAN 2(-14) MEANS 3/2 POWER
064332,000396:                                                                                                  #  WILL BE LESS THAN 2(-21).
064333,000397: 21,3575           55737                           TS       SHFTFLAG                              
064334,000398: 
064335,000399: 21,3576           34752                           CA       TWO                                   
064336,000400: 21,3577           55740                           TS       ININDEX                               #  INITIALIZE THE SHIFT LOOP.
064337,000401: 
064338,000402:                                                                                                  #  COLLECT THE 14 MOST SIGNIFICANT BITS OF
064339,000403: 21,3600           57750                           XCH      FUNCTION   +1                         #  THE 28 INTO THE HIGH ORDER WORD.
064340,000404: 21,3601           57747                           XCH      FUNCTION                              
064341,000405: 21,3602           13616                           TCF      SCALLOOP                              
064342,000406: 21,3603           35742        GOODARG            CA       TWELVE                                
064343,000407: 21,3604           55740                           TS       ININDEX                               #  INITIALIZE THE SHIFT LOOP.
064344,000408: 21,3605           34755                           CA       ZERO                                  #  THERE ARE SIGNIFICANT BITS IN THE HIGH
064345,000409: 21,3606           55737                           TS       SHFTFLAG                              #  ORDER WORD, SO SET SHFTFLAG TO ZERO.
064346,000410: 
064347,000411: 21,3607           13616                           TCF      SCALLOOP                              
064348,000412: 
064349,000413: 21,3610           31747        SCALSTRT           CA       FUNCTION                              
064350,000414: 21,3611           13633                           TCF      SCALDONE                              
064351,000415: 
064352,000416: 21,3612           37745        MULBUSH            CA       NEG2                                  #  IF ARG IS NOT LESS THAN 1/4, INDEX IS
064353,000417: 21,3613           27740                           ADS      ININDEX                               #  ZERO, INDICATING NO SHIFT NEEDED.
064354,000418: 21,3614           00006                           EXTEND                                         #  BRANCH IF ARG IS NOT LESS THAN 1/4.
064355,000419: 21,3615           63610                           BZMF     SCALSTRT                              #  OTHERWISE COMPARE ARG WITH A REFERENCE
064356,000420:                                                                                                  #  WHICH IS 4 TIMES LARGER THAN THE LAST.
064357,000421: 21,3616           41747        SCALLOOP           CS       FUNCTION                              
064358,000422: 21,3617           51740                           INDEX    ININDEX                               
064359,000423: 21,3620           64735                           AD       BIT15                                 #  REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
064360,000424: 21,3621           00006                           EXTEND                                         
064361,000425: 21,3622           63612                           BZMF     MULBUSH                               #  IF ARG IS NOT LESS THAN REFERENCE, GO
064362,000426:                                                                                                  #  AROUND THE MULBERRY BUSH ONCE MORE.
064363,000427: 21,3623           51740                           INDEX    ININDEX                               

Page 1476

064365,000429: 21,3624           34735                           CA       BIT15                                 #  THIS IS THE SCALE MAGNITUDE
064366,000430: 21,3625           56002                           XCH      Q                                     #  2**(-ININDEX) IS THE SHIFT DIVISOR.
064367,000431: 21,3626           00006                           EXTEND                                         #  RESCALE ARGUMENT.
064368,000432: 21,3627           31750                           DCA      FUNCTION                              
064369,000433: 21,3630           00006                           EXTEND                                         
064370,000434: 21,3631           10002                           DV       Q                                     
064371,000435: 21,3632           55747                           TS       FUNCTION                              #  ININDEX AND SHFTFLAG PRESERVE INFO FOR
064372,000436:                                                                                                  #  RESCALING AFTER ROOT PROCESS.
064373,000437: 21,3633           00006        SCALDONE           EXTEND                                         #  AFTER 3/2 POWER IS TAKEN, SCALE FACTOR
064374,000438: 21,3634           74737                           MP       BIT13                                 #  OF SQRT(1/2) WILL BE NEEDED, SO FACTOR
064375,000439: 21,3635           55743                           TS       HALFARG                               #  OF 1/2 IS INCLUDED NOW, BEFORE SQRT.
064376,000440: 
064377,000441: 21,3636           33761                           CA       STARTER                               #  INITIAL GUESS FOR SQRT ALGORITHM.
064378,000442: 21,3637           03763                           TC       ROOTCYCL                              
064379,000443: 21,3640           03763                           TC       ROOTCYCL                              
064380,000444: 21,3641           03763                           TC       ROOTCYCL                              
064381,000445: 
064382,000446: 21,3642           00006                           EXTEND                                         #  SQRT(1/2)*SQRT(ARG) IN A.
064383,000447: 21,3643           71747                           MP       FUNCTION                              #  SQRT(1/2)*ARG*SQRT(ARG) IN A,L.
064384,000448: 21,3644           53750                           DXCH     FUNCTION                              
064385,000449: 
064386,000450: 21,3645           31737        DOSHIFT            CA       SHFTFLAG                              #  HOW MANY SHIFT BITS ARE THERE?
064387,000451: 21,3646           61740                           AD       ININDEX                               #  2**(-ININDEX) WAS SHIFT DIVISOR.
064388,000452: 21,3647           54021                           TS       SR                                    
064389,000453: 21,3650           60021                           AD       SR                                    #  THIS MANY SHIFTS ARE REQUIRED.
064390,000454: 21,3651           54002        SAVESHFT           TS       Q                                     #  Q BOUNDS ARE ZERO AND 24 (DECIMAL).
064391,000455: 21,3652           00006                           EXTEND                                         
064392,000456: 21,3653           63701                           BZMF     SUMNEGU                               #  BRANCH IF SHIFTING IS UNNECESSARY.
064393,000457: 
064394,000458: 21,3654           44317                           CS       FOURTEEN                              
064395,000459: 21,3655           60002                           AD       Q                                     
064396,000460: 21,3656           00006                           EXTEND                                         #  Q = 0(MOD 3), SO A REG IS NON-ZERO.
064397,000461: 21,3657           63664                           BZMF     MINISHIFT                             #  BRANCH IF SMALL SHIFT SUFFICES.
064398,000462: 
064399,000463: 21,3660           54002        MAXISHIFT           TS       Q                                     #  14 BIT SHIFT RIGHT NOW.
064400,000464: 21,3661           34755                           CA       ZERO                                  
064401,000465: 21,3662           57747                           XCH      FUNCTION                              
064402,000466: 21,3663           55750                           TS       FUNCTION   +1                         
064403,000467: 
064404,000468: 21,3664           50002        MINISHIFT           INDEX    Q                                     #  C(Q) ARE GREATER THAN ZERO.
064405,000469: 21,3665           34735                           CA       BIT15                                 
064406,000470: 21,3666           54002                           TS       Q                                     #  2**(-Q) WILL BE SHIFT MULTIPLIER.
064407,000471: 21,3667           00006                           EXTEND                                         
064408,000472: 21,3670           71750                           MP       FUNCTION   +1                         
064409,000473: 21,3671           56001                           XCH      L                                     
064410,000474: 21,3672           34755                           CA       ZERO                                  
064411,000475: 21,3673           53750                           DXCH     FUNCTION                              #  LOWER WORD SHIFTED NOW.
064412,000476: 21,3674           00006                           EXTEND                                         
064413,000477: 21,3675           63701                           BZMF     SUMNEGU                               #  BRANCH IF UPPER WORD WAS ZERO.

Page 1477

064415,000479: 21,3676           00006                           EXTEND                                         #  SHIFT UPPER WORD.
064416,000480: 21,3677           70002                           MP       Q                                     
064417,000481: 21,3700           21750                           DAS      FUNCTION                              #  NO OVERFLOW POSSIBLE.
064418,000482: 
064419,000483: 21,3701           41745        SUMNEGU            CS       DEL                                   #  INCLUDE DEL FACTOR IN PRODUCT TERM.
064420,000484: 21,3702           00006                           EXTEND                                         
064421,000485: 21,3703           63707                           BZMF     SUMTERMS                              
064422,000486: 
064423,000487: 21,3704           00006                           EXTEND                                         #  DEL FACTOR IS MINUS ONE.
064424,000488: 21,3705           41750                           DCS      FUNCTION                              
064425,000489: 21,3706           13713                           TCF      NEGUSUM    -1                         #  NOW ADD IN THE K2THETA TERM.
064426,000490: 
064427,000491: 21,3707           00006        SUMTERMS           EXTEND                                         
064428,000492: 21,3710           13714                           BZF      NEGUSUM                               #  BRANCH IF DEL IS ZERO.
064429,000493: 
064430,000494: 21,3711           00006                           EXTEND                                         #  DEL FACTOR IS +1.
064431,000495: 21,3712           31750                           DCA      FUNCTION                              
064432,000496: 21,3713           21736                           DAS      K2THETA                               #  NOW ADD IN THE K2THETA TERM.
064433,000497: 21,3714           11735        NEGUSUM            CCS      K2THETA                               #  TEST SIGN OF HIGH ORDER PART.
064434,000498: 21,3715           13721                           TCF      NEGDRIVE                              
064435,000499: 21,3716           13720                           TCF      +2                                    
064436,000500: 21,3717           13723                           TCF      POSDRIVE                              
064437,000501: 
064438,000502: 21,3720           11736                           CCS      K2THETA    +1                         #  SIGN TEST FOR LOW ORDER PART.
064439,000503: 21,3721           34753        NEGDRIVE           CA       BIT1                                  
064440,000504: 21,3722           13724                           TCF      +2                                    #  STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
064441,000505: 21,3723           44753        POSDRIVE           CS       BIT1                                  
064442,000506: 21,3724           54001                           TS       L                                     #  SAVE FOR DRIVE REVERSAL TEST.
064443,000507: 21,3725           51746                           INDEX    QRCNTR                                
064444,000508: 21,3726           57500                           XCH      NEGUQ                                 
064445,000509: 
064446,000510: 21,3727           00006                           EXTEND                                         
064447,000511: 21,3730           70001                           MP       L                                     #  MULTIPLY OLD NEGU AND NEW NEGU.
064448,000512: 21,3731           10001                           CCS      L                                     
064449,000513: 21,3732           13747                           TCF      LOUPE                                 #  NON-ZERO GIMBAL DRIVE BEING CONTINUED.
064450,000514: 
064451,000515: 21,3733           13744                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
064452,000516: 
064453,000517: 21,3734           13736                           TCF      REVERSAL                              #  NON-ZERO GIMBAL DRIVE BEING REVERSED.
064454,000518: 21,3735           13744                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
064455,000519: 
064456,000520: 21,3736           51746        REVERSAL           INDEX    QRCNTR                                #  A ZERO-DRIVE PAUSE IS NEEDED HERE.  ZERO
064457,000521: 21,3737           55510                           TS       QACCDOT                               #  IS IN A REGISTER FROM CCS ON (-1).
064458,000522: 21,3740           51746                           INDEX    QRCNTR                                
064459,000523: 21,3741           43760                           CS       GMBLBITA                              
064460,000524: 21,3742           00006                           EXTEND                                         
064461,000525: 21,3743           03012                           WAND     CHAN12                                
064462,000526: 
064463,000527: 21,3744           41273        ZEROLOUP           CS       RCSFLAGS                              #  SET UP REQUEST FOR ACDT+C12 CALL.
064464,000528: 21,3745           74747                           MASK     CALLGMBL                              

Page 1478

064466,000530: 21,3746           27273                           ADS      RCSFLAGS                              
064467,000531: 
064468,000532: 21,3747           11746        LOUPE              CCS      QRCNTR                                #  HAVE BOTH AXES BEEN PROCESSED?
064469,000533: 21,3750           13306                           TCF      GOQTRIMG                              #  NO.  DO Q AXIS NEXT.
064470,000534: 
064471,000535: 21,3751           31476                           CA       SAVESR                                #  RESTORE THE SR
064472,000536: 21,3752           54021                           TS       SR                                    
064473,000537: 
064474,000538: 21,3753           00006        GOCLOSE            EXTEND                                         #  TERMINATE THE JASK.
064475,000539: 21,3754           33757                           DCA      CLOSEADR                              
064476,000540: 21,3755           52006                           DTCB                                           
064477,000541: 
064478,000542: 21,3756  E6,1537                                  EBANK=   AOSQ                                  
064479,000543: 21,3756           03173 36106  CLOSEADR           2CADR    CLOSEOUT                              #  TERMINATE THE JASK.
064480,000544: 
064481,000545: 21,3760     5742               TWELVE             EQUALS   OCT14                                 
064482,000546: 21,3760           01400        GMBLBITA           OCTAL    01400                                 #  INDEXED WRT GMBLBITB   DO NOT MOVE ******
064483,000547: 21,3761           20761        STARTER            DEC      .53033                                #  INITIAL VALUE FOR SQRT ALGORITHM.
064484,000548: 21,3762           06000        GMBLBITB           OCTAL    06000                                 #  INDEXED WRT GMBLBITA   DO NOT MOVE ******
064485,000549: 
064486,000550:                                                                                                  #  SUBROUTINE ROOTCYCL:  BY CRAIG WORK,3 APRIL 68
064487,000551: 
064488,000552:                                                                                                  #  ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION.  THE INITIAL GUESS AT THE
064489,000553:                                                                                                  #  SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG.  THE NEW APPROXI-
064490,000554:                                                                                                  #  MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER.  DEBRIS:  A,L,SR,SCRATCH.   ROOTCYCL IS CALLED FROM
064491,000555:                                                                                                  #  LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
064492,000556: 
064493,000557:                                                                                                  #  WARNING:  IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
064494,000558: 
064495,000559: 21,3763           55742        ROOTCYCL           TS       SCRATCH                               #  STORE X
064496,000560: 21,3764           54021                           TS       SR                                    #  X/2 NOW IN SR
064497,000561: 21,3765           31743                           CA       HALFARG                               #  ARG/2 IN THE A REG
064498,000562: 21,3766           22007                           ZL                                             #  PREPARE FOR DIVISION
064499,000563: 21,3767           00006                           EXTEND                                         
064500,000564: 21,3770           11742                           DV       SCRATCH                               #  (ARG/X)/2
064501,000565: 21,3771           60021                           AD       SR                                    #  (X + ARG/X)/2 IN THE A REG
064502,000566: 21,3772           00002                           TC       Q                                     
064503,000567: 
064504,000568: 

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