Source Code
These source-code files are part of a reconstructed copy of Comanche 45/2 (AKA Manche45 revision 2),
the final, flown mission release of the Apollo 10 Command Module (CM) Apollo Guidance
Computer (AGC) software. Comanche 45/2 was preceded by Comanche 44 and Comanche 45. The
reconstruction is believed to be exactly accurate, but in the absence of an actual Apollo-era
listing of Comanche 45/2, some explanation of the reconstruction process is needed
to insure confidence in that accuracy.
The starting point was the source code of Comanche 45 (itself previously accurately reconstructed). Comanche 45 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 45 and 45/2. The now-reconstructed Comanche 45/2 source code was verified by assembling it and checking that the assembled code had the expected known-correct memory-bank checksums. Note that page numbers in the reconstructed code tend to match those in the Comanche 55, the most-similar revision of Comanche for which we have access to an actual non-reconstructed hardcopy; the source code would likely have different page numbers in a contemporary Comanche 45 listing. Annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change relative to Comanche 44. Here's a guide to the Apollo documentation referenced in those annotations:
|
064006,000002: ## Copyright: Public domain.
064007,000003: ## Filename: RTB_OP_CODES.agc
064008,000004: ## Purpose: A section of Manche45 revision 2.
064009,000005: ## It is part of the reconstructed source code for the
064010,000006: ## final, flown release of the flight software for the Command
064011,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
064012,000008: ## The code has been recreated from a copy of Comanche 055. It
064013,000009: ## has been adapted such that the resulting bugger words
064014,000010: ## exactly match those specified for Manche 45/2 in NASA drawing
064015,000011: ## 2021153D, which gives relatively high confidence that the
064016,000012: ## reconstruction is correct.
064017,000013: ## Assembler: yaYUL
064018,000014: ## Contact: Ron Burkey <info@sandroid.org>.
064019,000015: ## Website: www.ibiblio.org/apollo/index.html
064020,000016: ## Mod history: 2020-12-24 MAS Created from Comanche 45 and added in the
064021,000017: ## QUALITY1 and QUALITY2 functions for the R-2
064022,000018: ## potential model.
064023,000019: ## 2020-12-24 RSB Beefed up reconstruction-justification annotation.
064024,000020:
Page 1508 |
064026,000022: 22,3510 BANK 22
064027,000023: 22,2000 SETLOC RTBCODES
064028,000024: 22,2000 BANK
064029,000025:
064030,000026: 22,3510 E5,1713 EBANK= XNB
064031,000027: 22,3510 COUNT* $$/RTB
064032,000028:
064033,000029: # LOAD TIME2, TIME1 INTO MPAC:
064034,000030:
064035,000031: 22,3510 00006 LOADTIME EXTEND
064036,000032: 22,3511 30025 DCA TIME2
064037,000033: 22,3512 16024 TCF SLOAD2
064038,000034:
064039,000035: # CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
064040,000036: # DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
064041,000037:
064042,000038: 22,3513 10154 CDULOGIC CCS MPAC
064043,000039: 22,3514 35021 CAF ZERO
064044,000040: 22,3515 13520 TCF +3
064045,000041: 22,3516 13517 NOOP
064046,000042: 22,3517 45002 CS HALF
064047,000043:
064048,000044: 22,3520 54155 TS MPAC +1
064049,000045: 22,3521 35021 CAF ZERO
064050,000046: 22,3522 56154 XCH MPAC
064051,000047: 22,3523 00006 EXTEND
064052,000048: 22,3524 75002 MP HALF
064053,000049: 22,3525 20155 DAS MPAC
064054,000050: 22,3526 16030 TCF DANZIG # MODE IS ALREADY AT DOUBLE-PRECISION
064055,000051:
064056,000052: # READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
064057,000053:
064058,000054: 22,3527 00004 READPIPS INHINT
064059,000055: 22,3530 30037 CA PIPAX
064060,000056: 22,3531 54154 TS MPAC
064061,000057: 22,3532 30040 CA PIPAY
064062,000058: 22,3533 54157 TS MPAC +3
064063,000059: 22,3534 30041 CA PIPAZ
064064,000060: 22,3535 00003 RELINT
064065,000061: 22,3536 54161 TS MPAC +5
064066,000062:
064067,000063: 22,3537 35021 CAF ZERO
064068,000064: 22,3540 54155 TS MPAC +1
064069,000065: 22,3541 54160 TS MPAC +4
064070,000066: 22,3542 54162 TS MPAC +6
064071,000067: 22,3543 16470 VECMODE TCF VMODE
064072,000068:
064073,000069: # FORCE TP SIGN AGREEMENT IN MPAC:
064074,000070:
064075,000071: 22,3544 07226 SGNAGREE TC TPAGREE
064076,000072:
Page 1509 |
064078,000074:
064079,000075: 22,3545 16030 TCF DANZIG
064080,000076:
064081,000077: # CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
064082,000078: # SCALED IN HALF-REVOLUTIONS.
064083,000079:
064084,000080: 22,3546 03576 1STO2S TC 1TO2SUB
064085,000081: 22,3547 35021 CAF ZERO
064086,000082: 22,3550 54155 TS MPAC +1
064087,000083: 22,3551 16027 TCF NEWMODE
064088,000084:
064089,000085: # DO 1STO2S ON A VECTOR OF ANGLES:
064090,000086:
064091,000087: 22,3552 03576 V1STO2S TC 1TO2SUB # ANSWER ARRIVES IN A AND MPAC.
064092,000088:
064093,000089: 22,3553 52162 DXCH MPAC +5
064094,000090: 22,3554 52155 DXCH MPAC
064095,000091: 22,3555 03576 TC 1TO2SUB
064096,000092: 22,3556 54156 TS MPAC +2
064097,000093:
064098,000094: 22,3557 52160 DXCH MPAC +3
064099,000095: 22,3560 52155 DXCH MPAC
064100,000096: 22,3561 03576 TC 1TO2SUB
064101,000097: 22,3562 54155 TS MPAC +1
064102,000098:
064103,000099: 22,3563 30161 CA MPAC +5
064104,000100: 22,3564 54154 TS MPAC
064105,000101:
064106,000102: 22,3565 35017 TPMODE CAF ONE # MODE IS TP.
064107,000103: 22,3566 16027 TCF NEWMODE
064108,000104:
064109,000105: # V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
064110,000106:
064111,000107: 22,3567 03576 2V1STO2S TC 1TO2SUB
064112,000108: 22,3570 52160 DXCH MPAC +3
064113,000109: 22,3571 52155 DXCH MPAC
064114,000110: 22,3572 03576 TC 1TO2SUB
064115,000111: 22,3573 54001 TS L
064116,000112: 22,3574 30157 CA MPAC +3
064117,000113: 22,3575 16024 TCF SLOAD2
064118,000114:
064119,000115: # SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
064120,000116:
064121,000117: 22,3576 52155 1TO2SUB DXCH MPAC # FINAL MPAC +1 UNSPECIFIED.
064122,000118: 22,3577 20001 DDOUBL
064123,000119: 22,3600 10000 CCS A
064124,000120: 22,3601 65017 AD ONE
064125,000121: 22,3602 13604 TCF +2
064126,000122: 22,3603 40000 COM # THIS WAS REVERSE OF MSU.
064127,000123:
064128,000124: 22,3604 54154 TS MPAC # AND SKIP ON OVERFLOW.
Page 1510 |
064130,000126: 22,3605 00002 TC Q
064131,000127:
064132,000128: 22,3606 50000 INDEX A # OVERFLOW UNCORRECT AND IN MSU.
064133,000129: 22,3607 35000 CAF LIMITS
064134,000130: 22,3610 26154 ADS MPAC
064135,000131: 22,3611 00002 TC Q
064136,000132:
Page 1511 |
064138,000134: # SUBROUTINE TO INCREMENT CDUS
064139,000135:
064140,000136: 22,3612 33625 INCRCDUS CAF LOCTHETA
064141,000137: 22,3613 54130 TS BUF # PLACE ADRES(THETA) IN BUF.
064142,000138: 22,3614 30154 CAE MPAC # INCREMENT IN 1S COMPL.
064143,000139: 22,3615 03626 TC CDUINC
064144,000140:
064145,000141: 22,3616 24130 INCR BUF
064146,000142: 22,3617 30157 CAE MPAC +3
064147,000143: 22,3620 03626 TC CDUINC
064148,000144:
064149,000145: 22,3621 24130 INCR BUF
064150,000146: 22,3622 30161 CAE MPAC +5
064151,000147: 22,3623 03626 TC CDUINC
064152,000148:
064153,000149: 22,3624 13543 TCF VECMODE
064154,000150:
064155,000151: 22,3625 01155 LOCTHETA ADRES THETAD
064156,000152:
064157,000153: # THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
064158,000154: # QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
064159,000155: # (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
064160,000156:
064161,000157: 22,3626 54142 CDUINC TS TEM2 # 1S COMPL. QUANT. ARRIVES IN ACC. STORE IT
064162,000158: 22,3627 50130 INDEX BUF
064163,000159: 22,3630 10000 CCS 0 # CHANGE 2S COMPL. ANGLE (IN BUF) INTO 1S
064164,000160: 22,3631 65017 AD ONE
064165,000161: 22,3632 13636 TCF +4
064166,000162: 22,3633 65017 AD ONE
064167,000163: 22,3634 65017 AD ONE # OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
064168,000164: 22,3635 40000 COM
064169,000165:
064170,000166: 22,3636 60142 AD TEM2 # SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
064171,000167: 22,3637 10000 CCS A # BACK TO 2S COMPL.
064172,000168: 22,3640 65017 AD ONE
064173,000169: 22,3641 13643 TCF +2
064174,000170: 22,3642 40000 COM
064175,000171: 22,3643 54142 TS TEM2 # STORE 14BIT QUANTITY WITH PRESENT SIGN
064176,000172: 22,3644 13650 TCF +4
064177,000173: 22,3645 50000 INDEX A # SIGN.
064178,000174: 22,3646 35000 CAF LIMITS # FIX IT, BY ADDING IN 37777 OR 40000
064179,000175: 22,3647 60142 AD TEM2
064180,000176:
064181,000177: 22,3650 50130 INDEX BUF
064182,000178: 22,3651 54000 TS 0 # STORE NEW ANGLE IN 2S COMPLEMENT.
064183,000179: 22,3652 00002 TC Q
064184,000180:
Page 1512 |
064186,000182: # RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
064187,000183:
064188,000184: 22,3653 50120 PULSEIMU INDEX FIXLOC # ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
064189,000185: 22,3654 30046 CA X1
064190,000186: 22,3655 04662 TC BANKCALL
064191,000187: 22,3656 17206 CADR IMUPULSE
064192,000188: 22,3657 16030 TCF DANZIG
064193,000189:
Page 1513 |
064195,000191: # EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
064196,000192: # WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
064197,000193: # XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
064198,000194:
064199,000195: 22,3660 02713 XNBEB ECADR XNB
064200,000196: 22,3661 02554 XNB1EB ECADR XNB1
064201,000197:
064202,000198: 22,3662 E5,1713 EBANK= XNB
064203,000199:
064204,000200: 22,3662 33660 TRANSP1 CAF XNBEB
064205,000201: 22,3663 54003 TS EBANK
064206,000202: 22,3664 53716 DXCH XNB +2
064207,000203: 22,3665 53722 DXCH XNB +6
064208,000204: 22,3666 53716 DXCH XNB +2
064209,000205:
064210,000206: 22,3667 53720 DXCH XNB +4
064211,000207: 22,3670 53730 DXCH XNB +12D
064212,000208: 22,3671 53720 DXCH XNB +4
064213,000209:
064214,000210: 22,3672 53726 DXCH XNB +10D
064215,000211: 22,3673 53732 DXCH XNB +14D
064216,000212: 22,3674 53726 DXCH XNB +10D
064217,000213: 22,3675 16030 TCF DANZIG
064218,000214: 22,3676 E5,1554 EBANK= XNB1
064219,000215:
064220,000216: 22,3676 33661 TRANSP2 CAF XNB1EB
064221,000217: 22,3677 54003 TS EBANK
064222,000218: 22,3700 53557 DXCH XNB1 +2
064223,000219: 22,3701 53563 DXCH XNB1 +6
064224,000220: 22,3702 53557 DXCH XNB1 +2
064225,000221:
064226,000222: 22,3703 53561 DXCH XNB1 +4
064227,000223: 22,3704 53571 DXCH XNB1 +12D
064228,000224: 22,3705 53561 DXCH XNB1 +4
064229,000225:
064230,000226: 22,3706 53567 DXCH XNB1 +10D
064231,000227: 22,3707 53573 DXCH XNB1 +14D
064232,000228: 22,3710 53567 DXCH XNB1 +10D
064233,000229: 22,3711 16030 TCF DANZIG
064234,000230:
Page 1514 |
064236,000232: # THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
064237,000233: # FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED. ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
064238,000234:
064239,000235: # ENTRY MAY BE BY EITHER OF THE FOLLOWING:
064240,000236: # 1. LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
064241,000237: # ENTRY: BOVB
064242,000238: # SIGNMPAC
064243,000239: # 2. GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
064244,000240: # ENTRY: RTB
064245,000241: # SIGNMPAC
064246,000242: # IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
064247,000243:
064248,000244: 22,3712 00006 SIGNMPAC EXTEND
064249,000245: 22,3713 34777 DCA DPOSMAX
064250,000246: 22,3714 52155 DXCH MPAC
064251,000247: 22,3715 10000 CCS A
064252,000248: 22,3716 35021 DPMODE CAF ZERO # SETS MPAC +2 TO ZERO IN THE PROCESS
064253,000249: 22,3717 16026 TCF SLOAD2 +2
064254,000250: 22,3720 13721 TCF +1
064255,000251: 22,3721 00006 EXTEND
064256,000252: 22,3722 44777 DCS DPOSMAX
064257,000253: 22,3723 16024 TCF SLOAD2
064258,000254:
064259,000255: # RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
064260,000256: # UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO. IF NORMUNIT
064261,000257: # IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
064262,000258: # BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
064263,000259:
064264,000260: 22,3724 35017 NORMUNX1 CAF ONE
064265,000261: 22,3725 13727 TCF NORMUNIT +1
064266,000262: 22,3726 35021 NORMUNIT CAF ZERO
064267,000263: 22,3727 60120 AD FIXLOC
064268,000264: 22,3730 54156 TS MPAC +2
064269,000265: 22,3731 04662 TC BANKCALL # GET SIGN AGREEMENT IN ALL COMPONENTS
064270,000266: 22,3732 01010 CADR VECAGREE
064271,000267: 22,3733 10154 CCS MPAC
064272,000268: 22,3734 13770 TCF NOSHIFT
064273,000269: 22,3735 13737 TCF +2
064274,000270: 22,3736 13770 TCF NOSHIFT
064275,000271: 22,3737 10157 CCS MPAC +3
064276,000272: 22,3740 13770 TCF NOSHIFT
064277,000273: 22,3741 13743 TCF +2
064278,000274: 22,3742 13770 TCF NOSHIFT
064279,000275: 22,3743 10161 CCS MPAC +5
064280,000276: 22,3744 13770 TCF NOSHIFT
064281,000277: 22,3745 13747 TCF +2
064282,000278: 22,3746 13770 TCF NOSHIFT
Page 1515 |
064284,000280: 22,3747 30155 CA MPAC +1 # SHIFT ALL COMPONENTS LEFT 13
064285,000281: 22,3750 00006 EXTEND
064286,000282: 22,3751 75002 MP BIT14
064287,000283: 22,3752 20155 DAS MPAC # DAS GAINS A LITTLE ACCURACY
064288,000284: 22,3753 30160 CA MPAC +4
064289,000285: 22,3754 00006 EXTEND
064290,000286: 22,3755 75002 MP BIT14
064291,000287: 22,3756 20160 DAS MPAC +3
064292,000288: 22,3757 30162 CA MPAC +6
064293,000289: 22,3760 00006 EXTEND
064294,000290: 22,3761 75002 MP BIT14
064295,000291: 22,3762 20162 DAS MPAC +5
064296,000292: 22,3763 35025 CAF THIRTEEN
064297,000293: 22,3764 50156 INDEX MPAC +2
064298,000294: 22,3765 54045 TS 37D
064299,000295: 22,3766 04701 OFFTUNIT TC POSTJUMP
064300,000296: 22,3767 01024 CADR UNIT +1 # SKIP THE "TC VECAGREE" DONE AT UNIT
064301,000297:
064302,000298: 22,3770 35021 NOSHIFT CAF ZERO
064303,000299: 22,3771 13764 TCF OFFTUNIT -2
064304,000300:
064305,000301: # RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
064306,000302:
064307,000303: 22,3772 04662 VECSGNAG TC BANKCALL
064308,000304: 22,3773 01010 CADR VECAGREE
064309,000305: 22,3774 06030 TC DANZIG
064310,000306:
Page 1516 |
064312,000308: 16,2000 SETLOC MODCHG1
064313,000309: 16,2000 BANK
064314,000310: 16,3715 51575 S40.1A VLOAD ABVAL
064315,000311: 16,3716 03646 DELVSIN
064316,000312: 16,3717 27654 STOVL DELVSAB # COMPUTE FOR P30/P40 INTERFACE
064317,000313: 16,3720 03640 VTIG
064318,000314: 16,3721 77616 RVQ
064319,000315:
Reconstruction: As decribed in an annotation in the ORBITAL INTEGRATION log section the same R-2 model changes made between Comanche 51 and 55 have been backported into Comanche 45. The following block of code, through the end of this log section, is one of those associated changes. |
064324,000320: # MODULE CHANGE FOR NEW LUNAR GRAVITY MODEL
064325,000321: 13,2000 SETLOC MODCHG3
064326,000322: 13,2000 BANK
064327,000323: 13,3770 71214 QUALITY1 BOF DLOAD
064328,000324: 13,3771 00343 MOONFLAG
064329,000325: 13,3772 23220 NBRANCH
064330,000326: 13,3773 00017 URPV
064331,000327: 13,3774 52116 DSQ GOTO
064332,000328: 13,3775 25754 QUALITY2
064333,000329: 12,2000 SETLOC MODCHG2
064334,000330: 12,2000 BANK
064335,000331: 12,3754 63525 QUALITY2 PDDL DSQ # SQUARE INTO 2D, B2
064336,000332: 12,3755 00021 URPV +2 # Y COMPONENT, B1
064337,000333: 12,3756 77625 DSU
064338,000334: 12,3757 74205 DMP VXSC # 5(Y**2-X**2)UR
064339,000335: 12,3760 27755 5/8 # CONSTANT, 5B3
064340,000336: 12,3761 00017 URPV # VECTOR, RESULT MAXIMUM IS 5, SCALING
064341,000337: # HERE B6
064342,000338: 12,3762 65332 VSL3 PDDL # STORE SCALED B3 IN 2D, 4D, 6D FOR XYZ
064343,000339: 12,3763 00017 URPV # X COMPONENT, B1
064344,000340: 12,3764 43342 SR1 DAD # 2 X X COMPONENT FOR B3 SCALING
064345,000341: 12,3765 00003 2D # ADD TO VECTOR X COMPONENT OF ANSWER.
064346,000342: # SAME AS MULTIPLYING BY UNITX. MAX IS 7.
064347,000343: 12,3766 14003 STODL 2D
064348,000344: 12,3767 00021 URPV +2 # Y COMPONENT, B1
064349,000345: 12,3770 44342 SR1 BDSU # 2 X Y COMPONENT FOR B3 SCALING
064350,000346: 12,3771 00005 4D # SUBTRACT FROM VECTOR Y COMPONENT OF
064351,000347: # ANSWER, SAME AS MULTIPLYING BY UNITY.
064352,000348: # MAX IS 7.
064353,000349: 12,3772 00005 STORE 4D # 2D HAS VECTOR, B3.
064354,000350: 12,3773 74335 SLOAD VXSC # MULTIPLY COEFFIECIENT TIMES VECTOR IN 2D
064355,000351: 12,3774 01774 E3J22R2M
064356,000352: 12,3775 43525 PDDL RVQ # J22 TERM X R**4 IN 2D, SCALED B61
064357,000353: 12,3776 00023 COSPHI/2 # SAME AS URPV +4, Z COMPONENT
End of include-file RTB_OP_CODES.agc. Parent file is MAIN.agc