Source Code
This is a reconstructed version of Luminary 130, the initial AGC program released
in November 1969 for the Apollo 13 LM. Three more releases
followed before the flown revision was finally manufactured in February 1970.
This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G. In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'. |
062592,000002: ## Copyright: Public domain.
062593,000003: ## Filename: TRIM_GIMBAL_CONTROL_SYSTEM.agc
062594,000004: ## Purpose: A section of the reconstructed source code for Luminary 130.
062595,000005: ## This was the original program released for the Apollo 13 LM,
062596,000006: ## although several more revisions would follow. It has been
062597,000007: ## reconstructed from a listing of Luminary 131, from which it
062598,000008: ## differs on only two lines in P70-P71. The difference is
062599,000009: ## described in detail in Luminary memo #129, which was used
062600,000010: ## to perform the reconstruction. This file is intended to be a
062601,000011: ## faithful reconstruction, except that the code format has been
062602,000012: ## changed to conform to the requirements of the yaYUL assembler
062603,000013: ## rather than the original YUL assembler.
062604,000014: ## Reference: pp. 1464-1476
062605,000015: ## Contact: Ron Burkey <info@sandroid.org>.
062606,000016: ## Website: www.ibiblio.org/apollo/index.html
062607,000017: ## Mod history: 06/08/03 RSB. Began transcribing.
062608,000018: ## 05/14/05 RSB Corrected website reference above.
062609,000019: ## 2010-10-25 JL Indentation fixes.
062610,000020: ## 2017-01-06 RSB Page numbers now agree with those on the
062611,000021: ## original hardcopy, as opposed to the PDF page
062612,000022: ## numbers in 1701.pdf.
062613,000023: ## 2017-02-28 RSB Proofed comment text using octopus/ProoferComments.
062614,000024: ## 2017-03-14 RSB Comment-text fixes noted in proofing Luminary 116.
062615,000025: ## 2018-09-04 MAS Copied from Luminary 131 for Luminary 130.
062616,000026: ## 2021-05-30 ABS GTSGO+DN -> GTSGO+ON
062617,000027:
Page 1464 |
062619,000029: 21,3076 BANK 21
062620,000030: 21,3076 E6,1450 EBANK= QDIFF
062621,000031: 21,2000 SETLOC DAPS4
062622,000032: 21,2000 BANK
062623,000033:
062624,000034: 21,3076 COUNT* $$/DAPGT
062625,000035:
062626,000036: # CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
062627,000037: # AUTOPILOT ARE BOTH ON:
062628,000038: # A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
062629,000039: # INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
062630,000040: # B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
062631,000041: # ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
062632,000042: # GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
062633,000043:
062634,000044: 21,3076 37752 GTS CAF NEGONE # MAKE THE NEXT PASS THROUGH THE DAP BE
062635,000045: 21,3077 55630 TS COTROLER # THROUGH RCS CONTROL,
062636,000046: 21,3100 34751 CAF FOUR # AND ENSURE THAT IT IS NOT A SKIP.
062637,000047: 21,3101 55534 TS SKIPU
062638,000048: 21,3102 55535 TS SKIPV
062639,000049:
062640,000050: 21,3103 34752 CAF TWO
062641,000051: 21,3104 55632 TS INGTS # SET INDICATOR OF GTS CONTROL POSITIVE.
062642,000052: 21,3105 55631 TS QGIMTIMR # SET TIMERS TO 200 MSEC TO AVOID BOTH
062643,000053: 21,3106 55633 TS RGIMTIMR # RUNAWAY AND INTERFERENCE BY NULLING.
062644,000054:
062645,000055: # THE DRIVE SETTING ALGORITHM
062646,000056: # DEL = SGN(OMEGA + ALPHA*ABS(ALPHA)/(2*K))
062647,000057: # 2 1/2 2 3/2
062648,000058: # NEGUSUM = ERROR*K + ALPHA*(DEL*OMEGA + ALPHA /(3*K)) + DEL*K (DEL*OMEGA + ALPHA /(2*K))
062649,000059: # DRIVE = -SGN(NEGUSUM)
062650,000060:
062651,000061: 21,3107 30021 CA SR # SAVE THE SR. SHIFT IT LEFT TO CORRECT
062652,000062: 21,3110 60000 AD A # FOR THE RIGHT SHIFT DUE TO EDITING.
062653,000063: 21,3111 55505 TS SAVESR
062654,000064:
062655,000065: 21,3112 34752 GTSGO+ON CAF TWO # SET INDEXER FOR R-AXIS CALCULATIONS.
062656,000066: 21,3113 13115 TCF GOQTRIMG +1
062657,000067:
062658,000068: 21,3114 34755 GOQTRIMG CAF ZERO # SET INDEXER FOR Q-AXIS CALCULATIONS
062659,000069: 21,3115 55747 TS QRCNTR
062660,000070:
062661,000071: 21,3116 51747 INDEX QRCNTR # AOS SCALED AT PI/2
062662,000072: 21,3117 31536 CA AOSQ
062663,000073: 21,3120 00006 EXTEND
062664,000074: 21,3121 74752 MP BIT2 # RESCALE AOS TO PI/4
Page 1465 |
062666,000076: 21,3122 00006 EXTEND
062667,000077: 21,3123 13127 BZF GTSQAXIS -3 # USE FULL SCALE FOR LARGER AOS ESTIMATES.
062668,000078:
062669,000079: 21,3124 50000 INDEX A
062670,000080: 21,3125 44734 CS LIMITS # LIMITS +1 CONTAINS NEGMAX.
062671,000081: 21,3126 56001 XCH L # LIMITS -1 CONTAINS POSMAX.
062672,000082:
062673,000083: 21,3127 11747 CCS QRCNTR # PICK UP RATE FOR THIS AXIS. RATE CELLS
062674,000084: 21,3130 50000 INDEX A # ARE ADJACENT, NOT SEPARATED. AT PI/4
062675,000085: 21,3131 31436 CA EDOTQ
062676,000086: 21,3132 53743 GTSQAXIS DXCH WCENTRAL
062677,000087:
062678,000088: 21,3133 51747 INDEX QRCNTR # COLLECT K FOR THIS AXIS
062679,000089: 21,3134 31504 CA KQ
062680,000090: 21,3135 55740 TS KCENTRAL
062681,000091:
062682,000092: 21,3136 00006 EXTEND # CONTROL AUTHORITY ZERO. AVOID DRIVING
062683,000093: 21,3137 13575 BZF POSDRIVE +1 # ENGINE BELL TO THE STOPS.
062684,000094:
062685,000095: 21,3140 51747 INDEX QRCNTR # QDIFF, RDIFF ARE STORED IN D.P.
062686,000096: 21,3141 31450 CAE QDIFF
062687,000097:
062688,000098: 21,3142 00006 ALGORTHM EXTEND # Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
062689,000099: 21,3143 71740 MP KCENTRAL # FORM K*ERROR AT PI(2)/2(8), IN D.P.
062690,000100: 21,3144 23736 LXCH K2THETA
062691,000101: 21,3145 00006 EXTEND
062692,000102: 21,3146 74747 MP BIT5 # RESCALE TO 4*PI(2)
062693,000103: 21,3147 53737 DXCH K2THETA
062694,000104: 21,3150 00006 EXTEND
062695,000105: 21,3151 74747 MP BIT5 # FIRST TERM OF NEGUSUM IN K2THETA.
062696,000106: 21,3152 27737 ADS K2THETA +1 # NO CARRY NEEDED D.P. AT 4*PI(2)
062697,000107:
062698,000108: 21,3153 41743 CS ACENTRAL # FORM ALPHA(2)/(2*K) AT 16*PI, IN D.P.,
062699,000109: 21,3154 00006 EXTEND # LIMITING QUOTIENT TO AVOID OVERFLOW.
062700,000110: 21,3155 74736 MP BIT14 # -ALPHA/2 IN A, SCALED AT PI/4
062701,000111: 21,3156 00006 EXTEND
062702,000112: 21,3157 71743 MP ACENTRAL # -ALPHA(2)/2 IN A,L, SCALED AT PI(2)/16
062703,000113: 21,3160 61740 AD KCENTRAL
062704,000114: 21,3161 00006 EXTEND
062705,000115: 21,3162 63177 BZMF HUGEQUOT # K-ALPHA(2)/2 SHOULD BE PNZ FO DIVISION
062706,000116:
062707,000117: 21,3163 00006 EXTEND
062708,000118: 21,3164 40001 DCS A # ALPHA(2)/2 - K
062709,000119: 21,3165 61740 AD KCENTRAL
062710,000120: 21,3166 00006 EXTEND
062711,000121: 21,3167 11740 DV KCENTRAL # HIGH ORDER OF QUOTIENT.
062712,000122: 21,3170 57745 XCH A2CNTRAL
062713,000123: 21,3171 30001 CA L # SHIFT UP THE REMAINDER.
062714,000124: 21,3172 22007 LXCH 7 # ZERO LOW-ORDER DIVIDEND.
062715,000125: 21,3173 00006 EXTEND
Page 1466 |
062717,000127: 21,3174 11740 DV KCENTRAL
062718,000128: 21,3175 57746 XCH A2CNTRAL +1 # QUOTIENT STORED AT 16*PI, D.P.
062719,000129: 21,3176 13202 TCF HAVEQUOT
062720,000130:
062721,000131: 21,3177 34733 HUGEQUOT CA POSMAX
062722,000132: 21,3200 54001 TS L
062723,000133: 21,3201 53746 DXCH A2CNTRAL # LIMITED QUOTIENT STORED AT 16*PI, D.P.
062724,000134:
062725,000135: 21,3202 31742 HAVEQUOT CA WCENTRAL
062726,000136: 21,3203 00006 EXTEND
062727,000137: 21,3204 74743 MP BIT9 # RESCALE OMEGA AT 16*PI IN D.P.
062728,000138: 21,3205 53742 DXCH K2CNTRAL # LOWER WORD OVERLAYS OMEGA IN WCENTRAL
062729,000139:
062730,000140: 21,3206 00006 EXTEND
062731,000141: 21,3207 31742 DCA K2CNTRAL
062732,000142: 21,3210 53751 DXCH FUNCTION
062733,000143:
062734,000144: 21,3211 31743 CA ACENTRAL # GET ALPHA*ABS(ALPHA)/(2*K)
062735,000145: 21,3212 00006 EXTEND
062736,000146: 21,3213 63217 BZMF +4
062737,000147:
062738,000148: 21,3214 00006 EXTEND
062739,000149: 21,3215 31746 DCA A2CNTRAL
062740,000150: 21,3216 13221 TCF +3
062741,000151:
062742,000152: 21,3217 00006 EXTEND
062743,000153: 21,3220 41746 DCS A2CNTRAL
062744,000154:
062745,000155: 21,3221 21751 DAS FUNCTION # OMEGA + ALPHA*ABS(ALPHA)/2*K) AT 16*PI
062746,000156:
062747,000157: 21,3222 11750 CCS FUNCTION # DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
062748,000158: 21,3223 13227 TCF POSFNCT1 # OTHERWISE DEL = -1
062749,000159: 21,3224 13226 TCF +2
062750,000160: 21,3225 13231 TCF NEGFNCT1
062751,000161:
062752,000162: 21,3226 11751 CCS FUNCTION +1 # USE LOW ORDER WORD SINCE HIGH IS ZERO
062753,000163: 21,3227 34753 POSFNCT1 CAF BIT1
062754,000164: 21,3230 13232 TCF +2
062755,000165: 21,3231 44753 NEGFNCT1 CS BIT1
062756,000166: 21,3232 55744 TS DEL
062757,000167:
062758,000168: 21,3233 11744 CCS DEL # REPLACE OMEGA BY DEL*OMEGA
062759,000169: 21,3234 13246 TCF FUNCT2 # POSITIVE DEL VALUE. PROCEED.
062760,000170: 21,3235 13237 TCF DEFUNCT
062761,000171: 21,3236 13243 TCF NEGFNCT2
062762,000172:
062763,000173: 21,3237 55741 DEFUNCT TS K2CNTRAL
062764,000174: 21,3240 55742 TS K2CNTRAL +1
062765,000175: 21,3241 13246 TCF FUNCT2
062766,000176:
Page 1467 |
062768,000178: 21,3242 65252 NEG1/3 DEC -.33333
062769,000179:
062770,000180: 21,3243 00006 NEGFNCT2 EXTEND
062771,000181: 21,3244 41742 DCS K2CNTRAL
062772,000182: 21,3245 53742 DXCH K2CNTRAL
062773,000183:
062774,000184: 21,3246 00006 FUNCT2 EXTEND
062775,000185: 21,3247 31746 DCA A2CNTRAL
062776,000186: 21,3250 21742 DAS K2CNTRAL # DEL*OMEGA + ALPHA(2)/(2*K) AT 16*PI, D.P.
062777,000187:
062778,000188: 21,3251 31745 FUNCT3 CA A2CNTRAL
062779,000189: 21,3252 00006 EXTEND
062780,000190: 21,3253 73242 MP NEG1/3
062781,000191: 21,3254 53746 DXCH A2CNTRAL
062782,000192: 21,3255 30001 CA L
062783,000193: 21,3256 00006 EXTEND
062784,000194: 21,3257 73242 MP NEG1/3
062785,000195: 21,3260 27746 ADS A2CNTRAL +1
062786,000196: 21,3261 54001 TS L
062787,000197: 21,3262 13264 TCF +2 # A2CNTRAL NOW CONTAINS -ALPHA(2)/(6*K),
062788,000198: 21,3263 27745 ADS A2CNTRAL # SCALED AT 16*PI, IN D.P.
062789,000199:
062790,000200: 21,3264 00006 EXTEND
062791,000201: 21,3265 31742 DCA K2CNTRAL # DEL*OMEGA + ALPHA(2)/(3*K) IN A2CNTRAL,
062792,000202: 21,3266 21746 DAS A2CNTRAL # SCALED AT 16*PI, D.P.
062793,000203:
062794,000204: 21,3267 31745 CA A2CNTRAL
062795,000205: 21,3270 00006 EXTEND
062796,000206: 21,3271 71743 MP ACENTRAL
062797,000207: 21,3272 21737 DAS K2THETA
062798,000208: 21,3273 31746 CA A2CNTRAL +1
062799,000209: 21,3274 00006 EXTEND
062800,000210: 21,3275 71743 MP ACENTRAL # ACENTRAL MAY NOW BE OVERLAID.
062801,000211: 21,3276 27737 ADS K2THETA +1
062802,000212: 21,3277 54001 TS L
062803,000213: 21,3300 13302 TCF +2 # TWO TERMS OF NEGUSUM ACCUMULATED, SO FAR
062804,000214: 21,3301 27736 ADS K2THETA # SCALED AT 4*PI(2), IN D.P.
062805,000215:
062806,000216: 21,3302 31741 GETROOT CA K2CNTRAL # K*(DEL*OMEGA + ALPHA(2)/(2*K)) IS THE
062807,000217: 21,3303 00006 EXTEND # TERM FOR WHICH A SQUARE ROOT IS NEEDED.
062808,000218: 21,3304 71740 MP KCENTRAL # K AT PI/2(8)
062809,000219: 21,3305 53751 DXCH FUNCTION
062810,000220: 21,3306 31742 CA K2CNTRAL +1
062811,000221: 21,3307 00006 EXTEND
062812,000222: 21,3310 71740 MP KCENTRAL
062813,000223: 21,3311 27751 ADS FUNCTION +1
062814,000224: 21,3312 54001 TS L
062815,000225: 21,3313 13315 TCF +2
062816,000226: 21,3314 27750 ADS FUNCTION # DESIRED TERM IN FUNCTION, AT PI(2)/16
Page 1468 |
062818,000228: 21,3315 11744 CCS DEL
062819,000229: 21,3316 13523 TCF RSTOFGTS
062820,000230: 21,3317 13565 TCF NEGUSUM
062821,000231: 21,3320 13322 TCF NEGATE
062822,000232: 21,3321 13565 TCF NEGUSUM
062823,000233:
062824,000234: 21,3322 00006 NEGATE EXTEND
062825,000235: 21,3323 41742 DCS K2CNTRAL
062826,000236: 21,3324 53742 DXCH K2CNTRAL
062827,000237: 21,3325 13523 TCF RSTOFGTS
062828,000238:
062829,000239: 16,3741 BANK 16
062830,000240: 16,3741 E6,1501 EBANK= NEGUQ
062831,000241: 16,2000 SETLOC DAPS1
062832,000242: 16,2000 BANK
062833,000243:
062834,000244: # THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
062835,000245: # THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES. ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
062836,000246:
062837,000247: # WARNING: ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
062838,000248:
062839,000249: 16,3741 07400 BGIM OCTAL 07400
062840,000250: 16,3742 0066 CHNL12 EQUALS ITEMP6
062841,000251: 16,3742 41501 ACDT+C12 CS NEGUQ
062842,000252: 16,3743 00006 EXTEND # GIMBAL DRIVE REQUESTS.
062843,000253: 16,3744 71507 MP ACCDOTQ
062844,000254: 16,3745 23510 LXCH QACCDOT
062845,000255: 16,3746 41503 CS NEGUR
062846,000256: 16,3747 00006 EXTEND
062847,000257: 16,3750 71511 MP ACCDOTR
062848,000258: 16,3751 23512 LXCH RACCDOT
062849,000259:
062850,000260: 16,3752 11501 CCS NEGUQ
062851,000261: 16,3753 34742 CAF BIT10
062852,000262: 16,3754 13756 TCF +2
062853,000263: 16,3755 34743 CAF BIT9
062854,000264: 16,3756 54066 TS CHNL12
062855,000265:
062856,000266: 16,3757 11503 CCS NEGUR
062857,000267: 16,3760 34740 CAF BIT12
062858,000268: 16,3761 13763 TCF +2
062859,000269: 16,3762 34741 CAF BIT11
062860,000270: 16,3763 26066 ADS CHNL12 # (STORED RESULT NOT USED AT PRESENT)
062861,000271:
062862,000272: 16,3764 43741 CS BGIM
062863,000273: 16,3765 00006 EXTEND
062864,000274: 16,3766 02012 RAND CHAN12
062865,000275: 16,3767 60066 AD CHNL12
062866,000276: 16,3770 00006 EXTEND
062867,000277: 16,3771 01012 WRITE CHAN12
Page 1469 |
062869,000279: 16,3772 44747 CS CALLGMBL # TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
062870,000280: 16,3773 71262 MASK RCSFLAGS
062871,000281: 16,3774 55262 TS RCSFLAGS
062872,000282:
062873,000283: 16,3775 00002 TC Q # RETURN TO CALLER.
062874,000284:
062875,000285: 21,3326 BANK 21
062876,000286: 21,3326 E6,1450 EBANK= QDIFF
062877,000287: 21,2000 SETLOC DAPS4
062878,000288: 21,2000 BANK
062879,000289:
Page 1470 |
062881,000291: # SUBROUTINE TIMEGMBL: MOD 0, OCTOBER 1967, CRAIG WORK
062882,000292:
062883,000293: # TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
062884,000294: # THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS. INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
062885,000295: # SCALED AT PI/8. FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT). A ZERO
062886,000296: # ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY. OTHERWISE, THE GIMBAL IS TURNED ON
062887,000297: # DRIVING IN THE CORRECT DIRECTION. THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
062888,000298: # IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE. NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
062889,000299: # WHICH IS NEGATIVE, ZERO, OR POSITIVE.
062890,000300:
062891,000301: # INPUTS: AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7). PI/2(7).
062892,000302:
062893,000303: # OUTPUTS: NEW GIMBAL DRIVE BITS IN CHANNEL 12, NEGUQ, NEGUR, QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
062894,000304: # Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
062895,000305:
062896,000306: # DEBRIS: A, L, Q, ITEMPS 2, 3, 6, RUPTREG2 AND ACDT+C12 DEBRIS.
062897,000307:
062898,000308: # EXITS: VIA TC Q.
062899,000309:
062900,000310: # ALARMS, ABORTS, : NONE
062901,000311:
062902,000312: # SUBROUTINES: ACDT+C12, IBNKCALL
062903,000313:
062904,000314: # WARNING: THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS. THEREFORE IT MAY ONLY BE CALLED WITH
062905,000315: # INTERRUPT INHIBITED.
062906,000316:
062907,000317: # ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
062908,000318: # NEGUQ ERASE +2 NEGATIVE OF Q-AXIS GIMBAL DRIVE
062909,000319: # (SPWORD) EQUALS NEGUQ +1 ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
062910,000320: # NEGUR EQUALS NEGUQ +2 NEGATIVE OF R-AXIS GIMBAL DRIVE
062911,000321: # ACCDOTQ ERASE +2 Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
062912,000322: # (SPWORD) EQUALS ACCDOTQ +1 ANY S.P. ERASABLE NUMBER NOW QACCDOT
062913,000323: # ACCDOTR EQUALS ACCDOTQ +2 R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
062914,000324: # ACCDOTQ, ACCDOTR ARE MAGNITUDES.
062915,000325: # AOSQ ERASE +4 Q-AXIS ACC., D.P. AT PI/2 R/SEC(2)
062916,000326: # AOSR EQUALS AOSQ +2 R-AXIS ACCELERATION SCALED AT PI/2 R/S2
062917,000327:
062918,000328: 21,3326 0066 QRNDXER EQUALS ITEMP6
062919,000329: 21,3326 23146 OCT23146 OCTAL 23146 # DECIMAL .6
062920,000330: 21,3327 0063 NZACCDOT EQUALS ITEMP3
062921,000331:
062922,000332: 21,3327 34753 TIMEGMBL CAF ONE # INITIALIZE ALLOWGTS.
062923,000333: 21,3330 55502 TS ALLOWGTS
062924,000334:
062925,000335: 21,3331 34752 CAF TWO # SET UP LOOP FOR R AXIS.
062926,000336: 21,3332 22002 LXCH Q # SAVE RETURN ADDRESS.
062927,000337: 21,3333 22071 LXCH RUPTREG2
Page 1471 |
062929,000339: 21,3334 13336 TCF +2
062930,000340: 21,3335 34755 TIMQGMBL CAF ZERO # NOW DO THE Q-AXIS
062931,000341: 21,3336 54066 TS QRNDXER
062932,000342: 21,3337 50066 INDEX QRNDXER
062933,000343: 21,3340 31507 CA ACCDOTQ # ACCDOT IS PRESUMED TO BE AT PI/2(7).
062934,000344: 21,3341 00006 EXTEND
062935,000345: 21,3342 63412 BZMF TGOFFNOW # IS ACCDOT LESS THAN OR EQUAL TO 0?
062936,000346: 21,3343 54063 TS NZACCDOT # NO. STORE NON-ZERO, POSITIVE ACCDOT.
062937,000347:
062938,000348: 21,3344 50066 ALPHATRY INDEX QRNDXER
062939,000349: 21,3345 41536 CS AOSQ
062940,000350: 21,3346 00006 EXTEND
062941,000351: 21,3347 13412 BZF TGOFFNOW # IS ALPHA ZERO?
062942,000352:
062943,000353: 21,3350 54002 TS Q # SAVE A COPY OF -AOS.
062944,000354: 21,3351 00006 EXTEND # NO. RESCALE FOR TIMEGMBL USE.
062945,000355: 21,3352 73326 MP OCT23146 # OCTAL 23146 IS DECIMAL .6
062946,000356: 21,3353 60002 AD Q # -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
062947,000357: 21,3354 54001 TS L # WAS THERE OVERFLOW?
062948,000358: 21,3355 13362 TCF SETNEGU # NO. COMPUTE DRIVE TIME.
062949,000359:
062950,000360: 21,3356 40000 CS A # RECOVER -SGN(AOS) IN THE A REGISTER.
062951,000361: 21,3357 50066 INDEX QRNDXER # YES. START DRIVE WITHOUT WAITLIST.
062952,000362: 21,3360 57501 XCH NEGUQ
062953,000363: 21,3361 13416 TCF NOTALLOW # KNOCK DOWN THE ALLOWGTS FLAG.
062954,000364:
062955,000365: 21,3362 00006 SETNEGU EXTEND
062956,000366: 21,3363 63370 BZMF POSALPH
062957,000367:
062958,000368: 21,3364 40000 COM
062959,000369: 21,3365 54062 TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
062960,000370: 21,3366 44753 CS BIT1
062961,000371: 21,3367 13372 TCF POSALPH +2
062962,000372: 21,3370 54062 POSALPH TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
062963,000373: 21,3371 34753 CA BIT1
062964,000374: 21,3372 50066 +2 INDEX QRNDXER # SGN(AOS) INTO NEGU
062965,000375: 21,3373 55501 TS NEGUQ # STORE SGN(APLHA) AS NEGU
062966,000376:
062967,000377: 21,3374 30063 CA NZACCDOT
062968,000378: 21,3375 00006 EXTEND
062969,000379: 21,3376 74740 MP BIT12 # 2*ACCDOT, SCALED AT PI/8.
062970,000380: 21,3377 60062 AD ITEMP2 # -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
062971,000381: 21,3400 00006 EXTEND
062972,000382: 21,3401 63416 BZMF NOTALLOW # IS DRIVE TIME MORE THAN TWO SECONDS?
062973,000383: 21,3402 40062 CS ITEMP2 # NO. COMPUTE DRIVE TIME.
062974,000384: 21,3403 00006 EXTEND # ABS(ALPHA) AT PI/8.
062975,000385: 21,3404 73437 MP OCT00240 # DECIMAL 10/1024
062976,000386: 21,3405 00006 EXTEND # QUOTIENT IS DRIVE TIME AT WAITLIST.
062977,000387: 21,3406 10063 DV NZACCDOT # ABS(ALPHA)/ACCDOT AT 2(14)/100
Page 1472 |
062979,000389: 21,3407 00006 EXTEND
062980,000390: 21,3410 13412 BZF TGOFFNOW # DRIVE TIME MUST BE GREATER THAN ZERO.
062981,000391:
062982,000392: 21,3411 13424 TCF DRIVEON
062983,000393:
062984,000394: 21,3412 34755 TGOFFNOW CAF ZERO # TURN OFF GIMBAL NOW.
062985,000395: 21,3413 50066 INDEX QRNDXER
062986,000396: 21,3414 55501 TS NEGUQ
062987,000397:
062988,000398: 21,3415 13426 TCF DONEYET
062989,000399:
062990,000400: 21,3416 36010 NOTALLOW CAF OCT31
062991,000401: 21,3417 50066 INDEX QRNDXER
062992,000402: 21,3420 55631 TS QGIMTIMR
062993,000403: 21,3421 34755 CAF ZERO # DRIVE TIME IS MORE THAN 2 SECONDS, SO
062994,000404: 21,3422 55502 TS ALLOWGTS # DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
062995,000405: # CONTROL UNTIL AOSTASK APPROVES.
062996,000406: 21,3423 13426 TCF DONEYET # NO WAITLIST CALL IS MADE.
062997,000407:
062998,000408: 21,3424 50066 DRIVEON INDEX QRNDXER
062999,000409: 21,3425 55631 TS QGIMTIMR # CHOOSE Q OR R AXIS.
063000,000410:
063001,000411: 21,3426 10066 DONEYET CCS QRNDXER
063002,000412: 21,3427 13335 TCF TIMQGMBL
063003,000413:
063004,000414: 21,3430 52073 DXCH RUPTREG3 # PROTECT IBNKCALL ERASABLES. ACDT+C12
063005,000415: 21,3431 52063 DXCH ITEMP2 # LEAVES ITEMPS2,3 ALONE.
063006,000416:
063007,000417: 21,3432 04674 TC IBNKCALL # TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
063008,000418: 21,3433 35742 CADR ACDT+C12
063009,000419:
063010,000420: 21,3434 52063 DXCH ITEMP2 # RESTORE ERASABLES FOR IBNKCALL.
063011,000421: 21,3435 52073 DXCH RUPTREG3
063012,000422:
063013,000423: 21,3436 00071 TC RUPTREG2 # RETURN TO CALLER.
063014,000424:
063015,000425: 21,3437 00240 OCT00240 OCTAL 00240 # DECIMAL 10/1024
063016,000426:
Page 1473 |
063018,000428: # THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY. THE QUANTITY NEGUSUM
063019,000429: # IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM. NEW DRIVES ARE ENTERED TO CH 12.
063020,000430:
063021,000431: # THE SUBROUTINE GTSQRT ACCEPTS A DOUBLE PRECISION VALUE IN FUNCTION, FUNCTION +1 AND RETURNS A SINGLE-PRECISION
063022,000432: # SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF THE ARGUMENT. ALSO, THE CELL SHFTFLAG CONTAINS A BINARY
063023,000433: # EXPONENT S, SUCH THAT THE SQUARE ROOT (RETURNED IN THE A REGISTER) MUST BE SHIFTED RIGHT (MULTIPLIED BY 2 TO THE
063024,000434: # POWER (-S)) IN ORDER TO BE THE TRUE SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF FUNCTION, FUNCTION +1.
063025,000435: # SQUARE ROOT ERROR IS NOT MORE THAN 2 IN THE 14TH SIGNIFICANT BIT. CELLS CLOBBERED ARE A, L, SHFTFLAG, ININDEX,
063026,000436: # HALFARG, SCRATCH, SR, FUNCTION, FUNCTION +1. GTSQRT IS CALLED BY TC GTSQRT AND RETURNS VIA TC Q OR TC FUNCTION +1.
063027,000437: # ZERO OR NEGATIVE ARGUMENTS YIELD ZERO FOR SQUARE ROOTS.
063028,000438:
063029,000439: 21,3440 11750 GTSQRT CCS FUNCTION
063030,000440: 21,3441 13457 TCF GOODARG # FUNCTION IS POSITIVE. TAKE SQUARE ROOT.
063031,000441: 21,3442 13444 TCF +2 # HIGH ORDER WORD IS ZERO. TRY THE LOWER.
063032,000442: 21,3443 13450 TCF ZEROOT # NEGATIVE. USE ZERO FOR 1/2 POWER.
063033,000443:
063034,000444: 21,3444 31751 CA FUNCTION +1
063035,000445: 21,3445 00006 EXTEND
063036,000446: 21,3446 63450 BZMF ZEROOT
063037,000447:
063038,000448: 21,3447 13453 TCF ZEROHIGH # PROCEED.
063039,000449: 21,3450 34755 ZEROOT CA ZERO
063040,000450: 21,3451 55740 TS SHFTFLAG
063041,000451: 21,3452 00002 TC Q
063042,000452:
063043,000453: 21,3453 57750 ZEROHIGH XCH FUNCTION # 14 MOST SIGNIFICANT BITS ARE IN THE
063044,000454: 21,3454 57751 XCH FUNCTION +1 # LOWER WORD. EXCHANGE THEM.
063045,000455: 21,3455 34757 CA SEVEN
063046,000456: 21,3456 13460 TCF GOODARG +1
063047,000457:
063048,000458: 21,3457 34755 GOODARG CA ZERO
063049,000459: 21,3460 55740 TS SHFTFLAG
063050,000460: 21,3461 35741 CA TWELVE # INITIALIZE THE SCALING LOOP.
063051,000461: 21,3462 55743 TS ININDEX
063052,000462: 21,3463 13472 TCF SCALLOOP
063053,000463:
063054,000464: 21,3464 31750 SCALSTRT CA FUNCTION
063055,000465: 21,3465 13506 TCF SCALDONE
063056,000466:
063057,000467: 21,3466 37751 MULBUSH CA NEG2 # IF ARG IS NOT LESS THAN 1/4, INDEX IS
063058,000468: 21,3467 27743 ADS ININDEX # ZERO, INDICATING NO SHIFT NEEDED.
063059,000469: 21,3470 00006 EXTEND # BRANCH IF ARG IS NOT LESS THAN 1/4.
063060,000470: 21,3471 63464 BZMF SCALSTRT # OTHERWISE COMPARE ARG WITH A REFERENCE
063061,000471: # WHICH IS 4 TIMES LARGER THAN THE LAST.
063062,000472: 21,3472 41750 SCALLOOP CS FUNCTION
063063,000473: 21,3473 51743 INDEX ININDEX
063064,000474: 21,3474 64735 AD BIT15 # REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
063065,000475: 21,3475 00006 EXTEND
063066,000476: 21,3476 63466 BZMF MULBUSH # IF ARG IS NOT LESS THAN REFERENCE, GO
063067,000477: # AROUND THE MULBERRY BUSH ONCE MORE.
Page 1474 |
063069,000479: 21,3477 51743 INDEX ININDEX
063070,000480: 21,3500 34735 CA BIT15 # THIS IS THE SCALE MAGNITUDE
063071,000481: 21,3501 57746 XCH HALFARG # 2**(-ININDEX) IS THE SHIFT DIVISOR.
063072,000482: 21,3502 00006 EXTEND # RESCALE ARGUMENT.
063073,000483: 21,3503 31751 DCA FUNCTION
063074,000484: 21,3504 00006 EXTEND
063075,000485: 21,3505 11746 DV HALFARG
063076,000486: # ININDEX AND SHFTFLAG PRESERVE INFO FOR
063077,000487: # RESCALING AFTER ROOT PROCESS.
063078,000488: 21,3506 00006 SCALDONE EXTEND
063079,000489: 21,3507 23751 QXCH FUNCTION +1 # SAVE Q FOR RETURN
063080,000490: 21,3510 00006 EXTEND
063081,000491: 21,3511 74736 MP BIT14
063082,000492: 21,3512 55746 TS HALFARG
063083,000493: 21,3513 74737 MASK BIT13
063084,000494: 21,3514 10000 CCS A
063085,000495: 21,3515 33633 CA OCT11276
063086,000496: 21,3516 63631 AD ROOTHALF # INITIAL GUESS IS ROOT 1/2 OR POSMAX
063087,000497: 21,3517 03635 TC ROOTCYCL
063088,000498: 21,3520 03635 TC ROOTCYCL
063089,000499: 21,3521 03635 TC ROOTCYCL
063090,000500: 21,3522 01751 TC FUNCTION +1
063091,000501:
063092,000502: # ****************************************************************************************************************
063093,000503:
063094,000504: 21,3523 03440 RSTOFGTS TC GTSQRT
063095,000505: 21,3524 57741 PRODUCT XCH K2CNTRAL
063096,000506: 21,3525 00006 EXTEND
063097,000507: 21,3526 71741 MP K2CNTRAL
063098,000508: 21,3527 53742 DXCH K2CNTRAL
063099,000509: 21,3530 00006 EXTEND # THE PRODUCT OF
063100,000510: 21,3531 70001 MP L # 1/2 2 1/2
063101,000511: 21,3532 27742 ADS K2CNTRAL +1 # K *(DEL*OMEGA + ALPHA /(2*K))
063102,000512: 21,3533 54001 TS L # AND
063103,000513: 21,3534 13536 TCF +2 # 2
063104,000514: 21,3535 27741 ADS K2CNTRAL # DEL*(DEL*OMEGA + ALPHA /(2*K)) NOW IN
063105,000515: # K2CNTRAL
063106,000516:
063107,000517: 21,3536 31743 DOSHIFT CA ININDEX
063108,000518: 21,3537 00006 EXTEND # MULTIPLY IN THE FACTOR 2(-S), RETURNED
063109,000519: 21,3540 74736 MP BIT14 # BY THE GTSQRT SUBROUTINE
063110,000520: 21,3541 27740 ADS SHFTFLAG
063111,000521: 21,3542 00006 EXTEND
063112,000522: 21,3543 13562 BZF ADDITIN
063113,000523: 21,3544 51740 INDEX SHFTFLAG
063114,000524: 21,3545 34735 CA BIT15
Page 1475 |
063116,000526: 21,3546 57741 XCH K2CNTRAL
063117,000527: 21,3547 00006 EXTEND
063118,000528: 21,3550 71741 MP K2CNTRAL
063119,000529: 21,3551 21737 DAS K2THETA
063120,000530: 21,3552 57741 XCH K2CNTRAL
063121,000531: 21,3553 00006 EXTEND
063122,000532: 21,3554 71742 MP K2CNTRAL +1
063123,000533: 21,3555 27737 ADS K2THETA +1
063124,000534: 21,3556 54001 TS L
063125,000535: 21,3557 13561 TCF +2
063126,000536: 21,3560 27736 ADS K2THETA
063127,000537:
063128,000538: 21,3561 13565 TCF NEGUSUM
063129,000539:
063130,000540: 21,3562 00006 ADDITIN EXTEND
063131,000541: 21,3563 31742 DCA K2CNTRAL
063132,000542: 21,3564 21737 DAS K2THETA # NOW ADD IN THE K2THETA TERM.
063133,000543: 21,3565 11736 NEGUSUM CCS K2THETA # TEST SIGN OF HIGH ORDER PART.
063134,000544: 21,3566 13572 TCF NEGDRIVE
063135,000545: 21,3567 13571 TCF +2
063136,000546: 21,3570 13574 TCF POSDRIVE
063137,000547:
063138,000548: 21,3571 11737 CCS K2THETA +1 # SIGN TEST FOR LOW ORDER PART.
063139,000549: 21,3572 34753 NEGDRIVE CA BIT1
063140,000550: 21,3573 13575 TCF +2 # STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
063141,000551: 21,3574 44753 POSDRIVE CS BIT1
063142,000552: 21,3575 54001 TS L # SAVE FOR DRIVE REVERSAL TEST.
063143,000553: 21,3576 51747 INDEX QRCNTR
063144,000554: 21,3577 57501 XCH NEGUQ
063145,000555:
063146,000556: 21,3600 00006 EXTEND
063147,000557: 21,3601 70001 MP L # MULTIPLY OLD NEGU AND NEW NEGU.
063148,000558: 21,3602 10001 CCS L
063149,000559: 21,3603 13620 TCF LOUPE # NON-ZERO GIMBAL DRIVE BEING CONTINUED.
063150,000560:
063151,000561: 21,3604 13615 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
063152,000562:
063153,000563: 21,3605 13607 TCF REVERSAL # NON-ZERO GIMBAL DRIVE BEING REVERSED.
063154,000564: 21,3606 13615 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
063155,000565:
063156,000566: 21,3607 51747 REVERSAL INDEX QRCNTR # A ZERO-DRIVE PAUSE IS NEEDED HERE. ZERO
063157,000567: 21,3610 55510 TS QACCDOT # IS IN A REGISTER FROM CCS ON (-1).
063158,000568: 21,3611 51747 INDEX QRCNTR
063159,000569: 21,3612 43632 CS GMBLBITA
063160,000570: 21,3613 00006 EXTEND
063161,000571: 21,3614 03012 WAND CHAN12
063162,000572:
063163,000573: 21,3615 41262 ZEROLOUP CS RCSFLAGS # SET UP REQUEST FOR ACDT+C12 CALL.
063164,000574: 21,3616 74747 MASK CALLGMBL
063165,000575: 21,3617 27262 ADS RCSFLAGS
Page 1476 |
063167,000577: 21,3620 11747 LOUPE CCS QRCNTR # HAVE BOTH AXES BEEN PROCESSED?
063168,000578: 21,3621 13114 TCF GOQTRIMG # NO. DO Q AXIS NEXT.
063169,000579:
063170,000580: 21,3622 31505 CA SAVESR # RESTORE THE SR
063171,000581: 21,3623 54021 TS SR
063172,000582:
063173,000583: 21,3624 00006 GOCLOSE EXTEND # TERMINATE THE JASK.
063174,000584: 21,3625 33630 DCA CLOSEADR
063175,000585: 21,3626 52006 DTCB
063176,000586:
063177,000587: 21,3627 E6,1536 EBANK= AOSQ
063178,000588: 21,3627 03270 36106 CLOSEADR 2CADR CLOSEOUT # TERMINATE THE JASK.
063179,000589:
063180,000590: 21,3631 5741 TWELVE EQUALS OCT14
063181,000591: 21,3631 26501 ROOTHALF OCTAL 26501 # SQUARE ROOT OF 1/2
063182,000592: 21,3632 01400 GMBLBITA OCTAL 01400 # INDEXED WRT GMBLBITB DO NOT MOVE ******
063183,000593: 21,3633 11276 OCT11276 OCTAL 11276 # POSMAX - ROOTHALF
063184,000594: 21,3634 06000 GMBLBITB OCTAL 06000 # INDEXED WRT GMBLBITA DO NOT MOVE ******
063185,000595:
063186,000596: # SUBROUTINE ROOTCYCL: BY CRAIG WORK, 3 APRIL 68
063187,000597:
063188,000598: # ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION. THE INITIAL GUESS AT THE
063189,000599: # SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG. THE NEW APPROXI-
063190,000600: # MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER. DEBRIS: A, L, SR, SCRATCH. ROOTCYCL IS CALLED FROM
063191,000601: # LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
063192,000602:
063193,000603: # WARNING: IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
063194,000604:
063195,000605: 21,3635 55745 ROOTCYCL TS SCRATCH # STORE X
063196,000606: 21,3636 54021 TS SR # X/2 NOW IN SR
063197,000607: 21,3637 31746 CA HALFARG # ARG/2 IN THE A REG
063198,000608: 21,3640 22007 ZL # PREPARE FOR DIVISION
063199,000609: 21,3641 00006 EXTEND
063200,000610: 21,3642 11745 DV SCRATCH # (ARG/X)/2
063201,000611: 21,3643 60021 AD SR # (X + ARG/X)/2 IN THE A REG
063202,000612: 21,3644 00002 TC Q
063203,000613:
063204,000614:
End of include-file TRIM_GIMBAL_CONTROL_SYSTEM.agc. Parent file is MAIN.agc