Source Code
These source-code files are part of a reconstructed copy of LM131 revision 1,
the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer
(AGC) software.
The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 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. |
063687,000002: ## Copyright: Public domain.
063688,000003: ## Filename: SPS_BACK-UP_RCS_CONTROL.agc
063689,000004: ## Purpose: A section of LM131 revision 1.
063690,000005: ## It is part of the reconstructed source code for the final
063691,000006: ## release of the flight software for the Lunar Module's (LM)
063692,000007: ## Apollo Guidance Computer (AGC) for Apollo 13. The code has
063693,000008: ## been reconstructed from a listing of Luminary 131 and a dump
063694,000009: ## of a core rope memory module B5, part number 2010802-171,
063695,000010: ## which is the only module different between LM131 revision 1
063696,000011: ## and Luminary 131. The executable generated from this source
063697,000012: ## has been verified against the module dump, so while the names,
063698,000013: ## comments, and ordering may not be exactly correct, the
063699,000014: ## resulting binary is.
063700,000015: ## Reference: pp. 1499-1502
063701,000016: ## Assembler: yaYUL
063702,000017: ## Contact: Ron Burkey <info@sandroid.org>.
063703,000018: ## Website: www.ibiblio.org/apollo/index.html
063704,000019: ## Mod history: 2022-10-28 MAS Created from Luminary 131.
063705,000020:
Page 1499 |
063707,000022: # PROGRAM NAME: SPSRCS
063708,000023: # AUTHOR: EDGAR M. OSHIKA (AC ELECTRONICS)
063709,000024: # MODIFIED: TO RETURN TO ALL AXES VIA Q BY P. S. WEISSMAN, OCT 7, 1968
063710,000025: # MODIFIED TO IMPROVE BENDING STABILITY BY G. KALAN, FEB. 14, 1969
063711,000026:
063712,000027: # FUNCTIONAL DESCRIPTION:
063713,000028: # THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
063714,000029: # PLANE LOGIC.
063715,000030:
063716,000031: # 1. JET SENSE TEST (SPSRCS)
063717,000032: # IF JETS ARE FIRING NEGATIVELY, SET OLDSENSE NEGATIVE AND CONTINUE
063718,000033: # IF JETS ARE FIRING POSITIVELY, SET OLDSENSE POSITIVE AND CONTINUE
063719,000034: # IF JETS ARE NOT FIRING, SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT TEST
063720,000035:
063721,000036: # 2. RATE DEAD BAND TEST
063722,000037: # IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE, LEAVE
063723,000038: # JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE, CONTINUE.
063724,000039: # IF JETS ARE FIRING POSITIVELY AND RATE IS LESS THAN TARGET RATE, LEAVE
063725,000040: # JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE, CONTINUE.
063726,000041:
063727,000042: # 3. OUTER RATE LIMIT TEST (SPSSTART)
063728,000043: # IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
063729,000044: # TO REDUCE RATE AND GO TO INHIBITION LOGIC. OTHERWISE, CONTINUE.
063730,000045:
063731,000046: # 4. COAST ZONE TEST
063732,000047: # IF STATE (E,EDOT) IS BELOW LINE E + 4 X EDOT > -1.4 DEG AND EDOT IS LESS THAN 1.30 DEG/SEC SET JET TIME POSI-
063733,000048: # TIVE AND CONTINUE. OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
063734,000049: # IF STATE IS ABOVE LINE E + 4 X EDOT > +1.4 DEG AND EDOT IS GREATER THAN -1.30 DEG/SEC, SET JET TIME NEGATIVE
063735,000050: # AND CONTINUE. OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
063736,000051:
063737,000052: # 5. INHIBITION LOGIC
063738,000053: # IF OLDSENSE IS NON-ZERO:
063739,000054: # A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
063740,000055: # B) SET INHIBITION COUNTER* AND RETURN IF JET TIME IS ZERO
063741,000056: # C) SET INHIBITION COUNTER,* SET JET TIME TO ZERO AND RETURN IF SIGN
063742,000057: # OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
063743,000058: # IF OLDSENSE IS ZERO:
063744,000059: # A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
063745,000060: # B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
063746,000061: # *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P,AND UV AXES,
063747,000062: # RESPECTIVELY, IN SPSRCS. THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF
Page 1500 |
063749,000064: # EACH DAP PASS.
063750,000065:
063751,000066: # THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION RATE AT WHICH THIS ROUTINE IS CALLED
063752,000067: # AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT. DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
063753,000068: # P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
063754,000069:
063755,000070: # CALLING SEQUENCE:
063756,000071: # INHINT
063757,000072: # TC IBNKCALL
063758,000073: # CADR SPSRCS
063759,000074:
063760,000075: # EXIT:
063761,000076: # TC Q
063762,000077:
063763,000078: # ALARM/ABORT MODE: NONE
063764,000079:
063765,000080: # SUBROUTINES CALLED: NONE
063766,000081:
063767,000082: # INPUT: E, EDOT
063768,000083: # TJP, TJV, TJU TJ MUST NOT BE NEGATIVE ZERO
063769,000084:
063770,000085: # OUTPUT: TJP, TJV, TJU
063771,000086:
063772,000087: 21,3655 BANK 21
063773,000088: 21,2000 SETLOC DAPS4
063774,000089: 21,2000 BANK
063775,000090:
063776,000091: 21,3655 COUNT* $$/DAPBU
063777,000092:
063778,000093: 21,3655 E6,1525 EBANK= TJU
063779,000094: 21,3655 00632 RATELIM2 OCT 00632 # 1.125 DEG/SEC
063780,000095: 21,3656 34736 POSTHRST CA HALF
063781,000096:
063782,000097: 21,3657 51505 NDX AXISCTR
063783,000098: 21,3660 55525 TS TJU
063784,000099: 21,3661 11744 CCS OLDSENSE
063785,000100: 21,3662 13702 TCF POSCHECK # JETS FIRING POSITIVELY
063786,000101: 21,3663 13705 TCF CTRCHECK # JETS OFF. CHECK INHIBITION CTR
063787,000102: 21,3664 51505 NEGCHECK INDEX AXISCTR # JETS FIRING NEGATIVELY
063788,000103: 21,3665 41525 CS TJU
063789,000104: 21,3666 10000 CCS A
063790,000105: 21,3667 00002 TC Q # RETURN
063791,000106: 21,3670 13672 TCF +2
063792,000107: 21,3671 13672 TCF +1 # JETS COMMANDED OFF. SET CTR AND RETURN
063793,000108: 21,3672 51505 SETCTR INDEX AXISCTR # JET FIRING REVERSAL COMMANDED. SET CTR,
063794,000109: 21,3673 33714 CA UTIME # SET JET TIME TO ZERO,AND RETURN
Page 1501 |
063796,000111: 21,3674 51505 INDEX AXISCTR
063797,000112: 21,3675 55767 TS UJETCTR
063798,000113: 21,3676 34755 ZAPTJ CA ZERO
063799,000114: 21,3677 51505 INDEX AXISCTR
063800,000115: 21,3700 55525 TS TJU
063801,000116: 21,3701 00002 TC Q
063802,000117: 21,3702 51505 POSCHECK INDEX AXISCTR
063803,000118: 21,3703 31525 CA TJU
063804,000119: 21,3704 13666 TCF NEGCHECK +2
063805,000120: 21,3705 51505 CTRCHECK INDEX AXISCTR # CHECK JET INHIBITION COUNTER
063806,000121: 21,3706 11767 CCS UJETCTR
063807,000122: 21,3707 13711 TCF +2
063808,000123: 21,3710 00002 TC Q # CTR IS NOT POSITIVE. RETURN
063809,000124: 21,3711 13676 TCF ZAPTJ # CTR IS POSITIVE. INHIBIT FIRINGS
063810,000125: 21,3712 00002 TC Q # CTR IS NOT POSITIVE. RETURN
063811,000126: 21,3713 00004 OCT 00004
063812,000127: 21,3714 00012 UTIME OCT 00012
063813,000128: 21,3715 00012 OCT 00012
063814,000129: 21,3716 E6,1744 OLDSENSE EQUALS DAPTREG1
063815,000130: 21,3716 44753 NEGFIRE CS ONE # JETS FIRING NEGATIVELY
063816,000131: 21,3717 55744 TS OLDSENSE
063817,000132: 21,3720 31427 CA EDOT
063818,000133: 21,3721 13725 TCF +4
063819,000134: 21,3722 34753 PLUSFIRE CA ONE
063820,000135: 21,3723 55744 TS OLDSENSE
063821,000136: 21,3724 41427 CS EDOT # RATE DEAD BAND TEST
063822,000137: 21,3725 22000 LXCH A
063823,000138: 21,3726 40111 CS DAPBOOLS # IF DRIFTBIT = 1, USE ZERO TARGET RATE
063824,000139: 21,3727 74744 MASK DRIFTBIT # IF DRIFTBIT = 0, USE 0.10 RATE TARGET
063825,000140: 21,3730 10000 CCS A
063826,000141: 21,3731 34767 CA RATEDB1
063827,000142: 21,3732 60001 AD L
063828,000143: 21,3733 00006 EXTEND
063829,000144: 21,3734 63744 BZMF SPSSTART
063830,000145: 21,3735 13661 TCF POSTHRST +3
063831,000146:
063832,000147: 21,3736 51505 SPSRCS INDEX AXISCTR # JET SENSE TEST
063833,000148: 21,3737 11525 CCS TJU
063834,000149: 21,3740 13722 TCF PLUSFIRE # JETS FIRING POSITIVELY
063835,000150: 21,3741 13743 TCF +2
063836,000151: 21,3742 13716 TCF NEGFIRE # JETS FIRING NEGATIVELY
063837,000152: 21,3743 55744 TS OLDSENSE # JETS OFF
063838,000153: 21,3744 31427 SPSSTART CA EDOT # OUTER RATE LIMIT TEST
063839,000154: 21,3745 00006 EXTEND
063840,000155: 21,3746 74766 MP RATELIM1
063841,000156: 21,3747 10000 CCS A
063842,000157: 21,3750 13767 TCF NEGTHRST # OUTER RATE LIMIT EXCEEDED
063843,000158: 21,3751 13753 TCF +2
063844,000159: 21,3752 13656 TCF POSTHRST # OUTER RATE LIMIT EXCEEDED
063845,000160: 21,3753 31427 CA EDOT # COAST ZONE TEST
Page 1502 |
063847,000162: 21,3754 61751 AD E
063848,000163: 21,3755 00006 EXTEND
063849,000164: 21,3756 71411 MP DKDB # PAD LOADED DEADBAND. FRESHSTART: 1.4 DEG
063850,000165: 21,3757 00006 EXTEND
063851,000166: 21,3760 13775 BZF TJZERO
063852,000167:
063853,000168: 21,3761 00006 EXTEND
063854,000169: 21,3762 63771 BZMF +7
063855,000170: 21,3763 31427 CA EDOT
063856,000171: 21,3764 63655 AD RATELIM2
063857,000172: 21,3765 00006 EXTEND
063858,000173: 21,3766 63775 BZMF TJZERO
063859,000174: 21,3767 44736 NEGTHRST CS HALF
063860,000175: 21,3770 13657 TCF POSTHRST +1
063861,000176: 21,3771 43655 +7 CS RATELIM2
063862,000177: 21,3772 61427 AD EDOT
063863,000178: 21,3773 00006 EXTEND
063864,000179: 21,3774 63656 BZMF POSTHRST
063865,000180: 21,3775 34755 TJZERO CA ZERO
063866,000181: 21,3776 13657 TCF POSTHRST +1
063867,000182:
063868,000183: 21,3777 4766 RATELIM1 = CALLCODE # = 00032, CORRESPONDING TO 1.73 DEG/SEC
063869,000184: 21,3777 4767 RATEDB1 = TBUILDFX # = 00045, CORRESPONDS TO 0.101 DEG/SEC
End of include-file SPS_BACK-UP_RCS_CONTROL.agc. Parent file is MAIN.agc