Source Code

This is a reconstructed version of Luminary 130, the initial AGC program released in November 1969 for the Apollo 13 LM. Three more releases followed before the flown revision was finally manufactured in February 1970.

This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G.

In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'.

064269,000002:                                                                                                  ## Copyright:   Public domain.
064270,000003:                                                                                                  ## Filename:    SPS_BACK-UP_RCS_CONTROL.agc
064271,000004:                                                                                                  ## Purpose:     A section of the reconstructed source code for Luminary 130.
064272,000005:                                                                                                  ##              This was the original program released for the Apollo 13 LM,
064273,000006:                                                                                                  ##              although several more revisions would follow. It has been
064274,000007:                                                                                                  ##              reconstructed from a listing of Luminary 131, from which it
064275,000008:                                                                                                  ##              differs on only two lines in P70-P71. The difference is
064276,000009:                                                                                                  ##              described in detail in Luminary memo #129, which was used
064277,000010:                                                                                                  ##              to perform the reconstruction. This file is intended to be a
064278,000011:                                                                                                  ##              faithful reconstruction, except that the code format has been
064279,000012:                                                                                                  ##              changed to conform to the requirements of the yaYUL assembler
064280,000013:                                                                                                  ##              rather than the original YUL assembler.
064281,000014:                                                                                                  ## Reference:   pp. 1499-1502 
064282,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
064283,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
064284,000017:                                                                                                  ## Mod history: 06/08/03 RSB.   Began transcribing.
064285,000018:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
064286,000019:                                                                                                  ##              2010-10-25 JL   Indentation fixes.
064287,000020:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
064288,000021:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
064289,000022:                                                                                                  ##                              numbers in 1701.pdf.
064290,000023:                                                                                                  ##              2017-02-28 RSB  Proofed comment text using octopus/ProoferComments.
064291,000024:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes noted in proofing Luminary 116.
064292,000025:                                                                                                  ##              2018-09-04 MAS  Copied from Luminary 131 for Luminary 130.
064293,000026: 

Page 1499

064295,000028:                                                                                                  #  PROGRAM NAME:         SPSRCS
064296,000029:                                                                                                  #  AUTHOR:               EDGAR M. OSHIKA (AC ELECTRONICS)
064297,000030:                                                                                                  #  MODIFIED:             TO RETURN TO ALL AXES VIA Q BY P. S. WEISSMAN, OCT 7, 1968
064298,000031:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G. KALAN, FEB. 14, 1969
064299,000032: 
064300,000033:                                                                                                  #  FUNCTIONAL DESCRIPTION:
064301,000034:                                                                                                  #        THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
064302,000035:                                                                                                  #        PLANE LOGIC.
064303,000036: 
064304,000037:                                                                                                  #        1. JET SENSE TEST (SPSRCS)
064305,000038:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY, SET OLDSENSE NEGATIVE AND CONTINUE
064306,000039:                                                                                                  #                IF JETS ARE FIRING POSITIVELY, SET OLDSENSE POSITIVE AND CONTINUE
064307,000040:                                                                                                  #                IF JETS ARE NOT FIRING, SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT TEST
064308,000041: 
064309,000042:                                                                                                  #        2. RATE DEAD BAND TEST
064310,000043:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE, LEAVE
064311,000044:                                                                                                  #                JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
064312,000045:                                                                                                  #                IF JETS ARE FIRING POSITIVELY AND RATE IS LESS THAN TARGET RATE, LEAVE
064313,000046:                                                                                                  #                JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
064314,000047: 
064315,000048:                                                                                                  #        3. OUTER RATE LIMIT TEST (SPSSTART)
064316,000049:                                                                                                  #                IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
064317,000050:                                                                                                  #                TO REDUCE RATE AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
064318,000051: 
064319,000052:                                                                                                  #        4. COAST ZONE TEST
064320,000053:                                                                                                  #                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-
064321,000054:                                                                                                  #                TIVE AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
064322,000055:                                                                                                  #                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
064323,000056:                                                                                                  #                AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
064324,000057: 
064325,000058:                                                                                                  #        5. INHIBITION LOGIC
064326,000059:                                                                                                  #                IF OLDSENSE IS NON-ZERO:
064327,000060:                                                                                                  #                        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
064328,000061:                                                                                                  #                        B) SET INHIBITION COUNTER* AND RETURN IF JET TIME IS ZERO
064329,000062:                                                                                                  #                        C) SET INHIBITION COUNTER,* SET JET TIME TO ZERO AND RETURN IF SIGN
064330,000063:                                                                                                  #                           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
064331,000064:                                                                                                  #                IF OLDSENSE IS ZERO:
064332,000065:                                                                                                  #                        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
064333,000066:                                                                                                  #                        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
064334,000067:                                                                                                  #                *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P,AND UV AXES,
064335,000068:                                                                                                  #                RESPECTIVELY, IN SPSRCS.  THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1500

064337,000070:                                                                                                  #                EACH DAP PASS.
064338,000071: 
064339,000072:                                                                                                  #        THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION RATE AT WHICH THIS ROUTINE IS CALLED
064340,000073:                                                                                                  #        AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT.  DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
064341,000074:                                                                                                  #        P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
064342,000075: 
064343,000076:                                                                                                  #  CALLING SEQUENCE:
064344,000077:                                                                                                  #                INHINT
064345,000078:                                                                                                  #                TC      IBNKCALL
064346,000079:                                                                                                  #                CADR    SPSRCS
064347,000080: 
064348,000081:                                                                                                  #  EXIT:
064349,000082:                                                                                                  #                TC      Q
064350,000083: 
064351,000084:                                                                                                  #  ALARM/ABORT MODE:     NONE
064352,000085: 
064353,000086:                                                                                                  #  SUBROUTINES CALLED:   NONE
064354,000087: 
064355,000088:                                                                                                  #  INPUT:                E, EDOT
064356,000089:                                                                                                  #                        TJP, TJV, TJU           TJ MUST NOT BE NEGATIVE ZERO
064357,000090: 
064358,000091:                                                                                                  #  OUTPUT:               TJP, TJV, TJU
064359,000092: 
064360,000093: 21,3655                                           BANK     21                                    
064361,000094: 21,2000                                           SETLOC   DAPS4                                 
064362,000095: 21,2000                                           BANK                                           
064363,000096: 
064364,000097: 21,3655                                           COUNT*   $$/DAPBU                              
064365,000098: 
064366,000099: 21,3655  E6,1525                                  EBANK=   TJU                                   
064367,000100: 21,3655           00632        RATELIM2           OCT      00632                                 #  1.125 DEG/SEC
064368,000101: 21,3656           34736        POSTHRST           CA       HALF                                  
064369,000102: 
064370,000103: 21,3657           51505                           NDX      AXISCTR                               
064371,000104: 21,3660           55525                           TS       TJU                                   
064372,000105: 21,3661           11744                           CCS      OLDSENSE                              
064373,000106: 21,3662           13702                           TCF      POSCHECK                              #  JETS FIRING POSITIVELY
064374,000107: 21,3663           13705                           TCF      CTRCHECK                              #  JETS OFF.  CHECK INHIBITION CTR
064375,000108: 21,3664           51505        NEGCHECK           INDEX    AXISCTR                               #  JETS FIRING NEGATIVELY
064376,000109: 21,3665           41525                           CS       TJU                                   
064377,000110: 21,3666           10000                           CCS      A                                     
064378,000111: 21,3667           00002                           TC       Q                                     #  RETURN
064379,000112: 21,3670           13672                           TCF      +2                                    
064380,000113: 21,3671           13672                           TCF      +1                                    #  JETS COMMANDED OFF.  SET CTR AND RETURN
064381,000114: 21,3672           51505        SETCTR             INDEX    AXISCTR                               #  JET FIRING REVERSAL COMMANDED.  SET CTR,
064382,000115: 21,3673           33714                           CA       UTIME                                 #  SET JET TIME TO ZERO,AND RETURN

Page 1501

064384,000117: 21,3674           51505                           INDEX    AXISCTR                               
064385,000118: 21,3675           55767                           TS       UJETCTR                               
064386,000119: 21,3676           34755        ZAPTJ              CA       ZERO                                  
064387,000120: 21,3677           51505                           INDEX    AXISCTR                               
064388,000121: 21,3700           55525                           TS       TJU                                   
064389,000122: 21,3701           00002                           TC       Q                                     
064390,000123: 21,3702           51505        POSCHECK           INDEX    AXISCTR                               
064391,000124: 21,3703           31525                           CA       TJU                                   
064392,000125: 21,3704           13666                           TCF      NEGCHECK   +2                         
064393,000126: 21,3705           51505        CTRCHECK           INDEX    AXISCTR                               #  CHECK JET INHIBITION COUNTER
064394,000127: 21,3706           11767                           CCS      UJETCTR                               
064395,000128: 21,3707           13711                           TCF      +2                                    
064396,000129: 21,3710           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
064397,000130: 21,3711           13676                           TCF      ZAPTJ                                 #  CTR IS POSITIVE.  INHIBIT FIRINGS
064398,000131: 21,3712           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
064399,000132: 21,3713           00004                           OCT      00004                                 
064400,000133: 21,3714           00012        UTIME              OCT      00012                                 
064401,000134: 21,3715           00012                           OCT      00012                                 
064402,000135: 21,3716  E6,1744               OLDSENSE           EQUALS   DAPTREG1                              
064403,000136: 21,3716           44753        NEGFIRE            CS       ONE                                   #  JETS FIRING NEGATIVELY
064404,000137: 21,3717           55744                           TS       OLDSENSE                              
064405,000138: 21,3720           31427                           CA       EDOT                                  
064406,000139: 21,3721           13725                           TCF      +4                                    
064407,000140: 21,3722           34753        PLUSFIRE           CA       ONE                                   
064408,000141: 21,3723           55744                           TS       OLDSENSE                              
064409,000142: 21,3724           41427                           CS       EDOT                                  #  RATE DEAD BAND TEST
064410,000143: 21,3725           22000                           LXCH     A                                     
064411,000144: 21,3726           40111                           CS       DAPBOOLS                              #  IF DRIFTBIT = 1, USE ZERO TARGET RATE
064412,000145: 21,3727           74744                           MASK     DRIFTBIT                              #  IF DRIFTBIT = 0, USE 0.10 RATE TARGET
064413,000146: 21,3730           10000                           CCS      A                                     
064414,000147: 21,3731           34767                           CA       RATEDB1                               
064415,000148: 21,3732           60001                           AD       L                                     
064416,000149: 21,3733           00006                           EXTEND                                         
064417,000150: 21,3734           63744                           BZMF     SPSSTART                              
064418,000151: 21,3735           13661                           TCF      POSTHRST   +3                         
064419,000152: 
064420,000153: 21,3736           51505        SPSRCS             INDEX    AXISCTR                               #  JET SENSE TEST
064421,000154: 21,3737           11525                           CCS      TJU                                   
064422,000155: 21,3740           13722                           TCF      PLUSFIRE                              #  JETS FIRING POSITIVELY
064423,000156: 21,3741           13743                           TCF      +2                                    
064424,000157: 21,3742           13716                           TCF      NEGFIRE                               #  JETS FIRING NEGATIVELY
064425,000158: 21,3743           55744                           TS       OLDSENSE                              #  JETS OFF
064426,000159: 21,3744           31427        SPSSTART           CA       EDOT                                  #  OUTER RATE LIMIT TEST
064427,000160: 21,3745           00006                           EXTEND                                         
064428,000161: 21,3746           74766                           MP       RATELIM1                              
064429,000162: 21,3747           10000                           CCS      A                                     
064430,000163: 21,3750           13767                           TCF      NEGTHRST                              #  OUTER RATE LIMIT EXCEEDED
064431,000164: 21,3751           13753                           TCF      +2                                    
064432,000165: 21,3752           13656                           TCF      POSTHRST                              #  OUTER RATE LIMIT EXCEEDED
064433,000166: 21,3753           31427                           CA       EDOT                                  #  COAST ZONE TEST

Page 1502

064435,000168: 21,3754           61751                           AD       E                                     
064436,000169: 21,3755           00006                           EXTEND                                         
064437,000170: 21,3756           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND.  FRESHSTART: 1.4 DEG
064438,000171: 21,3757           00006                           EXTEND                                         
064439,000172: 21,3760           13775                           BZF      TJZERO                                
064440,000173: 
064441,000174: 21,3761           00006                           EXTEND                                         
064442,000175: 21,3762           63771                           BZMF     +7                                    
064443,000176: 21,3763           31427                           CA       EDOT                                  
064444,000177: 21,3764           63655                           AD       RATELIM2                              
064445,000178: 21,3765           00006                           EXTEND                                         
064446,000179: 21,3766           63775                           BZMF     TJZERO                                
064447,000180: 21,3767           44736        NEGTHRST           CS       HALF                                  
064448,000181: 21,3770           13657                           TCF      POSTHRST   +1                         
064449,000182: 21,3771           43655                 +7        CS       RATELIM2                              
064450,000183: 21,3772           61427                           AD       EDOT                                  
064451,000184: 21,3773           00006                           EXTEND                                         
064452,000185: 21,3774           63656                           BZMF     POSTHRST                              
064453,000186: 21,3775           34755        TJZERO             CA       ZERO                                  
064454,000187: 21,3776           13657                           TCF      POSTHRST   +1                         
064455,000188: 
064456,000189: 21,3777     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
064457,000190: 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