Source Code
This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release
of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97.
A bug (which had been around since at least Apollo 10, Luminary 69) was
discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute
revision into Rev 1,
which is what actually flew rather than
the Rev 0 presented here. A hardcopy of Rev 0 is known to
exist — it belonged to AGC developer Allan Klumpp for many years — but
unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus
the code you see here had been reconstructed (we believe accurately) rather than
transcribed. The first step of the reconstruction of the Rev 0 source code was
the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection.
The process of reverting the active portion of the source code (i.e., other than
program comments) from Rev 1 to Rev 0 was very minor, consisting
only of moving the position of the STARTSB1 label in
FRESH START AND RESTART. Allan had previously given
us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums
identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read,
in part:GAP: ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051 A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here. |
064924,000002: ## Copyright: Public domain.
064925,000003: ## Filename: TRIM_GIMBAL_CONTROL_SYSTEM.agc
064926,000004: ## Purpose: Part of the reconstructed source code for LMY99 Rev 0,
064927,000005: ## otherwise known as Luminary Rev 99, the third release
064928,000006: ## of the Apollo Guidance Computer (AGC) software for Apollo 11.
064929,000007: ## It differs from LMY99 Rev 1 (the flown version) only in the
064930,000008: ## placement of a single label. The corrections shown here have
064931,000009: ## been verified to have the same bank checksums as AGC developer
064932,000010: ## Allan Klumpp's copy of Luminary Rev 99, and so are believed
064933,000011: ## to be accurate. This file is intended to be a faithful
064934,000012: ## recreation, except that the code format has been changed to
064935,000013: ## conform to the requirements of the yaYUL assembler rather than
064936,000014: ## the original YUL assembler.
064937,000015: ##
064938,000016: ## Assembler: yaYUL
064939,000017: ## Contact: Ron Burkey <info@sandroid.org>.
064940,000018: ## Website: www.ibiblio.org/apollo.
064941,000019: ## Pages: 1472-1485
064942,000020: ## Mod history: 2009-05-27 RSB Adapted from the corresponding
064943,000021: ## Luminary131 file, using page
064944,000022: ## images from Luminary 1A.
064945,000023: ## 2011-01-06 JL Fixed pseudo-label indentation.
064946,000024: ## 2016-12-18 RSB Proofed text comments with octopus/ProoferComments
064947,000025: ## and corrected the errors found.
064948,000026: ## 2017-03-14 RSB Comment-text fixes noted in proofing Luminary 116.
064949,000027: ## 2017-08-01 MAS Created from LMY99 Rev 1.
064950,000028: ## 2021-05-30 ABS GTSGO+DN -> GTSGO+ON
064951,000029:
064952,000030: ## This source code has been transcribed or otherwise adapted from
064953,000031: ## digitized images of a hardcopy from the MIT Museum. The digitization
064954,000032: ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
064955,000033: ## the Museum. Many thanks to both. The images (with suitable reduction
064956,000034: ## in storage size and consequent reduction in image quality as well) are
064957,000035: ## available online at www.ibiblio.org/apollo. If for some reason you
064958,000036: ## find that the images are illegible, contact me at info@sandroid.org
064959,000037: ## about getting access to the (much) higher-quality images which Paul
064960,000038: ## actually created.
064961,000039: ##
064962,000040: ## The code has been modified to match LMY99 Revision 0, otherwise
064963,000041: ## known as Luminary Revision 99, the Apollo 11 software release preceeding
064964,000042: ## the listing from which it was transcribed. It has been verified to
064965,000043: ## contain the same bank checksums as AGC developer Allan Klumpp's listing
064966,000044: ## of Luminary Revision 99 (for which we do not have scans).
064967,000045: ##
064968,000046: ## Notations on Allan Klumpp's listing read, in part:
064969,000047: ##
064970,000048: ## ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
064971,000049:
Page 1472 |
064973,000051: 21,3077 BANK 21
064974,000052: 21,3077 E6,1450 EBANK= QDIFF
064975,000053: 21,2000 SETLOC DAPS4
064976,000054: 21,2000 BANK
064977,000055:
064978,000056: 21,3077 COUNT* $$/DAPGT
064979,000057:
064980,000058: # CONTROL REACHES THIS POINT UNDER EITHER OF THE FOLLOWING TWO CONDITIONS ONCE THE DESCENT ENGINE AND THE DIGITAL
064981,000059: # AUTOPILOT ARE BOTH ON:
064982,000060: # A) THE TRIM GIMBAL CONTROL LAW WAS ON DURING THE PREVIOUS Q,R-AXIS TIME5 INTERRUPT (OR THE DAPIDLER
064983,000061: # INITIALIZATION WAS SET FOR TRIM GIMBAL CONTROL AND THIS IS THE FIRST PASS), OR
064984,000062: # B) THE Q,R-AXES RCS AUTOPILOT DETERMINED THAT THE VEHICLE WAS ENTERING (OR HAD JUST ENTERED) A COAST
064985,000063: # ZONE WITH A SMALL OFFSET ANGULAR ACCELERATION.
064986,000064: # GTS IS THE ENTRY TO THE GIMBAL TRIM SYSTEM FOR CONTROLLING ATTITUDE ERRORS AND RATES AS WELL AS ACCELERATIONS.
064987,000065:
064988,000066: 21,3077 37747 GTS CAF NEGONE # MAKE THE NEXT PASS THROUGH THE DAP BE
064989,000067: 21,3100 55631 TS COTROLER # THROUGH RCS CONTROL,
064990,000068: 21,3101 34751 CAF FOUR # AND ENSURE THAT IT IS NOT A SKIP.
064991,000069: 21,3102 55535 TS SKIPU
064992,000070: 21,3103 55536 TS SKIPV
064993,000071:
064994,000072: 21,3104 34752 CAF TWO
064995,000073: 21,3105 55633 TS INGTS # SET INDICATOR OF GTS CONTROL POSITIVE.
064996,000074: 21,3106 55632 TS QGIMTIMR # SET TIMERS TO 200 MSEC TO AVOID BOTH
064997,000075: 21,3107 55634 TS RGIMTIMR # RUNAWAY AND INTERFERENCE BY NULLING.
064998,000076:
064999,000077: # THE DRIVE SETTING ALGORITHM
065000,000078:
065001,000079: # DEL = SGN(OMEGA + ALPHA*ABS(ALPHA)/(2*K))
065002,000080: # 2 1/2 2 3/2
065003,000081: # NEGUSUM = ERROR*K + ALPHA*(DEL*OMEGA + ALPHA /(3*K)) + DEL*K (DEL*OMEGA + ALPHA /(2*K))
065004,000082:
065005,000083: # DRIVE = -SGN(NEGUSUM)
065006,000084:
065007,000085: 21,3110 30021 CA SR # SAVE THE SR. SHIFT IT LEFT TO CORRECT
065008,000086: 21,3111 60000 AD A # FOR THE RIGHT SHIFT DUE TO EDITING.
065009,000087: 21,3112 55505 TS SAVESR
065010,000088:
065011,000089: 21,3113 34752 GTSGO+ON CAF TWO # SET INDEXER FOR R-AXIS CALCULATIONS.
065012,000090: 21,3114 13116 TCF GOQTRIMG +1
065013,000091:
065014,000092: 21,3115 34755 GOQTRIMG CAF ZERO # SET INDEXER FOR Q-AXIS CALCULATIONS
065015,000093: 21,3116 55750 TS QRCNTR
065016,000094:
RSB 2016 — Everything between this line and the corresponding line below was missing in the Luminary 099 print-out from the MIT Museum (from which the remainder of the source-code was transcribed), presumably due to some problem with the printer. It has been filled in from snapshots of page 1472 and 1473 of a different Luminary 99 print-out, thoughtfully made for us by Don Eyles. |
065023,000101: 21,3117 51750 INDEX QRCNTR # AOS SCALED AT PI/2
065024,000102: 21,3120 31537 CA AOSQ
065025,000103: 21,3121 00006 EXTEND
065026,000104: 21,3122 74752 MP BIT2 # RESCALE AOS TO PI/4
Page 1473 |
065028,000106: 21,3123 00006 EXTEND
065029,000107: 21,3124 13130 BZF GTSQAXIS -3 # USE FULL SCALE FOR LARGER AOS ESTIMATES.
065030,000108:
065031,000109: 21,3125 50000 INDEX A
065032,000110: 21,3126 44734 CS LIMITS # LIMITS +1 CONTAINS NEGMAX.
065033,000111: 21,3127 56001 XCH L # LIMITS -1 CONTAINS POSMAX.
065034,000112:
065035,000113: 21,3130 11750 CCS QRCNTR # PICK UP RATE FOR THIS AXIS. RATE CELLS
065036,000114: 21,3131 50000 INDEX A # ARE ADJACENT, NOT SEPARATED. AT PI/4
065037,000115: 21,3132 31436 CA EDOTQ
065038,000116: 21,3133 53744 GTSQAXIS DXCH WCENTRAL
065039,000117:
065040,000118: 21,3134 51750 INDEX QRCNTR # COLLECT K FOR THIS AXIS
065041,000119: 21,3135 31504 CA KQ
065042,000120: 21,3136 55741 TS KCENTRAL
065043,000121:
065044,000122: 21,3137 00006 EXTEND # CONTROL AUTHORITY ZERO. AVOID DRIVING
065045,000123: 21,3140 13576 BZF POSDRIVE +1 # ENGINE BELL TO THE STOPS.
065046,000124:
065047,000125: 21,3141 51750 INDEX QRCNTR # QDIFF, RDIFF ARE STORED IN D.P.
065048,000126: 21,3142 31450 CAE QDIFF
065049,000127:
065050,000128: 21,3143 00006 ALGORTHM EXTEND # Q(R)DIFF IS THETA (ERROR) SCALED AT PI.
065051,000129: 21,3144 71741 MP KCENTRAL # FORM K*ERROR AT PI(2)/2(8), IN D.P.
065052,000130: 21,3145 23737 LXCH K2THETA
065053,000131: 21,3146 00006 EXTEND
065054,000132: 21,3147 74747 MP BIT5 # RESCALE TO 4*PI(2)
065055,000133: 21,3150 53740 DXCH K2THETA
065056,000134: 21,3151 00006 EXTEND
065057,000135: 21,3152 74747 MP BIT5 # FIRST TERM OF NEGUSUM IN K2THETA.
065058,000136: 21,3153 27740 ADS K2THETA +1 # NO CARRY NEEDED D.P. AT 4*PI(2)
065059,000137:
065060,000138: 21,3154 41744 CS ACENTRAL # FORM ALPHA(2)/(2*K) AT 16*PI, IN D.P.,
065061,000139: 21,3155 00006 EXTEND # LIMITING QUOTIENT TO AVOID OVERFLOW.
065062,000140: 21,3156 74736 MP BIT14 # -ALPHA/2 IN A, SCALED AT PI/4
065063,000141: 21,3157 00006 EXTEND
065064,000142: 21,3160 71744 MP ACENTRAL # -ALPHA(2)/2 IN A,L, SCALED AT PI(2)/16
065065,000143: 21,3161 61741 AD KCENTRAL
065066,000144: 21,3162 00006 EXTEND
065067,000145: 21,3163 63200 BZMF HUGEQUOT # K-ALPHA(2)/2 SHOULD BE PNZ FO DIVISION
065068,000146:
065069,000147: 21,3164 00006 EXTEND
065070,000148: 21,3165 40001 DCS A # ALPHA(2)/2 - K
065071,000149: 21,3166 61741 AD KCENTRAL
RSB 2016 — End of material from Don Eyles's printout. The non-blank portion of page 1473 continues below: |
065074,000152: 21,3167 00006 EXTEND
065075,000153: 21,3170 11741 DV KCENTRAL # HIGH ORDER OF QUOTIENT.
065076,000154: 21,3171 57746 XCH A2CNTRAL
065077,000155: 21,3172 30001 CA L # SHIFT UP THE REMAINDER.
065078,000156: 21,3173 22007 LXCH 7 # ZERO LOW-ORDER DIVIDEND.
065079,000157: 21,3174 00006 EXTEND
Page 1474 |
065081,000159: 21,3175 11741 DV KCENTRAL
065082,000160: 21,3176 57747 XCH A2CNTRAL +1 # QUOTIENT STORED AT 16*PI, D.P.
065083,000161: 21,3177 13203 TCF HAVEQUOT
065084,000162:
065085,000163: 21,3200 34733 HUGEQUOT CA POSMAX
065086,000164: 21,3201 54001 TS L
065087,000165: 21,3202 53747 DXCH A2CNTRAL # LIMITED QUOTIENT STORED AT 16*PI, D.P.
065088,000166:
065089,000167: 21,3203 31743 HAVEQUOT CA WCENTRAL
065090,000168: 21,3204 00006 EXTEND
065091,000169: 21,3205 74743 MP BIT9 # RESCALE OMEGA AT 16*PI IN D.P.
065092,000170: 21,3206 53743 DXCH K2CNTRAL # LOWER WORD OVERLAYS OMEGA IN WCENTRAL
065093,000171:
065094,000172: 21,3207 00006 EXTEND
065095,000173: 21,3210 31743 DCA K2CNTRAL
065096,000174: 21,3211 53752 DXCH FUNCTION
065097,000175:
065098,000176: 21,3212 31744 CA ACENTRAL # GET ALPHA*ABS(ALPHA)/(2*K)
065099,000177: 21,3213 00006 EXTEND
065100,000178: 21,3214 63220 BZMF +4
065101,000179:
065102,000180: 21,3215 00006 EXTEND
065103,000181: 21,3216 31747 DCA A2CNTRAL
065104,000182: 21,3217 13222 TCF +3
065105,000183:
065106,000184: 21,3220 00006 EXTEND
065107,000185: 21,3221 41747 DCS A2CNTRAL
065108,000186:
065109,000187: 21,3222 21752 DAS FUNCTION # OMEGA + ALPHA*ABS(ALPHA)/2*K) AT 16*PI
065110,000188:
065111,000189: 21,3223 11751 CCS FUNCTION # DEL = +1 FOR FUNCT1 GREATER THAN ZERO.
065112,000190: 21,3224 13230 TCF POSFNCT1 # OTHERWISE DEL = -1
065113,000191: 21,3225 13227 TCF +2
065114,000192: 21,3226 13232 TCF NEGFNCT1
065115,000193:
065116,000194: 21,3227 11752 CCS FUNCTION +1 # USE LOW ORDER WORD SINCE HIGH IS ZERO
065117,000195: 21,3230 34753 POSFNCT1 CAF BIT1
065118,000196: 21,3231 13233 TCF +2
065119,000197: 21,3232 44753 NEGFNCT1 CS BIT1
065120,000198: 21,3233 55745 TS DEL
065121,000199:
065122,000200: 21,3234 11745 CCS DEL # REPLACE OMEGA BY DEL*OMEGA
065123,000201: 21,3235 13247 TCF FUNCT2 # POSITIVE DEL VALUE. PROCEED.
065124,000202: 21,3236 13240 TCF DEFUNCT
065125,000203: 21,3237 13244 TCF NEGFNCT2
065126,000204:
065127,000205: 21,3240 55742 DEFUNCT TS K2CNTRAL
065128,000206: 21,3241 55743 TS K2CNTRAL +1
065129,000207: 21,3242 13247 TCF FUNCT2
065130,000208:
Page 1475 |
065132,000210: 21,3243 65252 NEG1/3 DEC -.33333
065133,000211:
065134,000212: 21,3244 00006 NEGFNCT2 EXTEND
065135,000213: 21,3245 41743 DCS K2CNTRAL
065136,000214: 21,3246 53743 DXCH K2CNTRAL
065137,000215:
065138,000216: 21,3247 00006 FUNCT2 EXTEND
065139,000217: 21,3250 31747 DCA A2CNTRAL
065140,000218: 21,3251 21743 DAS K2CNTRAL # DEL*OMEGA + ALPHA(2)/(2*K) AT 16*PI, D.P.
065141,000219:
065142,000220: 21,3252 31746 FUNCT3 CA A2CNTRAL
065143,000221: 21,3253 00006 EXTEND
065144,000222: 21,3254 73243 MP NEG1/3
065145,000223: 21,3255 53747 DXCH A2CNTRAL
065146,000224: 21,3256 30001 CA L
065147,000225: 21,3257 00006 EXTEND
065148,000226: 21,3260 73243 MP NEG1/3
065149,000227: 21,3261 27747 ADS A2CNTRAL +1
065150,000228: 21,3262 54001 TS L
065151,000229: 21,3263 13265 TCF +2 # A2CNTRAL NOW CONTAINS -ALPHA(2)/(6*K),
065152,000230: 21,3264 27746 ADS A2CNTRAL # SCALED AT 16*PI, IN D.P.
065153,000231:
065154,000232: 21,3265 00006 EXTEND
065155,000233: 21,3266 31743 DCA K2CNTRAL # DEL*OMEGA + ALPHA(2)/(3*K) IN A2CNTRAL,
065156,000234: 21,3267 21747 DAS A2CNTRAL # SCALED AT 16*PI, D.P.
065157,000235:
065158,000236: 21,3270 31746 CA A2CNTRAL
065159,000237: 21,3271 00006 EXTEND
065160,000238: 21,3272 71744 MP ACENTRAL
065161,000239: 21,3273 21740 DAS K2THETA
065162,000240: 21,3274 31747 CA A2CNTRAL +1
065163,000241: 21,3275 00006 EXTEND
065164,000242: 21,3276 71744 MP ACENTRAL # ACENTRAL MAY NOW BE OVERLAID.
065165,000243: 21,3277 27740 ADS K2THETA +1
065166,000244: 21,3300 54001 TS L
065167,000245: 21,3301 13303 TCF +2 # TWO TERMS OF NEGUSUM ACCUMULATED, SO FAR
065168,000246: 21,3302 27737 ADS K2THETA # SCALED AT 4*PI(2), IN D.P.
065169,000247:
065170,000248: 21,3303 31742 GETROOT CA K2CNTRAL # K*(DEL*OMEGA + ALPHA(2)/(2*K)) IS THE
065171,000249: 21,3304 00006 EXTEND # TERM FOR WHICH A SQUARE ROOT IS NEEDED.
065172,000250: 21,3305 71741 MP KCENTRAL # K AT PI/2(8)
065173,000251: 21,3306 53752 DXCH FUNCTION
065174,000252: 21,3307 31743 CA K2CNTRAL +1
065175,000253: 21,3310 00006 EXTEND
065176,000254: 21,3311 71741 MP KCENTRAL
065177,000255: 21,3312 27752 ADS FUNCTION +1
065178,000256: 21,3313 54001 TS L
065179,000257: 21,3314 13316 TCF +2
065180,000258: 21,3315 27751 ADS FUNCTION # DESIRED TERM IN FUNCTION, AT PI(2)/16
Page 1476 |
065182,000260: 21,3316 11745 CCS DEL
065183,000261: 21,3317 13524 TCF RSTOFGTS
065184,000262: 21,3320 13566 TCF NEGUSUM
065185,000263: 21,3321 13323 TCF NEGATE
065186,000264: 21,3322 13566 TCF NEGUSUM
065187,000265:
065188,000266: 21,3323 00006 NEGATE EXTEND
065189,000267: 21,3324 41743 DCS K2CNTRAL
065190,000268: 21,3325 53743 DXCH K2CNTRAL
065191,000269: 21,3326 13524 TCF RSTOFGTS
065192,000270:
065193,000271: 16,3735 BANK 16
065194,000272: 16,3735 E6,1501 EBANK= NEGUQ
065195,000273: 16,2000 SETLOC DAPS1
065196,000274: 16,2000 BANK
065197,000275:
065198,000276: # THE WRCHN12 SUBROUTINE SETS BITS 9,10,11,12 OF CHANNEL 12 ON THE BASIS OF THE CONTENTS OF NEGUQ,NEGUR WHICH ARE
065199,000277: # THE NEGATIVES OF THE DESIRED ACCELERATION CHANGES. ACDT+C12 SETS Q(R)ACCDOT TO REFLECT THE NEW DRIVES.
065200,000278:
065201,000279: # WARNING: ACDT+C12 AND WRCHN12 MUST BE CALLED WITH INTERRUPT INHIBITED.
065202,000280:
065203,000281: 16,3735 07400 BGIM OCTAL 07400
065204,000282: 16,3736 0066 CHNL12 EQUALS ITEMP6
065205,000283: 16,3736 41501 ACDT+C12 CS NEGUQ
065206,000284: 16,3737 00006 EXTEND # GIMBAL DRIVE REQUESTS.
065207,000285: 16,3740 71507 MP ACCDOTQ
065208,000286: 16,3741 23510 LXCH QACCDOT
065209,000287: 16,3742 41503 CS NEGUR
065210,000288: 16,3743 00006 EXTEND
065211,000289: 16,3744 71511 MP ACCDOTR
065212,000290: 16,3745 23512 LXCH RACCDOT
065213,000291:
065214,000292: 16,3746 11501 CCS NEGUQ
065215,000293: 16,3747 34742 CAF BIT10
065216,000294: 16,3750 13752 TCF +2
065217,000295: 16,3751 34743 CAF BIT9
065218,000296: 16,3752 54066 TS CHNL12
065219,000297:
065220,000298: 16,3753 11503 CCS NEGUR
065221,000299: 16,3754 34740 CAF BIT12
065222,000300: 16,3755 13757 TCF +2
065223,000301: 16,3756 34741 CAF BIT11
065224,000302: 16,3757 26066 ADS CHNL12 # (STORED RESULT NOT USED AT PRESENT)
065225,000303:
065226,000304: 16,3760 43735 CS BGIM
065227,000305: 16,3761 00006 EXTEND
065228,000306: 16,3762 02012 RAND CHAN12
065229,000307: 16,3763 60066 AD CHNL12
065230,000308: 16,3764 00006 EXTEND
065231,000309: 16,3765 01012 WRITE CHAN12
Page 1477 |
065233,000311: 16,3766 44747 CS CALLGMBL # TURN OFF REQUEST FOR ACDT+C12 EXECUTION.
065234,000312: 16,3767 71273 MASK RCSFLAGS
065235,000313: 16,3770 55273 TS RCSFLAGS
065236,000314:
065237,000315: 16,3771 00002 TC Q # RETURN TO CALLER.
065238,000316:
065239,000317: 21,3327 BANK 21
065240,000318: 21,3327 E6,1450 EBANK= QDIFF
065241,000319: 21,2000 SETLOC DAPS4
065242,000320: 21,2000 BANK
065243,000321:
Page 1478 |
065245,000323: # SUBROUTINE TIMEGMBL: MOD 0, OCTOBER 1967, CRAIG WORK
065246,000324:
065247,000325: # TIMEGMBL COMPUTES THE DRIVE TIME NEEDED FOR THE TRIM GIMBAL TO POSITION THE DESCENT ENGINE NOZZLE SO AS TO NULL
065248,000326: # THE OFFSET ANGULAR ACCELERATION ABOUT THE Q (OR R) AXIS. INSTEAD OF USING AOSQ(R), TIMEGMBL USES .4*AOSQ(R),
065249,000327: # SCALED AT PI/8. FOR EACH AXIS, THE DRIVE TIME IS COMPUTED AS ABS(ALPHA/ACCDOT). A ZERO
065250,000328: # ALPHA OR ACCDOT OR A ZERO QUOTIENT TURNS OFF THE GIMBAL DRIVE IMMEDIATELY. OTHERWISE, THE GIMBAL IS TURNED ON
065251,000329: # DRIVING IN THE CORRECT DIRECTION. THE Q(R)GIMTIMR IS SET TO TERMINATE THE DRIVE AND Q(R)ACCDOT
065252,000330: # IS STORED TO REFLECT THE NEW ACCELERATION DERIVATIVE. NEGUQ(R) WILL CONTAIN +1,+0,-1 FOR A Q(R)ACCDOT VALUE
065253,000331: # WHICH IS NEGATIVE, ZERO, OR POSITIVE.
065254,000332:
065255,000333: # INPUTS: AOSQ,AOSR, SCALED AT P1/2, AND ACCDOTQ, ACCDOTR AT PI/2(7). PI/2(7).
065256,000334:
065257,000335: # OUTPUTS: NEW GIMBAL DRIVE BITS IN CHANNEL 12, NEGUQ, NEGUR, QACCDOT AND RACCDOT, THE LAST SCALED AT PI/2(7).
065258,000336: # Q(R)GIMTIMR WILL BE SET TO TIME AND TERMINATE GIMBAL DRIVE(S)
065259,000337:
065260,000338: # DEBRIS: A, L, Q, ITEMPS 2, 3, 6, RUPTREG2 AND ACDT+C12 DEBRIS.
065261,000339:
065262,000340: # EXITS: VIA TC Q.
065263,000341:
065264,000342: # ALARMS, ABORTS, : NONE
065265,000343:
065266,000344: # SUBROUTINES: ACDT+C12, IBNKCALL
065267,000345:
065268,000346: # WARNING: THIS SUBROUTINE WRITES INTO CHANNEL 12 AND USES THE ITEMPS. THEREFORE IT MAY ONLY BE CALLED WITH
065269,000347: # INTERRUPT INHIBITED.
065270,000348:
065271,000349: # ERASABLE STORAGE CONFIGURATION (NEEDED BY THE INDEXING METHODS):
065272,000350: # NEGUQ ERASE +2 NEGATIVE OF Q-AXIS GIMBAL DRIVE
065273,000351: # (SPWORD) EQUALS NEGUQ +1 ANY S.P. ERASABLE NUMBER, NOW THRSTCMD
065274,000352: # NEGUR EQUALS NEGUQ +2 NEGATIVE OF R-AXIS GIMBAL DRIVE
065275,000353: # ACCDOTQ ERASE +2 Q-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
065276,000354: # (SPWORD) EQUALS ACCDOTQ +1 ANY S.P. ERASABLE NUMBER NOW QACCDOT
065277,000355: # ACCDOTR EQUALS ACCDOTQ +2 R-JERK TERM SCALED AT PI/2(7) RAD/SEC(3)
065278,000356: # ACCDOTQ, ACCDOTR ARE MAGNITUDES.
065279,000357: # AOSQ ERASE +4 Q-AXIS ACC., D.P. AT PI/2 R/SEC(2)
065280,000358: # AOSR EQUALS AOSQ +2 R-AXIS ACCELERATION SCALED AT PI/2 R/S2
065281,000359:
065282,000360: 21,3327 0066 QRNDXER EQUALS ITEMP6
065283,000361: 21,3327 23146 OCT23146 OCTAL 23146 # DECIMAL .6
065284,000362: 21,3330 0063 NZACCDOT EQUALS ITEMP3
065285,000363:
065286,000364: 21,3330 34753 TIMEGMBL CAF ONE # INITIALIZE ALLOWGTS.
065287,000365: 21,3331 55502 TS ALLOWGTS
065288,000366:
065289,000367: 21,3332 34752 CAF TWO # SET UP LOOP FOR R AXIS.
065290,000368: 21,3333 22002 LXCH Q # SAVE RETURN ADDRESS.
065291,000369: 21,3334 22071 LXCH RUPTREG2
Page 1479 |
065293,000371: 21,3335 13337 TCF +2
065294,000372: 21,3336 34755 TIMQGMBL CAF ZERO # NOW DO THE Q-AXIS
065295,000373: 21,3337 54066 TS QRNDXER
065296,000374: 21,3340 50066 INDEX QRNDXER
065297,000375: 21,3341 31507 CA ACCDOTQ # ACCDOT IS PRESUMED TO BE AT PI/2(7).
065298,000376: 21,3342 00006 EXTEND
065299,000377: 21,3343 63413 BZMF TGOFFNOW # IS ACCDOT LESS THAN OR EQUAL TO 0?
065300,000378: 21,3344 54063 TS NZACCDOT # NO. STORE NON-ZERO, POSITIVE ACCDOT.
065301,000379:
065302,000380: 21,3345 50066 ALPHATRY INDEX QRNDXER
065303,000381: 21,3346 41537 CS AOSQ
065304,000382: 21,3347 00006 EXTEND
065305,000383: 21,3350 13413 BZF TGOFFNOW # IS ALPHA ZERO?
065306,000384:
065307,000385: 21,3351 54002 TS Q # SAVE A COPY OF -AOS.
065308,000386: 21,3352 00006 EXTEND # NO. RESCALE FOR TIMEGMBL USE.
065309,000387: 21,3353 73327 MP OCT23146 # OCTAL 23146 IS DECIMAL .6
065310,000388: 21,3354 60002 AD Q # -1.6*AOS AT PI/2 = -.4*AOS AT PI/8.
065311,000389: 21,3355 54001 TS L # WAS THERE OVERFLOW?
065312,000390: 21,3356 13363 TCF SETNEGU # NO. COMPUTE DRIVE TIME.
065313,000391:
065314,000392: 21,3357 40000 CS A # RECOVER -SGN(AOS) IN THE A REGISTER.
065315,000393: 21,3360 50066 INDEX QRNDXER # YES. START DRIVE WITHOUT WAITLIST.
065316,000394: 21,3361 57501 XCH NEGUQ
065317,000395: 21,3362 13417 TCF NOTALLOW # KNOCK DOWN THE ALLOWGTS FLAG.
065318,000396:
065319,000397: 21,3363 00006 SETNEGU EXTEND
065320,000398: 21,3364 63371 BZMF POSALPH
065321,000399:
065322,000400: 21,3365 40000 COM
065323,000401: 21,3366 54062 TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
065324,000402: 21,3367 44753 CS BIT1
065325,000403: 21,3370 13373 TCF POSALPH +2
065326,000404: 21,3371 54062 POSALPH TS ITEMP2 # STORE -ABS(.4*AOS) SCALED AT PI/8.
065327,000405: 21,3372 34753 CA BIT1
065328,000406: 21,3373 50066 +2 INDEX QRNDXER # SGN(AOS) INTO NEGU
065329,000407: 21,3374 55501 TS NEGUQ # STORE SGN(APLHA) AS NEGU
065330,000408:
065331,000409: 21,3375 30063 CA NZACCDOT
065332,000410: 21,3376 00006 EXTEND
065333,000411: 21,3377 74740 MP BIT12 # 2*ACCDOT, SCALED AT PI/8.
065334,000412: 21,3400 60062 AD ITEMP2 # -ABS(ALPHA) + 2*ACCDOT, AT PI/8.
065335,000413: 21,3401 00006 EXTEND
065336,000414: 21,3402 63417 BZMF NOTALLOW # IS DRIVE TIME MORE THAN TWO SECONDS?
065337,000415: 21,3403 40062 CS ITEMP2 # NO. COMPUTE DRIVE TIME.
065338,000416: 21,3404 00006 EXTEND # ABS(ALPHA) AT PI/8.
065339,000417: 21,3405 73440 MP OCT00240 # DECIMAL 10/1024
065340,000418: 21,3406 00006 EXTEND # QUOTIENT IS DRIVE TIME AT WAITLIST.
065341,000419: 21,3407 10063 DV NZACCDOT # ABS(ALPHA)/ACCDOT AT 2(14)/100
Page 1480 |
065343,000421: 21,3410 00006 EXTEND
065344,000422: 21,3411 13413 BZF TGOFFNOW # DRIVE TIME MUST BE GREATER THAN ZERO.
065345,000423:
065346,000424: 21,3412 13425 TCF DRIVEON
065347,000425:
065348,000426: 21,3413 34755 TGOFFNOW CAF ZERO # TURN OFF GIMBAL NOW.
065349,000427: 21,3414 50066 INDEX QRNDXER
065350,000428: 21,3415 55501 TS NEGUQ
065351,000429:
065352,000430: 21,3416 13427 TCF DONEYET
065353,000431:
065354,000432: 21,3417 36010 NOTALLOW CAF OCT31
065355,000433: 21,3420 50066 INDEX QRNDXER
065356,000434: 21,3421 55632 TS QGIMTIMR
065357,000435: 21,3422 34755 CAF ZERO # DRIVE TIME IS MORE THAN 2 SECONDS, SO
065358,000436: 21,3423 55502 TS ALLOWGTS # DO NOT PERMIT FURTHER GTS ATTITUDE-RATE
065359,000437: # CONTROL UNTIL AOSTASK APPROVES.
065360,000438: 21,3424 13427 TCF DONEYET # NO WAITLIST CALL IS MADE.
065361,000439:
065362,000440: 21,3425 50066 DRIVEON INDEX QRNDXER
065363,000441: 21,3426 55632 TS QGIMTIMR # CHOOSE Q OR R AXIS.
065364,000442:
065365,000443: 21,3427 10066 DONEYET CCS QRNDXER
065366,000444: 21,3430 13336 TCF TIMQGMBL
065367,000445:
065368,000446: 21,3431 52073 DXCH RUPTREG3 # PROTECT IBNKCALL ERASABLES. ACDT+C12
065369,000447: 21,3432 52063 DXCH ITEMP2 # LEAVES ITEMPS2,3 ALONE.
065370,000448:
065371,000449: 21,3433 04674 TC IBNKCALL # TURN OF CHANNEL BITS, SET Q(R)ACCDOTS.
065372,000450: 21,3434 35736 CADR ACDT+C12
065373,000451:
065374,000452: 21,3435 52063 DXCH ITEMP2 # RESTORE ERASABLES FOR IBNKCALL.
065375,000453: 21,3436 52073 DXCH RUPTREG3
065376,000454:
065377,000455: 21,3437 00071 TC RUPTREG2 # RETURN TO CALLER.
065378,000456:
065379,000457: 21,3440 00240 OCT00240 OCTAL 00240 # DECIMAL 10/1024
065380,000458:
Page 1481 |
065382,000460: # THE FOLLOWING SECTION IS A CONTINUATION OF THE TRIM GIMBAL CONTROL FROM THE LAST GTS ENTRY. THE QUANTITY NEGUSUM
065383,000461: # IS COMPUTED FOR EACH AXIS (Q,R), .707*DEL*FUNCTION(3/2) + K2THETA = NEGUSUM. NEW DRIVES ARE ENTERED TO CH 12.
065384,000462:
065385,000463: # THE SUBROUTINE GTSQRT ACCEPTS A DOUBLE PRECISION VALUE IN FUNCTION, FUNCTION +1 AND RETURNS A SINGLE-PRECISION
065386,000464: # SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF THE ARGUMENT. ALSO, THE CELL SHFTFLAG CONTAINS A BINARY
065387,000465: # EXPONENT S, SUCH THAT THE SQUARE ROOT (RETURNED IN THE A REGISTER) MUST BE SHIFTED RIGHT (MULTIPLIED BY 2 TO THE
065388,000466: # POWER (-S)) IN ORDER TO BE THE TRUE SQUARE ROOT OF THE FOURTEEN MOST SIGNIFICANT BITS OF FUNCTION, FUNCTION +1.
065389,000467: # SQUARE ROOT ERROR IS NOT MORE THAN 2 IN THE 14TH SIGNIFICANT BIT. CELLS CLOBBERED ARE A, L, SHFTFLAG, ININDEX,
065390,000468: # HALFARG, SCRATCH, SR, FUNCTION, FUNCTION +1. GTSQRT IS CALLED BY TC GTSQRT AND RETURNS VIA TC Q OR TC FUNCTION +1.
065391,000469: # ZERO OR NEGATIVE ARGUMENTS YIELD ZERO FOR SQUARE ROOTS.
065392,000470:
065393,000471: 21,3441 11751 GTSQRT CCS FUNCTION
065394,000472: 21,3442 13460 TCF GOODARG # FUNCTION IS POSITIVE. TAKE SQUARE ROOT.
065395,000473: 21,3443 13445 TCF +2 # HIGH ORDER WORD IS ZERO. TRY THE LOWER.
065396,000474: 21,3444 13451 TCF ZEROOT # NEGATIVE. USE ZERO FOR 1/2 POWER.
065397,000475:
065398,000476: 21,3445 31752 CA FUNCTION +1
065399,000477: 21,3446 00006 EXTEND
065400,000478: 21,3447 63451 BZMF ZEROOT
065401,000479:
065402,000480: 21,3450 13454 TCF ZEROHIGH # PROCEED.
065403,000481: 21,3451 34755 ZEROOT CA ZERO
065404,000482: 21,3452 55741 TS SHFTFLAG
065405,000483: 21,3453 00002 TC Q
065406,000484:
065407,000485: 21,3454 57751 ZEROHIGH XCH FUNCTION # 14 MOST SIGNIFICANT BITS ARE IN THE
065408,000486: 21,3455 57752 XCH FUNCTION +1 # LOWER WORD. EXCHANGE THEM.
065409,000487: 21,3456 34757 CA SEVEN
065410,000488: 21,3457 13461 TCF GOODARG +1
065411,000489:
065412,000490: 21,3460 34755 GOODARG CA ZERO
065413,000491: 21,3461 55741 TS SHFTFLAG
065414,000492: 21,3462 35751 CA TWELVE # INITIALIZE THE SCALING LOOP.
065415,000493: 21,3463 55744 TS ININDEX
065416,000494: 21,3464 13473 TCF SCALLOOP
065417,000495:
065418,000496: 21,3465 31751 SCALSTRT CA FUNCTION
065419,000497: 21,3466 13507 TCF SCALDONE
065420,000498:
065421,000499: 21,3467 37746 MULBUSH CA NEG2 # IF ARG IS NOT LESS THAN 1/4, INDEX IS
065422,000500: 21,3470 27744 ADS ININDEX # ZERO, INDICATING NO SHIFT NEEDED.
065423,000501: 21,3471 00006 EXTEND # BRANCH IF ARG IS NOT LESS THAN 1/4.
065424,000502: 21,3472 63465 BZMF SCALSTRT # OTHERWISE COMPARE ARG WITH A REFERENCE
065425,000503: # WHICH IS 4 TIMES LARGER THAN THE LAST.
065426,000504: 21,3473 41751 SCALLOOP CS FUNCTION
065427,000505: 21,3474 51744 INDEX ININDEX
065428,000506: 21,3475 64735 AD BIT15 # REFERENCE MAGNITUDE LESS OR EQUAL TO 1/4
065429,000507: 21,3476 00006 EXTEND
065430,000508: 21,3477 63467 BZMF MULBUSH # IF ARG IS NOT LESS THAN REFERENCE, GO
065431,000509: # AROUND THE MULBERRY BUSH ONCE MORE.
Page 1482 |
065433,000511: 21,3500 51744 INDEX ININDEX
065434,000512: 21,3501 34735 CA BIT15 # THIS IS THE SCALE MAGNITUDE
065435,000513: 21,3502 57747 XCH HALFARG # 2**(-ININDEX) IS THE SHIFT DIVISOR.
065436,000514: 21,3503 00006 EXTEND # RESCALE ARGUMENT.
065437,000515: 21,3504 31752 DCA FUNCTION
065438,000516: 21,3505 00006 EXTEND
065439,000517: 21,3506 11747 DV HALFARG
065440,000518: # ININDEX AND SHFTFLAG PRESERVE INFO FOR
065441,000519: # RESCALING AFTER ROOT PROCESS.
065442,000520: 21,3507 00006 SCALDONE EXTEND
065443,000521: 21,3510 23752 QXCH FUNCTION +1 # SAVE Q FOR RETURN
065444,000522: 21,3511 00006 EXTEND
065445,000523: 21,3512 74736 MP BIT14
065446,000524: 21,3513 55747 TS HALFARG
065447,000525: 21,3514 74737 MASK BIT13
065448,000526: 21,3515 10000 CCS A
065449,000527: 21,3516 33634 CA OCT11276
065450,000528: 21,3517 63632 AD ROOTHALF # INITIAL GUESS IS ROOT 1/2 OR POSMAX
065451,000529: 21,3520 03636 TC ROOTCYCL
065452,000530: 21,3521 03636 TC ROOTCYCL
065453,000531: 21,3522 03636 TC ROOTCYCL
065454,000532: 21,3523 01752 TC FUNCTION +1
065455,000533:
065456,000534: # ****************************************************************************************************************
065457,000535:
065458,000536: 21,3524 03441 RSTOFGTS TC GTSQRT
065459,000537: 21,3525 57742 PRODUCT XCH K2CNTRAL
065460,000538: 21,3526 00006 EXTEND
065461,000539: 21,3527 71742 MP K2CNTRAL
065462,000540: 21,3530 53743 DXCH K2CNTRAL
065463,000541: 21,3531 00006 EXTEND # THE PRODUCT OF
065464,000542: 21,3532 70001 MP L # 1/2 2 1/2
065465,000543: 21,3533 27743 ADS K2CNTRAL +1 # K *(DEL*OMEGA + ALPHA /(2*K))
065466,000544: 21,3534 54001 TS L # AND
065467,000545: 21,3535 13537 TCF +2 # 2
065468,000546: 21,3536 27742 ADS K2CNTRAL # DEL*(DEL*OMEGA + ALPHA /(2*K)) NOW IN
065469,000547: # K2CNTRAL
065470,000548:
065471,000549: 21,3537 31744 DOSHIFT CA ININDEX
065472,000550: 21,3540 00006 EXTEND # MULTIPLY IN THE FACTOR 2(-S), RETURNED
065473,000551: 21,3541 74736 MP BIT14 # BY THE GTSQRT SUBROUTINE
065474,000552: 21,3542 27741 ADS SHFTFLAG
065475,000553: 21,3543 00006 EXTEND
065476,000554: 21,3544 13563 BZF ADDITIN
065477,000555: 21,3545 51741 INDEX SHFTFLAG
065478,000556: 21,3546 34735 CA BIT15
Page 1483 |
065480,000558: 21,3547 57742 XCH K2CNTRAL
065481,000559: 21,3550 00006 EXTEND
065482,000560: 21,3551 71742 MP K2CNTRAL
065483,000561: 21,3552 21740 DAS K2THETA
065484,000562: 21,3553 57742 XCH K2CNTRAL
065485,000563: 21,3554 00006 EXTEND
065486,000564: 21,3555 71743 MP K2CNTRAL +1
065487,000565: 21,3556 27740 ADS K2THETA +1
065488,000566: 21,3557 54001 TS L
065489,000567: 21,3560 13562 TCF +2
065490,000568: 21,3561 27737 ADS K2THETA
065491,000569:
065492,000570: 21,3562 13566 TCF NEGUSUM
065493,000571:
065494,000572: 21,3563 00006 ADDITIN EXTEND
065495,000573: 21,3564 31743 DCA K2CNTRAL
065496,000574: 21,3565 21740 DAS K2THETA # NOW ADD IN THE K2THETA TERM.
065497,000575: 21,3566 11737 NEGUSUM CCS K2THETA # TEST SIGN OF HIGH ORDER PART.
065498,000576: 21,3567 13573 TCF NEGDRIVE
065499,000577: 21,3570 13572 TCF +2
065500,000578: 21,3571 13575 TCF POSDRIVE
065501,000579:
065502,000580: 21,3572 11740 CCS K2THETA +1 # SIGN TEST FOR LOW ORDER PART.
065503,000581: 21,3573 34753 NEGDRIVE CA BIT1
065504,000582: 21,3574 13576 TCF +2 # STOP GIMBAL DRIVE FOR A ZERO NEGUSUM.
065505,000583: 21,3575 44753 POSDRIVE CS BIT1
065506,000584: 21,3576 54001 TS L # SAVE FOR DRIVE REVERSAL TEST.
065507,000585: 21,3577 51750 INDEX QRCNTR
065508,000586: 21,3600 57501 XCH NEGUQ
065509,000587:
065510,000588: 21,3601 00006 EXTEND
065511,000589: 21,3602 70001 MP L # MULTIPLY OLD NEGU AND NEW NEGU.
065512,000590: 21,3603 10001 CCS L
065513,000591: 21,3604 13621 TCF LOUPE # NON-ZERO GIMBAL DRIVE BEING CONTINUED.
065514,000592:
065515,000593: 21,3605 13616 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
065516,000594:
065517,000595: 21,3606 13610 TCF REVERSAL # NON-ZERO GIMBAL DRIVE BEING REVERSED.
065518,000596: 21,3607 13616 TCF ZEROLOUP # NO REVERSAL PROBLEM HERE.
065519,000597:
065520,000598: 21,3610 51750 REVERSAL INDEX QRCNTR # A ZERO-DRIVE PAUSE IS NEEDED HERE. ZERO
065521,000599: 21,3611 55510 TS QACCDOT # IS IN A REGISTER FROM CCS ON (-1).
065522,000600: 21,3612 51750 INDEX QRCNTR
065523,000601: 21,3613 43633 CS GMBLBITA
065524,000602: 21,3614 00006 EXTEND
065525,000603: 21,3615 03012 WAND CHAN12
065526,000604:
065527,000605: 21,3616 41273 ZEROLOUP CS RCSFLAGS # SET UP REQUEST FOR ACDT+C12 CALL.
065528,000606: 21,3617 74747 MASK CALLGMBL
065529,000607: 21,3620 27273 ADS RCSFLAGS
Page 1484 |
065531,000609: 21,3621 11750 LOUPE CCS QRCNTR # HAVE BOTH AXES BEEN PROCESSED?
065532,000610: 21,3622 13115 TCF GOQTRIMG # NO. DO Q AXIS NEXT.
065533,000611:
065534,000612: 21,3623 31505 CA SAVESR # RESTORE THE SR
065535,000613: 21,3624 54021 TS SR
065536,000614:
065537,000615: 21,3625 00006 GOCLOSE EXTEND # TERMINATE THE JASK.
065538,000616: 21,3626 33631 DCA CLOSEADR
065539,000617: 21,3627 52006 DTCB
065540,000618:
065541,000619: 21,3630 E6,1537 EBANK= AOSQ
065542,000620: 21,3630 03236 36106 CLOSEADR 2CADR CLOSEOUT # TERMINATE THE JASK.
065543,000621:
065544,000622: 21,3632 5751 TWELVE EQUALS OCT14
065545,000623: 21,3632 26501 ROOTHALF OCTAL 26501 # SQUARE ROOT OF 1/2
065546,000624: 21,3633 01400 GMBLBITA OCTAL 01400 # INDEXED WRT GMBLBITB DO NOT MOVE ******
065547,000625: 21,3634 11276 OCT11276 OCTAL 11276 # POSMAX - ROOTHALF
065548,000626: 21,3635 06000 GMBLBITB OCTAL 06000 # INDEXED WRT GMBLBITA DO NOT MOVE ******
065549,000627:
065550,000628: # SUBROUTINE ROOTCYCL: BY CRAIG WORK, 3 APRIL 68
065551,000629:
065552,000630: # ROOTCYCL IS A SUBROUTINE WHICH EXECUTES ONE NEWTON SQUARE ROOT ALGORITHM ITERATION. THE INITIAL GUESS AT THE
065553,000631: # SQUARE ROOT IS PRESUMED TO BE IN THE A REGISTER AND ONE-HALF THE SQUARE IS TAKEN FROM HALFARG. THE NEW APPROXI-
065554,000632: # MATION TO THE SQUARE ROOT IS RETURNED IN THE A REGISTER. DEBRIS: A, L, SR, SCRATCH. ROOTCYCL IS CALLED FROM
065555,000633: # LOCATION (LOC) BY A TC ROOTCYCL, AND RETURNS (TC Q) TO LOC +1.
065556,000634:
065557,000635: # WARNING: IF THE INITIAL GUESS IS NOT GREATER THAN THE SQUARE, DIVIDE OR ADD OVERFLOW IS A REAL POSSIBILITY.
065558,000636:
065559,000637: 21,3636 55746 ROOTCYCL TS SCRATCH # STORE X
065560,000638: 21,3637 54021 TS SR # X/2 NOW IN SR
065561,000639: 21,3640 31747 CA HALFARG # ARG/2 IN THE A REG
065562,000640: 21,3641 22007 ZL # PREPARE FOR DIVISION
065563,000641: 21,3642 00006 EXTEND
065564,000642: 21,3643 11746 DV SCRATCH # (ARG/X)/2
065565,000643: 21,3644 60021 AD SR # (X + ARG/X)/2 IN THE A REG
065566,000644: 21,3645 00002 TC Q
065567,000645:
065568,000646:
End of include-file TRIM_GIMBAL_CONTROL_SYSTEM.agc. Parent file is MAIN.agc