Source Code

These source-code files are part of a reconstructed copy of Luminary 97, the second release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software. It was created to fix two incorrect ephemeris constants in Luminary 96, as described by anomaly report LNY-59.

The reconstruction began with source code of Luminary 99 revision 1 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes described in original Luminary memos 83 and 85, using asterisks indicating changed lines in the listing as a guide. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 97 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.

064214,000002:                                                                                                  ## Copyright:   Public domain.
064215,000003:                                                                                                  ## Filename:    SPS_BACK-UP_RCS_CONTROL.agc
064216,000004:                                                                                                  ## Purpose:     A section of Luminary revision 97.
064217,000005:                                                                                                  ##              It is part of the reconstructed source code for the
064218,000006:                                                                                                  ##              second release of the flight software for the Lunar 
064219,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
064220,000008:                                                                                                  ##              It was created to fix two incorrect ephemeris constants in
064221,000009:                                                                                                  ##              Luminary 96, as described by anomaly report LNY-59.
064222,000010:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
064223,000011:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
064224,000012:                                                                                                  ##              the listing and Luminary Memos #83 and #85, which list 
064225,000013:                                                                                                  ##              changes between Luminary 97 and 98, and 98 and 99. The
064226,000014:                                                                                                  ##              code has been adapted such that the resulting bugger words
064227,000015:                                                                                                  ##              exactly match those specified for Luminary 97 in NASA drawing
064228,000016:                                                                                                  ##              2021152D, which gives relatively high confidence that the
064229,000017:                                                                                                  ##              reconstruction is correct.
064230,000018:                                                                                                  ## Reference:   pp. 1507-1510
064231,000019:                                                                                                  ## Assembler:   yaYUL
064232,000020:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
064233,000021:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
064234,000022:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
064235,000023: 

Page 1507

064237,000025:                                                                                                  #  PROGRAM NAME:         SPSRCS
064238,000026:                                                                                                  #  AUTHOR:               EDGAR M. OSHIKA (AC ELECTRONICS)
064239,000027:                                                                                                  #  MODIFIED:             TO RETURN TO ALL AXES VIA Q BY P. S. WEISSMAN, OCT 7, 1968
064240,000028:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G. KALAN, FEB. 14, 1969
064241,000029: 
064242,000030:                                                                                                  #  FUNCTIONAL DESCRIPTION:
064243,000031:                                                                                                  #        THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
064244,000032:                                                                                                  #        PLANE LOGIC.
064245,000033: 
064246,000034:                                                                                                  #        1. JET SENSE TEST (SPSRCS)
064247,000035:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY, SET OLDSENSE NEGATIVE AND CONTINUE
064248,000036:                                                                                                  #                IF JETS ARE FIRING POSITIVELY, SET OLDSENSE POSITIVE AND CONTINUE
064249,000037:                                                                                                  #                IF JETS ARE NOT FIRING, SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT TEST
064250,000038: 
064251,000039:                                                                                                  #        2. RATE DEAD BAND TEST
064252,000040:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE, LEAVE
064253,000041:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
064254,000042:                                                                                                  #                IF JETS ARE FIRING POSITIVELY AND RATE IS   LESS  THAN TARGET RATE, LEAVE
064255,000043:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
064256,000044: 
064257,000045:                                                                                                  #        3. OUTER RATE LIMIT TEST (SPSSTART)
064258,000046:                                                                                                  #                IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
064259,000047:                                                                                                  #                        TO REDUCE RATE AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
064260,000048: 
064261,000049:                                                                                                  #        4. COAST ZONE TEST
064262,000050:                                                                                                  #                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-
064263,000051:                                                                                                  #                        TIVE AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
064264,000052:                                                                                                  #                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
064265,000053:                                                                                                  #                        AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
064266,000054: 
064267,000055:                                                                                                  #        5. INHIBITION LOGIC
064268,000056:                                                                                                  #                IF OLDSENSE IS NON-ZERO:
064269,000057:                                                                                                  #                        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
064270,000058:                                                                                                  #                        B) SET INHIBITION COUNTER* AND RETURN IF JET TIME IS ZERO
064271,000059:                                                                                                  #                        C) SET INHIBITION COUNTER,* SET JET TIME TO ZERO AND RETURN IF SIGN
064272,000060:                                                                                                  #                           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
064273,000061:                                                                                                  #                IF OLDSENSE IS ZERO:
064274,000062:                                                                                                  #                        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
064275,000063:                                                                                                  #                        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
064276,000064:                                                                                                  #                *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P, AND UV AXES,
064277,000065:                                                                                                  #                RESPECTIVELY, IN SPSRCS.  THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1508

064279,000067:                                                                                                  #                EACH DAP PASS.
064280,000068: 
064281,000069:                                                                                                  #        THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION RATE AT WHICH THIS ROUTINE IS CALLED
064282,000070:                                                                                                  #        AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT.  DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
064283,000071:                                                                                                  #        P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
064284,000072: 
064285,000073:                                                                                                  #  CALLING SEQUENCE:
064286,000074:                                                                                                  #                INHINT
064287,000075:                                                                                                  #                TC      IBNKCALL
064288,000076:                                                                                                  #                CADR    SPSRCS
064289,000077: 
064290,000078:                                                                                                  #  EXIT:
064291,000079:                                                                                                  #                TC      Q
064292,000080: 
064293,000081:                                                                                                  #  ALARM/ABORT MODE:     NONE
064294,000082: 
064295,000083:                                                                                                  #  SUBROUTINES CALLED:   NONE
064296,000084: 
064297,000085:                                                                                                  #  INPUT:                E, EDOT
064298,000086:                                                                                                  #                        TJP, TJV, TJU           TJ MUST NOT BE NEGATIVE ZERO
064299,000087: 
064300,000088:                                                                                                  #  OUTPUT:               TJP, TJV, TJU
064301,000089: 
064302,000090: 21,3646                                           BANK     21                                    
064303,000091: 21,2000                                           SETLOC   DAPS4                                 
064304,000092: 21,2000                                           BANK                                           
064305,000093: 
064306,000094: 21,3646                                           COUNT*   $$/DAPBU                              
064307,000095: 
064308,000096: 21,3646  E6,1525                                  EBANK=   TJU                                   
064309,000097: 21,3646           00632        RATELIM2           OCT      00632                                 #  1.125 DEG/SEC
064310,000098: 21,3647           34736        POSTHRST           CA       HALF                                  
064311,000099: 
064312,000100: 21,3650           51505                           NDX      AXISCTR                               
064313,000101: 21,3651           55525                           TS       TJU                                   
064314,000102: 21,3652           11745                           CCS      OLDSENSE                              
064315,000103: 21,3653           13673                           TCF      POSCHECK                              #  JETS FIRING POSITIVELY
064316,000104: 21,3654           13676                           TCF      CTRCHECK                              #  JETS OFF.  CHECK INHIBITION CTR
064317,000105: 21,3655           51505        NEGCHECK           INDEX    AXISCTR                               #  JETS FIRING NEGATIVELY
064318,000106: 21,3656           41525                           CS       TJU                                   
064319,000107: 21,3657           10000                           CCS      A                                     
064320,000108: 21,3660           00002                           TC       Q                                     #  RETURN
064321,000109: 21,3661           13663                           TCF      +2                                    
064322,000110: 21,3662           13663                           TCF      +1                                    #  JETS COMMANDED OFF.  SET CTR AND RETURN
064323,000111: 21,3663           51505        SETCTR             INDEX    AXISCTR                               #  JET FIRING REVERSAL COMMANDED.  SET CTR,
064324,000112: 21,3664           33705                           CA       UTIME                                 #  SET JET TIME TO ZERO, AND RETURN

Page 1509

064326,000114: 21,3665           51505                           INDEX    AXISCTR                               
064327,000115: 21,3666           55770                           TS       UJETCTR                               
064328,000116: 21,3667           34755        ZAPTJ              CA       ZERO                                  
064329,000117: 21,3670           51505                           INDEX    AXISCTR                               
064330,000118: 21,3671           55525                           TS       TJU                                   
064331,000119: 21,3672           00002                           TC       Q                                     
064332,000120: 21,3673           51505        POSCHECK           INDEX    AXISCTR                               
064333,000121: 21,3674           31525                           CA       TJU                                   
064334,000122: 21,3675           13657                           TCF      NEGCHECK   +2                         
064335,000123: 21,3676           51505        CTRCHECK           INDEX    AXISCTR                               #  CHECK JET INHIBITION COUNTER
064336,000124: 21,3677           11770                           CCS      UJETCTR                               
064337,000125: 21,3700           13702                           TCF      +2                                    
064338,000126: 21,3701           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
064339,000127: 21,3702           13667                           TCF      ZAPTJ                                 #  CTR IS POSITIVE.  INHIBIT FIRINGS
064340,000128: 21,3703           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
064341,000129: 21,3704           00004                           OCT      00004                                 
064342,000130: 21,3705           00012        UTIME              OCT      00012                                 
064343,000131: 21,3706           00012                           OCT      00012                                 
064344,000132: 21,3707  E6,1745               OLDSENSE           EQUALS   DAPTREG1                              
064345,000133: 21,3707           44753        NEGFIRE            CS       ONE                                   #  JETS FIRING NEGATIVELY
064346,000134: 21,3710           55745                           TS       OLDSENSE                              
064347,000135: 21,3711           31427                           CA       EDOT                                  
064348,000136: 21,3712           13716                           TCF      +4                                    
064349,000137: 21,3713           34753        PLUSFIRE           CA       ONE                                   
064350,000138: 21,3714           55745                           TS       OLDSENSE                              
064351,000139: 21,3715           41427                           CS       EDOT                                  #  RATE DEAD BAND TEST
064352,000140: 21,3716           22000                           LXCH     A                                     
064353,000141: 21,3717           40111                           CS       DAPBOOLS                              #  IF DRIFTBIT = 1, USE ZERO TARGET RATE
064354,000142: 21,3720           74744                           MASK     DRIFTBIT                              #  IF DRIFTBIT = 0, USE 0.10 RATE TARGET
064355,000143: 21,3721           10000                           CCS      A                                     
064356,000144: 21,3722           34767                           CA       RATEDB1                               
064357,000145: 21,3723           60001                           AD       L                                     
064358,000146: 21,3724           00006                           EXTEND                                         
064359,000147: 21,3725           63735                           BZMF     SPSSTART                              
064360,000148: 21,3726           13652                           TCF      POSTHRST   +3                         
064361,000149: 
064362,000150: 21,3727           51505        SPSRCS             INDEX    AXISCTR                               #  JET SENSE TEST
064363,000151: 21,3730           11525                           CCS      TJU                                   
064364,000152: 21,3731           13713                           TCF      PLUSFIRE                              #  JETS FIRING POSITIVELY
064365,000153: 21,3732           13734                           TCF      +2                                    
064366,000154: 21,3733           13707                           TCF      NEGFIRE                               #  JETS FIRING NEGATIVELY
064367,000155: 21,3734           55745                           TS       OLDSENSE                              #  JETS OFF
064368,000156: 21,3735           31427        SPSSTART           CA       EDOT                                  #  OUTER RATE LIMIT TEST
064369,000157: 21,3736           00006                           EXTEND                                         
064370,000158: 21,3737           74766                           MP       RATELIM1                              
064371,000159: 21,3740           10000                           CCS      A                                     
064372,000160: 21,3741           13760                           TCF      NEGTHRST                              #  OUTER RATE LIMIT EXCEEDED
064373,000161: 21,3742           13744                           TCF      +2                                    
064374,000162: 21,3743           13647                           TCF      POSTHRST                              #  OUTER RATE LIMIT EXCEEDED
064375,000163: 21,3744           31427                           CA       EDOT                                  #  COAST ZONE TEST

Page 1510

064377,000165: 21,3745           61752                           AD       E                                     
064378,000166: 21,3746           00006                           EXTEND                                         
064379,000167: 21,3747           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND.  FRESHSTART: 1.4 DEG
064380,000168: 21,3750           00006                           EXTEND                                         
064381,000169: 21,3751           13766                           BZF      TJZERO                                
064382,000170: 
064383,000171: 21,3752           00006                           EXTEND                                         
064384,000172: 21,3753           63762                           BZMF     +7                                    
064385,000173: 21,3754           31427                           CA       EDOT                                  
064386,000174: 21,3755           63646                           AD       RATELIM2                              
064387,000175: 21,3756           00006                           EXTEND                                         
064388,000176: 21,3757           63766                           BZMF     TJZERO                                
064389,000177: 21,3760           44736        NEGTHRST           CS       HALF                                  
064390,000178: 21,3761           13650                           TCF      POSTHRST   +1                         
064391,000179: 21,3762           43646                 +7        CS       RATELIM2                              
064392,000180: 21,3763           61427                           AD       EDOT                                  
064393,000181: 21,3764           00006                           EXTEND                                         
064394,000182: 21,3765           63647                           BZMF     POSTHRST                              
064395,000183: 21,3766           34755        TJZERO             CA       ZERO                                  
064396,000184: 21,3767           13650                           TCF      POSTHRST   +1                         
064397,000185: 
064398,000186: 21,3770     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
064399,000187: 21,3770     4767               RATEDB1            =        TBUILDFX                              #  = 00045, CORRESPONDS TO 0.101 DEG/SEC
064400,000188: 

End of include-file SPS_BACK-UP_RCS_CONTROL.agc.  Parent file is MAIN.agc