### FILE="Main.annotation" ## Copyright: Public domain. ## Filename: IMU_COMPENSATION_PACKAGE.agc ## Purpose: Part of the source code for Colossus, build 249. ## It is part of the source code for the Command Module's (CM) ## Apollo Guidance Computer (AGC), for Apollo 9. ## Assembler: yaYUL ## Reference: pp. 292-301. ## Contact: Ron Burkey . ## Website: www.ibiblio.org/apollo. ## Mod history: 08/09/04 RSB. Began adapting from corresponding Luminary131 ## source file. ## 2010-10-24 JL Fixed page numbers. ## 2016-12-30 RSB Backported BYRO->GYRO from Colossus 237. ## (There's lots more that needs to be backported, ## but I found this one particularly annoying.) ## 2017-01-05 RSB Page numbers now agree with those on the ## original harcopy, as opposed to the PDF page ## numbers in 1701.pdf. ## 2017-01-14 RSB Cross-diff'd comment text (not whitespace) ## vs the already-proofed corresponding Colossus ## 237 and Comanche 55 source-code files ## and corrected errors found. ## 2017-03-16 RSB Comment-text fixes identified in 4-way side-by-side ## diff of Colossus237/249/Comanche55/Artemis72. ## The contents of the "Colossus249" files, in general, are transcribed ## from a scanned copy of the program listing. Notations on this ## document read, in part: ## ## Assemble revision 249 of AGC program Colossus by NASA ## 2021111-041. October 28, 1968. ## ## This AGC program shall also be referred to as ## Colossus 1A ## ## Prepared by ## Massachusetts Institute of Technology ## 75 Cambridge Parkway ## Cambridge, Massachusetts ## under NASA contract NAS 9-4065. ## ## Refer directly to the online document mentioned above for further information. ## Please report any errors (relative to the scanned pages) to info@sandroid.org. ## ## In some cases, where the source code for Luminary 131 overlaps that of ## Colossus 249, this code is instead copied from the corresponding Luminary 131 ## source file, and then is proofed to incorporate any changes. ## Page 292 BANK 7 SETLOC IMUCOMP BANK EBANK= NBDX COUNT 06/ICOMP 1/PIPA CAF LGCOMP # SAVE EBANK OF CALLING PROGRAM XCH EBANK TS MODE CCS GCOMPSW # BYPASS IF GCOMPSW NEGATIVE TCF +3 TCF +2 TCF IRIG1 # RETURN INHINT # ASSURE COMPLETE COMPENSATION OF DELV'S # FOR DOWNLINK. 1/PIPA1 CAF FOUR # PIPAZ, PIPAY, PIPAX TS BUF +2 INDEX BUF +2 CA PIPASCF # (P.P.M.) X 2(-9) EXTEND INDEX BUF +2 MP DELVX # (PP) X 2(+14) NOW (PIPA PULSES) X 2(+5) TS Q # SAVE MAJOR PART CA L # MINOR PART EXTEND MP BIT6 # SCALE 2(+9) SHIFT RIGHT 9 INDEX BUF +2 TS DELVX +1 # FRACTIONAL PIPA PULSES SCALED 2(+14) CA Q # MAJOR PART EXTEND MP BIT6 # SCALE 2(+9) SHIFT RIGHT 9 INDEX BUF +2 DAS DELVX # (PIPAI) + (PIPAI)(SFE) INDEX BUF +2 CS PIPABIAS # (PIPA PULSES)/(CS) X 2(-8) * EXTEND MP 1/PIPADT # (CS) X 2(+8) NOW (PIPA PULSES) X 2(+0) * EXTEND MP BIT1 # SCALE 2(+14) SHIFT RIGHT 14 * INDEX BUF +2 DAS DELVX # (PIPAI) + (PIPAI)(SFE) - (BIAS)(DELTAT) CCS BUF +2 # PIPAZ, PIPAY, PIPAX ## Page 293 AD NEG1 TCF 1/PIPA1 +1 NOOP # LESS THAN ZERO IMPOSSIBLE. RELINT ## Page 294 IRIGCOMP TS GCOMPSW # INDICATE COMMANDS 2 PULSES OR LESS TS BUF # INDEX COUNTER - IRIGX, IRIGY, IRIGZ IRIGX EXTEND DCS DELVX # (PIPA PULSES) X 2(+14) DXCH MPAC CA ADIAX # (GYRO PULSES)/(PIPA PULSE) X 2(-3) * TC GCOMPSUB # -(ADIAX)(PIPAX) (GYRO PULSES) X 2(+14) EXTEND # DCS DELVY # (PIPA PULSES) X 2(+14) DXCH MPAC # CS ADSRAX # (GYRO PULSES)/(PIPA PULSE) X 2(-3) * TC GCOMPSUB # +(ADSRAX)(PIPAY) (GYRO PULSES) X 2(+14) # EXTEND *** # DCS DELVZ *** (PIPA PULSES) X 2(+14) # DXCH MPAC *** # CA ADOAX *** (GYRO PULSES)/(PIPA PULSE) X 2(-3) * # TC GCOMPSUB *** -(ADOAX)(PIPAZ) (GYRO PULSES) X 2(+14) CS NBDX # (GYRO PULSES)/(CS) X 2(-5) TC DRIFTSUB # -(NBDX)(DELTAT) (GYRO PULSES) X 2(+14) IRIGY EXTEND DCS DELVY # (PIPA PULSES) X 2(+14) DXCH MPAC CA ADIAY # (GYRO PULSES)/(PIPA PULSE) X 2(-3) * TC GCOMPSUB # -(ADIAY)(PIPAY) (GYRO PULSES) X 2(+14) EXTEND DCS DELVZ # (PIPA PULSES) X 2(+14) DXCH MPAC CS ADSRAY # (GYRO PULSES)/(PIPA PULSE) X 2(-3) * TC GCOMPSUB # +(ADSRAY)(PIPAZ) (GYRO PULSES) X 2(+14) # EXTEND *** # DCS DELVX *** (PIPA PULSES) X 2(+14) # DXCH MPAC *** # CA ADOAY *** (GYRO PULSES)/(PIPA PULSE) X 2(-3) * # TC GCOMPSUB *** -(ADOAY)(PIPAX) (GYRO PULSES) X 2(+14) CS NBDY # (GYRO PULSES)/(CS) X 2(-5) TC DRIFTSUB # -(NBDY)(DELTAT) (GYRO PULSES) X 2(+14) IRIGZ EXTEND DCS DELVY # (PIPA PULSES) X 2(+14) DXCH MPAC CA ADSRAZ # (GYRO PULSES)/(PIPA PULSE) X 2(-3) * ## Page 295 TC GCOMPSUB # -(ADSRAZ)(PIPAY) (GYRO PULSES) X 2(+14) EXTEND DCS DELVZ # (PIPA PULSES) X 2(+14) DXCH MPAC CA ADIAZ # (GYRO PULSES)/(PIPA PULSE) X 2(-3) * TC GCOMPSUB # -(ADIAZ)(PIPAZ) (GYRO PULSES) X 2(+14) # EXTEND *** # DCS DELVX *** (PIPA PULSE) X 2(+14) # DXCH MPAC *** # CS ADOAZ *** (GYRO PULSES)/(PIPA PULSE) X 2(-3) * # TC GCOMPSUB *** +(ADOAZ)(PIPAX) (GYRO PULSES) X 2(+14) CA NBDZ # (GYRO PULSES)/(CS) X 2(-5) TC DRIFTSUB # +(NBDZ)(DELTAT) (GYRO PULSES) X 2(+14) ## Page 296 CCS GCOMPSW # ARE GYRO COMMANDS GREATER THAN 2 PULSES TCF +2 # YES TCF IRIG1 # NO CA PRIO17 # LEM PRIORITY HIGHER-THIS FOR PRELAUNCH TC NOVAC EBANK= NBDX 2CADR 1/GYRO RELINT IRIG1 CA MODE # SET EBANK FOR RETURN TS EBANK TCF SWRETURN GCOMPSUB XCH MPAC # ADIA OR ADSRA COEFFICIENT ARRIVES IN A EXTEND # C(MPAC) = (PIPA PULSES) X 2(+14) MP MPAC # (GYRO PULSES)/(PIPA PULSE) X 2(-3) * DXCH VBUF # NOW = (GYRO PULSES) X 2(+11) * CA MPAC +1 # MINOR PART PIPA PULSES EXTEND MP MPAC # ADIA OR ADSRA TS L CAF ZERO DAS VBUF # NOW = (GYRO PULSES) X 2(+11) * CA VBUF # PARTIAL RESULT - MAJOR EXTEND MP BIT12 # SCALE 2(+3) SHIFT RIGHT 3 * INDEX BUF # RESULT = (GYRO PULSES) X 2(+14) DAS GCOMP # HI(ADIA)(PIPAI) OR HI(ADSRA)(PIPAI) CA VBUF +1 # PARTIAL RESULT - MINOR EXTEND MP BIT12 # SCALE 2(+3) SHIFT RIGHT 3 * TS L CAF ZERO INDEX BUF # RESULT = (GYRO PULSES) X 2(+14) DAS GCOMP # (ADIA)(PIPAI) OR (ADSRA)(PIPAI) TC Q ## Page 297 DRIFTSUB EXTEND QXCH BUF +1 EXTEND # C(A) = NBD (GYRO PULSES)/(CS) X 2(-5) MP 1/PIPADT # (CS) X 2(+8) NOW (GYRO PULSES) X 2(+3) LXCH MPAC +1 # SAVE FOR FRACTIONAL COMPENSATION EXTEND MP BIT4 # SCALE 2(+11) SHIFT RIGHT 11 INDEX BUF DAS GCOMP # HI(NBD)(DELTAT) (GYRO PULSES) X 2(+14) CA MPAC +1 # NOW MINOR PART EXTEND MP BIT4 # SCALE 2(+11) SHIFT RIGHT 11 TS L CAF ZERO INDEX BUF # ADD IN FRACTIONAL COMPENSATION DAS GCOMP # (NBD)(DELTAT) (GYRO PULSES) X 2(+14) DRFTSUB2 CAF TWO # PIPAX, PIPAY, PIPAZ AD BUF XCH BUF INDEX A CCS GCOMP # ARE GYRO COMMANDS 1 PULSE OR GREATER TCF +2 # YES TC BUF +1 # NO MASK NEGONE CCS A # ARE GYRO COMMANDS GREATER THAN 2 PULSES TS GCOMPSW # YES - SET GCOMPSW POSITIVE TC BUF +1 # NO ## Page 298 1/GYRO CAF FOUR # PIPAZ, PIPAY, PIPAX TS BUF INDEX BUF # SCALE GYRO COMMANDS FOR IMUPULSE CA GCOMP +1 # FRACTIONAL PULSES EXTEND MP BIT8 # SHIFT RIGHT 7 INDEX BUF TS GCOMP +1 # FRACTIONAL PULSES SCALED CAF ZERO # SET GCOMP = 0 FOR DAS INSTRUCTION INDEX BUF XCH GCOMP # GYRO PULSES EXTEND MP BIT8 # SHIFT RIGHT 7 INDEX BUF DAS GCOMP # ADD THESE TO FRACTIONAL PULSES ABOVE CCS BUF # PIPAZ, PIPAY, PIPAX AD NEG1 TCF 1/GYRO +1 LGCOMP ECADR GCOMP # LESS THAN ZERO IMPOSSIBLE CAF LGCOMP TC BANKCALL CADR IMUPULSE # CALL GYRO TORQUING ROUTINE TC BANKCALL CADR IMUSTALL # WAIT FOR PULSES TO GET OUT TCF ENDOFJOB # TEMPORARY GCOMP1 CAF FOUR # PIPAZ, PIPAY, PIPAX TS BUF INDEX BUF # RESCALE CA GCOMP +1 EXTEND MP BIT8 # SHIFT MINOR PART LEFT 7 - MAJOR PART = 0 INDEX BUF LXCH GCOMP +1 # BITS 8-14 OF MINOR PART WERE = 0 CCS BUF # PIPAZ, PIPAY, PIPAX AD NEG1 TCF GCOMP1 +1 V06N30S VN 0630 TCF ENDOFJOB ## Page 299 NBDONLY CCS GCOMPSW # BYPASS IF GCOMPSW NEGATIVE TCF +3 TCF +2 TCF ENDOFJOB INHINT CCS FLAGWRD2 # PREREAD T3RUPT MAY COINCIDE TCF ENDOFJOB TCF ENDOFJOB TCF +1 CA TIME1 # (CS) X 2(+14) XCH 1/PIPADT # PREVIOUS TIME RELINT COM AD 1/PIPADT NBD2 CCS A # CALCULATE ELAPSED TIME AD ONE # NO TIME1 OVERFLOW TCF NBD3 # RESTORE TIME DIFFERENCE AND JUMP TCF +2 # TIME1 OVERFLOW TCF ENDOFJOB # IF ELAPSED TIME = 0 (DIFFERENCE = -0) COM # CALCULATE ABSOLUTE DIFFERENCE AD POSMAX NBD3 EXTEND # C(A) = DELTAT (CS) X 2(+14) MP BIT10 # SHIFT RIGHT 5 DXCH VBUF EXTEND DCA VBUF DXCH MPAC # DELTAT NOW SCALED (CS) X 2(+19) CAF ZERO TS GCOMPSW # INDICATE COMMANDS 2 PULSES OR LESS TS BUF # PIPAX, PIPAY, PIPAZ CS NBDX # (GYRO PULSES)/(CS) X 2(-5) TC FBIASSUB # -(NBDX)(DELTAT) (GYRO PULSES) X 2(+14) EXTEND DCS VBUF DXCH MPAC # DELTAT SCALED (CS) X 2(+19) CA NBDY # (GYRO PULSES)/(CS) X 2(-5) TC FBIASSUB # -(NBDY)(DELTAT) (GYRO PULSES) X 2(+14) EXTEND DCS VBUF DXCH MPAC # DELTAT SCALED (CS) X 2(+19) CS NBDZ # (GYRO PULSES)/(CS) X 2(-5) TC FBIASSUB # +(NBDZ)(DELTAT) (GYRO PULSES) X 2(+14) ## Page 300 CCS GCOMPSW # ARE GYRO COMMANDS GREATER THAN 2 PULSES TCF 1/GYRO # YES TCF ENDOFJOB # NO ## Page 301 FBIASSUB XCH Q TS BUF +1 CA Q # NBD SCALED (GYRO PULSES)/(CS) X 2(-5) EXTEND MP MPAC # DELTAT SCALED (CS) X 2(+19) INDEX BUF DAS GCOMP # HI(NBD)(DELTAT) (GYRO PULSES) X 2(+14) CA Q # NOW FRACTIONAL PART EXTEND MP MPAC +1 TS L CAF ZERO INDEX BUF DAS GCOMP # (NBD)(DELTAT) (GYRO PULSES) X 2(+14) TCF DRFTSUB2 # CHECK MAGNITUDE OF COMPENSATION LASTBIAS TC BANKCALL CADR PIPUSE CCS GCOMPSW # BYPASS IF GCOMPSW NEGATIVE TCF +3 TCF +2 TCF ENDOFJOB CAF PRIO31 # 2 SECONDS SCALED (CS) X 2(+8) XCH 1/PIPADT COM AD PIPTIME1 +1 # TIME AT PIPA1 =0 TCF NBD2