Source Code
These source-code files derive from a printout of Luminary 210 (Apollo 15-17
Lunar Module guidance computer program), from the personal library of
original AGC developer Don Eyles, digitally photographed at archive.org,
financially sponsored by Jim Lawton, and transcribed to source code by a
team of volunteers. This colorized, syntax-highlighted form was created
by assembling that transcribed source code. Note that the full page images
are available on the
Virtual AGC project page at archive.org, while reduced-size images
are presented at the VirtualAGC project website. Report or fix any
transcription errors at
the Virtual AGC project code repository. Notations on the program listing read, in part: GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY BY NASA 2021112-161 17:11 MAR. 19,1971Note that the date is the date of the printout, not the date of the program revision. |
063862,000002: ## Copyright: Public domain.
063863,000003: ## Filename: TRIM_GIMBAL_CONTROL_SYSTEM.agc
063864,000004: ## Purpose: A section of Luminary revision 210.
063865,000005: ## It is part of the source code for the Lunar Module's (LM)
063866,000006: ## Apollo Guidance Computer (AGC) for Apollo 15-17.
063867,000007: ## This file is intended to be a faithful transcription, except
063868,000008: ## that the code format has been changed to conform to the
063869,000009: ## requirements of the yaYUL assembler rather than the
063870,000010: ## original YUL assembler.
063871,000011: ## Reference: pp. 1470-1482
063872,000012: ## Assembler: yaYUL
063873,000013: ## Contact: Ron Burkey <info@sandroid.org>.
063874,000014: ## Website: www.ibiblio.org/apollo/index.html
063875,000015: ## Mod history: 2016-11-17 JL Created from Luminary131 version.
063876,000016: ## 2016-12-26 RSB Comment-text proofed using ProoferComments
063877,000017: ## and corrected errors found.
063878,000018: ## 2021-05-30 ABS GTSGO+DN -> GTSGO+ON
063879,000019:
Page 1470 |
063881,000021: 21,3027 BANK 21
063882,000022: 21,3027 E6,1450 EBANK= QDIFF
063883,000023: 21,2000 SETLOC DAPS4
063884,000024: 21,2000 BANK
063885,000025:
063886,000026: 21,3027 COUNT* $$/DAPGT
063887,000027:
063888,000028: # CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
063889,000029: # AUTOPILOT ARE BOTH ON:
063890,000030: # A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
063891,000031: # INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
063892,000032: # B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
063893,000033: # ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
063894,000034:
063895,000035: # GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
063896,000036:
063897,000037: 21,3027 37770 GTS CAF NEGONE # MAKE THE NEXT PASS THROUGH THE DAP BE
063898,000038: 21,3030 55630 TS COTROLER # THROUGH RCS CONTROL,
063899,000039: 21,3031 34742 CAF FOUR # AND ENSURE THAT IT IS NOT A SKIP.
063900,000040: 21,3032 55534 TS SKIPU
063901,000041: 21,3033 55535 TS SKIPV
063902,000042:
063903,000043: 21,3034 34743 CAF TWO
063904,000044: 21,3035 55632 TS INGTS # SET INDICATOR OF GTS CONTROL POSITIVE.
063905,000045: 21,3036 55631 TS QGIMTIMR # SET TIMERS TO 200 MSEC TO AVOID BOTH
063906,000046: 21,3037 55633 TS RGIMTIMR # RUNAWAY AND INTERFERENCE BY NULLING.
063907,000047:
063908,000048: # THE DRIVE SETTING ALGORITHM
063909,000049:
063910,000050: # DEL = SGN(OMEGA + ALPHA*ABS(ALPHA)/(2*K))
063911,000051:
063912,000052: # 2 1/2 2 3/2
063913,000053: # NEGUSUM = ERROR*K + ALPHA*(DEL*OMEGA + ALPHA /(3*K)) + DEL*K (DEL*OMEGA + ALPHA /(2*K))
063914,000054:
063915,000055: # DRIVE = -SGN(NEGUSUM)
063916,000056:
063917,000057: 21,3040 30021 CA SR # SAVE THE SR. SHIFT IT LEFT TO CORRECT
063918,000058: 21,3041 60000 AD A # FOR THE RIGHT SHIFT DUE TO EDITING.
063919,000059: 21,3042 55505 TS SAVESR
063920,000060:
063921,000061: 21,3043 34743 GTSGO+ON CAF TWO # SET INDEXER FOR R-AXIS CALCULATIONS.
063922,000062: 21,3044 13046 TCF GOQTRIMG +1
063923,000063:
063924,000064: 21,3045 34746 GOQTRIMG CAF ZERO # SET INDEXER FOR Q-AXIS CALCULATIONS
063925,000065: 21,3046 55747 TS QRCNTR
063926,000066:
063927,000067: 21,3047 51747 INDEX QRCNTR # AOS SCALED AT PI/2
063928,000068: 21,3050 31536 CA AOSQ
063929,000069: 21,3051 00006 EXTEND
063930,000070: 21,3052 74743 MP BIT2 # RESCALE AOS TO PI/4
063931,000071:
Page 1471 |
063933,000073: 21,3053 00006 EXTEND
063934,000074: 21,3054 13060 BZF GTSQAXIS -3 # USE FULL SCALE FOR LARGER AOS ESTIMATES.
063935,000075:
063936,000076: 21,3055 50000 INDEX A
063937,000077: 21,3056 44725 CS LIMITS # LIMITS +1 CONTAINS NEGMAX.
063938,000078: 21,3057 56001 XCH L # LIMITS -1 CONTAINS POSMAX.
063939,000079:
063940,000080: 21,3060 11747 CCS QRCNTR # PICK UP RATE FOR THIS AXIS. RATE CELLS
063941,000081: 21,3061 50000 INDEX A # ARE ADJACENT, NOT SEPARATED. AT PI/4
063942,000082: 21,3062 31436 CA EDOTQ
063943,000083: 21,3063 53743 GTSQAXIS DXCH WCENTRAL
063944,000084:
063945,000085: 21,3064 51747 INDEX QRCNTR # COLLECT K FOR THIS AXIS
063946,000086: 21,3065 31504 CA KQ
063947,000087: 21,3066 55740 TS KCENTRAL
063948,000088:
063949,000089: 21,3067 00006 EXTEND # CONTROL AUTHORITY ZERO. AVOID DRIVING
063950,000090: 21,3070 13526 BZF POSDRIVE +1 # ENGINE BELL TO THE STOPS.
063951,000091:
063952,000092: 21,3071 51747 INDEX QRCNTR # QDIFF, RDIFF ARE STORED IN D.P.
063953,000093: 21,3072 31450 CAE QDIFF
063954,000094:
063955,000095: 21,3073 00006 ALGORTHM EXTEND # Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
063956,000096: 21,3074 71740 MP KCENTRAL # FORM K*ERROR AT PI(2)/2(8), IN D.P.
063957,000097: 21,3075 23736 LXCH K2THETA
063958,000098: 21,3076 00006 EXTEND
063959,000099: 21,3077 74740 MP BIT5 # RESCALE TO 4*PI(2)
063960,000100: 21,3100 53737 DXCH K2THETA
063961,000101: 21,3101 00006 EXTEND
063962,000102: 21,3102 74740 MP BIT5 # FIRST TERM OF NEGUSUM IN K2THETA.
063963,000103: 21,3103 27737 ADS K2THETA +1 # NO CARRY NEEDED D.P. AT 4*PI(2)
063964,000104:
063965,000105: 21,3104 41743 CS ACENTRAL # FORM ALPHA(2)/(2*K) AT 16*PI, IN D.P.,
063966,000106: 21,3105 00006 EXTEND # LIMITING QUOTIENT TO AVOID OVERFLOW.
063967,000107: 21,3106 74727 MP BIT14 # -ALPHA/2 IN A, SCALED AT PI/4
063968,000108: 21,3107 00006 EXTEND
063969,000109: 21,3110 71743 MP ACENTRAL # -ALPHA(2)/2 IN A,L, SCALED AT PI(2)/16
063970,000110: 21,3111 61740 AD KCENTRAL
063971,000111: 21,3112 00006 EXTEND
063972,000112: 21,3113 63130 BZMF HUGEQUOT # K-ALPHA(2)/2 SHOULD BE PNZ FO DIVISION
063973,000113:
063974,000114: 21,3114 00006 EXTEND
063975,000115: 21,3115 40001 DCS A # ALPHA(2)/2 - K
063976,000116: 21,3116 61740 AD KCENTRAL
063977,000117: 21,3117 00006 EXTEND
063978,000118: 21,3120 11740 DV KCENTRAL # HIGH ORDER OF QUOTIENT.
063979,000119: 21,3121 57745 XCH A2CNTRAL
063980,000120: 21,3122 30001 CA L # SHIFT UP THE REMAINDER.
063981,000121: 21,3123 22007 LXCH 7 # ZERO LOW-ORDER DIVIDEND.
063982,000122: 21,3124 00006 EXTEND
063983,000123:
Page 1472 |
063985,000125: 21,3125 11740 DV KCENTRAL
063986,000126: 21,3126 57746 XCH A2CNTRAL +1 # QUOTIENT STORED AT 16*PI, D.P.
063987,000127: 21,3127 13133 TCF HAVEQUOT
063988,000128:
063989,000129: 21,3130 34724 HUGEQUOT CA POSMAX
063990,000130: 21,3131 54001 TS L
063991,000131: 21,3132 53746 DXCH A2CNTRAL # LIMITED QUOTIENT STORED AT 16*PI, D.P.
063992,000132:
063993,000133: 21,3133 31742 HAVEQUOT CA WCENTRAL
063994,000134: 21,3134 00006 EXTEND
063995,000135: 21,3135 74734 MP BIT9 # RESCALE OMEGA AT 16*PI IN D.P.
063996,000136: 21,3136 53742 DXCH K2CNTRAL # LOWER WORD OVERLAYS OMEGA IN WCENTRAL
063997,000137:
063998,000138: 21,3137 00006 EXTEND
063999,000139: 21,3140 31742 DCA K2CNTRAL
064000,000140: 21,3141 53751 DXCH FUNCTION
064001,000141:
064002,000142: 21,3142 31743 CA ACENTRAL # GET ALPHA*ABS(ALPHA)/(2*K)
064003,000143: 21,3143 00006 EXTEND
064004,000144: 21,3144 63150 BZMF +4
064005,000145:
064006,000146: 21,3145 00006 EXTEND
064007,000147: 21,3146 31746 DCA A2CNTRAL
064008,000148: 21,3147 13152 TCF +3
064009,000149:
064010,000150: 21,3150 00006 EXTEND
064011,000151: 21,3151 41746 DCS A2CNTRAL
064012,000152:
064013,000153: 21,3152 21751 DAS FUNCTION # OMEGA + ALPHA*ABS(ALPHA)/2*K) AT 16*PI
064014,000154:
064015,000155: 21,3153 11750 CCS FUNCTION # DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
064016,000156: 21,3154 13160 TCF POSFNCT1 # OTHERWISE DEL = -1
064017,000157: 21,3155 13157 TCF +2
064018,000158: 21,3156 13162 TCF NEGFNCT1
064019,000159:
064020,000160: 21,3157 11751 CCS FUNCTION +1 # USE LOW ORDER WORD SINCE HIGH IS ZERO
064021,000161: 21,3160 34744 POSFNCT1 CAF BIT1
064022,000162: 21,3161 13163 TCF +2
064023,000163: 21,3162 44744 NEGFNCT1 CS BIT1
064024,000164: 21,3163 55744 TS DEL
064025,000165:
064026,000166: 21,3164 11744 CCS DEL # REPLACE OMEGA BY DEL*OMEGA
064027,000167: 21,3165 13177 TCF FUNCT2 # POSITIVE DEL VALUE. PROCEED.
064028,000168: 21,3166 13170 TCF DEFUNCT
064029,000169: 21,3167 13174 TCF NEGFNCT2
064030,000170:
064031,000171: 21,3170 55741 DEFUNCT TS K2CNTRAL
064032,000172: 21,3171 55742 TS K2CNTRAL +1
064033,000173: 21,3172 13177 TCF FUNCT2
064034,000174:
Page 1473 |
064036,000176: 21,3173 65252 NEG1/3 DEC -.33333
064037,000177:
064038,000178: 21,3174 00006 NEGFNCT2 EXTEND
064039,000179: 21,3175 41742 DCS K2CNTRAL
064040,000180: 21,3176 53742 DXCH K2CNTRAL
064041,000181:
064042,000182: 21,3177 00006 FUNCT2 EXTEND
064043,000183: 21,3200 31746 DCA A2CNTRAL
064044,000184: 21,3201 21742 DAS K2CNTRAL # DEL*OMEGA + ALPHA(2)/(2*K) AT 16*PI, D.P.
064045,000185:
064046,000186: 21,3202 31745 FUNCT3 CA A2CNTRAL
064047,000187: 21,3203 00006 EXTEND
064048,000188: 21,3204 73173 MP NEG1/3
064049,000189: 21,3205 53746 DXCH A2CNTRAL
064050,000190: 21,3206 30001 CA L
064051,000191: 21,3207 00006 EXTEND
064052,000192: 21,3210 73173 MP NEG1/3
064053,000193: 21,3211 27746 ADS A2CNTRAL +1
064054,000194: 21,3212 54001 TS L
064055,000195: 21,3213 13215 TCF +2 # A2CNTRAL NOW CONTAINS -ALPHA(2)/(6*K),
064056,000196: 21,3214 27745 ADS A2CNTRAL # SCALED AT 16*PI, IN D.P.
064057,000197:
064058,000198: 21,3215 00006 EXTEND
064059,000199: 21,3216 31742 DCA K2CNTRAL # DEL*OMEGA + ALPHA(2)/(3*K) IN A2CNTRAL,
064060,000200: 21,3217 21746 DAS A2CNTRAL # SCALED AT 16*PI, D.P.
064061,000201:
064062,000202: 21,3220 31745 CA A2CNTRAL
064063,000203: 21,3221 00006 EXTEND
064064,000204: 21,3222 71743 MP ACENTRAL
064065,000205: 21,3223 21737 DAS K2THETA
064066,000206: 21,3224 31746 CA A2CNTRAL +1
064067,000207: 21,3225 00006 EXTEND
064068,000208: 21,3226 71743 MP ACENTRAL # ACENTRAL MAY NOW BE OVERLAID.
064069,000209: 21,3227 27737 ADS K2THETA +1
064070,000210: 21,3230 54001 TS L
064071,000211: 21,3231 13233 TCF +2 # TWO TERMS OF NEGUSUM ACCUMULATED, SO FAR
064072,000212: 21,3232 27736 ADS K2THETA # SCALED AT 4*PI(2), IN D.P.
064073,000213:
064074,000214: 21,3233 31741 GETROOT CA K2CNTRAL # K*(DEL*OMEGA + ALPHA(2)/(2*K)) IS THE
064075,000215: 21,3234 00006 EXTEND # TERM FOR WHICH A SQUARE ROOT IS NEEDED.
064076,000216: 21,3235 71740 MP KCENTRAL # K AT PI/2(8)
064077,000217: 21,3236 53751 DXCH FUNCTION
064078,000218: 21,3237 31742 CA K2CNTRAL +1
064079,000219: 21,3240 00006 EXTEND
064080,000220: 21,3241 71740 MP KCENTRAL
064081,000221: 21,3242 27751 ADS FUNCTION +1
064082,000222: 21,3243 54001 TS L
064083,000223: 21,3244 13246 TCF +2
064084,000224: 21,3245 27750 ADS FUNCTION # DESIRED TERM IN FUNCTION, AT PI(2)/16
Page 1474 |
064086,000226: 21,3246 11744 CCS DEL
064087,000227: 21,3247 13454 TCF RSTOFGTS
064088,000228: 21,3250 13516 TCF NEGUSUM
064089,000229: 21,3251 13253 TCF NEGATE
064090,000230: 21,3252 13516 TCF NEGUSUM
064091,000231:
064092,000232: 21,3253 00006 NEGATE EXTEND
064093,000233: 21,3254 41742 DCS K2CNTRAL
064094,000234: 21,3255 53742 DXCH K2CNTRAL
064095,000235: 21,3256 13454 TCF RSTOFGTS
064096,000236:
064097,000237: 16,3736 BANK 16
064098,000238: 16,3736 E6,1501 EBANK= NEGUQ
064099,000239: 16,2000 SETLOC DAPS1
064100,000240: 16,2000 BANK
064101,000241:
064102,000242: # THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
064103,000243: # THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES. ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
064104,000244:
064105,000245: # WARNING: ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
064106,000246:
064107,000247: 16,3736 07400 BGIM OCTAL 07400
064108,000248: 16,3737 0066 CHNL12 EQUALS ITEMP6
064109,000249: 16,3737 41501 ACDT+C12 CS NEGUQ
064110,000250: 16,3740 00006 EXTEND # GIMBAL DRIVE REQUESTS.
064111,000251: 16,3741 71507 MP ACCDOTQ
064112,000252: 16,3742 23510 LXCH QACCDOT
064113,000253: 16,3743 41503 CS NEGUR
064114,000254: 16,3744 00006 EXTEND
064115,000255: 16,3745 71511 MP ACCDOTR
064116,000256: 16,3746 23512 LXCH RACCDOT
064117,000257:
064118,000258: 16,3747 11501 CCS NEGUQ
064119,000259: 16,3750 34733 CAF BIT10
064120,000260: 16,3751 13753 TCF +2
064121,000261: 16,3752 34734 CAF BIT9
064122,000262: 16,3753 54066 TS CHNL12
064123,000263:
064124,000264: 16,3754 11503 CCS NEGUR
064125,000265: 16,3755 34731 CAF BIT12
064126,000266: 16,3756 13760 TCF +2
064127,000267: 16,3757 34732 CAF BIT11
064128,000268: 16,3760 26066 ADS CHNL12 # (STORED RESULT NOT USED AT PRESENT)
064129,000269:
064130,000270: 16,3761 43736 CS BGIM
064131,000271: 16,3762 00006 EXTEND
064132,000272: 16,3763 02012 RAND CHAN12
064133,000273: 16,3764 60066 AD CHNL12
064134,000274: 16,3765 00006 EXTEND
064135,000275: 16,3766 01012 WRITE CHAN12
064136,000276:
Page 1475 |
064138,000278: 16,3767 44740 CS CALLGMBL # TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
064139,000279: 16,3770 71774 MASK RCSFLAGS
064140,000280: 16,3771 55774 TS RCSFLAGS
064141,000281:
064142,000282: 16,3772 00002 TC Q # RETURN TO CALLER.
064143,000283:
064144,000284: 21,3257 BANK 21
064145,000285: 21,3257 E6,1450 EBANK= QDIFF
064146,000286: 21,2000 SETLOC DAPS4
064147,000287: 21,2000 BANK
064148,000288:
Page 1476 |
064150,000290: # SUBROUTINE TIMEGMBL: MOD 0, OCTOBER 1967, CRAIG WORK
064151,000291:
064152,000292: # TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
064153,000293: # THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS. INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
064154,000294: # SCALED AT PI/8. FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT). A ZERO
064155,000295: # ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY. OTHERWISE, THE GIMBAL IS TURNED ON
064156,000296: # DRIVING IN THE CORRECT DIRECTION. THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
064157,000297: # IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE. NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
064158,000298: # WHICH IS NEGATIVE, ZERO, OR POSITIVE.
064159,000299:
064160,000300: # INPUTS: AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7). PI/2(7).
064161,000301:
064162,000302: # OUTPUTS: NEW GIMBAL DRIVE BITS IN CHANNEL 12,NEGUQ,NEGUR,QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
064163,000303: # Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
064164,000304:
064165,000305: # DEBRIS: A,L,Q, ITEMPS 2,3,6, RUPTREG2 AND ACDT+C12 DEBRIS.
064166,000306:
064167,000307: # EXITS: VIA TC Q.
064168,000308:
064169,000309: # ALARMS, ABORTS, : NONE
064170,000310:
064171,000311: # SUBROUTINES: ACDT+C12, IBNKCALL
064172,000312:
064173,000313: # WARNING: THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS. THEREFORE IT MAY ONLY BE CALLED WITH
064174,000314: # INTERRUPT INHIBITED.
064175,000315:
064176,000316: # ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
064177,000317:
064178,000318: # NEGUQ ERASE +2 NEGATIVE OF Q-AXIS GIMBAL DRIVE
064179,000319: # (SPWORD) EQUALS NEGUQ +1 ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
064180,000320: # NEGUR EQUALS NEGUQ +2 NEGATIVE OF R-AXIS GIMBAL DRIVE
064181,000321:
064182,000322: # ACCDOTQ ERASE +2 Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
064183,000323: # (SPWORD) EQUALS ACCDOTQ +1 ANY S.P. ERASABLE NUMBER NOW QACCDOT
064184,000324: # ACCDOTR EQUALS ACCDOTQ +2 R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
064185,000325: # ACCDOTQ,ACCDOTR ARE MAGNITUDES.
064186,000326: # AOSQ ERASE +4 Q-AXIS ACC.,D.P. AT PI/2 R/SEC(2)
064187,000327: # AOSR EQUALS AOSQ +2 R-AXIS ACCELERATION SCALED AT PI/2 R/S2
064188,000328:
064189,000329: 21,3257 0066 QRNDXER EQUALS ITEMP6
064190,000330: 21,3257 23146 OCT23146 OCTAL 23146 # DECIMAL .6
064191,000331: 21,3260 0063 NZACCDOT EQUALS ITEMP3
064192,000332:
064193,000333: 21,3260 34744 TIMEGMBL CAF ONE # INITIALIZE ALLOWGTS.
064194,000334: 21,3261 55502 TS ALLOWGTS
064195,000335:
064196,000336: 21,3262 34743 CAF TWO # SET UP LOOP FOR R AXIS.
064197,000337: 21,3263 22002 LXCH Q # SAVE RETURN ADDRESS.
064198,000338: 21,3264 22071 LXCH RUPTREG2
064199,000339:
Page 1477 |
064201,000341: 21,3265 13267 TCF +2
064202,000342: 21,3266 34746 TIMQGMBL CAF ZERO # NOW DO THE Q-AXIS
064203,000343: 21,3267 54066 TS QRNDXER
064204,000344: 21,3270 50066 INDEX QRNDXER
064205,000345: 21,3271 31507 CA ACCDOTQ # ACCDOT IS PRESUMED TO BE AT PI/2(7).
064206,000346: 21,3272 00006 EXTEND
064207,000347: 21,3273 63343 BZMF TGOFFNOW # IS ACCDOT LESS THAN OR EQUAL TO 0?
064208,000348: 21,3274 54063 TS NZACCDOT # NO. STORE NON-ZERO, POSITIVE ACCDOT.
064209,000349:
064210,000350: 21,3275 50066 ALPHATRY INDEX QRNDXER
064211,000351: 21,3276 41536 CS AOSQ
064212,000352: 21,3277 00006 EXTEND
064213,000353: 21,3300 13343 BZF TGOFFNOW # IS ALPHA ZERO?
064214,000354:
064215,000355: 21,3301 54002 TS Q # SAVE A COPY OF -AOS.
064216,000356: 21,3302 00006 EXTEND # NO. RESCALE FOR TIMEGMBL USE.
064217,000357: 21,3303 73257 MP OCT23146 # OCTAL 23146 IS DECIMAL .6
064218,000358: 21,3304 60002 AD Q # -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
064219,000359: 21,3305 54001 TS L # WAS THERE OVERFLOW?
064220,000360: 21,3306 13313 TCF SETNEGU # NO. COMPUTE DRIVE TIME.
064221,000361:
064222,000362: 21,3307 40000 CS A # RECOVER -SGN(AOS) IN THE A REGISTER.
064223,000363: 21,3310 50066 INDEX QRNDXER # YES. START DRIVE WITHOUT WAITLIST.
064224,000364: 21,3311 57501 XCH NEGUQ
064225,000365: 21,3312 13347 TCF NOTALLOW # KNOCK DOWN THE ALLOWGTS FLAG.
064226,000366:
064227,000367: 21,3313 00006 SETNEGU EXTEND
064228,000368: 21,3314 63321 BZMF POSALPH
064229,000369:
064230,000370: 21,3315 40000 COM
064231,000371: 21,3316 54062 TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
064232,000372: 21,3317 44744 CS BIT1
064233,000373: 21,3320 13323 TCF POSALPH +2
064234,000374: 21,3321 54062 POSALPH TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
064235,000375: 21,3322 34744 CA BIT1
064236,000376: 21,3323 50066 +2 INDEX QRNDXER # SGN(AOS) INTO NEGU
064237,000377: 21,3324 55501 TS NEGUQ # STORE SGN(APLHA) AS NEGU
064238,000378:
064239,000379: 21,3325 30063 CA NZACCDOT
064240,000380: 21,3326 00006 EXTEND
064241,000381: 21,3327 74731 MP BIT12 # 2*ACCDOT, SCALED AT PI/8.
064242,000382: 21,3330 60062 AD ITEMP2 # -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
064243,000383: 21,3331 00006 EXTEND
064244,000384: 21,3332 63347 BZMF NOTALLOW # IS DRIVE TIME MORE THAN TWO SECONDS?
064245,000385: 21,3333 40062 CS ITEMP2 # NO. COMPUTE DRIVE TIME.
064246,000386: 21,3334 00006 EXTEND # ABS(ALPHA) AT PI/8.
064247,000387: 21,3335 73370 MP OCT00240 # DECIMAL 10/1024
064248,000388: 21,3336 00006 EXTEND # QUOTIENT IS DRIVE TIME AT WAITLIST.
064249,000389: 21,3337 10063 DV NZACCDOT # ABS(ALPHA)/ACCDOT AT 2(14)/100
064250,000390:
Page 1478 |
064252,000392: 21,3340 00006 EXTEND
064253,000393: 21,3341 13343 BZF TGOFFNOW # DRIVE TIME MUST BE GREATER THAN ZERO.
064254,000394:
064255,000395: 21,3342 13355 TCF DRIVEON
064256,000396:
064257,000397: 21,3343 34746 TGOFFNOW CAF ZERO # TURN OFF GIMBAL NOW.
064258,000398: 21,3344 50066 INDEX QRNDXER
064259,000399: 21,3345 55501 TS NEGUQ
064260,000400:
064261,000401: 21,3346 13357 TCF DONEYET
064262,000402:
064263,000403: 21,3347 36010 NOTALLOW CAF OCT31
064264,000404: 21,3350 50066 INDEX QRNDXER
064265,000405: 21,3351 55631 TS QGIMTIMR
064266,000406: 21,3352 34746 CAF ZERO # DRIVE TIME IS MORE THAN 2 SECONDS, SO
064267,000407: 21,3353 55502 TS ALLOWGTS # DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
064268,000408: # CONTROL UNTIL AOSTASK APPROVES.
064269,000409: 21,3354 13357 TCF DONEYET # NO WAITLIST CALL IS MADE.
064270,000410:
064271,000411: 21,3355 50066 DRIVEON INDEX QRNDXER
064272,000412: 21,3356 55631 TS QGIMTIMR # CHOOSE Q OR R AXIS.
064273,000413:
064274,000414: 21,3357 10066 DONEYET CCS QRNDXER
064275,000415: 21,3360 13266 TCF TIMQGMBL
064276,000416:
064277,000417: 21,3361 52073 DXCH RUPTREG3 # PROTECT IBNKCALL ERASABLES. ACDT+C12
064278,000418: 21,3362 52063 DXCH ITEMP2 # LEAVES ITEMPS2,3 ALONE.
064279,000419:
064280,000420: 21,3363 04665 TC IBNKCALL # TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
064281,000421: 21,3364 35737 CADR ACDT+C12
064282,000422:
064283,000423: 21,3365 52063 DXCH ITEMP2 # RESTORE ERASABLES FOR IBNKCALL.
064284,000424: 21,3366 52073 DXCH RUPTREG3
064285,000425:
064286,000426: 21,3367 00071 TC RUPTREG2 # RETURN TO CALLER.
064287,000427:
064288,000428: 21,3370 00240 OCT00240 OCTAL 00240 # DECIMAL 10/1024
064289,000429:
Page 1479 |
064291,000431: # THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY. THE QUANTITY NEGUSUM
064292,000432: # IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM. NEW DRIVES ARE ENTERED TO CH 12.
064293,000433:
064294,000434: # THE SUBROUTINE GTSQRT ACCEPTS A DOUBLE PRECISION VALUE IN FUNCTION, FUNCTION +1 AND RETURNS A SINGLE-PRECISION
064295,000435: # SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF THE ARGUMENT. ALSO, THE CELL SHFTFLAG CONTAINS A BINARY
064296,000436: # EXPONENT S, SUCH THAT THE SQUARE ROOT (RETURNED IN THE A REGISTER) MUST BE SHIFTED RIGHT (MULTIPLIED BY 2 TO THE
064297,000437: # POWER (-S)) IN ORDER TO BE THE TRUE SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF FUNCTION, FUNCTION +1.
064298,000438: # SQUARE ROOT ERROR IS NOT MORE THAN 2 IN THE 14TH SIGNIFICANT BIT. CELLS CLOBBERED ARE A,L,SHFTFLAG,ININDEX,
064299,000439: # HALFARG,SCRATCH,SR,FUNCTION, FUNCTION +1. GTSQRT IS CALLED BY TC GTSQRT AND RETURNS VIA TC Q OR TC FUNCTION +1.
064300,000440: # ZERO OR NEGATIVE ARGUMENTS YIELD ZERO FOR SQUARE ROOTS.
064301,000441:
064302,000442: 21,3371 11750 GTSQRT CCS FUNCTION
064303,000443: 21,3372 13410 TCF GOODARG # FUNCTION IS POSITIVE. TAKE SQUARE ROOT.
064304,000444: 21,3373 13375 TCF +2 # HIGH ORDER WORD IS ZERO. TRY THE LOWER.
064305,000445: 21,3374 13401 TCF ZEROOT # NEGATIVE. USE ZERO FOR 1/2 POWER.
064306,000446:
064307,000447: 21,3375 31751 CA FUNCTION +1
064308,000448: 21,3376 00006 EXTEND
064309,000449: 21,3377 63401 BZMF ZEROOT
064310,000450:
064311,000451: 21,3400 13404 TCF ZEROHIGH # PROCEED.
064312,000452: 21,3401 34746 ZEROOT CA ZERO
064313,000453: 21,3402 55740 TS SHFTFLAG
064314,000454: 21,3403 00002 TC Q
064315,000455:
064316,000456: 21,3404 57750 ZEROHIGH XCH FUNCTION # 14 MOST SIGNIFICANT BITS ARE IN THE
064317,000457: 21,3405 57751 XCH FUNCTION +1 # LOWER WORD. EXCHANGE THEM.
064318,000458: 21,3406 34750 CA SEVEN
064319,000459: 21,3407 13411 TCF GOODARG +1
064320,000460:
064321,000461: 21,3410 34746 GOODARG CA ZERO
064322,000462: 21,3411 55740 TS SHFTFLAG
064323,000463: 21,3412 35745 CA TWELVE # INITIALIZE THE SCALING LOOP.
064324,000464: 21,3413 55743 TS ININDEX
064325,000465: 21,3414 13423 TCF SCALLOOP
064326,000466:
064327,000467: 21,3415 31750 SCALSTRT CA FUNCTION
064328,000468: 21,3416 13437 TCF SCALDONE
064329,000469:
064330,000470: 21,3417 37767 MULBUSH CA NEG2 # IF ARG IS NOT LESS THAN 1/4, INDEX IS
064331,000471: 21,3420 27743 ADS ININDEX # ZERO, INDICATING NO SHIFT NEEDED.
064332,000472: 21,3421 00006 EXTEND # BRANCH IF ARG IS NOT LESS THAN 1/4.
064333,000473: 21,3422 63415 BZMF SCALSTRT # OTHERWISE COMPARE ARG WITH A REFERENCE
064334,000474: # WHICH IS 4 TIMES LARGER THAN THE LAST.
064335,000475: 21,3423 41750 SCALLOOP CS FUNCTION
064336,000476: 21,3424 51743 INDEX ININDEX
064337,000477: 21,3425 64726 AD BIT15 # REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
064338,000478: 21,3426 00006 EXTEND
064339,000479: 21,3427 63417 BZMF MULBUSH # IF ARG IS NOT LESS THAN REFERENCE, GO
064340,000480: # AROUND THE MULBERRY BUSH ONCE MORE.
064341,000481:
Page 1480 |
064343,000483: 21,3430 51743 INDEX ININDEX
064344,000484: 21,3431 34726 CA BIT15 # THIS IS THE SCALE MAGNITUDE
064345,000485: 21,3432 57746 XCH HALFARG # 2**(-ININDEX) IS THE SHIFT DIVISOR.
064346,000486: 21,3433 00006 EXTEND # RESCALE ARGUMENT.
064347,000487: 21,3434 31751 DCA FUNCTION
064348,000488: 21,3435 00006 EXTEND
064349,000489: 21,3436 11746 DV HALFARG
064350,000490: # ININDEX AND SHFTFLAG PRESERVE INFO FOR
064351,000491:
064352,000492: # RESCALING AFTER ROOT PROCESS.
064353,000493: 21,3437 00006 SCALDONE EXTEND
064354,000494: 21,3440 23751 QXCH FUNCTION +1 # SAVE Q FOR RETURN
064355,000495: 21,3441 00006 EXTEND
064356,000496: 21,3442 74727 MP BIT14
064357,000497: 21,3443 55746 TS HALFARG
064358,000498: 21,3444 74730 MASK BIT13
064359,000499: 21,3445 10000 CCS A
064360,000500: 21,3446 33564 CA OCT11276
064361,000501: 21,3447 63562 AD ROOTHALF # INITIAL GUESS IS ROOT 1/2 OR POSMAX
064362,000502:
064363,000503: 21,3450 03566 TC ROOTCYCL
064364,000504: 21,3451 03566 TC ROOTCYCL
064365,000505: 21,3452 03566 TC ROOTCYCL
064366,000506:
064367,000507: 21,3453 01751 TC FUNCTION +1
064368,000508:
064369,000509: # ****************************************************************************************************************
064370,000510:
064371,000511:
064372,000512: 21,3454 03371 RSTOFGTS TC GTSQRT
064373,000513: 21,3455 57741 PRODUCT XCH K2CNTRAL
064374,000514: 21,3456 00006 EXTEND
064375,000515: 21,3457 71741 MP K2CNTRAL
064376,000516: 21,3460 53742 DXCH K2CNTRAL
064377,000517: 21,3461 00006 EXTEND # THE PRODUCT OF
064378,000518: 21,3462 70001 MP L # 1/2 2 1/2
064379,000519: 21,3463 27742 ADS K2CNTRAL +1 # K *(DEL*OMEGA + ALPHA /(2*K))
064380,000520: 21,3464 54001 TS L # AND
064381,000521: 21,3465 13467 TCF +2 # 2
064382,000522: 21,3466 27741 ADS K2CNTRAL # DEL*(DEL*OMEGA + ALPHA /(2*K)) NOW IN
064383,000523: # K2CNTRAL
064384,000524:
064385,000525: 21,3467 31743 DOSHIFT CA ININDEX
064386,000526: 21,3470 00006 EXTEND # MULTIPLY IN THE FACTOR 2(-S), RETURNED
064387,000527: 21,3471 74727 MP BIT14 # BY THE GTSQRT SUBROUTINE
064388,000528: 21,3472 27740 ADS SHFTFLAG
064389,000529: 21,3473 00006 EXTEND
064390,000530: 21,3474 13513 BZF ADDITIN
064391,000531: 21,3475 51740 INDEX SHFTFLAG
064392,000532: 21,3476 34726 CA BIT15
064393,000533:
Page 1481 |
064395,000535: 21,3477 57741 XCH K2CNTRAL
064396,000536: 21,3500 00006 EXTEND
064397,000537: 21,3501 71741 MP K2CNTRAL
064398,000538: 21,3502 21737 DAS K2THETA
064399,000539: 21,3503 57741 XCH K2CNTRAL
064400,000540: 21,3504 00006 EXTEND
064401,000541: 21,3505 71742 MP K2CNTRAL +1
064402,000542: 21,3506 27737 ADS K2THETA +1
064403,000543: 21,3507 54001 TS L
064404,000544: 21,3510 13512 TCF +2
064405,000545: 21,3511 27736 ADS K2THETA
064406,000546:
064407,000547: 21,3512 13516 TCF NEGUSUM
064408,000548:
064409,000549: 21,3513 00006 ADDITIN EXTEND
064410,000550: 21,3514 31742 DCA K2CNTRAL
064411,000551: 21,3515 21737 DAS K2THETA # NOW ADD IN THE K2THETA TERM.
064412,000552: 21,3516 11736 NEGUSUM CCS K2THETA # TEST SIGN OF HIGH ORDER PART.
064413,000553: 21,3517 13523 TCF NEGDRIVE
064414,000554: 21,3520 13522 TCF +2
064415,000555: 21,3521 13525 TCF POSDRIVE
064416,000556:
064417,000557: 21,3522 11737 CCS K2THETA +1 # SIGN TEST FOR LOW ORDER PART.
064418,000558: 21,3523 34744 NEGDRIVE CA BIT1
064419,000559: 21,3524 13526 TCF +2 # STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
064420,000560: 21,3525 44744 POSDRIVE CS BIT1
064421,000561: 21,3526 54001 TS L # SAVE FOR DRIVE REVERSAL TEST.
064422,000562: 21,3527 51747 INDEX QRCNTR
064423,000563: 21,3530 57501 XCH NEGUQ
064424,000564:
064425,000565: 21,3531 00006 EXTEND
064426,000566: 21,3532 70001 MP L # MULTIPLY OLD NEGU AND NEW NEGU.
064427,000567: 21,3533 10001 CCS L
064428,000568: 21,3534 13551 TCF LOUPE # NON-ZERO GIMBAL DRIVE BEING CONTINUED.
064429,000569:
064430,000570: 21,3535 13546 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
064431,000571:
064432,000572: 21,3536 13540 TCF REVERSAL # NON-ZERO GIMBAL DRIVE BEING REVERSED.
064433,000573: 21,3537 13546 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
064434,000574:
064435,000575: 21,3540 51747 REVERSAL INDEX QRCNTR # A ZERO-DRIVE PAUSE IS NEEDED HERE. ZERO
064436,000576: 21,3541 55510 TS QACCDOT # IS IN A REGISTER FROM CCS ON (-1).
064437,000577: 21,3542 51747 INDEX QRCNTR
064438,000578: 21,3543 43563 CS GMBLBITA
064439,000579: 21,3544 00006 EXTEND
064440,000580: 21,3545 03012 WAND CHAN12
064441,000581:
064442,000582: 21,3546 41774 ZEROLOUP CS RCSFLAGS # SET UP REQUEST FOR ACDT+C12 CALL.
064443,000583: 21,3547 74740 MASK CALLGMBL
064444,000584: 21,3550 27774 ADS RCSFLAGS
064445,000585:
Page 1482 |
064447,000587: 21,3551 11747 LOUPE CCS QRCNTR # HAVE BOTH AXES BEEN PROCESSED?
064448,000588: 21,3552 13045 TCF GOQTRIMG # NO. DO Q AXIS NEXT.
064449,000589:
064450,000590: 21,3553 31505 CA SAVESR # RESTORE THE SR
064451,000591: 21,3554 54021 TS SR
064452,000592:
064453,000593: 21,3555 00006 GOCLOSE EXTEND # TERMINATE THE JASK.
064454,000594: 21,3556 33561 DCA CLOSEADR
064455,000595: 21,3557 52006 DTCB
064456,000596:
064457,000597: 21,3560 E6,1536 EBANK= AOSQ
064458,000598: 21,3560 03270 36106 CLOSEADR 2CADR CLOSEOUT # TERMINATE THE JASK.
064459,000599:
064460,000600: 21,3562 5745 TWELVE EQUALS OCT14
064461,000601: 21,3562 26501 ROOTHALF OCTAL 26501 # SQUARE ROOT OF 1/2
064462,000602: 21,3563 01400 GMBLBITA OCTAL 01400 # INDEXED WRT GMBLBITB DO NOT MOVE******
064463,000603: 21,3564 11276 OCT11276 OCTAL 11276 # POSMAX - ROOTHALF
064464,000604: 21,3565 06000 GMBLBITB OCTAL 06000 # INDEXED WRT GMBLBITA DO NOT MOVE******
064465,000605:
064466,000606: # SUBROUTINE ROOTCYCL: BY CRAIG WORK,3 APRIL 68
064467,000607: # ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION. THE INITIAL GUESS AT THE
064468,000608: # SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG. THE NEW APPROXI-
064469,000609: # MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER. DEBRIS: A,L,SR,SCRATCH. ROOTCYCL IS CALLED FROM
064470,000610: # LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
064471,000611:
064472,000612: # WARNING: IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
064473,000613:
064474,000614: 21,3566 55745 ROOTCYCL TS SCRATCH # STORE X
064475,000615: 21,3567 54021 TS SR # X/2 NOW IN SR
064476,000616: 21,3570 31746 CA HALFARG # ARG/2 IN THE A REG
064477,000617: 21,3571 22007 ZL # PREPARE FOR DIVISION
064478,000618: 21,3572 00006 EXTEND
064479,000619: 21,3573 11745 DV SCRATCH # (ARG/X)/2
064480,000620: 21,3574 60021 AD SR # (X + ARG/X)/2 IN THE A REG
064481,000621: 21,3575 00002 TC Q
End of include-file TRIM_GIMBAL_CONTROL_SYSTEM.agc. Parent file is MAIN.agc