Source Code
These source-code files are part of a reconstructed copy of LM131 revision 1,
the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer
(AGC) software.
The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 listing. 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. |
062026,000002: ## Copyright: Public domain.
062027,000003: ## Filename: TRIM_GIMBAL_CONTROL_SYSTEM.agc
062028,000004: ## Purpose: A section of LM131 revision 1.
062029,000005: ## It is part of the reconstructed source code for the final
062030,000006: ## release of the flight software for the Lunar Module's (LM)
062031,000007: ## Apollo Guidance Computer (AGC) for Apollo 13. The code has
062032,000008: ## been reconstructed from a listing of Luminary 131 and a dump
062033,000009: ## of a core rope memory module B5, part number 2010802-171,
062034,000010: ## which is the only module different between LM131 revision 1
062035,000011: ## and Luminary 131. The executable generated from this source
062036,000012: ## has been verified against the module dump, so while the names,
062037,000013: ## comments, and ordering may not be exactly correct, the
062038,000014: ## resulting binary is.
062039,000015: ## Reference: pp. 1464-1476
062040,000016: ## Assembler: yaYUL
062041,000017: ## Contact: Ron Burkey <info@sandroid.org>.
062042,000018: ## Website: www.ibiblio.org/apollo/index.html
062043,000019: ## Mod history: 2022-10-28 MAS Created from Luminary 131.
062044,000020:
Page 1464 |
062046,000022: 21,3076 BANK 21
062047,000023: 21,3076 E6,1450 EBANK= QDIFF
062048,000024: 21,2000 SETLOC DAPS4
062049,000025: 21,2000 BANK
062050,000026:
062051,000027: 21,3076 COUNT* $$/DAPGT
062052,000028:
062053,000029: # CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
062054,000030: # AUTOPILOT ARE BOTH ON:
062055,000031: # A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
062056,000032: # INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
062057,000033: # B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
062058,000034: # ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
062059,000035: # GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
062060,000036:
062061,000037: 21,3076 37752 GTS CAF NEGONE # MAKE THE NEXT PASS THROUGH THE DAP BE
062062,000038: 21,3077 55630 TS COTROLER # THROUGH RCS CONTROL,
062063,000039: 21,3100 34751 CAF FOUR # AND ENSURE THAT IT IS NOT A SKIP.
062064,000040: 21,3101 55534 TS SKIPU
062065,000041: 21,3102 55535 TS SKIPV
062066,000042:
062067,000043: 21,3103 34752 CAF TWO
062068,000044: 21,3104 55632 TS INGTS # SET INDICATOR OF GTS CONTROL POSITIVE.
062069,000045: 21,3105 55631 TS QGIMTIMR # SET TIMERS TO 200 MSEC TO AVOID BOTH
062070,000046: 21,3106 55633 TS RGIMTIMR # RUNAWAY AND INTERFERENCE BY NULLING.
062071,000047:
062072,000048: # THE DRIVE SETTING ALGORITHM
062073,000049: # DEL = SGN(OMEGA + ALPHA*ABS(ALPHA)/(2*K))
062074,000050: # 2 1/2 2 3/2
062075,000051: # NEGUSUM = ERROR*K + ALPHA*(DEL*OMEGA + ALPHA /(3*K)) + DEL*K (DEL*OMEGA + ALPHA /(2*K))
062076,000052: # DRIVE = -SGN(NEGUSUM)
062077,000053:
062078,000054: 21,3107 30021 CA SR # SAVE THE SR. SHIFT IT LEFT TO CORRECT
062079,000055: 21,3110 60000 AD A # FOR THE RIGHT SHIFT DUE TO EDITING.
062080,000056: 21,3111 55505 TS SAVESR
062081,000057:
062082,000058: 21,3112 34752 GTSGO+ON CAF TWO # SET INDEXER FOR R-AXIS CALCULATIONS.
062083,000059: 21,3113 13115 TCF GOQTRIMG +1
062084,000060:
062085,000061: 21,3114 34755 GOQTRIMG CAF ZERO # SET INDEXER FOR Q-AXIS CALCULATIONS
062086,000062: 21,3115 55747 TS QRCNTR
062087,000063:
062088,000064: 21,3116 51747 INDEX QRCNTR # AOS SCALED AT PI/2
062089,000065: 21,3117 31536 CA AOSQ
062090,000066: 21,3120 00006 EXTEND
062091,000067: 21,3121 74752 MP BIT2 # RESCALE AOS TO PI/4
Page 1465 |
062093,000069: 21,3122 00006 EXTEND
062094,000070: 21,3123 13127 BZF GTSQAXIS -3 # USE FULL SCALE FOR LARGER AOS ESTIMATES.
062095,000071:
062096,000072: 21,3124 50000 INDEX A
062097,000073: 21,3125 44734 CS LIMITS # LIMITS +1 CONTAINS NEGMAX.
062098,000074: 21,3126 56001 XCH L # LIMITS -1 CONTAINS POSMAX.
062099,000075:
062100,000076: 21,3127 11747 CCS QRCNTR # PICK UP RATE FOR THIS AXIS. RATE CELLS
062101,000077: 21,3130 50000 INDEX A # ARE ADJACENT, NOT SEPARATED. AT PI/4
062102,000078: 21,3131 31436 CA EDOTQ
062103,000079: 21,3132 53743 GTSQAXIS DXCH WCENTRAL
062104,000080:
062105,000081: 21,3133 51747 INDEX QRCNTR # COLLECT K FOR THIS AXIS
062106,000082: 21,3134 31504 CA KQ
062107,000083: 21,3135 55740 TS KCENTRAL
062108,000084:
062109,000085: 21,3136 00006 EXTEND # CONTROL AUTHORITY ZERO. AVOID DRIVING
062110,000086: 21,3137 13575 BZF POSDRIVE +1 # ENGINE BELL TO THE STOPS.
062111,000087:
062112,000088: 21,3140 51747 INDEX QRCNTR # QDIFF, RDIFF ARE STORED IN D.P.
062113,000089: 21,3141 31450 CAE QDIFF
062114,000090:
062115,000091: 21,3142 00006 ALGORTHM EXTEND # Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
062116,000092: 21,3143 71740 MP KCENTRAL # FORM K*ERROR AT PI(2)/2(8), IN D.P.
062117,000093: 21,3144 23736 LXCH K2THETA
062118,000094: 21,3145 00006 EXTEND
062119,000095: 21,3146 74747 MP BIT5 # RESCALE TO 4*PI(2)
062120,000096: 21,3147 53737 DXCH K2THETA
062121,000097: 21,3150 00006 EXTEND
062122,000098: 21,3151 74747 MP BIT5 # FIRST TERM OF NEGUSUM IN K2THETA.
062123,000099: 21,3152 27737 ADS K2THETA +1 # NO CARRY NEEDED D.P. AT 4*PI(2)
062124,000100:
062125,000101: 21,3153 41743 CS ACENTRAL # FORM ALPHA(2)/(2*K) AT 16*PI, IN D.P.,
062126,000102: 21,3154 00006 EXTEND # LIMITING QUOTIENT TO AVOID OVERFLOW.
062127,000103: 21,3155 74736 MP BIT14 # -ALPHA/2 IN A, SCALED AT PI/4
062128,000104: 21,3156 00006 EXTEND
062129,000105: 21,3157 71743 MP ACENTRAL # -ALPHA(2)/2 IN A,L, SCALED AT PI(2)/16
062130,000106: 21,3160 61740 AD KCENTRAL
062131,000107: 21,3161 00006 EXTEND
062132,000108: 21,3162 63177 BZMF HUGEQUOT # K-ALPHA(2)/2 SHOULD BE PNZ FO DIVISION
062133,000109:
062134,000110: 21,3163 00006 EXTEND
062135,000111: 21,3164 40001 DCS A # ALPHA(2)/2 - K
062136,000112: 21,3165 61740 AD KCENTRAL
062137,000113: 21,3166 00006 EXTEND
062138,000114: 21,3167 11740 DV KCENTRAL # HIGH ORDER OF QUOTIENT.
062139,000115: 21,3170 57745 XCH A2CNTRAL
062140,000116: 21,3171 30001 CA L # SHIFT UP THE REMAINDER.
062141,000117: 21,3172 22007 LXCH 7 # ZERO LOW-ORDER DIVIDEND.
062142,000118: 21,3173 00006 EXTEND
Page 1466 |
062144,000120: 21,3174 11740 DV KCENTRAL
062145,000121: 21,3175 57746 XCH A2CNTRAL +1 # QUOTIENT STORED AT 16*PI, D.P.
062146,000122: 21,3176 13202 TCF HAVEQUOT
062147,000123:
062148,000124: 21,3177 34733 HUGEQUOT CA POSMAX
062149,000125: 21,3200 54001 TS L
062150,000126: 21,3201 53746 DXCH A2CNTRAL # LIMITED QUOTIENT STORED AT 16*PI, D.P.
062151,000127:
062152,000128: 21,3202 31742 HAVEQUOT CA WCENTRAL
062153,000129: 21,3203 00006 EXTEND
062154,000130: 21,3204 74743 MP BIT9 # RESCALE OMEGA AT 16*PI IN D.P.
062155,000131: 21,3205 53742 DXCH K2CNTRAL # LOWER WORD OVERLAYS OMEGA IN WCENTRAL
062156,000132:
062157,000133: 21,3206 00006 EXTEND
062158,000134: 21,3207 31742 DCA K2CNTRAL
062159,000135: 21,3210 53751 DXCH FUNCTION
062160,000136:
062161,000137: 21,3211 31743 CA ACENTRAL # GET ALPHA*ABS(ALPHA)/(2*K)
062162,000138: 21,3212 00006 EXTEND
062163,000139: 21,3213 63217 BZMF +4
062164,000140:
062165,000141: 21,3214 00006 EXTEND
062166,000142: 21,3215 31746 DCA A2CNTRAL
062167,000143: 21,3216 13221 TCF +3
062168,000144:
062169,000145: 21,3217 00006 EXTEND
062170,000146: 21,3220 41746 DCS A2CNTRAL
062171,000147:
062172,000148: 21,3221 21751 DAS FUNCTION # OMEGA + ALPHA*ABS(ALPHA)/2*K) AT 16*PI
062173,000149:
062174,000150: 21,3222 11750 CCS FUNCTION # DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
062175,000151: 21,3223 13227 TCF POSFNCT1 # OTHERWISE DEL = -1
062176,000152: 21,3224 13226 TCF +2
062177,000153: 21,3225 13231 TCF NEGFNCT1
062178,000154:
062179,000155: 21,3226 11751 CCS FUNCTION +1 # USE LOW ORDER WORD SINCE HIGH IS ZERO
062180,000156: 21,3227 34753 POSFNCT1 CAF BIT1
062181,000157: 21,3230 13232 TCF +2
062182,000158: 21,3231 44753 NEGFNCT1 CS BIT1
062183,000159: 21,3232 55744 TS DEL
062184,000160:
062185,000161: 21,3233 11744 CCS DEL # REPLACE OMEGA BY DEL*OMEGA
062186,000162: 21,3234 13246 TCF FUNCT2 # POSITIVE DEL VALUE. PROCEED.
062187,000163: 21,3235 13237 TCF DEFUNCT
062188,000164: 21,3236 13243 TCF NEGFNCT2
062189,000165:
062190,000166: 21,3237 55741 DEFUNCT TS K2CNTRAL
062191,000167: 21,3240 55742 TS K2CNTRAL +1
062192,000168: 21,3241 13246 TCF FUNCT2
062193,000169:
Page 1467 |
062195,000171: 21,3242 65252 NEG1/3 DEC -.33333
062196,000172:
062197,000173: 21,3243 00006 NEGFNCT2 EXTEND
062198,000174: 21,3244 41742 DCS K2CNTRAL
062199,000175: 21,3245 53742 DXCH K2CNTRAL
062200,000176:
062201,000177: 21,3246 00006 FUNCT2 EXTEND
062202,000178: 21,3247 31746 DCA A2CNTRAL
062203,000179: 21,3250 21742 DAS K2CNTRAL # DEL*OMEGA + ALPHA(2)/(2*K) AT 16*PI, D.P.
062204,000180:
062205,000181: 21,3251 31745 FUNCT3 CA A2CNTRAL
062206,000182: 21,3252 00006 EXTEND
062207,000183: 21,3253 73242 MP NEG1/3
062208,000184: 21,3254 53746 DXCH A2CNTRAL
062209,000185: 21,3255 30001 CA L
062210,000186: 21,3256 00006 EXTEND
062211,000187: 21,3257 73242 MP NEG1/3
062212,000188: 21,3260 27746 ADS A2CNTRAL +1
062213,000189: 21,3261 54001 TS L
062214,000190: 21,3262 13264 TCF +2 # A2CNTRAL NOW CONTAINS -ALPHA(2)/(6*K),
062215,000191: 21,3263 27745 ADS A2CNTRAL # SCALED AT 16*PI, IN D.P.
062216,000192:
062217,000193: 21,3264 00006 EXTEND
062218,000194: 21,3265 31742 DCA K2CNTRAL # DEL*OMEGA + ALPHA(2)/(3*K) IN A2CNTRAL,
062219,000195: 21,3266 21746 DAS A2CNTRAL # SCALED AT 16*PI, D.P.
062220,000196:
062221,000197: 21,3267 31745 CA A2CNTRAL
062222,000198: 21,3270 00006 EXTEND
062223,000199: 21,3271 71743 MP ACENTRAL
062224,000200: 21,3272 21737 DAS K2THETA
062225,000201: 21,3273 31746 CA A2CNTRAL +1
062226,000202: 21,3274 00006 EXTEND
062227,000203: 21,3275 71743 MP ACENTRAL # ACENTRAL MAY NOW BE OVERLAID.
062228,000204: 21,3276 27737 ADS K2THETA +1
062229,000205: 21,3277 54001 TS L
062230,000206: 21,3300 13302 TCF +2 # TWO TERMS OF NEGUSUM ACCUMULATED, SO FAR
062231,000207: 21,3301 27736 ADS K2THETA # SCALED AT 4*PI(2), IN D.P.
062232,000208:
062233,000209: 21,3302 31741 GETROOT CA K2CNTRAL # K*(DEL*OMEGA + ALPHA(2)/(2*K)) IS THE
062234,000210: 21,3303 00006 EXTEND # TERM FOR WHICH A SQUARE ROOT IS NEEDED.
062235,000211: 21,3304 71740 MP KCENTRAL # K AT PI/2(8)
062236,000212: 21,3305 53751 DXCH FUNCTION
062237,000213: 21,3306 31742 CA K2CNTRAL +1
062238,000214: 21,3307 00006 EXTEND
062239,000215: 21,3310 71740 MP KCENTRAL
062240,000216: 21,3311 27751 ADS FUNCTION +1
062241,000217: 21,3312 54001 TS L
062242,000218: 21,3313 13315 TCF +2
062243,000219: 21,3314 27750 ADS FUNCTION # DESIRED TERM IN FUNCTION, AT PI(2)/16
Page 1468 |
062245,000221: 21,3315 11744 CCS DEL
062246,000222: 21,3316 13523 TCF RSTOFGTS
062247,000223: 21,3317 13565 TCF NEGUSUM
062248,000224: 21,3320 13322 TCF NEGATE
062249,000225: 21,3321 13565 TCF NEGUSUM
062250,000226:
062251,000227: 21,3322 00006 NEGATE EXTEND
062252,000228: 21,3323 41742 DCS K2CNTRAL
062253,000229: 21,3324 53742 DXCH K2CNTRAL
062254,000230: 21,3325 13523 TCF RSTOFGTS
062255,000231:
062256,000232: 16,3741 BANK 16
062257,000233: 16,3741 E6,1501 EBANK= NEGUQ
062258,000234: 16,2000 SETLOC DAPS1
062259,000235: 16,2000 BANK
062260,000236:
062261,000237: # THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
062262,000238: # THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES. ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
062263,000239:
062264,000240: # WARNING: ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
062265,000241:
062266,000242: 16,3741 07400 BGIM OCTAL 07400
062267,000243: 16,3742 0066 CHNL12 EQUALS ITEMP6
062268,000244: 16,3742 41501 ACDT+C12 CS NEGUQ
062269,000245: 16,3743 00006 EXTEND # GIMBAL DRIVE REQUESTS.
062270,000246: 16,3744 71507 MP ACCDOTQ
062271,000247: 16,3745 23510 LXCH QACCDOT
062272,000248: 16,3746 41503 CS NEGUR
062273,000249: 16,3747 00006 EXTEND
062274,000250: 16,3750 71511 MP ACCDOTR
062275,000251: 16,3751 23512 LXCH RACCDOT
062276,000252:
062277,000253: 16,3752 11501 CCS NEGUQ
062278,000254: 16,3753 34742 CAF BIT10
062279,000255: 16,3754 13756 TCF +2
062280,000256: 16,3755 34743 CAF BIT9
062281,000257: 16,3756 54066 TS CHNL12
062282,000258:
062283,000259: 16,3757 11503 CCS NEGUR
062284,000260: 16,3760 34740 CAF BIT12
062285,000261: 16,3761 13763 TCF +2
062286,000262: 16,3762 34741 CAF BIT11
062287,000263: 16,3763 26066 ADS CHNL12 # (STORED RESULT NOT USED AT PRESENT)
062288,000264:
062289,000265: 16,3764 43741 CS BGIM
062290,000266: 16,3765 00006 EXTEND
062291,000267: 16,3766 02012 RAND CHAN12
062292,000268: 16,3767 60066 AD CHNL12
062293,000269: 16,3770 00006 EXTEND
062294,000270: 16,3771 01012 WRITE CHAN12
Page 1469 |
062296,000272: 16,3772 44747 CS CALLGMBL # TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
062297,000273: 16,3773 71262 MASK RCSFLAGS
062298,000274: 16,3774 55262 TS RCSFLAGS
062299,000275:
062300,000276: 16,3775 00002 TC Q # RETURN TO CALLER.
062301,000277:
062302,000278: 21,3326 BANK 21
062303,000279: 21,3326 E6,1450 EBANK= QDIFF
062304,000280: 21,2000 SETLOC DAPS4
062305,000281: 21,2000 BANK
062306,000282:
Page 1470 |
062308,000284: # SUBROUTINE TIMEGMBL: MOD 0, OCTOBER 1967, CRAIG WORK
062309,000285:
062310,000286: # TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
062311,000287: # THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS. INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
062312,000288: # SCALED AT PI/8. FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT). A ZERO
062313,000289: # ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY. OTHERWISE, THE GIMBAL IS TURNED ON
062314,000290: # DRIVING IN THE CORRECT DIRECTION. THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
062315,000291: # IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE. NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
062316,000292: # WHICH IS NEGATIVE, ZERO, OR POSITIVE.
062317,000293:
062318,000294: # INPUTS: AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7). PI/2(7).
062319,000295:
062320,000296: # OUTPUTS: NEW GIMBAL DRIVE BITS IN CHANNEL 12, NEGUQ, NEGUR, QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
062321,000297: # Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
062322,000298:
062323,000299: # DEBRIS: A, L, Q, ITEMPS 2, 3, 6, RUPTREG2 AND ACDT+C12 DEBRIS.
062324,000300:
062325,000301: # EXITS: VIA TC Q.
062326,000302:
062327,000303: # ALARMS, ABORTS, : NONE
062328,000304:
062329,000305: # SUBROUTINES: ACDT+C12, IBNKCALL
062330,000306:
062331,000307: # WARNING: THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS. THEREFORE IT MAY ONLY BE CALLED WITH
062332,000308: # INTERRUPT INHIBITED.
062333,000309:
062334,000310: # ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
062335,000311: # NEGUQ ERASE +2 NEGATIVE OF Q-AXIS GIMBAL DRIVE
062336,000312: # (SPWORD) EQUALS NEGUQ +1 ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
062337,000313: # NEGUR EQUALS NEGUQ +2 NEGATIVE OF R-AXIS GIMBAL DRIVE
062338,000314: # ACCDOTQ ERASE +2 Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
062339,000315: # (SPWORD) EQUALS ACCDOTQ +1 ANY S.P. ERASABLE NUMBER NOW QACCDOT
062340,000316: # ACCDOTR EQUALS ACCDOTQ +2 R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
062341,000317: # ACCDOTQ, ACCDOTR ARE MAGNITUDES.
062342,000318: # AOSQ ERASE +4 Q-AXIS ACC., D.P. AT PI/2 R/SEC(2)
062343,000319: # AOSR EQUALS AOSQ +2 R-AXIS ACCELERATION SCALED AT PI/2 R/S2
062344,000320:
062345,000321: 21,3326 0066 QRNDXER EQUALS ITEMP6
062346,000322: 21,3326 23146 OCT23146 OCTAL 23146 # DECIMAL .6
062347,000323: 21,3327 0063 NZACCDOT EQUALS ITEMP3
062348,000324:
062349,000325: 21,3327 34753 TIMEGMBL CAF ONE # INITIALIZE ALLOWGTS.
062350,000326: 21,3330 55502 TS ALLOWGTS
062351,000327:
062352,000328: 21,3331 34752 CAF TWO # SET UP LOOP FOR R AXIS.
062353,000329: 21,3332 22002 LXCH Q # SAVE RETURN ADDRESS.
062354,000330: 21,3333 22071 LXCH RUPTREG2
Page 1471 |
062356,000332: 21,3334 13336 TCF +2
062357,000333: 21,3335 34755 TIMQGMBL CAF ZERO # NOW DO THE Q-AXIS
062358,000334: 21,3336 54066 TS QRNDXER
062359,000335: 21,3337 50066 INDEX QRNDXER
062360,000336: 21,3340 31507 CA ACCDOTQ # ACCDOT IS PRESUMED TO BE AT PI/2(7).
062361,000337: 21,3341 00006 EXTEND
062362,000338: 21,3342 63412 BZMF TGOFFNOW # IS ACCDOT LESS THAN OR EQUAL TO 0?
062363,000339: 21,3343 54063 TS NZACCDOT # NO. STORE NON-ZERO, POSITIVE ACCDOT.
062364,000340:
062365,000341: 21,3344 50066 ALPHATRY INDEX QRNDXER
062366,000342: 21,3345 41536 CS AOSQ
062367,000343: 21,3346 00006 EXTEND
062368,000344: 21,3347 13412 BZF TGOFFNOW # IS ALPHA ZERO?
062369,000345:
062370,000346: 21,3350 54002 TS Q # SAVE A COPY OF -AOS.
062371,000347: 21,3351 00006 EXTEND # NO. RESCALE FOR TIMEGMBL USE.
062372,000348: 21,3352 73326 MP OCT23146 # OCTAL 23146 IS DECIMAL .6
062373,000349: 21,3353 60002 AD Q # -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
062374,000350: 21,3354 54001 TS L # WAS THERE OVERFLOW?
062375,000351: 21,3355 13362 TCF SETNEGU # NO. COMPUTE DRIVE TIME.
062376,000352:
062377,000353: 21,3356 40000 CS A # RECOVER -SGN(AOS) IN THE A REGISTER.
062378,000354: 21,3357 50066 INDEX QRNDXER # YES. START DRIVE WITHOUT WAITLIST.
062379,000355: 21,3360 57501 XCH NEGUQ
062380,000356: 21,3361 13416 TCF NOTALLOW # KNOCK DOWN THE ALLOWGTS FLAG.
062381,000357:
062382,000358: 21,3362 00006 SETNEGU EXTEND
062383,000359: 21,3363 63370 BZMF POSALPH
062384,000360:
062385,000361: 21,3364 40000 COM
062386,000362: 21,3365 54062 TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
062387,000363: 21,3366 44753 CS BIT1
062388,000364: 21,3367 13372 TCF POSALPH +2
062389,000365: 21,3370 54062 POSALPH TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
062390,000366: 21,3371 34753 CA BIT1
062391,000367: 21,3372 50066 +2 INDEX QRNDXER # SGN(AOS) INTO NEGU
062392,000368: 21,3373 55501 TS NEGUQ # STORE SGN(APLHA) AS NEGU
062393,000369:
062394,000370: 21,3374 30063 CA NZACCDOT
062395,000371: 21,3375 00006 EXTEND
062396,000372: 21,3376 74740 MP BIT12 # 2*ACCDOT, SCALED AT PI/8.
062397,000373: 21,3377 60062 AD ITEMP2 # -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
062398,000374: 21,3400 00006 EXTEND
062399,000375: 21,3401 63416 BZMF NOTALLOW # IS DRIVE TIME MORE THAN TWO SECONDS?
062400,000376: 21,3402 40062 CS ITEMP2 # NO. COMPUTE DRIVE TIME.
062401,000377: 21,3403 00006 EXTEND # ABS(ALPHA) AT PI/8.
062402,000378: 21,3404 73437 MP OCT00240 # DECIMAL 10/1024
062403,000379: 21,3405 00006 EXTEND # QUOTIENT IS DRIVE TIME AT WAITLIST.
062404,000380: 21,3406 10063 DV NZACCDOT # ABS(ALPHA)/ACCDOT AT 2(14)/100
Page 1472 |
062406,000382: 21,3407 00006 EXTEND
062407,000383: 21,3410 13412 BZF TGOFFNOW # DRIVE TIME MUST BE GREATER THAN ZERO.
062408,000384:
062409,000385: 21,3411 13424 TCF DRIVEON
062410,000386:
062411,000387: 21,3412 34755 TGOFFNOW CAF ZERO # TURN OFF GIMBAL NOW.
062412,000388: 21,3413 50066 INDEX QRNDXER
062413,000389: 21,3414 55501 TS NEGUQ
062414,000390:
062415,000391: 21,3415 13426 TCF DONEYET
062416,000392:
062417,000393: 21,3416 36010 NOTALLOW CAF OCT31
062418,000394: 21,3417 50066 INDEX QRNDXER
062419,000395: 21,3420 55631 TS QGIMTIMR
062420,000396: 21,3421 34755 CAF ZERO # DRIVE TIME IS MORE THAN 2 SECONDS, SO
062421,000397: 21,3422 55502 TS ALLOWGTS # DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
062422,000398: # CONTROL UNTIL AOSTASK APPROVES.
062423,000399: 21,3423 13426 TCF DONEYET # NO WAITLIST CALL IS MADE.
062424,000400:
062425,000401: 21,3424 50066 DRIVEON INDEX QRNDXER
062426,000402: 21,3425 55631 TS QGIMTIMR # CHOOSE Q OR R AXIS.
062427,000403:
062428,000404: 21,3426 10066 DONEYET CCS QRNDXER
062429,000405: 21,3427 13335 TCF TIMQGMBL
062430,000406:
062431,000407: 21,3430 52073 DXCH RUPTREG3 # PROTECT IBNKCALL ERASABLES. ACDT+C12
062432,000408: 21,3431 52063 DXCH ITEMP2 # LEAVES ITEMPS2,3 ALONE.
062433,000409:
062434,000410: 21,3432 04674 TC IBNKCALL # TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
062435,000411: 21,3433 35742 CADR ACDT+C12
062436,000412:
062437,000413: 21,3434 52063 DXCH ITEMP2 # RESTORE ERASABLES FOR IBNKCALL.
062438,000414: 21,3435 52073 DXCH RUPTREG3
062439,000415:
062440,000416: 21,3436 00071 TC RUPTREG2 # RETURN TO CALLER.
062441,000417:
062442,000418: 21,3437 00240 OCT00240 OCTAL 00240 # DECIMAL 10/1024
062443,000419:
Page 1473 |
062445,000421: # THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY. THE QUANTITY NEGUSUM
062446,000422: # IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM. NEW DRIVES ARE ENTERED TO CH 12.
062447,000423:
062448,000424: # THE SUBROUTINE GTSQRT ACCEPTS A DOUBLE PRECISION VALUE IN FUNCTION, FUNCTION +1 AND RETURNS A SINGLE-PRECISION
062449,000425: # SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF THE ARGUMENT. ALSO, THE CELL SHFTFLAG CONTAINS A BINARY
062450,000426: # EXPONENT S, SUCH THAT THE SQUARE ROOT (RETURNED IN THE A REGISTER) MUST BE SHIFTED RIGHT (MULTIPLIED BY 2 TO THE
062451,000427: # POWER (-S)) IN ORDER TO BE THE TRUE SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF FUNCTION, FUNCTION +1.
062452,000428: # SQUARE ROOT ERROR IS NOT MORE THAN 2 IN THE 14TH SIGNIFICANT BIT. CELLS CLOBBERED ARE A, L, SHFTFLAG, ININDEX,
062453,000429: # HALFARG, SCRATCH, SR, FUNCTION, FUNCTION +1. GTSQRT IS CALLED BY TC GTSQRT AND RETURNS VIA TC Q OR TC FUNCTION +1.
062454,000430: # ZERO OR NEGATIVE ARGUMENTS YIELD ZERO FOR SQUARE ROOTS.
062455,000431:
062456,000432: 21,3440 11750 GTSQRT CCS FUNCTION
062457,000433: 21,3441 13457 TCF GOODARG # FUNCTION IS POSITIVE. TAKE SQUARE ROOT.
062458,000434: 21,3442 13444 TCF +2 # HIGH ORDER WORD IS ZERO. TRY THE LOWER.
062459,000435: 21,3443 13450 TCF ZEROOT # NEGATIVE. USE ZERO FOR 1/2 POWER.
062460,000436:
062461,000437: 21,3444 31751 CA FUNCTION +1
062462,000438: 21,3445 00006 EXTEND
062463,000439: 21,3446 63450 BZMF ZEROOT
062464,000440:
062465,000441: 21,3447 13453 TCF ZEROHIGH # PROCEED.
062466,000442: 21,3450 34755 ZEROOT CA ZERO
062467,000443: 21,3451 55740 TS SHFTFLAG
062468,000444: 21,3452 00002 TC Q
062469,000445:
062470,000446: 21,3453 57750 ZEROHIGH XCH FUNCTION # 14 MOST SIGNIFICANT BITS ARE IN THE
062471,000447: 21,3454 57751 XCH FUNCTION +1 # LOWER WORD. EXCHANGE THEM.
062472,000448: 21,3455 34757 CA SEVEN
062473,000449: 21,3456 13460 TCF GOODARG +1
062474,000450:
062475,000451: 21,3457 34755 GOODARG CA ZERO
062476,000452: 21,3460 55740 TS SHFTFLAG
062477,000453: 21,3461 35741 CA TWELVE # INITIALIZE THE SCALING LOOP.
062478,000454: 21,3462 55743 TS ININDEX
062479,000455: 21,3463 13472 TCF SCALLOOP
062480,000456:
062481,000457: 21,3464 31750 SCALSTRT CA FUNCTION
062482,000458: 21,3465 13506 TCF SCALDONE
062483,000459:
062484,000460: 21,3466 37751 MULBUSH CA NEG2 # IF ARG IS NOT LESS THAN 1/4, INDEX IS
062485,000461: 21,3467 27743 ADS ININDEX # ZERO, INDICATING NO SHIFT NEEDED.
062486,000462: 21,3470 00006 EXTEND # BRANCH IF ARG IS NOT LESS THAN 1/4.
062487,000463: 21,3471 63464 BZMF SCALSTRT # OTHERWISE COMPARE ARG WITH A REFERENCE
062488,000464: # WHICH IS 4 TIMES LARGER THAN THE LAST.
062489,000465: 21,3472 41750 SCALLOOP CS FUNCTION
062490,000466: 21,3473 51743 INDEX ININDEX
062491,000467: 21,3474 64735 AD BIT15 # REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
062492,000468: 21,3475 00006 EXTEND
062493,000469: 21,3476 63466 BZMF MULBUSH # IF ARG IS NOT LESS THAN REFERENCE, GO
062494,000470: # AROUND THE MULBERRY BUSH ONCE MORE.
Page 1474 |
062496,000472: 21,3477 51743 INDEX ININDEX
062497,000473: 21,3500 34735 CA BIT15 # THIS IS THE SCALE MAGNITUDE
062498,000474: 21,3501 57746 XCH HALFARG # 2**(-ININDEX) IS THE SHIFT DIVISOR.
062499,000475: 21,3502 00006 EXTEND # RESCALE ARGUMENT.
062500,000476: 21,3503 31751 DCA FUNCTION
062501,000477: 21,3504 00006 EXTEND
062502,000478: 21,3505 11746 DV HALFARG
062503,000479: # ININDEX AND SHFTFLAG PRESERVE INFO FOR
062504,000480: # RESCALING AFTER ROOT PROCESS.
062505,000481: 21,3506 00006 SCALDONE EXTEND
062506,000482: 21,3507 23751 QXCH FUNCTION +1 # SAVE Q FOR RETURN
062507,000483: 21,3510 00006 EXTEND
062508,000484: 21,3511 74736 MP BIT14
062509,000485: 21,3512 55746 TS HALFARG
062510,000486: 21,3513 74737 MASK BIT13
062511,000487: 21,3514 10000 CCS A
062512,000488: 21,3515 33633 CA OCT11276
062513,000489: 21,3516 63631 AD ROOTHALF # INITIAL GUESS IS ROOT 1/2 OR POSMAX
062514,000490: 21,3517 03635 TC ROOTCYCL
062515,000491: 21,3520 03635 TC ROOTCYCL
062516,000492: 21,3521 03635 TC ROOTCYCL
062517,000493: 21,3522 01751 TC FUNCTION +1
062518,000494:
062519,000495: # ****************************************************************************************************************
062520,000496:
062521,000497: 21,3523 03440 RSTOFGTS TC GTSQRT
062522,000498: 21,3524 57741 PRODUCT XCH K2CNTRAL
062523,000499: 21,3525 00006 EXTEND
062524,000500: 21,3526 71741 MP K2CNTRAL
062525,000501: 21,3527 53742 DXCH K2CNTRAL
062526,000502: 21,3530 00006 EXTEND # THE PRODUCT OF
062527,000503: 21,3531 70001 MP L # 1/2 2 1/2
062528,000504: 21,3532 27742 ADS K2CNTRAL +1 # K *(DEL*OMEGA + ALPHA /(2*K))
062529,000505: 21,3533 54001 TS L # AND
062530,000506: 21,3534 13536 TCF +2 # 2
062531,000507: 21,3535 27741 ADS K2CNTRAL # DEL*(DEL*OMEGA + ALPHA /(2*K)) NOW IN
062532,000508: # K2CNTRAL
062533,000509:
062534,000510: 21,3536 31743 DOSHIFT CA ININDEX
062535,000511: 21,3537 00006 EXTEND # MULTIPLY IN THE FACTOR 2(-S), RETURNED
062536,000512: 21,3540 74736 MP BIT14 # BY THE GTSQRT SUBROUTINE
062537,000513: 21,3541 27740 ADS SHFTFLAG
062538,000514: 21,3542 00006 EXTEND
062539,000515: 21,3543 13562 BZF ADDITIN
062540,000516: 21,3544 51740 INDEX SHFTFLAG
062541,000517: 21,3545 34735 CA BIT15
Page 1475 |
062543,000519: 21,3546 57741 XCH K2CNTRAL
062544,000520: 21,3547 00006 EXTEND
062545,000521: 21,3550 71741 MP K2CNTRAL
062546,000522: 21,3551 21737 DAS K2THETA
062547,000523: 21,3552 57741 XCH K2CNTRAL
062548,000524: 21,3553 00006 EXTEND
062549,000525: 21,3554 71742 MP K2CNTRAL +1
062550,000526: 21,3555 27737 ADS K2THETA +1
062551,000527: 21,3556 54001 TS L
062552,000528: 21,3557 13561 TCF +2
062553,000529: 21,3560 27736 ADS K2THETA
062554,000530:
062555,000531: 21,3561 13565 TCF NEGUSUM
062556,000532:
062557,000533: 21,3562 00006 ADDITIN EXTEND
062558,000534: 21,3563 31742 DCA K2CNTRAL
062559,000535: 21,3564 21737 DAS K2THETA # NOW ADD IN THE K2THETA TERM.
062560,000536: 21,3565 11736 NEGUSUM CCS K2THETA # TEST SIGN OF HIGH ORDER PART.
062561,000537: 21,3566 13572 TCF NEGDRIVE
062562,000538: 21,3567 13571 TCF +2
062563,000539: 21,3570 13574 TCF POSDRIVE
062564,000540:
062565,000541: 21,3571 11737 CCS K2THETA +1 # SIGN TEST FOR LOW ORDER PART.
062566,000542: 21,3572 34753 NEGDRIVE CA BIT1
062567,000543: 21,3573 13575 TCF +2 # STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
062568,000544: 21,3574 44753 POSDRIVE CS BIT1
062569,000545: 21,3575 54001 TS L # SAVE FOR DRIVE REVERSAL TEST.
062570,000546: 21,3576 51747 INDEX QRCNTR
062571,000547: 21,3577 57501 XCH NEGUQ
062572,000548:
062573,000549: 21,3600 00006 EXTEND
062574,000550: 21,3601 70001 MP L # MULTIPLY OLD NEGU AND NEW NEGU.
062575,000551: 21,3602 10001 CCS L
062576,000552: 21,3603 13620 TCF LOUPE # NON-ZERO GIMBAL DRIVE BEING CONTINUED.
062577,000553:
062578,000554: 21,3604 13615 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
062579,000555:
062580,000556: 21,3605 13607 TCF REVERSAL # NON-ZERO GIMBAL DRIVE BEING REVERSED.
062581,000557: 21,3606 13615 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
062582,000558:
062583,000559: 21,3607 51747 REVERSAL INDEX QRCNTR # A ZERO-DRIVE PAUSE IS NEEDED HERE. ZERO
062584,000560: 21,3610 55510 TS QACCDOT # IS IN A REGISTER FROM CCS ON (-1).
062585,000561: 21,3611 51747 INDEX QRCNTR
062586,000562: 21,3612 43632 CS GMBLBITA
062587,000563: 21,3613 00006 EXTEND
062588,000564: 21,3614 03012 WAND CHAN12
062589,000565:
062590,000566: 21,3615 41262 ZEROLOUP CS RCSFLAGS # SET UP REQUEST FOR ACDT+C12 CALL.
062591,000567: 21,3616 74747 MASK CALLGMBL
062592,000568: 21,3617 27262 ADS RCSFLAGS
Page 1476 |
062594,000570: 21,3620 11747 LOUPE CCS QRCNTR # HAVE BOTH AXES BEEN PROCESSED?
062595,000571: 21,3621 13114 TCF GOQTRIMG # NO. DO Q AXIS NEXT.
062596,000572:
062597,000573: 21,3622 31505 CA SAVESR # RESTORE THE SR
062598,000574: 21,3623 54021 TS SR
062599,000575:
062600,000576: 21,3624 00006 GOCLOSE EXTEND # TERMINATE THE JASK.
062601,000577: 21,3625 33630 DCA CLOSEADR
062602,000578: 21,3626 52006 DTCB
062603,000579:
062604,000580: 21,3627 E6,1536 EBANK= AOSQ
062605,000581: 21,3627 03270 36106 CLOSEADR 2CADR CLOSEOUT # TERMINATE THE JASK.
062606,000582:
062607,000583: 21,3631 5741 TWELVE EQUALS OCT14
062608,000584: 21,3631 26501 ROOTHALF OCTAL 26501 # SQUARE ROOT OF 1/2
062609,000585: 21,3632 01400 GMBLBITA OCTAL 01400 # INDEXED WRT GMBLBITB DO NOT MOVE ******
062610,000586: 21,3633 11276 OCT11276 OCTAL 11276 # POSMAX - ROOTHALF
062611,000587: 21,3634 06000 GMBLBITB OCTAL 06000 # INDEXED WRT GMBLBITA DO NOT MOVE ******
062612,000588:
062613,000589: # SUBROUTINE ROOTCYCL: BY CRAIG WORK, 3 APRIL 68
062614,000590:
062615,000591: # ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION. THE INITIAL GUESS AT THE
062616,000592: # SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG. THE NEW APPROXI-
062617,000593: # MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER. DEBRIS: A, L, SR, SCRATCH. ROOTCYCL IS CALLED FROM
062618,000594: # LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
062619,000595:
062620,000596: # WARNING: IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
062621,000597:
062622,000598: 21,3635 55745 ROOTCYCL TS SCRATCH # STORE X
062623,000599: 21,3636 54021 TS SR # X/2 NOW IN SR
062624,000600: 21,3637 31746 CA HALFARG # ARG/2 IN THE A REG
062625,000601: 21,3640 22007 ZL # PREPARE FOR DIVISION
062626,000602: 21,3641 00006 EXTEND
062627,000603: 21,3642 11745 DV SCRATCH # (ARG/X)/2
062628,000604: 21,3643 60021 AD SR # (X + ARG/X)/2 IN THE A REG
062629,000605: 21,3644 00002 TC Q
062630,000606:
062631,000607:
End of include-file TRIM_GIMBAL_CONTROL_SYSTEM.agc. Parent file is MAIN.agc