Source Code
These source-code files are part of a reconstructed copy of Luminary 163, the
first (unflown) release of the Apollo 14 Lunar Module (LM) Apollo Guidance
Computer (AGC) software.
The reconstruction began with reconstructed source code for Luminary 173. Changes between revision 163 and 173 were backed out, as described by Luminary memos 157 and 158. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 163 listing would be different. 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. |
062842,000002: ## Copyright: Public domain.
062843,000003: ## Filename: TRIM_GIMBAL_CONTROL_SYSTEM.agc
062844,000004: ## Purpose: A section of Luminary revision 163.
062845,000005: ## It is part of the reconstructed source code for the first
062846,000006: ## (unflown) release of the flight software for the Lunar
062847,000007: ## Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
062848,000008: ## The code has been recreated from a reconstructed copy of
062849,000009: ## Luminary 173, as well as Luminary memos 157 amd 158.
062850,000010: ## It has been adapted such that the resulting bugger words
062851,000011: ## exactly match those specified for Luminary 163 in NASA
062852,000012: ## drawing 2021152N, which gives relatively high confidence
062853,000013: ## that the reconstruction is correct.
062854,000014: ## Reference: pp. 1460-1472
062855,000015: ## Assembler: yaYUL
062856,000016: ## Contact: Ron Burkey <info@sandroid.org>.
062857,000017: ## Website: www.ibiblio.org/apollo/index.html
062858,000018: ## Mod history: 2019-08-21 MAS Created from Luminary 173.
062859,000019: ## 2021-05-30 ABS GTSGO+DN -> GTSGO+ON
062860,000020:
Page 1460 |
062862,000022: 21,3061 BANK 21
062863,000023: 21,3061 E6,1450 EBANK= QDIFF
062864,000024: 21,2000 SETLOC DAPS4
062865,000025: 21,2000 BANK
062866,000026:
062867,000027: 21,3061 COUNT* $$/DAPGT
062868,000028:
062869,000029: # CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
062870,000030: # AUTOPILOT ARE BOTH ON:
062871,000031: # A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
062872,000032: # INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
062873,000033: # B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
062874,000034: # ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
062875,000035:
062876,000036: # GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
062877,000037:
062878,000038: 21,3061 37752 GTS CAF NEGONE # MAKE THE NEXT PASS THROUGH THE DAP BE
062879,000039: 21,3062 55630 TS COTROLER # THROUGH RCS CONTROL,
062880,000040: 21,3063 34751 CAF FOUR # AND ENSURE THAT IT IS NOT A SKIP.
062881,000041: 21,3064 55534 TS SKIPU
062882,000042: 21,3065 55535 TS SKIPV
062883,000043:
062884,000044: 21,3066 34752 CAF TWO
062885,000045: 21,3067 55632 TS INGTS # SET INDICATOR OF GTS CONTROL POSITIVE.
062886,000046: 21,3070 55631 TS QGIMTIMR # SET TIMERS TO 200 MSEC TO AVOID BOTH
062887,000047: 21,3071 55633 TS RGIMTIMR # RUNAWAY AND INTERFERENCE BY NULLING.
062888,000048:
062889,000049: # THE DRIVE SETTING ALGORITHM
062890,000050:
062891,000051: # DEL = SGN(OMEGA + ALPHA*ABS(ALPHA)/(2*K))
062892,000052:
062893,000053: # 2 1/2 2 3/2
062894,000054: # NEGUSUM = ERROR*K + ALPHA*(DEL*OMEGA + ALPHA /(3*K)) + DEL*K (DEL*OMEGA + ALPHA /(2*K))
062895,000055:
062896,000056: # DRIVE = -SGN(NEGUSUM)
062897,000057:
062898,000058: 21,3072 30021 CA SR # SAVE THE SR. SHIFT IT LEFT TO CORRECT
062899,000059: 21,3073 60000 AD A # FOR THE RIGHT SHIFT DUE TO EDITING.
062900,000060: 21,3074 55505 TS SAVESR
062901,000061:
062902,000062: 21,3075 34752 GTSGO+ON CAF TWO # SET INDEXER FOR R-AXIS CALCULATIONS.
062903,000063: 21,3076 13100 TCF GOQTRIMG +1
062904,000064:
062905,000065: 21,3077 34755 GOQTRIMG CAF ZERO # SET INDEXER FOR Q-AXIS CALCULATIONS
062906,000066: 21,3100 55747 TS QRCNTR
062907,000067:
062908,000068: 21,3101 51747 INDEX QRCNTR # AOS SCALED AT PI/2
062909,000069: 21,3102 31536 CA AOSQ
062910,000070: 21,3103 00006 EXTEND
062911,000071: 21,3104 74752 MP BIT2 # RESCALE AOS TO PI/4
062912,000072:
Page 1461 |
062914,000074: 21,3105 00006 EXTEND
062915,000075: 21,3106 13112 BZF GTSQAXIS -3 # USE FULL SCALE FOR LARGER AOS ESTIMATES.
062916,000076:
062917,000077: 21,3107 50000 INDEX A
062918,000078: 21,3110 44734 CS LIMITS # LIMITS +1 CONTAINS NEGMAX.
062919,000079: 21,3111 56001 XCH L # LIMITS -1 CONTAINS POSMAX.
062920,000080:
062921,000081: 21,3112 11747 CCS QRCNTR # PICK UP RATE FOR THIS AXIS. RATE CELLS
062922,000082: 21,3113 50000 INDEX A # ARE ADJACENT, NOT SEPARATED. AT PI/4
062923,000083: 21,3114 31436 CA EDOTQ
062924,000084: 21,3115 53743 GTSQAXIS DXCH WCENTRAL
062925,000085:
062926,000086: 21,3116 51747 INDEX QRCNTR # COLLECT K FOR THIS AXIS
062927,000087: 21,3117 31504 CA KQ
062928,000088: 21,3120 55740 TS KCENTRAL
062929,000089:
062930,000090: 21,3121 00006 EXTEND # CONTROL AUTHORITY ZERO. AVOID DRIVING
062931,000091: 21,3122 13560 BZF POSDRIVE +1 # ENGINE BELL TO THE STOPS.
062932,000092:
062933,000093: 21,3123 51747 INDEX QRCNTR # QDIFF, RDIFF ARE STORED IN D.P.
062934,000094: 21,3124 31450 CAE QDIFF
062935,000095:
062936,000096: 21,3125 00006 ALGORTHM EXTEND # Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
062937,000097: 21,3126 71740 MP KCENTRAL # FORM K*ERROR AT PI(2)/2(8), IN D.P.
062938,000098: 21,3127 23736 LXCH K2THETA
062939,000099: 21,3130 00006 EXTEND
062940,000100: 21,3131 74747 MP BIT5 # RESCALE TO 4*PI(2)
062941,000101: 21,3132 53737 DXCH K2THETA
062942,000102: 21,3133 00006 EXTEND
062943,000103: 21,3134 74747 MP BIT5 # FIRST TERM OF NEGUSUM IN K2THETA.
062944,000104: 21,3135 27737 ADS K2THETA +1 # NO CARRY NEEDED D.P. AT 4*PI(2)
062945,000105:
062946,000106: 21,3136 41743 CS ACENTRAL # FORM ALPHA(2)/(2*K) AT 16*PI, IN D.P.,
062947,000107: 21,3137 00006 EXTEND # LIMITING QUOTIENT TO AVOID OVERFLOW.
062948,000108: 21,3140 74736 MP BIT14 # -ALPHA/2 IN A, SCALED AT PI/4
062949,000109: 21,3141 00006 EXTEND
062950,000110: 21,3142 71743 MP ACENTRAL # -ALPHA(2)/2 IN A,L, SCALED AT PI(2)/16
062951,000111: 21,3143 61740 AD KCENTRAL
062952,000112: 21,3144 00006 EXTEND
062953,000113: 21,3145 63162 BZMF HUGEQUOT # K-ALPHA(2)/2 SHOULD BE PNZ FO DIVISION
062954,000114:
062955,000115: 21,3146 00006 EXTEND
062956,000116: 21,3147 40001 DCS A # ALPHA(2)/2 - K
062957,000117: 21,3150 61740 AD KCENTRAL
062958,000118: 21,3151 00006 EXTEND
062959,000119: 21,3152 11740 DV KCENTRAL # HIGH ORDER OF QUOTIENT.
062960,000120: 21,3153 57745 XCH A2CNTRAL
062961,000121: 21,3154 30001 CA L # SHIFT UP THE REMAINDER.
062962,000122: 21,3155 22007 LXCH 7 # ZERO LOW-ORDER DIVIDEND.
062963,000123: 21,3156 00006 EXTEND
Page 1462 |
062965,000125: 21,3157 11740 DV KCENTRAL
062966,000126: 21,3160 57746 XCH A2CNTRAL +1 # QUOTIENT STORED AT 16*PI, D.P.
062967,000127: 21,3161 13165 TCF HAVEQUOT
062968,000128:
062969,000129: 21,3162 34733 HUGEQUOT CA POSMAX
062970,000130: 21,3163 54001 TS L
062971,000131: 21,3164 53746 DXCH A2CNTRAL # LIMITED QUOTIENT STORED AT 16*PI, D.P.
062972,000132:
062973,000133: 21,3165 31742 HAVEQUOT CA WCENTRAL
062974,000134: 21,3166 00006 EXTEND
062975,000135: 21,3167 74743 MP BIT9 # RESCALE OMEGA AT 16*PI IN D.P.
062976,000136: 21,3170 53742 DXCH K2CNTRAL # LOWER WORD OVERLAYS OMEGA IN WCENTRAL
062977,000137:
062978,000138: 21,3171 00006 EXTEND
062979,000139: 21,3172 31742 DCA K2CNTRAL
062980,000140: 21,3173 53751 DXCH FUNCTION
062981,000141:
062982,000142: 21,3174 31743 CA ACENTRAL # GET ALPHA*ABS(ALPHA)/(2*K)
062983,000143: 21,3175 00006 EXTEND
062984,000144: 21,3176 63202 BZMF +4
062985,000145:
062986,000146: 21,3177 00006 EXTEND
062987,000147: 21,3200 31746 DCA A2CNTRAL
062988,000148: 21,3201 13204 TCF +3
062989,000149:
062990,000150: 21,3202 00006 EXTEND
062991,000151: 21,3203 41746 DCS A2CNTRAL
062992,000152:
062993,000153: 21,3204 21751 DAS FUNCTION # OMEGA + ALPHA*ABS(ALPHA)/2*K) AT 16*PI
062994,000154:
062995,000155: 21,3205 11750 CCS FUNCTION # DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
062996,000156: 21,3206 13212 TCF POSFNCT1 # OTHERWISE DEL = -1
062997,000157: 21,3207 13211 TCF +2
062998,000158: 21,3210 13214 TCF NEGFNCT1
062999,000159:
063000,000160: 21,3211 11751 CCS FUNCTION +1 # USE LOW ORDER WORD SINCE HIGH IS ZERO
063001,000161: 21,3212 34753 POSFNCT1 CAF BIT1
063002,000162: 21,3213 13215 TCF +2
063003,000163: 21,3214 44753 NEGFNCT1 CS BIT1
063004,000164: 21,3215 55744 TS DEL
063005,000165:
063006,000166: 21,3216 11744 CCS DEL # REPLACE OMEGA BY DEL*OMEGA
063007,000167: 21,3217 13231 TCF FUNCT2 # POSITIVE DEL VALUE. PROCEED.
063008,000168: 21,3220 13222 TCF DEFUNCT
063009,000169: 21,3221 13226 TCF NEGFNCT2
063010,000170:
063011,000171: 21,3222 55741 DEFUNCT TS K2CNTRAL
063012,000172: 21,3223 55742 TS K2CNTRAL +1
063013,000173: 21,3224 13231 TCF FUNCT2
063014,000174:
Page 1463 |
063016,000176: 21,3225 65252 NEG1/3 DEC -.33333
063017,000177:
063018,000178: 21,3226 00006 NEGFNCT2 EXTEND
063019,000179: 21,3227 41742 DCS K2CNTRAL
063020,000180: 21,3230 53742 DXCH K2CNTRAL
063021,000181:
063022,000182: 21,3231 00006 FUNCT2 EXTEND
063023,000183: 21,3232 31746 DCA A2CNTRAL
063024,000184: 21,3233 21742 DAS K2CNTRAL # DEL*OMEGA + ALPHA(2)/(2*K) AT 16*PI,D.P.
063025,000185:
063026,000186: 21,3234 31745 FUNCT3 CA A2CNTRAL
063027,000187: 21,3235 00006 EXTEND
063028,000188: 21,3236 73225 MP NEG1/3
063029,000189: 21,3237 53746 DXCH A2CNTRAL
063030,000190: 21,3240 30001 CA L
063031,000191: 21,3241 00006 EXTEND
063032,000192: 21,3242 73225 MP NEG1/3
063033,000193: 21,3243 27746 ADS A2CNTRAL +1
063034,000194: 21,3244 54001 TS L
063035,000195: 21,3245 13247 TCF +2 # A2CNTRAL NOW CONTAINS -ALPHA(2)/(6*K),
063036,000196: 21,3246 27745 ADS A2CNTRAL # SCALED AT 16*PI, IN D.P.
063037,000197:
063038,000198: 21,3247 00006 EXTEND
063039,000199: 21,3250 31742 DCA K2CNTRAL # DEL*OMEGA + ALPHA(2)/(3*K) IN A2CNTRAL,
063040,000200: 21,3251 21746 DAS A2CNTRAL # SCALED AT 16*PI, D.P.
063041,000201:
063042,000202: 21,3252 31745 CA A2CNTRAL
063043,000203: 21,3253 00006 EXTEND
063044,000204: 21,3254 71743 MP ACENTRAL
063045,000205: 21,3255 21737 DAS K2THETA
063046,000206: 21,3256 31746 CA A2CNTRAL +1
063047,000207: 21,3257 00006 EXTEND
063048,000208: 21,3260 71743 MP ACENTRAL # ACENTRAL MAY NOW BE OVERLAID.
063049,000209: 21,3261 27737 ADS K2THETA +1
063050,000210: 21,3262 54001 TS L
063051,000211: 21,3263 13265 TCF +2 # TWO TERMS OF NEGUSUM ACCUMULATED, SO FAR
063052,000212: 21,3264 27736 ADS K2THETA # SCALED AT 4*PI(2), IN D.P.
063053,000213:
063054,000214: 21,3265 31741 GETROOT CA K2CNTRAL # K*(DEL*OMEGA + ALPHA(2)/(2*K)) IS THE
063055,000215: 21,3266 00006 EXTEND # TERM FOR WHICH A SQUARE ROOT IS NEEDED.
063056,000216: 21,3267 71740 MP KCENTRAL # K AT PI/2(8)
063057,000217: 21,3270 53751 DXCH FUNCTION
063058,000218: 21,3271 31742 CA K2CNTRAL +1
063059,000219: 21,3272 00006 EXTEND
063060,000220: 21,3273 71740 MP KCENTRAL
063061,000221: 21,3274 27751 ADS FUNCTION +1
063062,000222: 21,3275 54001 TS L
063063,000223: 21,3276 13300 TCF +2
063064,000224: 21,3277 27750 ADS FUNCTION # DESIRED TERM IN FUNCTION, AT PI(2)/16
Page 1464 |
063066,000226: 21,3300 11744 CCS DEL
063067,000227: 21,3301 13506 TCF RSTOFGTS
063068,000228: 21,3302 13550 TCF NEGUSUM
063069,000229: 21,3303 13305 TCF NEGATE
063070,000230: 21,3304 13550 TCF NEGUSUM
063071,000231:
063072,000232: 21,3305 00006 NEGATE EXTEND
063073,000233: 21,3306 41742 DCS K2CNTRAL
063074,000234: 21,3307 53742 DXCH K2CNTRAL
063075,000235: 21,3310 13506 TCF RSTOFGTS
063076,000236:
063077,000237: 16,3740 BANK 16
063078,000238: 16,3740 E6,1501 EBANK= NEGUQ
063079,000239: 16,2000 SETLOC DAPS1
063080,000240: 16,2000 BANK
063081,000241:
063082,000242: # THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
063083,000243: # THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES. ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
063084,000244:
063085,000245: # WARNING: ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
063086,000246:
063087,000247: 16,3740 07400 BGIM OCTAL 07400
063088,000248: 16,3741 0066 CHNL12 EQUALS ITEMP6
063089,000249: 16,3741 41501 ACDT+C12 CS NEGUQ
063090,000250: 16,3742 00006 EXTEND # GIMBAL DRIVE REQUESTS.
063091,000251: 16,3743 71507 MP ACCDOTQ
063092,000252: 16,3744 23510 LXCH QACCDOT
063093,000253: 16,3745 41503 CS NEGUR
063094,000254: 16,3746 00006 EXTEND
063095,000255: 16,3747 71511 MP ACCDOTR
063096,000256: 16,3750 23512 LXCH RACCDOT
063097,000257:
063098,000258: 16,3751 11501 CCS NEGUQ
063099,000259: 16,3752 34742 CAF BIT10
063100,000260: 16,3753 13755 TCF +2
063101,000261: 16,3754 34743 CAF BIT9
063102,000262: 16,3755 54066 TS CHNL12
063103,000263:
063104,000264: 16,3756 11503 CCS NEGUR
063105,000265: 16,3757 34740 CAF BIT12
063106,000266: 16,3760 13762 TCF +2
063107,000267: 16,3761 34741 CAF BIT11
063108,000268: 16,3762 26066 ADS CHNL12 # (STORED RESULT NOT USED AT PRESENT)
063109,000269:
063110,000270: 16,3763 43740 CS BGIM
063111,000271: 16,3764 00006 EXTEND
063112,000272: 16,3765 02012 RAND CHAN12
063113,000273: 16,3766 60066 AD CHNL12
063114,000274: 16,3767 00006 EXTEND
063115,000275: 16,3770 01012 WRITE CHAN12
063116,000276:
Page 1465 |
063118,000278: 16,3771 44747 CS CALLGMBL # TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
063119,000279: 16,3772 71262 MASK RCSFLAGS
063120,000280: 16,3773 55262 TS RCSFLAGS
063121,000281:
063122,000282: 16,3774 00002 TC Q # RETURN TO CALLER.
063123,000283:
063124,000284: 21,3311 BANK 21
063125,000285: 21,3311 E6,1450 EBANK= QDIFF
063126,000286: 21,2000 SETLOC DAPS4
063127,000287: 21,2000 BANK
063128,000288:
Page 1466 |
063130,000290: # SUBROUTINE TIMEGMBL: MOD 0, OCTOBER 1967, CRAIG WORK
063131,000291:
063132,000292: # TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
063133,000293: # THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS. INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
063134,000294: # SCALED AT PI/8. FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT). A ZERO
063135,000295: # ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY. OTHERWISE, THE GIMBAL IS TURNED ON
063136,000296: # DRIVING IN THE CORRECT DIRECTION. THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
063137,000297: # IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE. NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
063138,000298: # WHICH IS NEGATIVE, ZERO, OR POSITIVE.
063139,000299:
063140,000300: # INPUTS: AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7). PI/2(7).
063141,000301:
063142,000302: # OUTPUTS: NEW GIMBAL DRIVE BITS IN CHANNEL 12,NEGUQ,NEGUR,QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
063143,000303: # Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
063144,000304:
063145,000305: # DEBRIS: A,L,Q, ITEMPS 2,3,6, RUPTREG2 AND ACDT+C12 DEBRIS.
063146,000306:
063147,000307: # EXITS: VIA TC Q.
063148,000308:
063149,000309: # ALARMS, ABORTS, : NONE
063150,000310:
063151,000311: # SUBROUTINES: ACDT+C12, IBNKCALL
063152,000312:
063153,000313: # WARNING: THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS. THEREFORE IT MAY ONLY BE CALLED WITH
063154,000314: # INTERRUPT INHIBITED.
063155,000315:
063156,000316: # ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
063157,000317:
063158,000318: # NEGUQ ERASE +2 NEGATIVE OF Q-AXIS GIMBAL DRIVE
063159,000319: # (SPWORD) EQUALS NEGUQ +1 ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
063160,000320: # NEGUR EQUALS NEGUQ +2 NEGATIVE OF R-AXIS GIMBAL DRIVE
063161,000321:
063162,000322: # ACCDOTQ ERASE +2 Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
063163,000323: # (SPWORD) EQUALS ACCDOTQ +1 ANY S.P. ERASABLE NUMBER NOW QACCDOT
063164,000324: # ACCDOTR EQUALS ACCDOTQ +2 R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
063165,000325: # ACCDOTQ,ACCDOTR ARE MAGNITUDES.
063166,000326: # AOSQ ERASE +4 Q-AXIS ACC.,D.P. AT PI/2 R/SEC(2)
063167,000327: # AOSR EQUALS AOSQ +2 R-AXIS ACCELERATION SCALED AT PI/2 R/S2
063168,000328:
063169,000329: 21,3311 0066 QRNDXER EQUALS ITEMP6
063170,000330: 21,3311 23146 OCT23146 OCTAL 23146 # DECIMAL .6
063171,000331: 21,3312 0063 NZACCDOT EQUALS ITEMP3
063172,000332:
063173,000333: 21,3312 34753 TIMEGMBL CAF ONE # INITIALIZE ALLOWGTS.
063174,000334: 21,3313 55502 TS ALLOWGTS
063175,000335:
063176,000336: 21,3314 34752 CAF TWO # SET UP LOOP FOR R AXIS.
063177,000337: 21,3315 22002 LXCH Q # SAVE RETURN ADDRESS.
063178,000338: 21,3316 22071 LXCH RUPTREG2
Page 1467 |
063180,000340: 21,3317 13321 TCF +2
063181,000341: 21,3320 34755 TIMQGMBL CAF ZERO # NOW DO THE Q-AXIS
063182,000342: 21,3321 54066 TS QRNDXER
063183,000343: 21,3322 50066 INDEX QRNDXER
063184,000344: 21,3323 31507 CA ACCDOTQ # ACCDOT IS PRESUMED TO BE AT PI/2(7).
063185,000345: 21,3324 00006 EXTEND
063186,000346: 21,3325 63375 BZMF TGOFFNOW # IS ACCDOT LESS THAN OR EQUAL TO 0?
063187,000347: 21,3326 54063 TS NZACCDOT # NO. STORE NON-ZERO, POSITIVE ACCDOT.
063188,000348:
063189,000349: 21,3327 50066 ALPHATRY INDEX QRNDXER
063190,000350: 21,3330 41536 CS AOSQ
063191,000351: 21,3331 00006 EXTEND
063192,000352: 21,3332 13375 BZF TGOFFNOW # IS ALPHA ZERO?
063193,000353:
063194,000354: 21,3333 54002 TS Q # SAVE A COPY OF -AOS.
063195,000355: 21,3334 00006 EXTEND # NO. RESCALE FOR TIMEGMBL USE.
063196,000356: 21,3335 73311 MP OCT23146 # OCTAL 23146 IS DECIMAL .6
063197,000357: 21,3336 60002 AD Q # -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
063198,000358: 21,3337 54001 TS L # WAS THERE OVERFLOW?
063199,000359: 21,3340 13345 TCF SETNEGU # NO. COMPUTE DRIVE TIME.
063200,000360:
063201,000361: 21,3341 40000 CS A # RECOVER -SGN(AOS) IN THE A REGISTER.
063202,000362: 21,3342 50066 INDEX QRNDXER # YES. START DRIVE WITHOUT WAITLIST.
063203,000363: 21,3343 57501 XCH NEGUQ
063204,000364: 21,3344 13401 TCF NOTALLOW # KNOCK DOWN THE ALLOWGTS FLAG.
063205,000365:
063206,000366: 21,3345 00006 SETNEGU EXTEND
063207,000367: 21,3346 63353 BZMF POSALPH
063208,000368:
063209,000369: 21,3347 40000 COM
063210,000370: 21,3350 54062 TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
063211,000371: 21,3351 44753 CS BIT1
063212,000372: 21,3352 13355 TCF POSALPH +2
063213,000373: 21,3353 54062 POSALPH TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
063214,000374: 21,3354 34753 CA BIT1
063215,000375: 21,3355 50066 +2 INDEX QRNDXER # SGN(AOS) INTO NEGU
063216,000376: 21,3356 55501 TS NEGUQ # STORE SGN(APLHA) AS NEGU
063217,000377:
063218,000378: 21,3357 30063 CA NZACCDOT
063219,000379: 21,3360 00006 EXTEND
063220,000380: 21,3361 74740 MP BIT12 # 2*ACCDOT, SCALED AT PI/8.
063221,000381: 21,3362 60062 AD ITEMP2 # -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
063222,000382: 21,3363 00006 EXTEND
063223,000383: 21,3364 63401 BZMF NOTALLOW # IS DRIVE TIME MORE THAN TWO SECONDS?
063224,000384: 21,3365 40062 CS ITEMP2 # NO. COMPUTE DRIVE TIME.
063225,000385: 21,3366 00006 EXTEND # ABS(ALPHA) AT PI/8.
063226,000386: 21,3367 73422 MP OCT00240 # DECIMAL 10/1024
063227,000387: 21,3370 00006 EXTEND # QUOTIENT IS DRIVE TIME AT WAITLIST.
063228,000388: 21,3371 10063 DV NZACCDOT # ABS(ALPHA)/ACCDOT AT 2(14)/100
063229,000389:
Page 1468 |
063231,000391: 21,3372 00006 EXTEND
063232,000392: 21,3373 13375 BZF TGOFFNOW # DRIVE TIME MUST BE GREATER THAN ZERO.
063233,000393:
063234,000394: 21,3374 13407 TCF DRIVEON
063235,000395:
063236,000396: 21,3375 34755 TGOFFNOW CAF ZERO # TURN OFF GIMBAL NOW.
063237,000397: 21,3376 50066 INDEX QRNDXER
063238,000398: 21,3377 55501 TS NEGUQ
063239,000399:
063240,000400: 21,3400 13411 TCF DONEYET
063241,000401:
063242,000402: 21,3401 36010 NOTALLOW CAF OCT31
063243,000403: 21,3402 50066 INDEX QRNDXER
063244,000404: 21,3403 55631 TS QGIMTIMR
063245,000405: 21,3404 34755 CAF ZERO # DRIVE TIME IS MORE THAN 2 SECONDS, SO
063246,000406: 21,3405 55502 TS ALLOWGTS # DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
063247,000407: # CONTROL UNTIL AOSTASK APPROVES.
063248,000408: 21,3406 13411 TCF DONEYET # NO WAITLIST CALL IS MADE.
063249,000409:
063250,000410: 21,3407 50066 DRIVEON INDEX QRNDXER
063251,000411: 21,3410 55631 TS QGIMTIMR # CHOOSE Q OR R AXIS.
063252,000412:
063253,000413: 21,3411 10066 DONEYET CCS QRNDXER
063254,000414: 21,3412 13320 TCF TIMQGMBL
063255,000415:
063256,000416: 21,3413 52073 DXCH RUPTREG3 # PROTECT IBNKCALL ERASABLES. ACDT+C12
063257,000417: 21,3414 52063 DXCH ITEMP2 # LEAVES ITEMPS2,3 ALONE.
063258,000418:
063259,000419: 21,3415 04674 TC IBNKCALL # TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
063260,000420: 21,3416 35741 CADR ACDT+C12
063261,000421:
063262,000422: 21,3417 52063 DXCH ITEMP2 # RESTORE ERASABLES FOR IBNKCALL.
063263,000423: 21,3420 52073 DXCH RUPTREG3
063264,000424:
063265,000425: 21,3421 00071 TC RUPTREG2 # RETURN TO CALLER.
063266,000426:
063267,000427: 21,3422 00240 OCT00240 OCTAL 00240 # DECIMAL 10/1024
063268,000428:
Page 1469 |
063270,000430: # THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY. THE QUANTITY NEGUSUM
063271,000431: # IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM. NEW DRIVES ARE ENTERED TO CH 12.
063272,000432:
063273,000433: # THE SUBROUTINE GTSQRT ACCEPTS A DOUBLE PRECISION VALUE IN FUNCTION, FUNCTION +1 AND RETURNS A SINGLE-PRECISION
063274,000434: # SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF THE ARGUMENT. ALSO, THE CELL SHFTFLAG CONTAINS A BINARY
063275,000435: # EXPONENT S, SUCH THAT THE SQUARE ROOT (RETURNED IN THE A REGISTER) MUST BE SHIFTED RIGHT (MULTIPLIED BY 2 TO THE
063276,000436: # POWER (-S)) IN ORDER TO BE THE TRUE SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF FUNCTION, FUNCTION +1.
063277,000437: # SQUARE ROOT ERROR IS NOT MORE THAN 2 IN THE 14TH SIGNIFICANT BIT. CELLS CLOBBERED ARE A,L,SHFTFLAG,ININDEX,
063278,000438: # HALFARG,SCRATCH,SR,FUNCTION, FUNCTION +1. GTSQRT IS CALLED BY TC GTSQRT AND RETURNS VIA TC Q OR TC FUNCTION +1.
063279,000439: # ZERO OR NEGATIVE ARGUMENTS YIELD ZERO FOR SQUARE ROOTS.
063280,000440:
063281,000441: 21,3423 11750 GTSQRT CCS FUNCTION
063282,000442: 21,3424 13442 TCF GOODARG # FUNCTION IS POSITIVE. TAKE SQUARE ROOT.
063283,000443: 21,3425 13427 TCF +2 # HIGH ORDER WORD IS ZERO. TRY THE LOWER.
063284,000444: 21,3426 13433 TCF ZEROOT # NEGATIVE. USE ZERO FOR 1/2 POWER.
063285,000445:
063286,000446: 21,3427 31751 CA FUNCTION +1
063287,000447: 21,3430 00006 EXTEND
063288,000448: 21,3431 63433 BZMF ZEROOT
063289,000449:
063290,000450: 21,3432 13436 TCF ZEROHIGH # PROCEED.
063291,000451: 21,3433 34755 ZEROOT CA ZERO
063292,000452: 21,3434 55740 TS SHFTFLAG
063293,000453: 21,3435 00002 TC Q
063294,000454:
063295,000455: 21,3436 57750 ZEROHIGH XCH FUNCTION # 14 MOST SIGNIFICANT BITS ARE IN THE
063296,000456: 21,3437 57751 XCH FUNCTION +1 # LOWER WORD. EXCHANGE THEM.
063297,000457: 21,3440 34757 CA SEVEN
063298,000458: 21,3441 13443 TCF GOODARG +1
063299,000459:
063300,000460: 21,3442 34755 GOODARG CA ZERO
063301,000461: 21,3443 55740 TS SHFTFLAG
063302,000462: 21,3444 35752 CA TWELVE # INITIALIZE THE SCALING LOOP.
063303,000463: 21,3445 55743 TS ININDEX
063304,000464: 21,3446 13455 TCF SCALLOOP
063305,000465:
063306,000466: 21,3447 31750 SCALSTRT CA FUNCTION
063307,000467: 21,3450 13471 TCF SCALDONE
063308,000468:
063309,000469: 21,3451 37751 MULBUSH CA NEG2 # IF ARG IS NOT LESS THAN 1/4, INDEX IS
063310,000470: 21,3452 27743 ADS ININDEX # ZERO, INDICATING NO SHIFT NEEDED.
063311,000471: 21,3453 00006 EXTEND # BRANCH IF ARG IS NOT LESS THAN 1/4.
063312,000472: 21,3454 63447 BZMF SCALSTRT # OTHERWISE COMPARE ARG WITH A REFERENCE
063313,000473: # WHICH IS 4 TIMES LARGER THAN THE LAST.
063314,000474: 21,3455 41750 SCALLOOP CS FUNCTION
063315,000475: 21,3456 51743 INDEX ININDEX
063316,000476: 21,3457 64735 AD BIT15 # REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
063317,000477: 21,3460 00006 EXTEND
063318,000478: 21,3461 63451 BZMF MULBUSH # IF ARG IS NOT LESS THAN REFERENCE, GO
063319,000479: # AROUND THE MULBERRY BUSH ONCE MORE.
063320,000480:
Page 1470 |
063322,000482: 21,3462 51743 INDEX ININDEX
063323,000483: 21,3463 34735 CA BIT15 # THIS IS THE SCALE MAGNITUDE
063324,000484: 21,3464 57746 XCH HALFARG # 2**(-ININDEX) IS THE SHIFT DIVISOR.
063325,000485: 21,3465 00006 EXTEND # RESCALE ARGUMENT.
063326,000486: 21,3466 31751 DCA FUNCTION
063327,000487: 21,3467 00006 EXTEND
063328,000488: 21,3470 11746 DV HALFARG
063329,000489: # ININDEX AND SHFTFLAG PRESERVE INFO FOR
063330,000490:
063331,000491: # RESCALING AFTER ROOT PROCESS.
063332,000492: 21,3471 00006 SCALDONE EXTEND
063333,000493: 21,3472 23751 QXCH FUNCTION +1 # SAVE Q FOR RETURN
063334,000494: 21,3473 00006 EXTEND
063335,000495: 21,3474 74736 MP BIT14
063336,000496: 21,3475 55746 TS HALFARG
063337,000497: 21,3476 74737 MASK BIT13
063338,000498: 21,3477 10000 CCS A
063339,000499: 21,3500 33616 CA OCT11276
063340,000500: 21,3501 63614 AD ROOTHALF # INITIAL GUESS IS ROOT 1/2 OR POSMAX
063341,000501:
063342,000502: 21,3502 03620 TC ROOTCYCL
063343,000503: 21,3503 03620 TC ROOTCYCL
063344,000504: 21,3504 03620 TC ROOTCYCL
063345,000505:
063346,000506: 21,3505 01751 TC FUNCTION +1
063347,000507:
063348,000508: # ****************************************************************************************************************
063349,000509:
063350,000510:
063351,000511: 21,3506 03423 RSTOFGTS TC GTSQRT
063352,000512: 21,3507 57741 PRODUCT XCH K2CNTRAL
063353,000513: 21,3510 00006 EXTEND
063354,000514: 21,3511 71741 MP K2CNTRAL
063355,000515: 21,3512 53742 DXCH K2CNTRAL
063356,000516: 21,3513 00006 EXTEND # THE PRODUCT OF
063357,000517: 21,3514 70001 MP L # 1/2 2 1/2
063358,000518: 21,3515 27742 ADS K2CNTRAL +1 # K *(DEL*OMEGA + ALPHA /(2*K))
063359,000519: 21,3516 54001 TS L # AND
063360,000520: 21,3517 13521 TCF +2 # 2
063361,000521: 21,3520 27741 ADS K2CNTRAL # DEL*(DEL*OMEGA + ALPHA /(2*K)) NOW IN
063362,000522: # K2CNTRAL
063363,000523:
063364,000524: 21,3521 31743 DOSHIFT CA ININDEX
063365,000525: 21,3522 00006 EXTEND # MULTIPLY IN THE FACTOR 2(-S), RETURNED
063366,000526: 21,3523 74736 MP BIT14 # BY THE GTSQRT SUBROUTINE
063367,000527: 21,3524 27740 ADS SHFTFLAG
063368,000528: 21,3525 00006 EXTEND
063369,000529: 21,3526 13545 BZF ADDITIN
063370,000530: 21,3527 51740 INDEX SHFTFLAG
063371,000531: 21,3530 34735 CA BIT15
Page 1471 |
063373,000533: 21,3531 57741 XCH K2CNTRAL
063374,000534: 21,3532 00006 EXTEND
063375,000535: 21,3533 71741 MP K2CNTRAL
063376,000536: 21,3534 21737 DAS K2THETA
063377,000537: 21,3535 57741 XCH K2CNTRAL
063378,000538: 21,3536 00006 EXTEND
063379,000539: 21,3537 71742 MP K2CNTRAL +1
063380,000540: 21,3540 27737 ADS K2THETA +1
063381,000541: 21,3541 54001 TS L
063382,000542: 21,3542 13544 TCF +2
063383,000543: 21,3543 27736 ADS K2THETA
063384,000544:
063385,000545: 21,3544 13550 TCF NEGUSUM
063386,000546:
063387,000547: 21,3545 00006 ADDITIN EXTEND
063388,000548: 21,3546 31742 DCA K2CNTRAL
063389,000549: 21,3547 21737 DAS K2THETA # NOW ADD IN THE K2THETA TERM.
063390,000550: 21,3550 11736 NEGUSUM CCS K2THETA # TEST SIGN OF HIGH ORDER PART.
063391,000551: 21,3551 13555 TCF NEGDRIVE
063392,000552: 21,3552 13554 TCF +2
063393,000553: 21,3553 13557 TCF POSDRIVE
063394,000554:
063395,000555: 21,3554 11737 CCS K2THETA +1 # SIGN TEST FOR LOW ORDER PART.
063396,000556: 21,3555 34753 NEGDRIVE CA BIT1
063397,000557: 21,3556 13560 TCF +2 # STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
063398,000558: 21,3557 44753 POSDRIVE CS BIT1
063399,000559: 21,3560 54001 TS L # SAVE FOR DRIVE REVERSAL TEST.
063400,000560: 21,3561 51747 INDEX QRCNTR
063401,000561: 21,3562 57501 XCH NEGUQ
063402,000562:
063403,000563: 21,3563 00006 EXTEND
063404,000564: 21,3564 70001 MP L # MULTIPLY OLD NEGU AND NEW NEGU.
063405,000565: 21,3565 10001 CCS L
063406,000566: 21,3566 13603 TCF LOUPE # NON-ZERO GIMBAL DRIVE BEING CONTINUED.
063407,000567:
063408,000568: 21,3567 13600 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
063409,000569:
063410,000570: 21,3570 13572 TCF REVERSAL # NON-ZERO GIMBAL DRIVE BEING REVERSED.
063411,000571: 21,3571 13600 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
063412,000572:
063413,000573: 21,3572 51747 REVERSAL INDEX QRCNTR # A ZERO-DRIVE PAUSE IS NEEDED HERE. ZERO
063414,000574: 21,3573 55510 TS QACCDOT # IS IN A REGISTER FROM CCS ON (-1).
063415,000575: 21,3574 51747 INDEX QRCNTR
063416,000576: 21,3575 43615 CS GMBLBITA
063417,000577: 21,3576 00006 EXTEND
063418,000578: 21,3577 03012 WAND CHAN12
063419,000579:
063420,000580: 21,3600 41262 ZEROLOUP CS RCSFLAGS # SET UP REQUEST FOR ACDT+C12 CALL.
063421,000581: 21,3601 74747 MASK CALLGMBL
063422,000582: 21,3602 27262 ADS RCSFLAGS
063423,000583:
Page 1472 |
063425,000585: 21,3603 11747 LOUPE CCS QRCNTR # HAVE BOTH AXES BEEN PROCESSED?
063426,000586: 21,3604 13077 TCF GOQTRIMG # NO. DO Q AXIS NEXT.
063427,000587:
063428,000588: 21,3605 31505 CA SAVESR # RESTORE THE SR
063429,000589: 21,3606 54021 TS SR
063430,000590:
063431,000591: 21,3607 00006 GOCLOSE EXTEND # TERMINATE THE JASK.
063432,000592: 21,3610 33613 DCA CLOSEADR
063433,000593: 21,3611 52006 DTCB
063434,000594:
063435,000595: 21,3612 E6,1536 EBANK= AOSQ
063436,000596: 21,3612 03270 36106 CLOSEADR 2CADR CLOSEOUT # TERMINATE THE JASK.
063437,000597:
063438,000598: 21,3614 5752 TWELVE EQUALS OCT14
063439,000599: 21,3614 26501 ROOTHALF OCTAL 26501 # SQUARE ROOT OF 1/2
063440,000600: 21,3615 01400 GMBLBITA OCTAL 01400 # INDEXED WRT GMBLBITB DO NOT MOVE******
063441,000601: 21,3616 11276 OCT11276 OCTAL 11276 # POSMAX - ROOTHALF
063442,000602: 21,3617 06000 GMBLBITB OCTAL 06000 # INDEXED WRT GMBLBITA DO NOT MOVE******
063443,000603:
063444,000604: # SUBROUTINE ROOTCYCL: BY CRAIG WORK,3 APRIL 68
063445,000605: # ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION. THE INITIAL GUESS AT THE
063446,000606: # SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG. THE NEW APPROXI-
063447,000607: # MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER. DEBRIS: A,L,SR,SCRATCH. ROOTCYCL IS CALLED FROM
063448,000608: # LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
063449,000609:
063450,000610: # WARNING: IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
063451,000611:
063452,000612: 21,3620 55745 ROOTCYCL TS SCRATCH # STORE X
063453,000613: 21,3621 54021 TS SR # X/2 NOW IN SR
063454,000614: 21,3622 31746 CA HALFARG # ARG/2 IN THE A REG
063455,000615: 21,3623 22007 ZL # PREPARE FOR DIVISION
063456,000616: 21,3624 00006 EXTEND
063457,000617: 21,3625 11745 DV SCRATCH # (ARG/X)/2
063458,000618: 21,3626 60021 AD SR # (X + ARG/X)/2 IN THE A REG
063459,000619: 21,3627 00002 TC Q
End of include-file TRIM_GIMBAL_CONTROL_SYSTEM.agc. Parent file is MAIN.agc