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