Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

063622,000002:                                                                                                  ## Copyright:   Public domain.
063623,000003:                                                                                                  ## Filename:    TRIM_GIMBAL_CONTROL_SYSTEM.agc
063624,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
063625,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
063626,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
063627,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
063628,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
063629,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
063630,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
063631,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
063632,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
063633,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
063634,000014:                                                                                                  ## Reference:   pp. 1467-1478
063635,000015:                                                                                                  ## Assembler:   yaYUL
063636,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
063637,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
063638,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
063639,000019:                                                                                                  ##              2021-05-30 ABS  GTSGO+DN -> GTSGO+ON
063640,000020:                                                                                                  ##                              MAXISHIFT -> MAXISHFT
063641,000021:                                                                                                  ##                              MINISHIFT -> MINISHFT
063642,000022: 

Page 1467

063644,000024: 21,3263                                           BANK     21                                    
063645,000025: 21,3263  E6,1446                                  EBANK=   QDIFF                                 
063646,000026: 21,2000                                           SETLOC   DAPS4                                 
063647,000027: 21,2000                                           BANK                                           
063648,000028: 
063649,000029: 21,3263                                           COUNT*   $$/DAPGT                              
063650,000030: 
063651,000031:                                                                                                  #  CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
063652,000032:                                                                                                  #  AUTOPILOT ARE BOTH ON:
063653,000033:                                                                                                  #        A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
063654,000034:                                                                                                  #           INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
063655,000035:                                                                                                  #        B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
063656,000036:                                                                                                  #           ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
063657,000037:                                                                                                  #  GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
063658,000038: 
063659,000039: 21,3263           37746        GTS                CAF      NEGONE                                #  MAKE THE NEXT PASS THROUGH THE DAP BE
063660,000040: 21,3264           55627                           TS       COTROLER                              #        THROUGH RCS CONTROL,
063661,000041: 21,3265           34751                           CAF      FOUR                                  #        AND ENSURE THAT IT IS NOT A SKIP.
063662,000042: 21,3266           55535                           TS       SKIPU                                 
063663,000043: 21,3267           55536                           TS       SKIPV                                 
063664,000044: 
063665,000045: 21,3270           34752                           CAF      TWO                                   
063666,000046: 21,3271           55631                           TS       INGTS                                 #  SET INDICATOR OF GTS CONTROL POSITIVE.
063667,000047: 21,3272           55630                           TS       QGIMTIMR                              #  SET TIMERS TO 200 MSEC TO AVOID BOTH
063668,000048: 21,3273           55632                           TS       RGIMTIMR                              #  RUNAWAY AND INTERFERENCE BY NULLING.
063669,000049: 
063670,000050:                                                                                                  #  THE DRIVE SETTING ALGORITHM
063671,000051: 
063672,000052:                                                                                                  #        DEL = SGN(OMEGA*K + ALPHA*ABS(ALPHA)/2).
063673,000053: 
063674,000054:                                                                                                  #        NEGUSUM = ERROR.K(2) + DEL(OMEGA.K.DEL + ALPHA(2)/2)(3/2) + ALPHA(OMEGA.K.DEL + ALPHA(2)/3)
063675,000055: 
063676,000056:                                                                                                  #        DRIVE = -SGN(NEGUSUM)
063677,000057: 
063678,000058: 21,3274           30021                           CA       SR                                    #  SAVE THE SR.  SHIFT IT LEFT TO CORRECT
063679,000059: 21,3275           60000                           AD       A                                     #  FOR THE RIGHT SHIFT DUE TO EDITING.
063680,000060: 21,3276           55476                           TS       SAVESR                                
063681,000061: 
063682,000062: 21,3277           34752        GTSGO+ON           CAF      TWO                                   #  SET INDEXER FOR R-AXIS CALCULATIONS.
063683,000063: 21,3300           55746                           TS       QRCNTR                                
063684,000064: 21,3301           31541                           CA       AOSR                                  
063685,000065: 21,3302           00006                           EXTEND                                         
063686,000066: 21,3303           74751                           MP       BIT3                                  
063687,000067: 21,3304           31435                           CA       EDOTR                                 
063688,000068: 21,3305           13314                           TCF      GTSQAXIS                              
063689,000069: 
063690,000070: 21,3306           34755        GOQTRIMG           CAF      ZERO                                  #  SET INDEXER FOR Q-AXIS CALCULATIONS
063691,000071: 21,3307           55746                           TS       QRCNTR                                

Page 1468

063693,000073: 21,3310           31537                           CA       AOSQ                                  
063694,000074: 21,3311           00006                           EXTEND                                         
063695,000075: 21,3312           74751                           MP       BIT3                                  
063696,000076: 21,3313           31434                           CA       EDOTQ                                 
063697,000077: 21,3314           53744        GTSQAXIS           DXCH     WCENTRAL                              
063698,000078: 21,3315           00006                           EXTEND                                         
063699,000079: 21,3316           51746                           INDEX    QRCNTR                                #  PICK UP K AND K(2) FOR THIS AXIS
063700,000080: 21,3317           31504                           DCA      KQ                                    
063701,000081: 21,3320           53742                           DXCH     KCENTRAL                              
063702,000082: 
063703,000083: 21,3321           51746                           INDEX    QRCNTR                                #  QDIFF, RDIFF ARE STORED IN D.P.
063704,000084: 21,3322           31446                           CAE      QDIFF                                 
063705,000085: 
063706,000086: 21,3323           00006        ALGORTHM           EXTEND                                         #  Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
063707,000087: 21,3324           71742                           MP       K2CNTRAL                              #  FORM K(2)*THETA IN D.P.
063708,000088: 21,3325           23735                           LXCH     K2THETA                               
063709,000089: 21,3326           00006                           EXTEND                                         #  FORM K(2)*THETA*SF2 IN D.P.
063710,000090: 21,3327           74743                           MP       BIT9                                  
063711,000091: 21,3330           53736                           DXCH     K2THETA                               
063712,000092: 21,3331           00006                           EXTEND                                         
063713,000093: 21,3332           74743                           MP       BIT9                                  
063714,000094: 21,3333           27736                           ADS      K2THETA    +1                         
063715,000095: 
063716,000096: 21,3334           31743                           CAE      WCENTRAL                              #  GET OMEGA
063717,000097: 21,3335           00006                           EXTEND                                         
063718,000098: 21,3336           71741                           MP       KCENTRAL                              #  FORM K*OMEGA IN D.P.
063719,000099: 21,3337           23741                           LXCH     OMEGA.K                               
063720,000100: 21,3340           00006                           EXTEND                                         #  FORM OMEGA*K*SF1 IN D.P.
063721,000101: 21,3341           74740                           MP       BIT12                                 
063722,000102: 21,3342           53742                           DXCH     OMEGA.K                               
063723,000103: 21,3343           00006                           EXTEND                                         
063724,000104: 21,3344           74740                           MP       BIT12                                 
063725,000105: 21,3345           27742                           ADS      OMEGA.K    +1                         
063726,000106: 
063727,000107: 21,3346           31744                           CAE      ACENTRAL                              #  FORM ALPHA(2)/2 IN D.P.
063728,000108: 21,3347           00006                           EXTEND                                         
063729,000109: 21,3350           70000                           SQUARE                                         
063730,000110: 21,3351           53740                           DXCH     A2CNTRAL                              
063731,000111: 
063732,000112: 21,3352           31744                           CAE      ACENTRAL                              #  GET ALPHA*ABS(ALPHA)/2, IF ALPHA GREATER
063733,000113:                                                                                                  #  THAN 0. OTHERWISE TAKE NEGATIVE OF ABOVE
063734,000114: 21,3353           00006                           EXTEND                                         
063735,000115: 21,3354           63360                           BZMF     +4                                    
063736,000116: 21,3355           00006                           EXTEND                                         
063737,000117: 21,3356           31740                           DCA      A2CNTRAL                              
063738,000118: 21,3357           13362                           TCF      +3                                    
063739,000119: 21,3360           00006                           EXTEND                                         
063740,000120: 21,3361           41740                           DCS      A2CNTRAL                              
063741,000121: 21,3362           53750                           DXCH     FUNCTION                              #  SAVE AS SGN(ALPHA)*ALPHA(2)/2

Page 1469

063743,000123: 21,3363           00006                           EXTEND                                         
063744,000124: 21,3364           31742                           DCA      OMEGA.K                               
063745,000125: 21,3365           21750                           DAS      FUNCTION                              #  FORM FUNCT1
063746,000126: 
063747,000127: 21,3366           11747                           CCS      FUNCTION                              #  DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
063748,000128: 21,3367           13373                           TCF      POSFNCT1                              #  OTHERWISE DEL = -1
063749,000129: 21,3370           13372                           TCF      +2                                    
063750,000130: 21,3371           13375                           TCF      NEGFNCT1                              
063751,000131: 
063752,000132: 21,3372           11750                           CCS      FUNCTION   +1                         #  USE LOW ORDER WORD SINCE HIGH IS ZERO
063753,000133: 21,3373           34753        POSFNCT1           CAF      BIT1                                  
063754,000134: 21,3374           13376                           TCF      +2                                    
063755,000135: 21,3375           44753        NEGFNCT1           CS       BIT1                                  
063756,000136: 21,3376           55745                           TS       DEL                                   
063757,000137: 
063758,000138: 21,3377           11745                           CCS      DEL                                   #  MAKE OMEGA*K REALLY DEL*OMEGA*K
063759,000139: 21,3400           13405                           TCF      FUNCT2                                #  (NOTHING NEED BE DONE)
063760,000140: 21,3401           13405                           TCF      FUNCT2                                
063761,000141: 21,3402           00006                           EXTEND                                         
063762,000142: 21,3403           41742                           DCS      OMEGA.K                               
063763,000143: 21,3404           53742                           DXCH     OMEGA.K                               #  CHANGE SIGN OF OMEGA*K
063764,000144: 
063765,000145: 21,3405           00006        FUNCT2             EXTEND                                         
063766,000146: 21,3406           31742                           DCA      OMEGA.K                               
063767,000147: 21,3407           53750                           DXCH     FUNCTION                              #  DEL*OMEGA*K
063768,000148: 21,3410           00006                           EXTEND                                         
063769,000149: 21,3411           31740                           DCA      A2CNTRAL                              
063770,000150: 21,3412           21750                           DAS      FUNCTION                              #  DEL*OMEGA*K + ALPHA(2)/2
063771,000151: 21,3413           31737        FUNCT3             CAE      A2CNTRAL                              #  CALCULATE (2/3)*ALPHA(2)/2 = ALPHA(2)/3
063772,000152: 21,3414           00006                           EXTEND                                         
063773,000153: 21,3415           73446                           MP       .66667                                
063774,000154: 21,3416           53740                           DXCH     A2CNTRAL                              
063775,000155: 21,3417           56001                           XCH      L                                     
063776,000156: 21,3420           00006                           EXTEND                                         
063777,000157: 21,3421           73446                           MP       .66667                                
063778,000158: 21,3422           27740                           ADS      A2CNTRAL   +1                         
063779,000159: 21,3423           54001                           TS       L                                     
063780,000160: 21,3424           13426                           TCF      +2                                    
063781,000161: 21,3425           27737                           ADS      A2CNTRAL                              
063782,000162: 21,3426           53742                           DXCH     OMEGA.K                               #  DEL*OMEGA*K + ALPHA(2)/3 = G
063783,000163: 21,3427           21740                           DAS      A2CNTRAL                              
063784,000164: 21,3430           31737                           CAE      A2CNTRAL                              #  G*ALPHA IN D.P.
063785,000165: 21,3431           00006                           EXTEND                                         
063786,000166: 21,3432           71744                           MP       ACENTRAL                              
063787,000167: 21,3433           53740                           DXCH     A2CNTRAL                              
063788,000168: 21,3434           56001                           XCH      L                                     
063789,000169: 21,3435           00006                           EXTEND                                         
063790,000170: 21,3436           71744                           MP       ACENTRAL                              
063791,000171: 21,3437           27740                           ADS      A2CNTRAL   +1                         
063792,000172: 21,3440           54001                           TS       L                                     

Page 1470

063794,000174: 21,3441           13443                           TCF      +2                                    
063795,000175: 21,3442           27737                           ADS      A2CNTRAL                              
063796,000176: 
063797,000177: 21,3443           53740                           DXCH     A2CNTRAL                              #  FIRST AND THIRD TERMS
063798,000178: 21,3444           21736                           DAS      K2THETA                               #  SUMMED IN D.P.
063799,000179: 
063800,000180: 21,3445           13561                           TCF      RSTOFGTS                              
063801,000181: 
063802,000182: 21,3446           25253        .66667             DEC      .66667                                
063803,000183: 
063804,000184: 16,3720                                           BANK     16                                    
063805,000185: 16,3720  E6,1500                                  EBANK=   NEGUQ                                 
063806,000186: 16,2000                                           SETLOC   DAPS1                                 
063807,000187: 16,2000                                           BANK                                           
063808,000188: 
063809,000189:                                                                                                  #  THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
063810,000190:                                                                                                  #  THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES.  ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
063811,000191: 
063812,000192:                                                                                                  #  WARNING:  ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
063813,000193: 
063814,000194: 16,3720           07400        BGIM               OCTAL    07400                                 
063815,000195: 16,3721     0066               CHNL12             EQUALS   ITEMP6                                
063816,000196: 16,3721           41500        ACDT+C12           CS       NEGUQ                                 
063817,000197: 16,3722           00006                           EXTEND                                         #  GIMBAL DRIVE REQUESTS.
063818,000198: 16,3723           71507                           MP       ACCDOTQ                               
063819,000199: 16,3724           23510                           LXCH     QACCDOT                               
063820,000200: 16,3725           41502                           CS       NEGUR                                 
063821,000201: 16,3726           00006                           EXTEND                                         
063822,000202: 16,3727           71511                           MP       ACCDOTR                               
063823,000203: 16,3730           23512                           LXCH     RACCDOT                               
063824,000204: 
063825,000205: 16,3731           11500                           CCS      NEGUQ                                 
063826,000206: 16,3732           34742                           CAF      BIT10                                 
063827,000207: 16,3733           13735                           TCF      +2                                    
063828,000208: 16,3734           34743                           CAF      BIT9                                  
063829,000209: 16,3735           54066                           TS       CHNL12                                
063830,000210: 
063831,000211: 16,3736           11502                           CCS      NEGUR                                 
063832,000212: 16,3737           34740                           CAF      BIT12                                 
063833,000213: 16,3740           13742                           TCF      +2                                    
063834,000214: 16,3741           34741                           CAF      BIT11                                 
063835,000215: 16,3742           26066                           ADS      CHNL12                                #  (STORED RESULT NOT USED AT PRESENT)
063836,000216: 
063837,000217: 16,3743           43720                           CS       BGIM                                  
063838,000218: 16,3744           00006                           EXTEND                                         
063839,000219: 16,3745           02012                           RAND     CHAN12                                
063840,000220: 16,3746           60066                           AD       CHNL12                                
063841,000221: 16,3747           00006                           EXTEND                                         
063842,000222: 16,3750           01012                           WRITE    CHAN12                                

Page 1471

063844,000224: 16,3751           44747                           CS       CALLGMBL                              #  TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
063845,000225: 16,3752           71273                           MASK     RCSFLAGS                              
063846,000226: 16,3753           55273                           TS       RCSFLAGS                              
063847,000227: 
063848,000228: 16,3754           00002                           TC       Q                                     #  RETURN TO CALLER.
063849,000229: 
063850,000230: 21,3447                                           BANK     21                                    
063851,000231: 21,3447  E6,1446                                  EBANK=   QDIFF                                 
063852,000232: 21,2000                                           SETLOC   DAPS4                                 
063853,000233: 21,2000                                           BANK                                           
063854,000234: 

Page 1472

063856,000236:                                                                                                  #  SUBROUTINE TIMEGMBL:  MOD 0, OCTOBER 1967, CRAIG WORK
063857,000237: 
063858,000238:                                                                                                  #  TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
063859,000239:                                                                                                  #  THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS.  INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
063860,000240:                                                                                                  #  SCALED AT PI/8.                         FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT).  A ZERO
063861,000241:                                                                                                  #  ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY.  OTHERWISE, THE GIMBAL IS TURNED ON
063862,000242:                                                                                                  #  DRIVING IN THE CORRECT DIRECTION. THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
063863,000243:                                                                                                  #  IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE.  NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
063864,000244:                                                                                                  #  WHICH IS NEGATIVE, ZERO, OR POSITIVE.
063865,000245: 
063866,000246:                                                                                                  #  INPUTS:       AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7).     PI/2(7).
063867,000247: 
063868,000248:                                                                                                  #  OUTPUTS:      NEW GIMBAL DRIVE BITS IN CHANNEL 12,NEGUQ,NEGUR,QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
063869,000249:                                                                                                  #                Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
063870,000250: 
063871,000251:                                                                                                  #  DEBRIS:       A,L,Q, ITEMPS 2,3,6, RUPTREG2 AND ACDT+C12 DEBRIS.
063872,000252: 
063873,000253:                                                                                                  #  EXITS:        VIA TC Q.
063874,000254: 
063875,000255:                                                                                                  #  ALARMS, ABORTS, :  NONE
063876,000256: 
063877,000257:                                                                                                  #  SUBROUTINES:  ACDT+C12, IBNKCALL
063878,000258: 
063879,000259:                                                                                                  #  WARNING:      THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS.  THEREFORE IT MAY ONLY BE CALLED WITH
063880,000260:                                                                                                  #  INTERRUPT INHIBITED.
063881,000261: 
063882,000262:                                                                                                  #  ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
063883,000263:                                                                                                  #        NEGUQ           ERASE   +2              NEGATIVE OF Q-AXIS GIMBAL DRIVE
063884,000264:                                                                                                  #        (SPWORD)        EQUALS  NEGUQ +1        ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
063885,000265:                                                                                                  #        NEGUR           EQUALS  NEGUQ +2        NEGATIVE OF R-AXIS GIMBAL DRIVE
063886,000266: 
063887,000267:                                                                                                  #        ACCDOTQ         ERASE   +2              Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
063888,000268:                                                                                                  #        (SPWORD)        EQUALS  ACCDOTQ +1      ANY S.P. ERASABLE NUMBER NOW QACCDOT
063889,000269:                                                                                                  #        ACCDOTR         EQUALS  ACCDOTQ +2      R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
063890,000270:                                                                                                  #                                                ACCDOTQ, ACCDOTR ARE MAGNITUDES.
063891,000271:                                                                                                  #        AOSQ            ERASE   +4              Q-AXIS ACC., D.P. AT PI/2 R/SEC(2)
063892,000272:                                                                                                  #        AOSR            EQUALS  AOSQ +2         R-AXIS ACCELERATION SCALED AT PI/2 R/S2
063893,000273: 
063894,000274: 21,3447     0066               QRNDXER            EQUALS   ITEMP6                                
063895,000275: 21,3447           23146        OCT23146           OCTAL    23146                                 #  DECIMAL .6
063896,000276: 21,3450     0063               NZACCDOT           EQUALS   ITEMP3                                
063897,000277: 
063898,000278: 21,3450           34753        TIMEGMBL           CAF      ONE                                   #  INITIALIZE ALLOWGTS.
063899,000279: 21,3451           55501                           TS       ALLOWGTS                              
063900,000280: 
063901,000281: 21,3452           34752                           CAF      TWO                                   #  SET UP LOOP FOR R AXIS.
063902,000282: 21,3453           22002                           LXCH     Q                                     #  SAVE RETURN ADDRESS.
063903,000283: 21,3454           22071                           LXCH     RUPTREG2                              

Page 1473

063905,000285: 21,3455           13457                           TCF      +2                                    
063906,000286: 21,3456           34755        TIMQGMBL           CAF      ZERO                                  #  NOW DO THE Q-AXIS
063907,000287: 21,3457           54066                           TS       QRNDXER                               
063908,000288: 21,3460           50066                           INDEX    QRNDXER                               
063909,000289: 21,3461           31507                           CA       ACCDOTQ                               #  ACCDOT IS PRESUMED TO BE AT PI/2(7).
063910,000290: 21,3462           00006                           EXTEND                                         
063911,000291: 21,3463           63533                           BZMF     TGOFFNOW                              #  IS ACCDOT LESS THAN OR EQUAL TO 0?
063912,000292: 21,3464           54063                           TS       NZACCDOT                              #  NO.  STORE NON-ZERO, POSITIVE ACCDOT.
063913,000293: 
063914,000294: 21,3465           50066        ALPHATRY           INDEX    QRNDXER                               
063915,000295: 21,3466           41537                           CS       AOSQ                                  
063916,000296: 21,3467           00006                           EXTEND                                         
063917,000297: 21,3470           13533                           BZF      TGOFFNOW                              #  IS ALPHA ZERO?
063918,000298: 
063919,000299: 21,3471           54002                           TS       Q                                     #  SAVE A COPY OF -AOS.
063920,000300: 21,3472           00006                           EXTEND                                         #  NO.  RESCALE FOR TIMEGMBL USE.
063921,000301: 21,3473           73447                           MP       OCT23146                              #  OCTAL 23146 IS DECIMAL .6
063922,000302: 21,3474           60002                           AD       Q                                     #  -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
063923,000303: 21,3475           54001                           TS       L                                     #  WAS THERE OVERFLOW?
063924,000304: 21,3476           13503                           TCF      SETNEGU                               #  NO.  COMPUTE DRIVE TIME.
063925,000305: 
063926,000306: 21,3477           40000                           CS       A                                     #  RECOVER  -SGN(AOS) IN THE A REGISTER.
063927,000307: 21,3500           50066                           INDEX    QRNDXER                               #  YES.  START DRIVE WITHOUT WAITLIST.
063928,000308: 21,3501           57500                           XCH      NEGUQ                                 
063929,000309: 21,3502           13537                           TCF      NOTALLOW                              #  KNOCK DOWN THE ALLOWGTS FLAG.
063930,000310: 
063931,000311: 21,3503           00006        SETNEGU            EXTEND                                         
063932,000312: 21,3504           63511                           BZMF     POSALPH                               
063933,000313: 
063934,000314: 21,3505           40000                           COM                                            
063935,000315: 21,3506           54062                           TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
063936,000316: 21,3507           44753                           CS       BIT1                                  
063937,000317: 21,3510           13513                           TCF      POSALPH    +2                         
063938,000318: 21,3511           54062        POSALPH            TS       ITEMP2                                #  STORE -ABS(.4*AOS) SCALED AT PI/8.
063939,000319: 21,3512           34753                           CA       BIT1                                  
063940,000320: 21,3513           50066                 +2        INDEX    QRNDXER                               #  SGN(AOS) INTO NEGU
063941,000321: 21,3514           55500                           TS       NEGUQ                                 #  STORE SGN(APLHA) AS NEGU
063942,000322: 
063943,000323: 21,3515           30063                           CA       NZACCDOT                              
063944,000324: 21,3516           00006                           EXTEND                                         
063945,000325: 21,3517           74740                           MP       BIT12                                 #  2*ACCDOT, SCALED AT PI/8.
063946,000326: 21,3520           60062                           AD       ITEMP2                                #  -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
063947,000327: 21,3521           00006                           EXTEND                                         
063948,000328: 21,3522           63537                           BZMF     NOTALLOW                              #  IS DRIVE TIME MORE THAN TWO SECONDS?
063949,000329: 21,3523           40062                           CS       ITEMP2                                #  NO.  COMPUTE DRIVE TIME.
063950,000330: 21,3524           00006                           EXTEND                                         #  ABS(ALPHA) AT PI/8.
063951,000331: 21,3525           73560                           MP       OCT00240                              #  DECIMAL 10/1024
063952,000332: 21,3526           00006                           EXTEND                                         #  QUOTIENT IS DRIVE TIME AT WAITLIST.
063953,000333: 21,3527           10063                           DV       NZACCDOT                              #  ABS(ALPHA)/ACCDOT AT 2(14)/100

Page 1474

063955,000335: 21,3530           00006                           EXTEND                                         
063956,000336: 21,3531           13533                           BZF      TGOFFNOW                              #  DRIVE TIME MUST BE GREATER THAN ZERO.
063957,000337: 
063958,000338: 21,3532           13545                           TCF      DRIVEON                               
063959,000339: 
063960,000340: 21,3533           34755        TGOFFNOW           CAF      ZERO                                  #  TURN OFF GIMBAL NOW.
063961,000341: 21,3534           50066                           INDEX    QRNDXER                               
063962,000342: 21,3535           55500                           TS       NEGUQ                                 
063963,000343: 
063964,000344: 21,3536           13547                           TCF      DONEYET                               
063965,000345: 
063966,000346: 21,3537           36010        NOTALLOW           CAF      OCT31                                 
063967,000347: 21,3540           50066                           INDEX    QRNDXER                               
063968,000348: 21,3541           55630                           TS       QGIMTIMR                              
063969,000349: 21,3542           34755                           CAF      ZERO                                  #  DRIVE TIME IS MORE THAN 2 SECONDS, SO
063970,000350: 21,3543           55501                           TS       ALLOWGTS                              #  DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
063971,000351:                                                                                                  #  CONTROL UNTIL AOSTASK APPROVES.
063972,000352: 21,3544           13547                           TCF      DONEYET                               #  NO WAITLIST CALL IS MADE.
063973,000353: 
063974,000354: 21,3545           50066        DRIVEON            INDEX    QRNDXER                               
063975,000355: 21,3546           55630                           TS       QGIMTIMR                              #  CHOOSE Q OR R AXIS.
063976,000356: 
063977,000357: 21,3547           10066        DONEYET            CCS      QRNDXER                               
063978,000358: 21,3550           13456                           TCF      TIMQGMBL                              
063979,000359: 
063980,000360: 21,3551           52073                           DXCH     RUPTREG3                              #  PROTECT IBNKCALL ERASABLES.  ACDT+C12
063981,000361: 21,3552           52063                           DXCH     ITEMP2                                #  LEAVES ITEMPS2,3 ALONE.
063982,000362: 
063983,000363: 21,3553           04674                           TC       IBNKCALL                              #  TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
063984,000364: 21,3554           35721                           CADR     ACDT+C12                              
063985,000365: 
063986,000366: 21,3555           52063                           DXCH     ITEMP2                                #  RESTORE ERASABLES FOR IBNKCALL.
063987,000367: 21,3556           52073                           DXCH     RUPTREG3                              
063988,000368: 
063989,000369: 21,3557           00071                           TC       RUPTREG2                              #  RETURN TO CALLER.
063990,000370: 
063991,000371: 21,3560           00240        OCT00240           OCTAL    00240                                 #  DECIMAL 10/1024
063992,000372: 

Page 1475

063994,000374:                                                                                                  #  THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY.  THE QUANTITY NEGUSUM
063995,000375:                                                                                                  #  IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM.  NEW DRIVES ARE ENTERED TO CH 12.
063996,000376: 
063997,000377: 21,3561           11747        RSTOFGTS           CCS      FUNCTION                              
063998,000378: 21,3562           13603                           TCF      GOODARG                               #  FUNCTION IS POSITIVE.  GET 3/2 POWER.
063999,000379: 21,3563           13565                           TCF      +2                                    #  HIGH ORDER WORD IS ZERO.  TRY THE LOWER.
064000,000380: 21,3564           13571                           TCF      ZEROOT                                #  NEGATIVE.  USE ZERO FOR 3/2 POWER.
064001,000381: 
064002,000382: 21,3565           41750                           CS       FUNCTION   +1                         #  IF ARG IS LESS THAN 2(-18), THEN THE 3/2
064003,000383: 21,3566           64741                           AD       BIT11                                 #  POWER IS LESS THAN 2(-27).  USE ZERO.
064004,000384: 21,3567           00006                           EXTEND                                         
064005,000385: 21,3570           63574                           BZMF     ZEROHIGH                              #  BRANCH IF ARG NOT LESS THAN 2(-18).
064006,000386: 
064007,000387: 21,3571           00006        ZEROOT             EXTEND                                         
064008,000388: 21,3572           34756                           DCA      ZERO                                  
064009,000389: 21,3573           13714                           TCF      NEGUSUM                               
064010,000390: 
064011,000391: 21,3574           34317        ZEROHIGH           CA       FOURTEEN                              #  ARG LESS THAN 2(-14) MEANS 3/2 POWER
064012,000392:                                                                                                  #  WILL BE LESS THAN 2(-21).
064013,000393: 21,3575           55737                           TS       SHFTFLAG                              
064014,000394: 
064015,000395: 21,3576           34752                           CA       TWO                                   
064016,000396: 21,3577           55740                           TS       ININDEX                               #  INITIALIZE THE SHIFT LOOP.
064017,000397: 
064018,000398:                                                                                                  #  COLLECT THE 14 MOST SIGNIFICANT BITS OF
064019,000399: 21,3600           57750                           XCH      FUNCTION   +1                         #  THE 28 INTO THE HIGH ORDER WORD.
064020,000400: 21,3601           57747                           XCH      FUNCTION                              
064021,000401: 21,3602           13616                           TCF      SCALLOOP                              
064022,000402: 21,3603           35742        GOODARG            CA       TWELVE                                
064023,000403: 21,3604           55740                           TS       ININDEX                               #  INITIALIZE THE SHIFT LOOP.
064024,000404: 21,3605           34755                           CA       ZERO                                  #  THERE ARE SIGNIFICANT BITS IN THE HIGH
064025,000405: 21,3606           55737                           TS       SHFTFLAG                              #  ORDER WORD, SO SET SHFTFLAG TO ZERO.
064026,000406: 
064027,000407: 21,3607           13616                           TCF      SCALLOOP                              
064028,000408: 
064029,000409: 21,3610           31747        SCALSTRT           CA       FUNCTION                              
064030,000410: 21,3611           13633                           TCF      SCALDONE                              
064031,000411: 
064032,000412: 21,3612           37745        MULBUSH            CA       NEG2                                  #  IF ARG IS NOT LESS THAN 1/4, INDEX IS
064033,000413: 21,3613           27740                           ADS      ININDEX                               #  ZERO, INDICATING NO SHIFT NEEDED.
064034,000414: 21,3614           00006                           EXTEND                                         #  BRANCH IF ARG IS NOT LESS THAN 1/4.
064035,000415: 21,3615           63610                           BZMF     SCALSTRT                              #  OTHERWISE COMPARE ARG WITH A REFERENCE
064036,000416:                                                                                                  #  WHICH IS 4 TIMES LARGER THAN THE LAST.
064037,000417: 21,3616           41747        SCALLOOP           CS       FUNCTION                              
064038,000418: 21,3617           51740                           INDEX    ININDEX                               
064039,000419: 21,3620           64735                           AD       BIT15                                 #  REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
064040,000420: 21,3621           00006                           EXTEND                                         
064041,000421: 21,3622           63612                           BZMF     MULBUSH                               #  IF ARG IS NOT LESS THAN REFERENCE, GO
064042,000422:                                                                                                  #  AROUND THE MULBERRY BUSH ONCE MORE.
064043,000423: 21,3623           51740                           INDEX    ININDEX                               

Page 1476

064045,000425: 21,3624           34735                           CA       BIT15                                 #  THIS IS THE SCALE MAGNITUDE
064046,000426: 21,3625           56002                           XCH      Q                                     #  2**(-ININDEX) IS THE SHIFT DIVISOR.
064047,000427: 21,3626           00006                           EXTEND                                         #  RESCALE ARGUMENT.
064048,000428: 21,3627           31750                           DCA      FUNCTION                              
064049,000429: 21,3630           00006                           EXTEND                                         
064050,000430: 21,3631           10002                           DV       Q                                     
064051,000431: 21,3632           55747                           TS       FUNCTION                              #  ININDEX AND SHFTFLAG PRESERVE INFO FOR
064052,000432:                                                                                                  #  RESCALING AFTER ROOT PROCESS.
064053,000433: 21,3633           00006        SCALDONE           EXTEND                                         #  AFTER 3/2 POWER IS TAKEN, SCALE FACTOR
064054,000434: 21,3634           74737                           MP       BIT13                                 #  OF SQRT(1/2) WILL BE NEEDED, SO FACTOR
064055,000435: 21,3635           55743                           TS       HALFARG                               #  OF 1/2 IS INCLUDED NOW, BEFORE SQRT.
064056,000436: 
064057,000437: 21,3636           33761                           CA       STARTER                               #  INITIAL GUESS FOR SQRT ALGORITHM.
064058,000438: 21,3637           03763                           TC       ROOTCYCL                              
064059,000439: 21,3640           03763                           TC       ROOTCYCL                              
064060,000440: 21,3641           03763                           TC       ROOTCYCL                              
064061,000441: 
064062,000442: 21,3642           00006                           EXTEND                                         #  SQRT(1/2)*SQRT(ARG) IN A.
064063,000443: 21,3643           71747                           MP       FUNCTION                              #  SQRT(1/2)*ARG*SQRT(ARG) IN A,L.
064064,000444: 21,3644           53750                           DXCH     FUNCTION                              
064065,000445: 
064066,000446: 21,3645           31737        DOSHIFT            CA       SHFTFLAG                              #  HOW MANY SHIFT BITS ARE THERE?
064067,000447: 21,3646           61740                           AD       ININDEX                               #  2**(-ININDEX) WAS SHIFT DIVISOR.
064068,000448: 21,3647           54021                           TS       SR                                    
064069,000449: 21,3650           60021                           AD       SR                                    #  THIS MANY SHIFTS ARE REQUIRED.
064070,000450: 21,3651           54002        SAVESHFT           TS       Q                                     #  Q BOUNDS ARE ZERO AND 24 (DECIMAL).
064071,000451: 21,3652           00006                           EXTEND                                         
064072,000452: 21,3653           63701                           BZMF     SUMNEGU                               #  BRANCH IF SHIFTING IS UNNECESSARY.
064073,000453: 
064074,000454: 21,3654           44317                           CS       FOURTEEN                              
064075,000455: 21,3655           60002                           AD       Q                                     
064076,000456: 21,3656           00006                           EXTEND                                         #  Q = 0(MOD 3), SO A REG IS NON-ZERO.
064077,000457: 21,3657           63664                           BZMF     MINISHFT                              #  BRANCH IF SMALL SHIFT SUFFICES.
064078,000458: 
064079,000459: 21,3660           54002        MAXISHFT           TS       Q                                     #  14 BIT SHIFT RIGHT NOW.
064080,000460: 21,3661           34755                           CA       ZERO                                  
064081,000461: 21,3662           57747                           XCH      FUNCTION                              
064082,000462: 21,3663           55750                           TS       FUNCTION   +1                         
064083,000463: 
064084,000464: 21,3664           50002        MINISHFT           INDEX    Q                                     #  C(Q) ARE GREATER THAN ZERO.
064085,000465: 21,3665           34735                           CA       BIT15                                 
064086,000466: 21,3666           54002                           TS       Q                                     #  2**(-Q) WILL BE SHIFT MULTIPLIER.
064087,000467: 21,3667           00006                           EXTEND                                         
064088,000468: 21,3670           71750                           MP       FUNCTION   +1                         
064089,000469: 21,3671           56001                           XCH      L                                     
064090,000470: 21,3672           34755                           CA       ZERO                                  
064091,000471: 21,3673           53750                           DXCH     FUNCTION                              #  LOWER WORD SHIFTED NOW.
064092,000472: 21,3674           00006                           EXTEND                                         
064093,000473: 21,3675           63701                           BZMF     SUMNEGU                               #  BRANCH IF UPPER WORD WAS ZERO.

Page 1477

064095,000475: 21,3676           00006                           EXTEND                                         #  SHIFT UPPER WORD.
064096,000476: 21,3677           70002                           MP       Q                                     
064097,000477: 21,3700           21750                           DAS      FUNCTION                              #  NO OVERFLOW POSSIBLE.
064098,000478: 
064099,000479: 21,3701           41745        SUMNEGU            CS       DEL                                   #  INCLUDE DEL FACTOR IN PRODUCT TERM.
064100,000480: 21,3702           00006                           EXTEND                                         
064101,000481: 21,3703           63707                           BZMF     SUMTERMS                              
064102,000482: 
064103,000483: 21,3704           00006                           EXTEND                                         #  DEL FACTOR IS MINUS ONE.
064104,000484: 21,3705           41750                           DCS      FUNCTION                              
064105,000485: 21,3706           13713                           TCF      NEGUSUM    -1                         #  NOW ADD IN THE K2THETA TERM.
064106,000486: 
064107,000487: 21,3707           00006        SUMTERMS           EXTEND                                         
064108,000488: 21,3710           13714                           BZF      NEGUSUM                               #  BRANCH IF DEL IS ZERO.
064109,000489: 
064110,000490: 21,3711           00006                           EXTEND                                         #  DEL FACTOR IS +1.
064111,000491: 21,3712           31750                           DCA      FUNCTION                              
064112,000492: 21,3713           21736                           DAS      K2THETA                               #  NOW ADD IN THE K2THETA TERM.
064113,000493: 21,3714           11735        NEGUSUM            CCS      K2THETA                               #  TEST SIGN OF HIGH ORDER PART.
064114,000494: 21,3715           13721                           TCF      NEGDRIVE                              
064115,000495: 21,3716           13720                           TCF      +2                                    
064116,000496: 21,3717           13723                           TCF      POSDRIVE                              
064117,000497: 
064118,000498: 21,3720           11736                           CCS      K2THETA    +1                         #  SIGN TEST FOR LOW ORDER PART.
064119,000499: 21,3721           34753        NEGDRIVE           CA       BIT1                                  
064120,000500: 21,3722           13724                           TCF      +2                                    #  STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
064121,000501: 21,3723           44753        POSDRIVE           CS       BIT1                                  
064122,000502: 21,3724           54001                           TS       L                                     #  SAVE FOR DRIVE REVERSAL TEST.
064123,000503: 21,3725           51746                           INDEX    QRCNTR                                
064124,000504: 21,3726           57500                           XCH      NEGUQ                                 
064125,000505: 
064126,000506: 21,3727           00006                           EXTEND                                         
064127,000507: 21,3730           70001                           MP       L                                     #  MULTIPLY OLD NEGU AND NEW NEGU.
064128,000508: 21,3731           10001                           CCS      L                                     
064129,000509: 21,3732           13747                           TCF      LOUPE                                 #  NON-ZERO GIMBAL DRIVE BEING CONTINUED.
064130,000510: 
064131,000511: 21,3733           13744                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
064132,000512: 
064133,000513: 21,3734           13736                           TCF      REVERSAL                              #  NON-ZERO GIMBAL DRIVE BEING REVERSED.
064134,000514: 21,3735           13744                           TCF      ZEROLOUP                              #  NO REVERSAL PROBLEM HERE.
064135,000515: 
064136,000516: 21,3736           51746        REVERSAL           INDEX    QRCNTR                                #  A ZERO-DRIVE PAUSE IS NEEDED HERE.  ZERO
064137,000517: 21,3737           55510                           TS       QACCDOT                               #  IS IN A REGISTER FROM CCS ON (-1).
064138,000518: 21,3740           51746                           INDEX    QRCNTR                                
064139,000519: 21,3741           43760                           CS       GMBLBITA                              
064140,000520: 21,3742           00006                           EXTEND                                         
064141,000521: 21,3743           03012                           WAND     CHAN12                                
064142,000522: 
064143,000523: 21,3744           41273        ZEROLOUP           CS       RCSFLAGS                              #  SET UP REQUEST FOR ACDT+C12 CALL.
064144,000524: 21,3745           74747                           MASK     CALLGMBL                              

Page 1478

064146,000526: 21,3746           27273                           ADS      RCSFLAGS                              
064147,000527: 
064148,000528: 21,3747           11746        LOUPE              CCS      QRCNTR                                #  HAVE BOTH AXES BEEN PROCESSED?
064149,000529: 21,3750           13306                           TCF      GOQTRIMG                              #  NO.  DO Q AXIS NEXT.
064150,000530: 
064151,000531: 21,3751           31476                           CA       SAVESR                                #  RESTORE THE SR
064152,000532: 21,3752           54021                           TS       SR                                    
064153,000533: 
064154,000534: 21,3753           00006        GOCLOSE            EXTEND                                         #  TERMINATE THE JASK.
064155,000535: 21,3754           33757                           DCA      CLOSEADR                              
064156,000536: 21,3755           52006                           DTCB                                           
064157,000537: 
064158,000538: 21,3756  E6,1537                                  EBANK=   AOSQ                                  
064159,000539: 21,3756           03173 36106  CLOSEADR           2CADR    CLOSEOUT                              #  TERMINATE THE JASK.
064160,000540: 
064161,000541: 21,3760     5742               TWELVE             EQUALS   OCT14                                 
064162,000542: 21,3760           01400        GMBLBITA           OCTAL    01400                                 #  INDEXED WRT GMBLBITB   DO NOT MOVE ******
064163,000543: 21,3761           20761        STARTER            DEC      .53033                                #  INITIAL VALUE FOR SQRT ALGORITHM.
064164,000544: 21,3762           06000        GMBLBITB           OCTAL    06000                                 #  INDEXED WRT GMBLBITA   DO NOT MOVE ******
064165,000545: 
064166,000546:                                                                                                  #  SUBROUTINE ROOTCYCL:  BY CRAIG WORK,3 APRIL 68
064167,000547: 
064168,000548:                                                                                                  #  ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION.  THE INITIAL GUESS AT THE
064169,000549:                                                                                                  #  SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG.  THE NEW APPROXI-
064170,000550:                                                                                                  #  MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER.  DEBRIS:  A,L,SR,SCRATCH.   ROOTCYCL IS CALLED FROM
064171,000551:                                                                                                  #  LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
064172,000552: 
064173,000553:                                                                                                  #  WARNING:  IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
064174,000554: 
064175,000555: 21,3763           55742        ROOTCYCL           TS       SCRATCH                               #  STORE X
064176,000556: 21,3764           54021                           TS       SR                                    #  X/2 NOW IN SR
064177,000557: 21,3765           31743                           CA       HALFARG                               #  ARG/2 IN THE A REG
064178,000558: 21,3766           22007                           ZL                                             #  PREPARE FOR DIVISION
064179,000559: 21,3767           00006                           EXTEND                                         
064180,000560: 21,3770           11742                           DV       SCRATCH                               #  (ARG/X)/2
064181,000561: 21,3771           60021                           AD       SR                                    #  (X + ARG/X)/2 IN THE A REG
064182,000562: 21,3772           00002                           TC       Q                                     
064183,000563: 
064184,000564: 

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