Source Code
These source-code files are part of a reconstructed copy of Luminary 96, the
original release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer
(AGC) software.
The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 96 listing. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. |
058650,000002: ## Copyright: Public domain.
058651,000003: ## Filename: RTB_OP_CODES.agc
058652,000004: ## Purpose: A section of Luminary revision 96.
058653,000005: ## It is part of the reconstructed source code for the
058654,000006: ## original release of the flight software for the Lunar
058655,000007: ## Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
058656,000008: ## The code has been recreated from a previously reconstructed
058657,000009: ## copy of Luminary 97 by undoing changes described in anomaly
058658,000010: ## report LNY-59. The code has been adapted such that the
058659,000011: ## resulting bugger words exactly match those specified for
058660,000012: ## Luminary 96 in NASA drawing 2021152D, which gives relatively
058661,000013: ## high confidence that the reconstruction is correct.
058662,000014: ## Reference: pp. 1397-1402
058663,000015: ## Assembler: yaYUL
058664,000016: ## Contact: Ron Burkey <info@sandroid.org>.
058665,000017: ## Website: www.ibiblio.org/apollo/index.html
058666,000018: ## Mod history: 2019-08-04 MAS Created from Luminary 97.
058667,000019:
Page 1397 |
058669,000021: 22,3773 BANK 22
058670,000022: 10,2000 SETLOC RTBCODES
058671,000023: 10,2000 BANK
058672,000024:
058673,000025: 10,3573 E5,1664 EBANK= XNB
058674,000026: 10,3573 COUNT* $$/RTB
058675,000027:
058676,000028: # LOAD TIME2, TIME1 INTO MPAC:
058677,000029:
058678,000030: 10,3573 00006 LOADTIME EXTEND
058679,000031: 10,3574 30025 DCA TIME2
058680,000032: 10,3575 16055 TCF SLOAD2
058681,000033:
058682,000034: # CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
058683,000035: # DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
058684,000036:
058685,000037: 10,3576 10154 CDULOGIC CCS MPAC
058686,000038: 10,3577 34755 CAF ZERO
058687,000039: 10,3600 13603 TCF +3
058688,000040: 10,3601 13602 NOOP
058689,000041: 10,3602 44736 CS HALF
058690,000042:
058691,000043: 10,3603 54155 TS MPAC +1
058692,000044: 10,3604 34755 CAF ZERO
058693,000045: 10,3605 56154 XCH MPAC
058694,000046: 10,3606 00006 EXTEND
058695,000047: 10,3607 74736 MP HALF
058696,000048: 10,3610 20155 DAS MPAC
058697,000049: 10,3611 16061 TCF DANZIG # MODE IS ALREADY AT DOUBLE-PRECISION
058698,000050:
058699,000051: # FORCE TP SIGN AGREEMENT IN MPAC:
058700,000052:
058701,000053: 10,3612 07257 SGNAGREE TC TPAGREE
058702,000054: 10,3613 16061 TCF DANZIG
058703,000055:
058704,000056: # CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
058705,000057: # SCALED IN HALF-REVOLUTIONS.
058706,000058:
058707,000059: 10,3614 03644 1STO2S TC 1TO2SUB
058708,000060: 10,3615 34755 CAF ZERO
058709,000061: 10,3616 54155 TS MPAC +1
058710,000062: 10,3617 16060 TCF NEWMODE
058711,000063:
058712,000064: # DO 1STO2S ON A VECTOR OF ANGLES:
058713,000065:
058714,000066: 10,3620 03644 V1STO2S TC 1TO2SUB # ANSWER ARRIVES IN A AND MPAC.
058715,000067:
058716,000068: 10,3621 52162 DXCH MPAC +5
058717,000069: 10,3622 52155 DXCH MPAC
058718,000070: 10,3623 03644 TC 1TO2SUB
Page 1398 |
058720,000072: 10,3624 54156 TS MPAC +2
058721,000073:
058722,000074: 10,3625 52160 DXCH MPAC +3
058723,000075: 10,3626 52155 DXCH MPAC
058724,000076: 10,3627 03644 TC 1TO2SUB
058725,000077: 10,3630 54155 TS MPAC +1
058726,000078:
058727,000079: 10,3631 30161 CA MPAC +5
058728,000080: 10,3632 54154 TS MPAC
058729,000081:
058730,000082: 10,3633 34753 TPMODE CAF ONE # MODE IS TP.
058731,000083: 10,3634 16060 TCF NEWMODE
058732,000084:
058733,000085: # V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
058734,000086:
058735,000087: 10,3635 03644 2V1STO2S TC 1TO2SUB
058736,000088: 10,3636 52160 DXCH MPAC +3
058737,000089: 10,3637 52155 DXCH MPAC
058738,000090: 10,3640 03644 TC 1TO2SUB
058739,000091: 10,3641 54001 TS L
058740,000092: 10,3642 30157 CA MPAC +3
058741,000093: 10,3643 16055 TCF SLOAD2
058742,000094:
058743,000095: # SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
058744,000096:
058745,000097: 10,3644 52155 1TO2SUB DXCH MPAC # FINAL MPAC +1 UNSPECIFIED.
058746,000098: 10,3645 20001 DDOUBL
058747,000099: 10,3646 10000 CCS A
058748,000100: 10,3647 64753 AD ONE
058749,000101: 10,3650 13652 TCF +2
058750,000102: 10,3651 40000 COM # THIS WAS REVERSE OF MSU.
058751,000103:
058752,000104: 10,3652 54154 TS MPAC # AND SKIP ON OVERFLOW.
058753,000105: 10,3653 00002 TC Q
058754,000106:
058755,000107: 10,3654 50000 INDEX A # OVERFLOW UNCORRECT AND IN MSU.
058756,000108: 10,3655 34734 CAF LIMITS
058757,000109: 10,3656 26154 ADS MPAC
058758,000110: 10,3657 00002 TC Q
058759,000111:
058760,000112: # THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
058761,000113: # QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
058762,000114: # (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
058763,000115:
058764,000116: 10,3660 54142 CDUINC TS TEM2 # 1S COMPL.QUANT. ARRIVES IN ACC. STORE IT
058765,000117: 10,3661 50130 INDEX BUF
058766,000118: 10,3662 10000 CCS 0 # CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
058767,000119: 10,3663 64753 AD ONE
058768,000120: 10,3664 13670 TCF +4
058769,000121: 10,3665 64753 AD ONE
Page 1399 |
058771,000123: 10,3666 64753 AD ONE # OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
058772,000124: 10,3667 40000 COM
058773,000125:
058774,000126: 10,3670 60142 AD TEM2 # SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
058775,000127: 10,3671 10000 CCS A # BACK TO 2S COMPL.
058776,000128: 10,3672 64753 AD ONE
058777,000129: 10,3673 13675 TCF +2
058778,000130: 10,3674 40000 COM
058779,000131: 10,3675 54142 TS TEM2 # STORE 14BIT QUANTITY WITH PRESENT SIGN
058780,000132: 10,3676 13702 TCF +4
058781,000133: 10,3677 50000 INDEX A # SIGN.
058782,000134: 10,3700 34734 CAF LIMITS # FIX IT, BY ADDING IN 37777 OR 40000
058783,000135: 10,3701 60142 AD TEM2
058784,000136:
058785,000137: 10,3702 50130 INDEX BUF
058786,000138: 10,3703 54000 TS 0 # STORE NEW ANGLE IN 2S COMPLEMENT.
058787,000139: 10,3704 00002 TC Q
058788,000140:
Page 1400 |
058790,000142: # RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
058791,000143:
058792,000144: 10,3705 50120 PULSEIMU INDEX FIXLOC # ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
058793,000145: 10,3706 30046 CA X1
058794,000146: 10,3707 04616 TC BANKCALL
058795,000147: 10,3710 17323 CADR IMUPULSE
058796,000148: 10,3711 16061 TCF DANZIG
058797,000149:
Page 1401 |
058799,000151: # THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
058800,000152: # FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED. ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
058801,000153:
058802,000154: # ENTRY MAY BE BY EITHER OF THE FOLLOWING:
058803,000155: # 1. LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
058804,000156: # ENTRY: BOVB
058805,000157: # SIGNMPAC
058806,000158: # 2. GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
058807,000159: # ENTRY: RTB
058808,000160: # SIGNMPAC
058809,000161: # IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
058810,000162:
058811,000163: 10,3712 00006 SIGNMPAC EXTEND
058812,000164: 10,3713 34733 DCA DPOSMAX
058813,000165: 10,3714 52155 DXCH MPAC
058814,000166: 10,3715 10000 CCS A
058815,000167: 10,3716 34755 DPMODE CAF ZERO # SETS MPAC +2 TO ZERO IN THE PROCESS
058816,000168: 10,3717 16057 TCF SLOAD2 +2
058817,000169: 10,3720 13721 TCF +1
058818,000170: 10,3721 00006 EXTEND
058819,000171: 10,3722 44733 DCS DPOSMAX
058820,000172: 10,3723 16055 TCF SLOAD2
058821,000173:
058822,000174: # RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
058823,000175: # UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO. IF NORMUNIT
058824,000176: # IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
058825,000177: # BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
058826,000178:
058827,000179: 10,3724 34753 NORMUNX1 CAF ONE
058828,000180: 10,3725 13727 TCF NORMUNIT +1
058829,000181: 10,3726 34755 NORMUNIT CAF ZERO
058830,000182: 10,3727 60120 AD FIXLOC
058831,000183: 10,3730 54156 TS MPAC +2
058832,000184: 10,3731 04616 TC BANKCALL # GET SIGN AGREEMENT IN ALL COMPONENTS
058833,000185: 10,3732 01010 CADR VECAGREE
058834,000186: 10,3733 10154 CCS MPAC
058835,000187: 10,3734 13770 TCF NOSHIFT
058836,000188: 10,3735 13737 TCF +2
058837,000189: 10,3736 13770 TCF NOSHIFT
058838,000190: 10,3737 10157 CCS MPAC +3
058839,000191: 10,3740 13770 TCF NOSHIFT
058840,000192: 10,3741 13743 TCF +2
058841,000193: 10,3742 13770 TCF NOSHIFT
058842,000194: 10,3743 10161 CCS MPAC +5
058843,000195: 10,3744 13770 TCF NOSHIFT
058844,000196: 10,3745 13747 TCF +2
058845,000197: 10,3746 13770 TCF NOSHIFT
Page 1402 |
058847,000199: 10,3747 30155 CA MPAC +1 # SHIFT ALL COMPONENTS LEFT 13
058848,000200: 10,3750 00006 EXTEND
058849,000201: 10,3751 74736 MP BIT14
058850,000202: 10,3752 20155 DAS MPAC # DAS GAINS A LITTLE ACCURACY
058851,000203: 10,3753 30160 CA MPAC +4
058852,000204: 10,3754 00006 EXTEND
058853,000205: 10,3755 74736 MP BIT14
058854,000206: 10,3756 20160 DAS MPAC +3
058855,000207: 10,3757 30162 CA MPAC +6
058856,000208: 10,3760 00006 EXTEND
058857,000209: 10,3761 74736 MP BIT14
058858,000210: 10,3762 20162 DAS MPAC +5
058859,000211: 10,3763 34761 CAF THIRTEEN
058860,000212: 10,3764 50156 INDEX MPAC +2
058861,000213: 10,3765 54045 TS 37D
058862,000214: 10,3766 04635 OFFTUNIT TC POSTJUMP
058863,000215: 10,3767 01024 CADR UNIT +1 # SKIP THE "TC VECAGREE" DONE AT UNIT
058864,000216:
058865,000217: 10,3770 34755 NOSHIFT CAF ZERO
058866,000218: 10,3771 13764 TCF OFFTUNIT -2
058867,000219:
058868,000220: # RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
058869,000221:
058870,000222: 10,3772 04616 VECSGNAG TC BANKCALL
058871,000223: 10,3773 01010 CADR VECAGREE
058872,000224: 10,3774 06061 TC DANZIG
058873,000225:
058874,000226:
End of include-file RTB_OP_CODES.agc. Parent file is MAIN.agc