Source Code
This is a reconstructed version of Luminary 130, the initial AGC program released
in November 1969 for the Apollo 13 LM. Three more releases
followed before the flown revision was finally manufactured in February 1970.
This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G. In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'. |
058968,000002: ## Copyright: Public domain.
058969,000003: ## Filename: RTB_OP_CODES.agc
058970,000004: ## Purpose: A section of the reconstructed source code for Luminary 130.
058971,000005: ## This was the original program released for the Apollo 13 LM,
058972,000006: ## although several more revisions would follow. It has been
058973,000007: ## reconstructed from a listing of Luminary 131, from which it
058974,000008: ## differs on only two lines in P70-P71. The difference is
058975,000009: ## described in detail in Luminary memo #129, which was used
058976,000010: ## to perform the reconstruction. This file is intended to be a
058977,000011: ## faithful reconstruction, except that the code format has been
058978,000012: ## changed to conform to the requirements of the yaYUL assembler
058979,000013: ## rather than the original YUL assembler.
058980,000014: ## Reference: pp. 1389-1394
058981,000015: ## Contact: Ron Burkey <info@sandroid.org>.
058982,000016: ## Website: www.ibiblio.org/apollo/index.html
058983,000017: ## Mod history: 06/07/03 RSB. Began transcribing.
058984,000018: ## 05/14/05 RSB Corrected website references above.
058985,000019: ## 2017-01-06 RSB Page numbers now agree with those on the
058986,000020: ## original hardcopy, as opposed to the PDF page
058987,000021: ## numbers in 1701.pdf.
058988,000022: ## 2017-02-28 RSB Proofed comment text using octopus/ProoferComments.
058989,000023: ## 2018-09-04 MAS Copied from Luminary 131 for Luminary 130.
058990,000024:
Page 1389 |
058992,000026: 22,3773 BANK 22
058993,000027: 10,2000 SETLOC RTBCODES
058994,000028: 10,2000 BANK
058995,000029:
058996,000030: 10,3574 E5,1664 EBANK= XNB
058997,000031: 10,3574 COUNT* $$/RTB
058998,000032:
058999,000033: # LOAD TIME2, TIME1 INTO MPAC:
059000,000034:
059001,000035: 10,3574 00006 LOADTIME EXTEND
059002,000036: 10,3575 30025 DCA TIME2
059003,000037: 10,3576 16060 TCF SLOAD2
059004,000038:
059005,000039: # CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
059006,000040: # DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
059007,000041:
059008,000042: 10,3577 10154 CDULOGIC CCS MPAC
059009,000043: 10,3600 34755 CAF ZERO
059010,000044: 10,3601 13604 TCF +3
059011,000045: 10,3602 13603 NOOP
059012,000046: 10,3603 44736 CS HALF
059013,000047:
059014,000048: 10,3604 54155 TS MPAC +1
059015,000049: 10,3605 34755 CAF ZERO
059016,000050: 10,3606 56154 XCH MPAC
059017,000051: 10,3607 00006 EXTEND
059018,000052: 10,3610 74736 MP HALF
059019,000053: 10,3611 20155 DAS MPAC
059020,000054: 10,3612 16064 TCF DANZIG # MODE IS ALREADY AT DOUBLE-PRECISION
059021,000055:
059022,000056: # FORCE TP SIGN AGREEMENT IN MPAC:
059023,000057:
059024,000058: 10,3613 07262 SGNAGREE TC TPAGREE
059025,000059: 10,3614 16064 TCF DANZIG
059026,000060:
059027,000061: # CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
059028,000062: # SCALED IN HALF-REVOLUTIONS.
059029,000063:
059030,000064: 10,3615 03645 1STO2S TC 1TO2SUB
059031,000065: 10,3616 34755 CAF ZERO
059032,000066: 10,3617 54155 TS MPAC +1
059033,000067: 10,3620 16063 TCF NEWMODE
059034,000068:
059035,000069: # DO 1STO2S ON A VECTOR OF ANGLES:
059036,000070:
059037,000071: 10,3621 03645 V1STO2S TC 1TO2SUB # ANSWER ARRIVES IN A AND MPAC.
059038,000072:
059039,000073: 10,3622 52162 DXCH MPAC +5
059040,000074: 10,3623 52155 DXCH MPAC
059041,000075: 10,3624 03645 TC 1TO2SUB
Page 1390 |
059043,000077: 10,3625 54156 TS MPAC +2
059044,000078:
059045,000079: 10,3626 52160 DXCH MPAC +3
059046,000080: 10,3627 52155 DXCH MPAC
059047,000081: 10,3630 03645 TC 1TO2SUB
059048,000082: 10,3631 54155 TS MPAC +1
059049,000083:
059050,000084: 10,3632 30161 CA MPAC +5
059051,000085: 10,3633 54154 TS MPAC
059052,000086:
059053,000087: 10,3634 34753 TPMODE CAF ONE # MODE IS TP.
059054,000088: 10,3635 16063 TCF NEWMODE
059055,000089:
059056,000090: # V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
059057,000091:
059058,000092: 10,3636 03645 2V1STO2S TC 1TO2SUB
059059,000093: 10,3637 52160 DXCH MPAC +3
059060,000094: 10,3640 52155 DXCH MPAC
059061,000095: 10,3641 03645 TC 1TO2SUB
059062,000096: 10,3642 54001 TS L
059063,000097: 10,3643 30157 CA MPAC +3
059064,000098: 10,3644 16060 TCF SLOAD2
059065,000099:
059066,000100: # SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
059067,000101:
059068,000102: 10,3645 52155 1TO2SUB DXCH MPAC # FINAL MPAC +1 UNSPECIFIED.
059069,000103: 10,3646 20001 DDOUBL
059070,000104: 10,3647 10000 CCS A
059071,000105: 10,3650 64753 AD ONE
059072,000106: 10,3651 13653 TCF +2
059073,000107: 10,3652 40000 COM # THIS WAS REVERSE OF MSU.
059074,000108:
059075,000109: 10,3653 54154 TS MPAC # AND SKIP ON OVERFLOW.
059076,000110: 10,3654 00002 TC Q
059077,000111:
059078,000112: 10,3655 50000 INDEX A # OVERFLOW UNCORRECT AND IN MSU.
059079,000113: 10,3656 34734 CAF LIMITS
059080,000114: 10,3657 26154 ADS MPAC
059081,000115: 10,3660 00002 TC Q
059082,000116:
059083,000117: # THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
059084,000118: # QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
059085,000119: # (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
059086,000120:
059087,000121: 10,3661 54142 CDUINC TS TEM2 # 1S COMPL. QUANT. ARRIVES IN ACC. STORE IT
059088,000122: 10,3662 50130 INDEX BUF
059089,000123: 10,3663 10000 CCS 0 # CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
059090,000124: 10,3664 64753 AD ONE
059091,000125: 10,3665 13671 TCF +4
059092,000126: 10,3666 64753 AD ONE
Page 1391 |
059094,000128: 10,3667 64753 AD ONE # OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
059095,000129: 10,3670 40000 COM
059096,000130:
059097,000131: 10,3671 60142 AD TEM2 # SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
059098,000132: 10,3672 10000 CCS A # BACK TO 2S COMPL.
059099,000133: 10,3673 64753 AD ONE
059100,000134: 10,3674 13676 TCF +2
059101,000135: 10,3675 40000 COM
059102,000136: 10,3676 54142 TS TEM2 # STORE 14BIT QUANTITY WITH PRESENT SIGN
059103,000137: 10,3677 13703 TCF +4
059104,000138: 10,3700 50000 INDEX A # SIGN.
059105,000139: 10,3701 34734 CAF LIMITS # FIX IT, BY ADDING IN 37777 OR 40000
059106,000140: 10,3702 60142 AD TEM2
059107,000141:
059108,000142: 10,3703 50130 INDEX BUF
059109,000143: 10,3704 54000 TS 0 # STORE NEW ANGLE IN 2S COMPLEMENT.
059110,000144: 10,3705 00002 TC Q
059111,000145:
Page 1392 |
059113,000147: # RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
059114,000148:
059115,000149: 10,3706 50120 PULSEIMU INDEX FIXLOC # ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
059116,000150: 10,3707 30046 CA X1
059117,000151: 10,3710 04616 TC BANKCALL
059118,000152: 10,3711 17314 CADR IMUPULSE
059119,000153: 10,3712 16064 TCF DANZIG
059120,000154:
Page 1393 |
059122,000156: # THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
059123,000157: # FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED. ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
059124,000158:
059125,000159: # ENTRY MAY BE BY EITHER OF THE FOLLOWING:
059126,000160: # 1. LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
059127,000161: # ENTRY: BOVB
059128,000162: # SIGNMPAC
059129,000163: # 2. GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
059130,000164: # ENTRY: RTB
059131,000165: # SIGNMPAC
059132,000166: # IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
059133,000167:
059134,000168: 10,3713 00006 SIGNMPAC EXTEND
059135,000169: 10,3714 34733 DCA DPOSMAX
059136,000170: 10,3715 52155 DXCH MPAC
059137,000171: 10,3716 10000 CCS A
059138,000172: 10,3717 34755 DPMODE CAF ZERO # SETS MPAC +2 TO ZERO IN THE PROCESS
059139,000173: 10,3720 16062 TCF SLOAD2 +2
059140,000174: 10,3721 13722 TCF +1
059141,000175: 10,3722 00006 EXTEND
059142,000176: 10,3723 44733 DCS DPOSMAX
059143,000177: 10,3724 16060 TCF SLOAD2
059144,000178:
059145,000179: # RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
059146,000180: # UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO. IF NORMUNIT
059147,000181: # IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
059148,000182: # BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
059149,000183:
059150,000184: 10,3725 34753 NORMUNX1 CAF ONE
059151,000185: 10,3726 13730 TCF NORMUNIT +1
059152,000186: 10,3727 34755 NORMUNIT CAF ZERO
059153,000187: 10,3730 60120 AD FIXLOC
059154,000188: 10,3731 54156 TS MPAC +2
059155,000189: 10,3732 04616 TC BANKCALL # GET SIGN AGREEMENT IN ALL COMPONENTS
059156,000190: 10,3733 01010 CADR VECAGREE
059157,000191: 10,3734 10154 CCS MPAC
059158,000192: 10,3735 13771 TCF NOSHIFT
059159,000193: 10,3736 13740 TCF +2
059160,000194: 10,3737 13771 TCF NOSHIFT
059161,000195: 10,3740 10157 CCS MPAC +3
059162,000196: 10,3741 13771 TCF NOSHIFT
059163,000197: 10,3742 13744 TCF +2
059164,000198: 10,3743 13771 TCF NOSHIFT
059165,000199: 10,3744 10161 CCS MPAC +5
059166,000200: 10,3745 13771 TCF NOSHIFT
059167,000201: 10,3746 13750 TCF +2
059168,000202: 10,3747 13771 TCF NOSHIFT
Page 1394 |
059170,000204: 10,3750 30155 CA MPAC +1 # SHIFT ALL COMPONENTS LEFT 13
059171,000205: 10,3751 00006 EXTEND
059172,000206: 10,3752 74736 MP BIT14
059173,000207: 10,3753 20155 DAS MPAC # DAS GAINS A LITTLE ACCURACY
059174,000208: 10,3754 30160 CA MPAC +4
059175,000209: 10,3755 00006 EXTEND
059176,000210: 10,3756 74736 MP BIT14
059177,000211: 10,3757 20160 DAS MPAC +3
059178,000212: 10,3760 30162 CA MPAC +6
059179,000213: 10,3761 00006 EXTEND
059180,000214: 10,3762 74736 MP BIT14
059181,000215: 10,3763 20162 DAS MPAC +5
059182,000216: 10,3764 34761 CAF THIRTEEN
059183,000217: 10,3765 50156 INDEX MPAC +2
059184,000218: 10,3766 54045 TS 37D
059185,000219: 10,3767 04635 OFFTUNIT TC POSTJUMP
059186,000220: 10,3770 01024 CADR UNIT +1 # SKIP THE "TC VECAGREE" DONE AT UNIT
059187,000221:
059188,000222: 10,3771 34755 NOSHIFT CAF ZERO
059189,000223: 10,3772 13765 TCF OFFTUNIT -2
059190,000224:
059191,000225: # RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
059192,000226:
059193,000227: 10,3773 04616 VECSGNAG TC BANKCALL
059194,000228: 10,3774 01010 CADR VECAGREE
059195,000229: 10,3775 06064 TC DANZIG
059196,000230:
059197,000231:
End of include-file RTB_OP_CODES.agc. Parent file is MAIN.agc