Source Code
These source-code files were from the printout at the MIT Museum, with many thanks
to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing
it to us. The printout was digitally photographed by Paul Fjeld. A team of
volunteers transcribed the source code manually from these images or, where
appropriate, modified already-transcribed but similar source Colossus 249 (Apollo 9)
source code to agree with the images from the printout. Note that the page images
presented online are of reduced quality, and that higher-quality images
are available. Report any conversion errors or legibility
problems in page images to info@sandroid.org.
Notations on the program listing read, in part:GAP: ASSEMBLE REVISION 055 OF AGC PROGRAM COMANCHE BY NASA 2021113-051 10:28 APR. 1,1969Note that the date is the date of the printout, not the date of the program revision. |
065756,000002: ## Copyright: Public domain.
065757,000003: ## Filename: RTB_OP_CODES.agc
065758,000004: ## Purpose: Part of the source code for Comanche, build 055. It
065759,000005: ## is part of the source code for the Command Module's
065760,000006: ## (CM) Apollo Guidance Computer (AGC), Apollo 11.
065761,000007: ## Assembler: yaYUL
065762,000008: ## Reference: pp. 1508-1516
065763,000009: ## Contact: Ron Burkey <info@sandroid.org>
065764,000010: ## Website: http://www.ibiblio.org/apollo.
065765,000011: ## Mod history: 2009-05-07 RSB Adapted from Colossus249/RTB_OP_CODES.agc
065766,000012: ## and page images.
065767,000013: ## 2009-05-07 RSB Oops! Left out the entire last page before.
065768,000014: ## 2016-12-22 RSB Proofed comment text using octopus/ProoferComments
065769,000015: ## and corrected the errors found.
065770,000016: ##
065771,000017: ## The contents of the "Comanche055" files, in general, are transcribed
065772,000018: ## from scanned documents.
065773,000019: ##
065774,000020: ## Assemble revision 055 of AGC program Comanche by NASA
065775,000021: ## 2021113-051. April 1, 1969.
065776,000022: ##
065777,000023: ## This AGC program shall also be referred to as Colossus 2A
065778,000024: ##
065779,000025: ## Prepared by
065780,000026: ## Massachusetts Institute of Technology
065781,000027: ## 75 Cambridge Parkway
065782,000028: ## Cambridge, Massachusetts
065783,000029: ##
065784,000030: ## under NASA contract NAS 9-4065.
065785,000031: ##
065786,000032: ## Refer directly to the online document mentioned above for further
065787,000033: ## information. Please report any errors to info@sandroid.org.
065788,000034:
Page 1508 |
065790,000036: 22,3510 BANK 22
065791,000037: 22,2000 SETLOC RTBCODES
065792,000038: 22,2000 BANK
065793,000039:
065794,000040: 22,3510 E5,1713 EBANK= XNB
065795,000041: 22,3510 COUNT* $$/RTB
065796,000042:
065797,000043: # LOAD TIME2, TIME1 INTO MPAC:
065798,000044:
065799,000045: 22,3510 00006 LOADTIME EXTEND
065800,000046: 22,3511 30025 DCA TIME2
065801,000047: 22,3512 16024 TCF SLOAD2
065802,000048:
065803,000049: # CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
065804,000050: # DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
065805,000051:
065806,000052: 22,3513 10154 CDULOGIC CCS MPAC
065807,000053: 22,3514 35021 CAF ZERO
065808,000054: 22,3515 13520 TCF +3
065809,000055: 22,3516 13517 NOOP
065810,000056: 22,3517 45002 CS HALF
065811,000057:
065812,000058: 22,3520 54155 TS MPAC +1
065813,000059: 22,3521 35021 CAF ZERO
065814,000060: 22,3522 56154 XCH MPAC
065815,000061: 22,3523 00006 EXTEND
065816,000062: 22,3524 75002 MP HALF
065817,000063: 22,3525 20155 DAS MPAC
065818,000064: 22,3526 16030 TCF DANZIG # MODE IS ALREADY AT DOUBLE-PRECISION
065819,000065:
065820,000066: # READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
065821,000067:
065822,000068: 22,3527 00004 READPIPS INHINT
065823,000069: 22,3530 30037 CA PIPAX
065824,000070: 22,3531 54154 TS MPAC
065825,000071: 22,3532 30040 CA PIPAY
065826,000072: 22,3533 54157 TS MPAC +3
065827,000073: 22,3534 30041 CA PIPAZ
065828,000074: 22,3535 00003 RELINT
065829,000075: 22,3536 54161 TS MPAC +5
065830,000076:
065831,000077: 22,3537 35021 CAF ZERO
065832,000078: 22,3540 54155 TS MPAC +1
065833,000079: 22,3541 54160 TS MPAC +4
065834,000080: 22,3542 54162 TS MPAC +6
065835,000081: 22,3543 16470 VECMODE TCF VMODE
065836,000082:
065837,000083: # FORCE TP SIGN AGREEMENT IN MPAC:
065838,000084:
065839,000085: 22,3544 07226 SGNAGREE TC TPAGREE
065840,000086:
Page 1509 |
065842,000088:
065843,000089: 22,3545 16030 TCF DANZIG
065844,000090:
065845,000091: # CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
065846,000092: # SCALED IN HALF-REVOLUTIONS.
065847,000093:
065848,000094: 22,3546 03576 1STO2S TC 1TO2SUB
065849,000095: 22,3547 35021 CAF ZERO
065850,000096: 22,3550 54155 TS MPAC +1
065851,000097: 22,3551 16027 TCF NEWMODE
065852,000098:
065853,000099: # DO 1STO2S ON A VECTOR OF ANGLES:
065854,000100:
065855,000101: 22,3552 03576 V1STO2S TC 1TO2SUB # ANSWER ARRIVES IN A AND MPAC.
065856,000102:
065857,000103: 22,3553 52162 DXCH MPAC +5
065858,000104: 22,3554 52155 DXCH MPAC
065859,000105: 22,3555 03576 TC 1TO2SUB
065860,000106: 22,3556 54156 TS MPAC +2
065861,000107:
065862,000108: 22,3557 52160 DXCH MPAC +3
065863,000109: 22,3560 52155 DXCH MPAC
065864,000110: 22,3561 03576 TC 1TO2SUB
065865,000111: 22,3562 54155 TS MPAC +1
065866,000112:
065867,000113: 22,3563 30161 CA MPAC +5
065868,000114: 22,3564 54154 TS MPAC
065869,000115:
065870,000116: 22,3565 35017 TPMODE CAF ONE # MODE IS TP.
065871,000117: 22,3566 16027 TCF NEWMODE
065872,000118:
065873,000119: # V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
065874,000120:
065875,000121: 22,3567 03576 2V1STO2S TC 1TO2SUB
065876,000122: 22,3570 52160 DXCH MPAC +3
065877,000123: 22,3571 52155 DXCH MPAC
065878,000124: 22,3572 03576 TC 1TO2SUB
065879,000125: 22,3573 54001 TS L
065880,000126: 22,3574 30157 CA MPAC +3
065881,000127: 22,3575 16024 TCF SLOAD2
065882,000128:
065883,000129: # SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
065884,000130:
065885,000131: 22,3576 52155 1TO2SUB DXCH MPAC # FINAL MPAC +1 UNSPECIFIED.
065886,000132: 22,3577 20001 DDOUBL
065887,000133: 22,3600 10000 CCS A
065888,000134: 22,3601 65017 AD ONE
065889,000135: 22,3602 13604 TCF +2
065890,000136: 22,3603 40000 COM # THIS WAS REVERSE OF MSU.
065891,000137:
065892,000138: 22,3604 54154 TS MPAC # AND SKIP ON OVERFLOW.
Page 1510 |
065894,000140: 22,3605 00002 TC Q
065895,000141:
065896,000142: 22,3606 50000 INDEX A # OVERFLOW UNCORRECT AND IN MSU.
065897,000143: 22,3607 35000 CAF LIMITS
065898,000144: 22,3610 26154 ADS MPAC
065899,000145: 22,3611 00002 TC Q
065900,000146:
Page 1511 |
065902,000148: # SUBROUTINE TO INCREMENT CDUS
065903,000149:
065904,000150: 22,3612 33625 INCRCDUS CAF LOCTHETA
065905,000151: 22,3613 54130 TS BUF # PLACE ADRES(THETA) IN BUF.
065906,000152: 22,3614 30154 CAE MPAC # INCREMENT IN 1S COMPL.
065907,000153: 22,3615 03626 TC CDUINC
065908,000154:
065909,000155: 22,3616 24130 INCR BUF
065910,000156: 22,3617 30157 CAE MPAC +3
065911,000157: 22,3620 03626 TC CDUINC
065912,000158:
065913,000159: 22,3621 24130 INCR BUF
065914,000160: 22,3622 30161 CAE MPAC +5
065915,000161: 22,3623 03626 TC CDUINC
065916,000162:
065917,000163: 22,3624 13543 TCF VECMODE
065918,000164:
065919,000165: 22,3625 01155 LOCTHETA ADRES THETAD
065920,000166:
065921,000167: # THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
065922,000168: # QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
065923,000169: # (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
065924,000170:
065925,000171: 22,3626 54142 CDUINC TS TEM2 # 1S COMPL. QUANT. ARRIVES IN ACC. STORE IT
065926,000172: 22,3627 50130 INDEX BUF
065927,000173: 22,3630 10000 CCS 0 # CHANGE 2S COMPL. ANGLE (IN BUF) INTO 1S
065928,000174: 22,3631 65017 AD ONE
065929,000175: 22,3632 13636 TCF +4
065930,000176: 22,3633 65017 AD ONE
065931,000177: 22,3634 65017 AD ONE # OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
065932,000178: 22,3635 40000 COM
065933,000179:
065934,000180: 22,3636 60142 AD TEM2 # SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
065935,000181: 22,3637 10000 CCS A # BACK TO 2S COMPL.
065936,000182: 22,3640 65017 AD ONE
065937,000183: 22,3641 13643 TCF +2
065938,000184: 22,3642 40000 COM
065939,000185: 22,3643 54142 TS TEM2 # STORE 14BIT QUANTITY WITH PRESENT SIGN
065940,000186: 22,3644 13650 TCF +4
065941,000187: 22,3645 50000 INDEX A # SIGN.
065942,000188: 22,3646 35000 CAF LIMITS # FIX IT, BY ADDING IN 37777 OR 40000
065943,000189: 22,3647 60142 AD TEM2
065944,000190:
065945,000191: 22,3650 50130 INDEX BUF
065946,000192: 22,3651 54000 TS 0 # STORE NEW ANGLE IN 2S COMPLEMENT.
065947,000193: 22,3652 00002 TC Q
065948,000194:
Page 1512 |
065950,000196: # RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
065951,000197:
065952,000198: 22,3653 50120 PULSEIMU INDEX FIXLOC # ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
065953,000199: 22,3654 30046 CA X1
065954,000200: 22,3655 04662 TC BANKCALL
065955,000201: 22,3656 17206 CADR IMUPULSE
065956,000202: 22,3657 16030 TCF DANZIG
065957,000203:
Page 1513 |
065959,000205: # EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
065960,000206: # WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
065961,000207: # XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
065962,000208:
065963,000209: 22,3660 02713 XNBEB ECADR XNB
065964,000210: 22,3661 02554 XNB1EB ECADR XNB1
065965,000211:
065966,000212: 22,3662 E5,1713 EBANK= XNB
065967,000213:
065968,000214: 22,3662 33660 TRANSP1 CAF XNBEB
065969,000215: 22,3663 54003 TS EBANK
065970,000216: 22,3664 53716 DXCH XNB +2
065971,000217: 22,3665 53722 DXCH XNB +6
065972,000218: 22,3666 53716 DXCH XNB +2
065973,000219:
065974,000220: 22,3667 53720 DXCH XNB +4
065975,000221: 22,3670 53730 DXCH XNB +12D
065976,000222: 22,3671 53720 DXCH XNB +4
065977,000223:
065978,000224: 22,3672 53726 DXCH XNB +10D
065979,000225: 22,3673 53732 DXCH XNB +14D
065980,000226: 22,3674 53726 DXCH XNB +10D
065981,000227: 22,3675 16030 TCF DANZIG
065982,000228: 22,3676 E5,1554 EBANK= XNB1
065983,000229:
065984,000230: 22,3676 33661 TRANSP2 CAF XNB1EB
065985,000231: 22,3677 54003 TS EBANK
065986,000232: 22,3700 53557 DXCH XNB1 +2
065987,000233: 22,3701 53563 DXCH XNB1 +6
065988,000234: 22,3702 53557 DXCH XNB1 +2
065989,000235:
065990,000236: 22,3703 53561 DXCH XNB1 +4
065991,000237: 22,3704 53571 DXCH XNB1 +12D
065992,000238: 22,3705 53561 DXCH XNB1 +4
065993,000239:
065994,000240: 22,3706 53567 DXCH XNB1 +10D
065995,000241: 22,3707 53573 DXCH XNB1 +14D
065996,000242: 22,3710 53567 DXCH XNB1 +10D
065997,000243: 22,3711 16030 TCF DANZIG
065998,000244:
Page 1514 |
066000,000246: # THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
066001,000247: # FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED. ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
066002,000248:
066003,000249: # ENTRY MAY BE BY EITHER OF THE FOLLOWING:
066004,000250: # 1. LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
066005,000251: # ENTRY: BOVB
066006,000252: # SIGNMPAC
066007,000253: # 2. GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
066008,000254: # ENTRY: RTB
066009,000255: # SIGNMPAC
066010,000256: # IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
066011,000257:
066012,000258: 22,3712 00006 SIGNMPAC EXTEND
066013,000259: 22,3713 34777 DCA DPOSMAX
066014,000260: 22,3714 52155 DXCH MPAC
066015,000261: 22,3715 10000 CCS A
066016,000262: 22,3716 35021 DPMODE CAF ZERO # SETS MPAC +2 TO ZERO IN THE PROCESS
066017,000263: 22,3717 16026 TCF SLOAD2 +2
066018,000264: 22,3720 13721 TCF +1
066019,000265: 22,3721 00006 EXTEND
066020,000266: 22,3722 44777 DCS DPOSMAX
066021,000267: 22,3723 16024 TCF SLOAD2
066022,000268:
066023,000269: # RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
066024,000270: # UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO. IF NORMUNIT
066025,000271: # IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
066026,000272: # BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
066027,000273:
066028,000274: 22,3724 35017 NORMUNX1 CAF ONE
066029,000275: 22,3725 13727 TCF NORMUNIT +1
066030,000276: 22,3726 35021 NORMUNIT CAF ZERO
066031,000277: 22,3727 60120 AD FIXLOC
066032,000278: 22,3730 54156 TS MPAC +2
066033,000279: 22,3731 04662 TC BANKCALL # GET SIGN AGREEMENT IN ALL COMPONENTS
066034,000280: 22,3732 01010 CADR VECAGREE
066035,000281: 22,3733 10154 CCS MPAC
066036,000282: 22,3734 13770 TCF NOSHIFT
066037,000283: 22,3735 13737 TCF +2
066038,000284: 22,3736 13770 TCF NOSHIFT
066039,000285: 22,3737 10157 CCS MPAC +3
066040,000286: 22,3740 13770 TCF NOSHIFT
066041,000287: 22,3741 13743 TCF +2
066042,000288: 22,3742 13770 TCF NOSHIFT
066043,000289: 22,3743 10161 CCS MPAC +5
066044,000290: 22,3744 13770 TCF NOSHIFT
066045,000291: 22,3745 13747 TCF +2
066046,000292: 22,3746 13770 TCF NOSHIFT
Page 1515 |
066048,000294: 22,3747 30155 CA MPAC +1 # SHIFT ALL COMPONENTS LEFT 13
066049,000295: 22,3750 00006 EXTEND
066050,000296: 22,3751 75002 MP BIT14
066051,000297: 22,3752 20155 DAS MPAC # DAS GAINS A LITTLE ACCURACY
066052,000298: 22,3753 30160 CA MPAC +4
066053,000299: 22,3754 00006 EXTEND
066054,000300: 22,3755 75002 MP BIT14
066055,000301: 22,3756 20160 DAS MPAC +3
066056,000302: 22,3757 30162 CA MPAC +6
066057,000303: 22,3760 00006 EXTEND
066058,000304: 22,3761 75002 MP BIT14
066059,000305: 22,3762 20162 DAS MPAC +5
066060,000306: 22,3763 35025 CAF THIRTEEN
066061,000307: 22,3764 50156 INDEX MPAC +2
066062,000308: 22,3765 54045 TS 37D
066063,000309: 22,3766 04701 OFFTUNIT TC POSTJUMP
066064,000310: 22,3767 01024 CADR UNIT +1 # SKIP THE "TC VECAGREE" DONE AT UNIT
066065,000311:
066066,000312: 22,3770 35021 NOSHIFT CAF ZERO
066067,000313: 22,3771 13764 TCF OFFTUNIT -2
066068,000314:
066069,000315: # RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
066070,000316:
066071,000317: 22,3772 04662 VECSGNAG TC BANKCALL
066072,000318: 22,3773 01010 CADR VECAGREE
066073,000319: 22,3774 06030 TC DANZIG
066074,000320:
Page 1516 |
066076,000322: # MODULE CHANGE FOR NEW LUNAR GRAVITY MODEL
066077,000323: 13,2000 SETLOC MODCHG3
066078,000324: 13,2000 BANK
066079,000325: 13,3770 71214 QUALITY1 BOF DLOAD
066080,000326: 13,3771 00343 MOONFLAG
066081,000327: 13,3772 23220 NBRANCH
066082,000328: 13,3773 00017 URPV
066083,000329: 13,3774 52116 DSQ GOTO
066084,000330: 13,3775 25754 QUALITY2
066085,000331: 12,2000 SETLOC MODCHG2
066086,000332: 12,2000 BANK
066087,000333: 12,3754 63525 QUALITY2 PDDL DSQ # SQUARE INTO 2D, B2
066088,000334: 12,3755 00021 URPV +2 # Y COMPONENT, B1
066089,000335: 12,3756 77625 DSU
066090,000336: 12,3757 74205 DMP VXSC # 5(Y**2-X**2)UR
066091,000337: 12,3760 27755 5/8 # CONSTANT, 5B3
066092,000338: 12,3761 00017 URPV # VECTOR, RESULT MAXIMUM IS 5, SCALING
066093,000339: # HERE B6
066094,000340: 12,3762 65332 VSL3 PDDL # STORE SCALED B3 IN 2D, 4D, 6D FOR XYZ
066095,000341: 12,3763 00017 URPV # X COMPONENT, B1
066096,000342: 12,3764 43342 SR1 DAD # 2 X X COMPONENT FOR B3 SCALING
066097,000343: 12,3765 00003 2D # ADD TO VECTOR X COMPONENT OF ANSWER.
066098,000344: # SAME AS MULTIPLYING BY UNITX. MAX IS 7.
066099,000345: 12,3766 14003 STODL 2D
066100,000346: 12,3767 00021 URPV +2 # Y COMPONENT, B1
066101,000347: 12,3770 44342 SR1 BDSU # 2 X Y COMPONENT FOR B3 SCALING
066102,000348: 12,3771 00005 4D # SUBTRACT FROM VECTOR Y COMPONENT OF
066103,000349: # ANSWER, SAME AS MULTIPLYING BY UNITY.
066104,000350: # MAX IS 7.
066105,000351: 12,3772 00005 STORE 4D # 2D HAS VECTOR, B3.
066106,000352: 12,3773 74335 SLOAD VXSC # MULTIPLY COEFFIECIENT TIMES VECTOR IN 2D
066107,000353: 12,3774 01777 E3J22R2M
066108,000354: 12,3775 43525 PDDL RVQ # J22 TERM X R**4 IN 2D, SCALED B61
066109,000355: 12,3776 00023 COSPHI/2 # SAME AS URPV +4, Z COMPONENT
End of include-file RTB_OP_CODES.agc. Parent file is MAIN.agc