Source Code
This source code is very close to the Apollo Guidance Computer software for the
Apollo 13 Lunar module. This revision of the Luminary 131 program is from December
of 1969, whereas there was a later revision in January of 1970, and still another
revision in February, which is the code that flew on the mission.
As far as this transcription is concerned, it was originally from a copy made in 1991 of
a printout from the collection of AGC developer Don Eyles for collector David Craig.
It was subsequently scanned by Gary Neff, reprocessed for online
presentation at the now-discontinued History of Recent Science and Technology (HRST) website
of MIT's Dibner Institute (the full-quality scans being discarded in the process),
and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a
high-quality replacement scan for a completely illegible page was later provided by Gary
Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many
errors to be introduced into the transcription. Accordingly, a second scan of the same physical
printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive,
and used to correct the transcription errors. All of the scanned materials mentioned,
as well as other Luminary 131 related material, are available online.
Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017,
so the two scans are not identical in that respect. The page-headings in the printout read, in part:GAP: ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091 17:53 DEC. 19, 1969Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together. |
063903,000002: ## Copyright: Public domain.
063904,000003: ## Filename: SPS_BACK-UP_RCS_CONTROL.agc
063905,000004: ## Purpose: A section of Luminary 1C, revision 131.
063906,000005: ## It is part of the source code for the Lunar Module's (LM)
063907,000006: ## Apollo Guidance Computer (AGC) for Apollo 13.
063908,000007: ## This file is intended to be a faithful transcription, except
063909,000008: ## that the code format has been changed to conform to the
063910,000009: ## requirements of the yaYUL assembler rather than the
063911,000010: ## original YUL assembler.
063912,000011: ## Reference: pp. 1499-1502
063913,000012: ## Contact: Ron Burkey <info@sandroid.org>.
063914,000013: ## Website: www.ibiblio.org/apollo/index.html
063915,000014: ## Mod history: 06/08/03 RSB. Began transcribing.
063916,000015: ## 05/14/05 RSB Corrected website reference above.
063917,000016: ## 2010-10-25 JL Indentation fixes.
063918,000017: ## 2017-01-06 RSB Page numbers now agree with those on the
063919,000018: ## original hardcopy, as opposed to the PDF page
063920,000019: ## numbers in 1701.pdf.
063921,000020: ## 2017-02-28 RSB Proofed comment text using octopus/ProoferComments.
063922,000021: ## 2017-03-14 RSB Comment-text fixes noted in proofing Luminary 116.
063923,000022:
Page 1499 |
063925,000024: # PROGRAM NAME: SPSRCS
063926,000025: # AUTHOR: EDGAR M. OSHIKA (AC ELECTRONICS)
063927,000026: # MODIFIED: TO RETURN TO ALL AXES VIA Q BY P. S. WEISSMAN, OCT 7, 1968
063928,000027: # MODIFIED TO IMPROVE BENDING STABILITY BY G. KALAN, FEB. 14, 1969
063929,000028:
063930,000029: # FUNCTIONAL DESCRIPTION:
063931,000030: # THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
063932,000031: # PLANE LOGIC.
063933,000032:
063934,000033: # 1. JET SENSE TEST (SPSRCS)
063935,000034: # IF JETS ARE FIRING NEGATIVELY, SET OLDSENSE NEGATIVE AND CONTINUE
063936,000035: # IF JETS ARE FIRING POSITIVELY, SET OLDSENSE POSITIVE AND CONTINUE
063937,000036: # IF JETS ARE NOT FIRING, SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT TEST
063938,000037:
063939,000038: # 2. RATE DEAD BAND TEST
063940,000039: # IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE, LEAVE
063941,000040: # JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE, CONTINUE.
063942,000041: # IF JETS ARE FIRING POSITIVELY AND RATE IS LESS THAN TARGET RATE, LEAVE
063943,000042: # JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE, CONTINUE.
063944,000043:
063945,000044: # 3. OUTER RATE LIMIT TEST (SPSSTART)
063946,000045: # IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
063947,000046: # TO REDUCE RATE AND GO TO INHIBITION LOGIC. OTHERWISE, CONTINUE.
063948,000047:
063949,000048: # 4. COAST ZONE TEST
063950,000049: # 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-
063951,000050: # TIVE AND CONTINUE. OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
063952,000051: # 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
063953,000052: # AND CONTINUE. OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
063954,000053:
063955,000054: # 5. INHIBITION LOGIC
063956,000055: # IF OLDSENSE IS NON-ZERO:
063957,000056: # A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
063958,000057: # B) SET INHIBITION COUNTER* AND RETURN IF JET TIME IS ZERO
063959,000058: # C) SET INHIBITION COUNTER,* SET JET TIME TO ZERO AND RETURN IF SIGN
063960,000059: # OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
063961,000060: # IF OLDSENSE IS ZERO:
063962,000061: # A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
063963,000062: # B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
063964,000063: # *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P,AND UV AXES,
063965,000064: # RESPECTIVELY, IN SPSRCS. THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF
Page 1500 |
063967,000066: # EACH DAP PASS.
063968,000067:
063969,000068: # THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION RATE AT WHICH THIS ROUTINE IS CALLED
063970,000069: # AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT. DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
063971,000070: # P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
063972,000071:
063973,000072: # CALLING SEQUENCE:
063974,000073: # INHINT
063975,000074: # TC IBNKCALL
063976,000075: # CADR SPSRCS
063977,000076:
063978,000077: # EXIT:
063979,000078: # TC Q
063980,000079:
063981,000080: # ALARM/ABORT MODE: NONE
063982,000081:
063983,000082: # SUBROUTINES CALLED: NONE
063984,000083:
063985,000084: # INPUT: E, EDOT
063986,000085: # TJP, TJV, TJU TJ MUST NOT BE NEGATIVE ZERO
063987,000086:
063988,000087: # OUTPUT: TJP, TJV, TJU
063989,000088:
063990,000089: 21,3655 BANK 21
063991,000090: 21,2000 SETLOC DAPS4
063992,000091: 21,2000 BANK
063993,000092:
063994,000093: 21,3655 COUNT* $$/DAPBU
063995,000094:
063996,000095: 21,3655 E6,1525 EBANK= TJU
063997,000096: 21,3655 00632 RATELIM2 OCT 00632 # 1.125 DEG/SEC
063998,000097: 21,3656 34736 POSTHRST CA HALF
063999,000098:
064000,000099: 21,3657 51505 NDX AXISCTR
064001,000100: 21,3660 55525 TS TJU
064002,000101: 21,3661 11744 CCS OLDSENSE
064003,000102: 21,3662 13702 TCF POSCHECK # JETS FIRING POSITIVELY
064004,000103: 21,3663 13705 TCF CTRCHECK # JETS OFF. CHECK INHIBITION CTR
064005,000104: 21,3664 51505 NEGCHECK INDEX AXISCTR # JETS FIRING NEGATIVELY
064006,000105: 21,3665 41525 CS TJU
064007,000106: 21,3666 10000 CCS A
064008,000107: 21,3667 00002 TC Q # RETURN
064009,000108: 21,3670 13672 TCF +2
064010,000109: 21,3671 13672 TCF +1 # JETS COMMANDED OFF. SET CTR AND RETURN
064011,000110: 21,3672 51505 SETCTR INDEX AXISCTR # JET FIRING REVERSAL COMMANDED. SET CTR,
064012,000111: 21,3673 33714 CA UTIME # SET JET TIME TO ZERO,AND RETURN
Page 1501 |
064014,000113: 21,3674 51505 INDEX AXISCTR
064015,000114: 21,3675 55767 TS UJETCTR
064016,000115: 21,3676 34755 ZAPTJ CA ZERO
064017,000116: 21,3677 51505 INDEX AXISCTR
064018,000117: 21,3700 55525 TS TJU
064019,000118: 21,3701 00002 TC Q
064020,000119: 21,3702 51505 POSCHECK INDEX AXISCTR
064021,000120: 21,3703 31525 CA TJU
064022,000121: 21,3704 13666 TCF NEGCHECK +2
064023,000122: 21,3705 51505 CTRCHECK INDEX AXISCTR # CHECK JET INHIBITION COUNTER
064024,000123: 21,3706 11767 CCS UJETCTR
064025,000124: 21,3707 13711 TCF +2
064026,000125: 21,3710 00002 TC Q # CTR IS NOT POSITIVE. RETURN
064027,000126: 21,3711 13676 TCF ZAPTJ # CTR IS POSITIVE. INHIBIT FIRINGS
064028,000127: 21,3712 00002 TC Q # CTR IS NOT POSITIVE. RETURN
064029,000128: 21,3713 00004 OCT 00004
064030,000129: 21,3714 00012 UTIME OCT 00012
064031,000130: 21,3715 00012 OCT 00012
064032,000131: 21,3716 E6,1744 OLDSENSE EQUALS DAPTREG1
064033,000132: 21,3716 44753 NEGFIRE CS ONE # JETS FIRING NEGATIVELY
064034,000133: 21,3717 55744 TS OLDSENSE
064035,000134: 21,3720 31427 CA EDOT
064036,000135: 21,3721 13725 TCF +4
064037,000136: 21,3722 34753 PLUSFIRE CA ONE
064038,000137: 21,3723 55744 TS OLDSENSE
064039,000138: 21,3724 41427 CS EDOT # RATE DEAD BAND TEST
064040,000139: 21,3725 22000 LXCH A
064041,000140: 21,3726 40111 CS DAPBOOLS # IF DRIFTBIT = 1, USE ZERO TARGET RATE
064042,000141: 21,3727 74744 MASK DRIFTBIT # IF DRIFTBIT = 0, USE 0.10 RATE TARGET
064043,000142: 21,3730 10000 CCS A
064044,000143: 21,3731 34767 CA RATEDB1
064045,000144: 21,3732 60001 AD L
064046,000145: 21,3733 00006 EXTEND
064047,000146: 21,3734 63744 BZMF SPSSTART
064048,000147: 21,3735 13661 TCF POSTHRST +3
064049,000148:
064050,000149: 21,3736 51505 SPSRCS INDEX AXISCTR # JET SENSE TEST
064051,000150: 21,3737 11525 CCS TJU
064052,000151: 21,3740 13722 TCF PLUSFIRE # JETS FIRING POSITIVELY
064053,000152: 21,3741 13743 TCF +2
064054,000153: 21,3742 13716 TCF NEGFIRE # JETS FIRING NEGATIVELY
064055,000154: 21,3743 55744 TS OLDSENSE # JETS OFF
064056,000155: 21,3744 31427 SPSSTART CA EDOT # OUTER RATE LIMIT TEST
064057,000156: 21,3745 00006 EXTEND
064058,000157: 21,3746 74766 MP RATELIM1
064059,000158: 21,3747 10000 CCS A
064060,000159: 21,3750 13767 TCF NEGTHRST # OUTER RATE LIMIT EXCEEDED
064061,000160: 21,3751 13753 TCF +2
064062,000161: 21,3752 13656 TCF POSTHRST # OUTER RATE LIMIT EXCEEDED
064063,000162: 21,3753 31427 CA EDOT # COAST ZONE TEST
Page 1502 |
064065,000164: 21,3754 61751 AD E
064066,000165: 21,3755 00006 EXTEND
064067,000166: 21,3756 71411 MP DKDB # PAD LOADED DEADBAND. FRESHSTART: 1.4 DEG
064068,000167: 21,3757 00006 EXTEND
064069,000168: 21,3760 13775 BZF TJZERO
064070,000169:
064071,000170: 21,3761 00006 EXTEND
064072,000171: 21,3762 63771 BZMF +7
064073,000172: 21,3763 31427 CA EDOT
064074,000173: 21,3764 63655 AD RATELIM2
064075,000174: 21,3765 00006 EXTEND
064076,000175: 21,3766 63775 BZMF TJZERO
064077,000176: 21,3767 44736 NEGTHRST CS HALF
064078,000177: 21,3770 13657 TCF POSTHRST +1
064079,000178: 21,3771 43655 +7 CS RATELIM2
064080,000179: 21,3772 61427 AD EDOT
064081,000180: 21,3773 00006 EXTEND
064082,000181: 21,3774 63656 BZMF POSTHRST
064083,000182: 21,3775 34755 TJZERO CA ZERO
064084,000183: 21,3776 13657 TCF POSTHRST +1
064085,000184:
064086,000185: 21,3777 4766 RATELIM1 = CALLCODE # = 00032, CORRESPONDING TO 1.73 DEG/SEC
064087,000186: 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