Source Code
These source-code files are part of a reconstructed copy of Comanche 67, the
Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 12.
They have been adapted from sources files for Comanche 55, and updated via disassembly of binary dumps of original core rope memory modules, part numbers 2003972-1081, 2003972-1091, 2003972-1111, 2003972-1121, 2003972-1131, and 2003972-1141. Since only binary dumps (rather than listings) of Comanche 67 are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing. |
062473,000002: ## Copyright: Public domain.
062474,000003: ## Filename: RTB_OP_CODES.agc
062475,000004: ## Purpose: A section of Comanche revision 067.
062476,000005: ## It is part of the reconstructed source code for the flight
062477,000006: ## software for the Command Module's (CM) Apollo Guidance Computer
062478,000007: ## (AGC) for Apollo 12. No original listings of this program are
062479,000008: ## available; instead, this file was created via dissassembly of
062480,000009: ## dumps of Comanche 067 core rope modules and comparison with
062481,000010: ## other AGC programs.
062482,000011: ## Assembler: yaYUL
062483,000012: ## Contact: Ron Burkey <info@sandroid.org>.
062484,000013: ## Website: www.ibiblio.org/apollo/index.html
062485,000014: ## Mod history: 2023-08-16 MAS Created from Comanche 055.
062486,000015: ## 2024-05-13 MAS Updated for Comanche 067.
062487,000016:
062488,000017: 22,3510 BANK 22
062489,000018: 22,2000 SETLOC RTBCODES
062490,000019: 22,2000 BANK
062491,000020:
062492,000021: 22,3510 E5,1713 EBANK= XNB
062493,000022: 22,3510 COUNT* $$/RTB
062494,000023:
062495,000024: # LOAD TIME2, TIME1 INTO MPAC:
062496,000025:
062497,000026: 22,3510 00006 LOADTIME EXTEND
062498,000027: 22,3511 30025 DCA TIME2
062499,000028: 22,3512 16024 TCF SLOAD2
062500,000029:
062501,000030: # CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
062502,000031: # DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
062503,000032:
062504,000033: 22,3513 10154 CDULOGIC CCS MPAC
062505,000034: 22,3514 35035 CAF ZERO
062506,000035: 22,3515 13520 TCF +3
062507,000036: 22,3516 13517 NOOP
062508,000037: 22,3517 45016 CS HALF
062509,000038:
062510,000039: 22,3520 54155 TS MPAC +1
062511,000040: 22,3521 35035 CAF ZERO
062512,000041: 22,3522 56154 XCH MPAC
062513,000042: 22,3523 00006 EXTEND
062514,000043: 22,3524 75016 MP HALF
062515,000044: 22,3525 20155 DAS MPAC
062516,000045: 22,3526 16030 TCF DANZIG # MODE IS ALREADY AT DOUBLE-PRECISION
062517,000046:
062518,000047: # READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
062519,000048:
062520,000049: 22,3527 00004 READPIPS INHINT
062521,000050: 22,3530 30037 CA PIPAX
062522,000051: 22,3531 54154 TS MPAC
062523,000052: 22,3532 30040 CA PIPAY
062524,000053: 22,3533 54157 TS MPAC +3
062525,000054: 22,3534 30041 CA PIPAZ
062526,000055: 22,3535 00003 RELINT
062527,000056: 22,3536 54161 TS MPAC +5
062528,000057:
062529,000058: 22,3537 35035 CAF ZERO
062530,000059: 22,3540 54155 TS MPAC +1
062531,000060: 22,3541 54160 TS MPAC +4
062532,000061: 22,3542 54162 TS MPAC +6
062533,000062: 22,3543 16470 VECMODE TCF VMODE
062534,000063:
062535,000064: # FORCE TP SIGN AGREEMENT IN MPAC:
062536,000065:
062537,000066: 22,3544 07226 SGNAGREE TC TPAGREE
062538,000067:
062539,000068:
062540,000069: 22,3545 16030 TCF DANZIG
062541,000070:
062542,000071: # CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
062543,000072: # SCALED IN HALF-REVOLUTIONS.
062544,000073:
062545,000074: 22,3546 03576 1STO2S TC 1TO2SUB
062546,000075: 22,3547 35035 CAF ZERO
062547,000076: 22,3550 54155 TS MPAC +1
062548,000077: 22,3551 16027 TCF NEWMODE
062549,000078:
062550,000079: # DO 1STO2S ON A VECTOR OF ANGLES:
062551,000080:
062552,000081: 22,3552 03576 V1STO2S TC 1TO2SUB # ANSWER ARRIVES IN A AND MPAC.
062553,000082:
062554,000083: 22,3553 52162 DXCH MPAC +5
062555,000084: 22,3554 52155 DXCH MPAC
062556,000085: 22,3555 03576 TC 1TO2SUB
062557,000086: 22,3556 54156 TS MPAC +2
062558,000087:
062559,000088: 22,3557 52160 DXCH MPAC +3
062560,000089: 22,3560 52155 DXCH MPAC
062561,000090: 22,3561 03576 TC 1TO2SUB
062562,000091: 22,3562 54155 TS MPAC +1
062563,000092:
062564,000093: 22,3563 30161 CA MPAC +5
062565,000094: 22,3564 54154 TS MPAC
062566,000095:
062567,000096: 22,3565 35033 TPMODE CAF ONE # MODE IS TP.
062568,000097: 22,3566 16027 TCF NEWMODE
062569,000098:
062570,000099: # V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
062571,000100:
062572,000101: 22,3567 03576 2V1STO2S TC 1TO2SUB
062573,000102: 22,3570 52160 DXCH MPAC +3
062574,000103: 22,3571 52155 DXCH MPAC
062575,000104: 22,3572 03576 TC 1TO2SUB
062576,000105: 22,3573 54001 TS L
062577,000106: 22,3574 30157 CA MPAC +3
062578,000107: 22,3575 16024 TCF SLOAD2
062579,000108:
062580,000109: # SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
062581,000110:
062582,000111: 22,3576 52155 1TO2SUB DXCH MPAC # FINAL MPAC +1 UNSPECIFIED.
062583,000112: 22,3577 20001 DDOUBL
062584,000113: 22,3600 10000 CCS A
062585,000114: 22,3601 65033 AD ONE
062586,000115: 22,3602 13604 TCF +2
062587,000116: 22,3603 40000 COM # THIS WAS REVERSE OF MSU.
062588,000117:
062589,000118: 22,3604 54154 TS MPAC # AND SKIP ON OVERFLOW.
062590,000119: 22,3605 00002 TC Q
062591,000120:
062592,000121: 22,3606 50000 INDEX A # OVERFLOW UNCORRECT AND IN MSU.
062593,000122: 22,3607 35014 CAF LIMITS
062594,000123: 22,3610 26154 ADS MPAC
062595,000124: 22,3611 00002 TC Q
062596,000125:
062597,000126: # SUBROUTINE TO INCREMENT CDUS
062598,000127:
062599,000128: 22,3612 33625 INCRCDUS CAF LOCTHETA
062600,000129: 22,3613 54130 TS BUF # PLACE ADRES(THETA) IN BUF.
062601,000130: 22,3614 30154 CAE MPAC # INCREMENT IN 1S COMPL.
062602,000131: 22,3615 03626 TC CDUINC
062603,000132:
062604,000133: 22,3616 24130 INCR BUF
062605,000134: 22,3617 30157 CAE MPAC +3
062606,000135: 22,3620 03626 TC CDUINC
062607,000136:
062608,000137: 22,3621 24130 INCR BUF
062609,000138: 22,3622 30161 CAE MPAC +5
062610,000139: 22,3623 03626 TC CDUINC
062611,000140:
062612,000141: 22,3624 13543 TCF VECMODE
062613,000142:
062614,000143: 22,3625 01155 LOCTHETA ADRES THETAD
062615,000144:
062616,000145: # THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
062617,000146: # QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
062618,000147: # (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
062619,000148:
062620,000149: 22,3626 54142 CDUINC TS TEM2 # 1S COMPL. QUANT. ARRIVES IN ACC. STORE IT
062621,000150: 22,3627 50130 INDEX BUF
062622,000151: 22,3630 10000 CCS 0 # CHANGE 2S COMPL. ANGLE (IN BUF) INTO 1S
062623,000152: 22,3631 65033 AD ONE
062624,000153: 22,3632 13636 TCF +4
062625,000154: 22,3633 65033 AD ONE
062626,000155: 22,3634 65033 AD ONE # OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
062627,000156: 22,3635 40000 COM
062628,000157:
062629,000158: 22,3636 60142 AD TEM2 # SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
062630,000159: 22,3637 10000 CCS A # BACK TO 2S COMPL.
062631,000160: 22,3640 65033 AD ONE
062632,000161: 22,3641 13643 TCF +2
062633,000162: 22,3642 40000 COM
062634,000163: 22,3643 54142 TS TEM2 # STORE 14BIT QUANTITY WITH PRESENT SIGN
062635,000164: 22,3644 13650 TCF +4
062636,000165: 22,3645 50000 INDEX A # SIGN.
062637,000166: 22,3646 35014 CAF LIMITS # FIX IT, BY ADDING IN 37777 OR 40000
062638,000167: 22,3647 60142 AD TEM2
062639,000168:
062640,000169: 22,3650 50130 INDEX BUF
062641,000170: 22,3651 54000 TS 0 # STORE NEW ANGLE IN 2S COMPLEMENT.
062642,000171: 22,3652 00002 TC Q
062643,000172:
062644,000173: # RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
062645,000174:
062646,000175: 22,3653 50120 PULSEIMU INDEX FIXLOC # ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
062647,000176: 22,3654 30046 CA X1
062648,000177: 22,3655 04676 TC BANKCALL
062649,000178: 22,3656 17206 CADR IMUPULSE
062650,000179: 22,3657 16030 TCF DANZIG
062651,000180:
062652,000181: # EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
062653,000182: # WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
062654,000183: # XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
062655,000184:
062656,000185: 22,3660 02713 XNBEB ECADR XNB
062657,000186: 22,3661 02554 XNB1EB ECADR XNB1
062658,000187:
062659,000188: 22,3662 E5,1713 EBANK= XNB
062660,000189:
062661,000190: 22,3662 33660 TRANSP1 CAF XNBEB
062662,000191: 22,3663 54003 TS EBANK
062663,000192: 22,3664 53716 DXCH XNB +2
062664,000193: 22,3665 53722 DXCH XNB +6
062665,000194: 22,3666 53716 DXCH XNB +2
062666,000195:
062667,000196: 22,3667 53720 DXCH XNB +4
062668,000197: 22,3670 53730 DXCH XNB +12D
062669,000198: 22,3671 53720 DXCH XNB +4
062670,000199:
062671,000200: 22,3672 53726 DXCH XNB +10D
062672,000201: 22,3673 53732 DXCH XNB +14D
062673,000202: 22,3674 53726 DXCH XNB +10D
062674,000203: 22,3675 16030 TCF DANZIG
062675,000204: 22,3676 E5,1554 EBANK= XNB1
062676,000205:
062677,000206: 22,3676 33661 TRANSP2 CAF XNB1EB
062678,000207: 22,3677 54003 TS EBANK
062679,000208: 22,3700 53557 DXCH XNB1 +2
062680,000209: 22,3701 53563 DXCH XNB1 +6
062681,000210: 22,3702 53557 DXCH XNB1 +2
062682,000211:
062683,000212: 22,3703 53561 DXCH XNB1 +4
062684,000213: 22,3704 53571 DXCH XNB1 +12D
062685,000214: 22,3705 53561 DXCH XNB1 +4
062686,000215:
062687,000216: 22,3706 53567 DXCH XNB1 +10D
062688,000217: 22,3707 53573 DXCH XNB1 +14D
062689,000218: 22,3710 53567 DXCH XNB1 +10D
062690,000219: 22,3711 16030 TCF DANZIG
062691,000220:
062692,000221: # THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
062693,000222: # FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED. ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
062694,000223:
062695,000224: # ENTRY MAY BE BY EITHER OF THE FOLLOWING:
062696,000225: # 1. LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
062697,000226: # ENTRY: BOVB
062698,000227: # SIGNMPAC
062699,000228: # 2. GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
062700,000229: # ENTRY: RTB
062701,000230: # SIGNMPAC
062702,000231: # IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
062703,000232:
062704,000233: 22,3712 00006 SIGNMPAC EXTEND
062705,000234: 22,3713 35013 DCA DPOSMAX
062706,000235: 22,3714 52155 DXCH MPAC
062707,000236: 22,3715 10000 CCS A
062708,000237: 22,3716 35035 DPMODE CAF ZERO # SETS MPAC +2 TO ZERO IN THE PROCESS
062709,000238: 22,3717 16026 TCF SLOAD2 +2
062710,000239: 22,3720 13721 TCF +1
062711,000240: 22,3721 00006 EXTEND
062712,000241: 22,3722 45013 DCS DPOSMAX
062713,000242: 22,3723 16024 TCF SLOAD2
062714,000243:
062715,000244: # RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
062716,000245: # UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO. IF NORMUNIT
062717,000246: # IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
062718,000247: # BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
062719,000248:
062720,000249: 22,3724 35033 NORMUNX1 CAF ONE
062721,000250: 22,3725 13727 TCF NORMUNIT +1
062722,000251: 22,3726 35035 NORMUNIT CAF ZERO
062723,000252: 22,3727 60120 AD FIXLOC
062724,000253: 22,3730 54156 TS MPAC +2
062725,000254: 22,3731 04676 TC BANKCALL # GET SIGN AGREEMENT IN ALL COMPONENTS
062726,000255: 22,3732 01010 CADR VECAGREE
062727,000256: 22,3733 10154 CCS MPAC
062728,000257: 22,3734 13770 TCF NOSHIFT
062729,000258: 22,3735 13737 TCF +2
062730,000259: 22,3736 13770 TCF NOSHIFT
062731,000260: 22,3737 10157 CCS MPAC +3
062732,000261: 22,3740 13770 TCF NOSHIFT
062733,000262: 22,3741 13743 TCF +2
062734,000263: 22,3742 13770 TCF NOSHIFT
062735,000264: 22,3743 10161 CCS MPAC +5
062736,000265: 22,3744 13770 TCF NOSHIFT
062737,000266: 22,3745 13747 TCF +2
062738,000267: 22,3746 13770 TCF NOSHIFT
062739,000268: 22,3747 30155 CA MPAC +1 # SHIFT ALL COMPONENTS LEFT 13
062740,000269: 22,3750 00006 EXTEND
062741,000270: 22,3751 75016 MP BIT14
062742,000271: 22,3752 20155 DAS MPAC # DAS GAINS A LITTLE ACCURACY
062743,000272: 22,3753 30160 CA MPAC +4
062744,000273: 22,3754 00006 EXTEND
062745,000274: 22,3755 75016 MP BIT14
062746,000275: 22,3756 20160 DAS MPAC +3
062747,000276: 22,3757 30162 CA MPAC +6
062748,000277: 22,3760 00006 EXTEND
062749,000278: 22,3761 75016 MP BIT14
062750,000279: 22,3762 20162 DAS MPAC +5
062751,000280: 22,3763 35041 CAF THIRTEEN
062752,000281: 22,3764 50156 INDEX MPAC +2
062753,000282: 22,3765 54045 TS 37D
062754,000283: 22,3766 04715 OFFTUNIT TC POSTJUMP
062755,000284: 22,3767 01024 CADR UNIT +1 # SKIP THE "TC VECAGREE" DONE AT UNIT
062756,000285:
062757,000286: 22,3770 35035 NOSHIFT CAF ZERO
062758,000287: 22,3771 13764 TCF OFFTUNIT -2
062759,000288:
062760,000289: # RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
062761,000290:
062762,000291: 22,3772 04676 VECSGNAG TC BANKCALL
062763,000292: 22,3773 01010 CADR VECAGREE
062764,000293: 22,3774 06030 TC DANZIG
End of include-file RTB_OP_CODES.agc. Parent file is MAIN.agc