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. |
063858,000002: ## Copyright: Public domain.
063859,000003: ## Filename: SPS_BACK-UP_RCS_CONTROL.agc
063860,000004: ## Purpose: A section of Luminary 1C, revision 131.
063861,000005: ## It is part of the source code for the Lunar Module's (LM)
063862,000006: ## Apollo Guidance Computer (AGC) for Apollo 13.
063863,000007: ## This file is intended to be a faithful transcription, except
063864,000008: ## that the code format has been changed to conform to the
063865,000009: ## requirements of the yaYUL assembler rather than the
063866,000010: ## original YUL assembler.
063867,000011: ## Reference: pp. 1499-1502
063868,000012: ## Contact: Ron Burkey <info@sandroid.org>.
063869,000013: ## Website: www.ibiblio.org/apollo/index.html
063870,000014: ## Mod history: 06/08/03 RSB. Began transcribing.
063871,000015: ## 05/14/05 RSB Corrected website reference above.
063872,000016: ## 2010-10-25 JL Indentation fixes.
063873,000017: ## 2017-01-06 RSB Page numbers now agree with those on the
063874,000018: ## original hardcopy, as opposed to the PDF page
063875,000019: ## numbers in 1701.pdf.
063876,000020: ## 2017-02-28 RSB Proofed comment text using octopus/ProoferComments.
063877,000021: ## 2017-03-14 RSB Comment-text fixes noted in proofing Luminary 116.
063878,000022:
![]() |
Page 1499 |
063880,000024: # PROGRAM NAME: SPSRCS
063881,000025: # AUTHOR: EDGAR M. OSHIKA (AC ELECTRONICS)
063882,000026: # MODIFIED: TO RETURN TO ALL AXES VIA Q BY P. S. WEISSMAN, OCT 7, 1968
063883,000027: # MODIFIED TO IMPROVE BENDING STABILITY BY G. KALAN, FEB. 14, 1969
063884,000028:
063885,000029: # FUNCTIONAL DESCRIPTION:
063886,000030: # THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
063887,000031: # PLANE LOGIC.
063888,000032:
063889,000033: # 1. JET SENSE TEST (SPSRCS)
063890,000034: # IF JETS ARE FIRING NEGATIVELY, SET OLDSENSE NEGATIVE AND CONTINUE
063891,000035: # IF JETS ARE FIRING POSITIVELY, SET OLDSENSE POSITIVE AND CONTINUE
063892,000036: # IF JETS ARE NOT FIRING, SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT TEST
063893,000037:
063894,000038: # 2. RATE DEAD BAND TEST
063895,000039: # IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE, LEAVE
063896,000040: # JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE, CONTINUE.
063897,000041: # IF JETS ARE FIRING POSITIVELY AND RATE IS LESS THAN TARGET RATE, LEAVE
063898,000042: # JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE, CONTINUE.
063899,000043:
063900,000044: # 3. OUTER RATE LIMIT TEST (SPSSTART)
063901,000045: # IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
063902,000046: # TO REDUCE RATE AND GO TO INHIBITION LOGIC. OTHERWISE, CONTINUE.
063903,000047:
063904,000048: # 4. COAST ZONE TEST
063905,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-
063906,000050: # TIVE AND CONTINUE. OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
063907,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
063908,000052: # AND CONTINUE. OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
063909,000053:
063910,000054: # 5. INHIBITION LOGIC
063911,000055: # IF OLDSENSE IS NON-ZERO:
063912,000056: # A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
063913,000057: # B) SET INHIBITION COUNTER* AND RETURN IF JET TIME IS ZERO
063914,000058: # C) SET INHIBITION COUNTER,* SET JET TIME TO ZERO AND RETURN IF SIGN
063915,000059: # OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
063916,000060: # IF OLDSENSE IS ZERO:
063917,000061: # A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
063918,000062: # B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
063919,000063: # *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P,AND UV AXES,
063920,000064: # RESPECTIVELY, IN SPSRCS. THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF
![]() |
Page 1500 |
063922,000066: # EACH DAP PASS.
063923,000067:
063924,000068: # THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION RATE AT WHICH THIS ROUTINE IS CALLED
063925,000069: # AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT. DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
063926,000070: # P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
063927,000071:
063928,000072: # CALLING SEQUENCE:
063929,000073: # INHINT
063930,000074: # TC IBNKCALL
063931,000075: # CADR SPSRCS
063932,000076:
063933,000077: # EXIT:
063934,000078: # TC Q
063935,000079:
063936,000080: # ALARM/ABORT MODE: NONE
063937,000081:
063938,000082: # SUBROUTINES CALLED: NONE
063939,000083:
063940,000084: # INPUT: E, EDOT
063941,000085: # TJP, TJV, TJU TJ MUST NOT BE NEGATIVE ZERO
063942,000086:
063943,000087: # OUTPUT: TJP, TJV, TJU
063944,000088:
063945,000089: 21,3655 BANK 21
063946,000090: 21,2000 SETLOC DAPS4
063947,000091: 21,2000 BANK
063948,000092:
063949,000093: 21,3655 COUNT* $$/DAPBU
063950,000094:
063951,000095: 21,3655 E6,1525 EBANK= TJU
063952,000096: 21,3655 00632 RATELIM2 OCT 00632 # 1.125 DEG/SEC
063953,000097: 21,3656 34736 POSTHRST CA HALF
063954,000098:
063955,000099: 21,3657 51505 NDX AXISCTR
063956,000100: 21,3660 55525 TS TJU
063957,000101: 21,3661 11744 CCS OLDSENSE
063958,000102: 21,3662 13702 TCF POSCHECK # JETS FIRING POSITIVELY
063959,000103: 21,3663 13705 TCF CTRCHECK # JETS OFF. CHECK INHIBITION CTR
063960,000104: 21,3664 51505 NEGCHECK INDEX AXISCTR # JETS FIRING NEGATIVELY
063961,000105: 21,3665 41525 CS TJU
063962,000106: 21,3666 10000 CCS A
063963,000107: 21,3667 00002 TC Q # RETURN
063964,000108: 21,3670 13672 TCF +2
063965,000109: 21,3671 13672 TCF +1 # JETS COMMANDED OFF. SET CTR AND RETURN
063966,000110: 21,3672 51505 SETCTR INDEX AXISCTR # JET FIRING REVERSAL COMMANDED. SET CTR,
063967,000111: 21,3673 33714 CA UTIME # SET JET TIME TO ZERO,AND RETURN
![]() |
Page 1501 |
063969,000113: 21,3674 51505 INDEX AXISCTR
063970,000114: 21,3675 55767 TS UJETCTR
063971,000115: 21,3676 34755 ZAPTJ CA ZERO
063972,000116: 21,3677 51505 INDEX AXISCTR
063973,000117: 21,3700 55525 TS TJU
063974,000118: 21,3701 00002 TC Q
063975,000119: 21,3702 51505 POSCHECK INDEX AXISCTR
063976,000120: 21,3703 31525 CA TJU
063977,000121: 21,3704 13666 TCF NEGCHECK +2
063978,000122: 21,3705 51505 CTRCHECK INDEX AXISCTR # CHECK JET INHIBITION COUNTER
063979,000123: 21,3706 11767 CCS UJETCTR
063980,000124: 21,3707 13711 TCF +2
063981,000125: 21,3710 00002 TC Q # CTR IS NOT POSITIVE. RETURN
063982,000126: 21,3711 13676 TCF ZAPTJ # CTR IS POSITIVE. INHIBIT FIRINGS
063983,000127: 21,3712 00002 TC Q # CTR IS NOT POSITIVE. RETURN
063984,000128: 21,3713 00004 OCT 00004
063985,000129: 21,3714 00012 UTIME OCT 00012
063986,000130: 21,3715 00012 OCT 00012
063987,000131: 21,3716 E6,1744 OLDSENSE EQUALS DAPTREG1
063988,000132: 21,3716 44753 NEGFIRE CS ONE # JETS FIRING NEGATIVELY
063989,000133: 21,3717 55744 TS OLDSENSE
063990,000134: 21,3720 31427 CA EDOT
063991,000135: 21,3721 13725 TCF +4
063992,000136: 21,3722 34753 PLUSFIRE CA ONE
063993,000137: 21,3723 55744 TS OLDSENSE
063994,000138: 21,3724 41427 CS EDOT # RATE DEAD BAND TEST
063995,000139: 21,3725 22000 LXCH A
063996,000140: 21,3726 40111 CS DAPBOOLS # IF DRIFTBIT = 1, USE ZERO TARGET RATE
063997,000141: 21,3727 74744 MASK DRIFTBIT # IF DRIFTBIT = 0, USE 0.10 RATE TARGET
063998,000142: 21,3730 10000 CCS A
063999,000143: 21,3731 34767 CA RATEDB1
064000,000144: 21,3732 60001 AD L
064001,000145: 21,3733 00006 EXTEND
064002,000146: 21,3734 63744 BZMF SPSSTART
064003,000147: 21,3735 13661 TCF POSTHRST +3
064004,000148:
064005,000149: 21,3736 51505 SPSRCS INDEX AXISCTR # JET SENSE TEST
064006,000150: 21,3737 11525 CCS TJU
064007,000151: 21,3740 13722 TCF PLUSFIRE # JETS FIRING POSITIVELY
064008,000152: 21,3741 13743 TCF +2
064009,000153: 21,3742 13716 TCF NEGFIRE # JETS FIRING NEGATIVELY
064010,000154: 21,3743 55744 TS OLDSENSE # JETS OFF
064011,000155: 21,3744 31427 SPSSTART CA EDOT # OUTER RATE LIMIT TEST
064012,000156: 21,3745 00006 EXTEND
064013,000157: 21,3746 74766 MP RATELIM1
064014,000158: 21,3747 10000 CCS A
064015,000159: 21,3750 13767 TCF NEGTHRST # OUTER RATE LIMIT EXCEEDED
064016,000160: 21,3751 13753 TCF +2
064017,000161: 21,3752 13656 TCF POSTHRST # OUTER RATE LIMIT EXCEEDED
064018,000162: 21,3753 31427 CA EDOT # COAST ZONE TEST
![]() |
Page 1502 |
064020,000164: 21,3754 61751 AD E
064021,000165: 21,3755 00006 EXTEND
064022,000166: 21,3756 71411 MP DKDB # PAD LOADED DEADBAND. FRESHSTART: 1.4 DEG
064023,000167: 21,3757 00006 EXTEND
064024,000168: 21,3760 13775 BZF TJZERO
064025,000169:
064026,000170: 21,3761 00006 EXTEND
064027,000171: 21,3762 63771 BZMF +7
064028,000172: 21,3763 31427 CA EDOT
064029,000173: 21,3764 63655 AD RATELIM2
064030,000174: 21,3765 00006 EXTEND
064031,000175: 21,3766 63775 BZMF TJZERO
064032,000176: 21,3767 44736 NEGTHRST CS HALF
064033,000177: 21,3770 13657 TCF POSTHRST +1
064034,000178: 21,3771 43655 +7 CS RATELIM2
064035,000179: 21,3772 61427 AD EDOT
064036,000180: 21,3773 00006 EXTEND
064037,000181: 21,3774 63656 BZMF POSTHRST
064038,000182: 21,3775 34755 TJZERO CA ZERO
064039,000183: 21,3776 13657 TCF POSTHRST +1
064040,000184:
064041,000185: 21,3777 4766 RATELIM1 = CALLCODE # = 00032, CORRESPONDING TO 1.73 DEG/SEC
064042,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