Source Code
These source-code files are part of a reconstructed copy of Artemis 071, the
first release of the Apollo 15 through 17 Command Module (CM) Apollo Guidance
Computer (AGC) software.
The reconstruction began with source code of Artemis 072 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes between the two versions. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021154-. Note that page numbers in the reconstructed code match those on the Artemis 072 printout, although the changed code would likely have changed page numbers for a real Artemis 071 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. |
064348,000002: ## Copyright: Public domain.
064349,000003: ## Filename: RTB_OP_CODES.agc
064350,000004: ## Purpose: A section of Artemis revision 071.
064351,000005: ## It is part of the reconstructed source code for the first
064352,000006: ## release of the flight software for the Command Module's
064353,000007: ## (CM) Apollo Guidance Computer (AGC) for Apollo 15 through
064354,000008: ## 17. The code has been recreated from a copy of Artemis 072.
064355,000009: ## It has been adapted such that the resulting bugger words
064356,000010: ## exactly match those specified for Artemis 071 in NASA
064357,000011: ## drawing 2021154-, which gives relatively high confidence
064358,000012: ## that the reconstruction is correct.
064359,000013: ## Reference: 1501
064360,000014: ## Assembler: yaYUL
064361,000015: ## Contact: Ron Burkey <info@sandroid.org>.
064362,000016: ## Website: www.ibiblio.org/apollo/index.html
064363,000017: ## Mod history: 2019-08-14 MAS Created from Artemis 072.
064364,000018:
Page 1501 |
064366,000020:
064367,000021: 24,2000 SETLOC RTBCODE1
064368,000022: 24,2000 BANK
064369,000023:
064370,000024: 24,3751 E5,1713 EBANK= XNB
064371,000025: 24,3751 COUNT* $$/RTB
064372,000026:
064373,000027: # LOAD TIME2, TIME1 INTO MPAC:
064374,000028:
064375,000029: 24,3751 00006 LOADTIME EXTEND
064376,000030: 24,3752 30025 DCA TIME2
064377,000031: 24,3753 16024 TCF SLOAD2
064378,000032:
064379,000033: # CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
064380,000034: # DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
064381,000035:
064382,000036: 24,3754 10154 CDULOGIC CCS MPAC
064383,000037: 24,3755 34772 CAF ZERO
064384,000038: 24,3756 13761 TCF +3
064385,000039: 24,3757 13760 NOOP
064386,000040: 24,3760 44753 CS HALF
064387,000041:
064388,000042: 24,3761 54155 TS MPAC +1
064389,000043: 24,3762 34772 CAF ZERO
064390,000044: 24,3763 56154 XCH MPAC
064391,000045: 24,3764 00006 EXTEND
064392,000046: 24,3765 74753 MP HALF
064393,000047: 24,3766 20155 DAS MPAC
064394,000048: 24,3767 16030 TCF DANZIG # MODE IS ALREADY AT DOUBLE-PRECISION
064395,000049:
064396,000050: 22,2000 SETLOC RTBCODES
064397,000051: 22,2000 BANK
064398,000052:
064399,000053: 22,3621 COUNT* $$/RTB
064400,000054:
064401,000055: # READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
064402,000056:
064403,000057: 22,3621 00004 READPIPS INHINT
064404,000058: 22,3622 30037 CA PIPAX
064405,000059: 22,3623 54154 TS MPAC
064406,000060: 22,3624 30040 CA PIPAY
064407,000061: 22,3625 54157 TS MPAC +3
064408,000062: 22,3626 30041 CA PIPAZ
064409,000063: 22,3627 00003 RELINT
064410,000064: 22,3630 54161 TS MPAC +5
064411,000065:
064412,000066: 22,3631 34772 CAF ZERO
064413,000067: 22,3632 54155 TS MPAC +1
064414,000068: 22,3633 54160 TS MPAC +4
064415,000069: 22,3634 54162 TS MPAC +6
064416,000070: 22,3635 16470 VECMODE TCF VMODE
064417,000071:
Page 1502 |
064419,000073:
064420,000074: # FORCE TP SIGN AGREEMENT IN MPAC:
064421,000075:
064422,000076: 22,3636 07226 SGNAGREE TC TPAGREE
064423,000077: 22,3637 16030 TCF DANZIG
064424,000078:
064425,000079: # CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
064426,000080: # SCALED IN HALF-REVOLUTIONS.
064427,000081:
064428,000082: 22,3640 03661 1STO2S TC 1TO2SUB
064429,000083: 22,3641 34772 CAF ZERO
064430,000084: 22,3642 54155 TS MPAC +1
064431,000085: 22,3643 16027 TCF NEWMODE
064432,000086:
064433,000087: # DO 1STO2S ON A VECTOR OF ANGLES:
064434,000088:
064435,000089: 22,3644 03661 V1STO2S TC 1TO2SUB # ANSWER ARRIVES IN A AND MPAC.
064436,000090:
064437,000091: 22,3645 52162 DXCH MPAC +5
064438,000092: 22,3646 52155 DXCH MPAC
064439,000093: 22,3647 03661 TC 1TO2SUB
064440,000094: 22,3650 54156 TS MPAC +2
064441,000095:
064442,000096: 22,3651 52160 DXCH MPAC +3
064443,000097: 22,3652 52155 DXCH MPAC
064444,000098: 22,3653 03661 TC 1TO2SUB
064445,000099: 22,3654 54155 TS MPAC +1
064446,000100:
064447,000101: 22,3655 30161 CA MPAC +5
064448,000102: 22,3656 54154 TS MPAC
064449,000103:
064450,000104: 22,3657 34770 TPMODE CAF ONE # MODE IS TP.
064451,000105: 22,3660 16027 TCF NEWMODE
064452,000106:
064453,000107: # SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
064454,000108:
064455,000109: 22,3661 52155 1TO2SUB DXCH MPAC # FINAL MPAC +1 UNSPECIFIED.
064456,000110: 22,3662 20001 DDOUBL
064457,000111: 22,3663 10000 CCS A
064458,000112: 22,3664 64770 AD ONE
064459,000113: 22,3665 13667 TCF +2
064460,000114: 22,3666 40000 COM # THIS WAS REVERSE OF MSU.
064461,000115:
064462,000116: 22,3667 54154 TS MPAC # AND SKIP ON OVERFLOW.
064463,000117: 22,3670 00002 TC Q
064464,000118:
064465,000119: 22,3671 50000 INDEX A # OVERFLOW UNCORRECT AND IN MSU.
064466,000120: 22,3672 34751 CAF LIMITS
064467,000121: 22,3673 26154 ADS MPAC
064468,000122: 22,3674 00002 TC Q
064469,000123:
Page 1503 |
064471,000125:
064472,000126: # THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
064473,000127: # QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
064474,000128: # (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
064475,000129:
064476,000130: 22,3675 54142 CDUINC TS TEM2 # 1S COMPL.QUANT. ARRIVES IN ACC. STORE IT
064477,000131: 22,3676 50130 INDEX BUF
064478,000132: 22,3677 10000 CCS 0 # CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
064479,000133: 22,3700 64770 AD ONE
064480,000134: 22,3701 13705 TCF +4
064481,000135: 22,3702 64770 AD ONE
064482,000136: 22,3703 64770 AD ONE # OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
064483,000137: 22,3704 40000 COM
064484,000138:
064485,000139: 22,3705 60142 AD TEM2 # SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
064486,000140: 22,3706 10000 CCS A # BACK TO 2S COMPL.
064487,000141: 22,3707 64770 AD ONE
064488,000142: 22,3710 13712 TCF +2
064489,000143: 22,3711 40000 COM
064490,000144: 22,3712 54142 TS TEM2 # STORE 14BIT QUANTITY WITH PRESENT SIGN
064491,000145: 22,3713 13717 TCF +4
064492,000146: 22,3714 50000 INDEX A # SIGN.
064493,000147: 22,3715 34751 CAF LIMITS # FIX IT, BY ADDING IN 37777 OR 40000
064494,000148: 22,3716 60142 AD TEM2
064495,000149:
064496,000150: 22,3717 50130 INDEX BUF
064497,000151: 22,3720 54000 TS 0 # STORE NEW ANGLE IN 2S COMPLEMENT.
064498,000152: 22,3721 00002 TC Q
064499,000153:
Page 1504 |
064501,000155:
064502,000156: # RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
064503,000157:
064504,000158: 22,3722 50120 PULSEIMU INDEX FIXLOC # ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
064505,000159: 22,3723 30046 CA X1
064506,000160: 22,3724 04636 TC BANKCALL
064507,000161: 22,3725 17244 CADR IMUPULSE
064508,000162: 22,3726 16030 TCF DANZIG
064509,000163:
Page 1505 |
064511,000165:
064512,000166: # EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
064513,000167: # WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
064514,000168: # XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
064515,000169:
064516,000170: 22,3727 02713 XNBEB ECADR XNB
064517,000171: 22,3730 02554 XNB1EB ECADR XNB1
064518,000172:
064519,000173: 22,3731 E5,1713 EBANK= XNB
064520,000174:
064521,000175: 22,3731 33727 TRANSP1 CAF XNBEB
064522,000176: 22,3732 54003 TS EBANK
064523,000177: 22,3733 53716 DXCH XNB +2
064524,000178: 22,3734 53722 DXCH XNB +6
064525,000179: 22,3735 53716 DXCH XNB +2
064526,000180:
064527,000181: 22,3736 53720 DXCH XNB +4
064528,000182: 22,3737 53730 DXCH XNB +12D
064529,000183: 22,3740 53720 DXCH XNB +4
064530,000184:
064531,000185: 22,3741 53726 DXCH XNB +10D
064532,000186: 22,3742 53732 DXCH XNB +14D
064533,000187: 22,3743 53726 DXCH XNB +10D
064534,000188: 22,3744 16030 TCF DANZIG
064535,000189:
064536,000190: 22,3745 E5,1554 EBANK= XNB1
064537,000191:
064538,000192: 22,3745 33730 TRANSP2 CAF XNB1EB
064539,000193: 22,3746 54003 TS EBANK
064540,000194: 22,3747 53557 DXCH XNB1 +2
064541,000195: 22,3750 53563 DXCH XNB1 +6
064542,000196: 22,3751 53557 DXCH XNB1 +2
064543,000197:
064544,000198: 22,3752 53561 DXCH XNB1 +4
064545,000199: 22,3753 53571 DXCH XNB1 +12D
064546,000200: 22,3754 53561 DXCH XNB1 +4
064547,000201:
064548,000202: 22,3755 53567 DXCH XNB1 +10D
064549,000203: 22,3756 53573 DXCH XNB1 +14D
064550,000204: 22,3757 53567 DXCH XNB1 +10D
064551,000205: 22,3760 16030 TCF DANZIG
064552,000206:
Page 1506 |
064554,000208:
064555,000209: # THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
064556,000210: # FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED. ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
064557,000211:
064558,000212: # ENTRY MAY BE BY EITHER OF THE FOLLOWING:
064559,000213:
064560,000214: # 1. LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
064561,000215: # ENTRY: BOVB
064562,000216: # SIGNMPAC
064563,000217: # 2. GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
064564,000218: # ENTRY: RTB
064565,000219: # SIGNMPAC
064566,000220:
064567,000221: # IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
064568,000222:
064569,000223: 22,3761 00006 SIGNMPAC EXTEND
064570,000224: 22,3762 34750 DCA DPOSMAX
064571,000225: 22,3763 52155 DXCH MPAC
064572,000226: 22,3764 10000 CCS A
064573,000227: 22,3765 34772 DPMODE CAF ZERO # SETS MPAC +2 TO ZERO IN THE PROCESS
064574,000228: 22,3766 16026 TCF SLOAD2 +2
064575,000229: 22,3767 13770 TCF +1
064576,000230: 22,3770 00006 EXTEND
064577,000231: 22,3771 44750 DCS DPOSMAX
064578,000232: 22,3772 16024 TCF SLOAD2
064579,000233:
064580,000234:
End of include-file RTB_OP_CODES.agc. Parent file is MAIN.agc