Source Code

These source-code files were from the printout at the MIT Museum, with many thanks to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing it to us. The printout was digitally photographed by Paul Fjeld. A team of volunteers transcribed the source code manually from these images or, where appropriate, modified already-transcribed but similar source Luminary 131 (Apollo 13) source code to agree with the images from the printout. Note that the page images presented online are of reduced quality, and that higher-quality images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 001 OF AGC PROGRAM LMY99 BY NASA 2021112-061
	20'35 OCT. 28,1968
Note that the date is the date of the printout, not the date of the program revision.

065323,000002:                                                                                                  ## Copyright:   Public domain.
065324,000003:                                                                                                  ## Filename:    SPS_BACK-UP_RCS_CONTROL.agc
065325,000004:                                                                                                  ## Purpose:     Part of the source code for Luminary 1A build 099.
065326,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
065327,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 11.
065328,000007:                                                                                                  ## Assembler:   yaYUL
065329,000008:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
065330,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo.
065331,000010:                                                                                                  ## Pages:       1507-1510
065332,000011:                                                                                                  ## Mod history: 2009-05-27 RSB  Adapted from the corresponding 
065333,000012:                                                                                                  ##                              Luminary131 file, using page 
065334,000013:                                                                                                  ##                              images from Luminary 1A.
065335,000014:                                                                                                  ##              2011-01-06 JL   Fixed pseudo-label indentation.
065336,000015:                                                                                                  ##              2016-12-18 RSB  Proofed text comments with octopus/ProoferComments
065337,000016:                                                                                                  ##                              and corrected the errors found.
065338,000017:                                                                                                  ##
065339,000018:                                                                                                  ## This source code has been transcribed or otherwise adapted from
065340,000019:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
065341,000020:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
065342,000021:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
065343,000022:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
065344,000023:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
065345,000024:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
065346,000025:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
065347,000026:                                                                                                  ## actually created.
065348,000027:                                                                                                  ##
065349,000028:                                                                                                  ## Notations on the hardcopy document read, in part:
065350,000029:                                                                                                  ##
065351,000030:                                                                                                  ##      Assemble revision 001 of AGC program LMY99 by NASA 2021112-61
065352,000031:                                                                                                  ##      16:27 JULY 14, 1969 
065353,000032: 

Page 1507

065355,000034:                                                                                                  #  PROGRAM NAME:         SPSRCS
065356,000035:                                                                                                  #  AUTHOR:               EDGAR M. OSHIKA (AC ELECTRONICS)
065357,000036:                                                                                                  #  MODIFIED:             TO RETURN TO ALL AXES VIA Q BY P. S. WEISSMAN, OCT 7, 1968
065358,000037:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G. KALAN, FEB. 14, 1969
065359,000038: 
065360,000039:                                                                                                  #  FUNCTIONAL DESCRIPTION:
065361,000040:                                                                                                  #        THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
065362,000041:                                                                                                  #        PLANE LOGIC.
065363,000042: 
065364,000043:                                                                                                  #        1. JET SENSE TEST (SPSRCS)
065365,000044:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY, SET OLDSENSE NEGATIVE AND CONTINUE
065366,000045:                                                                                                  #                IF JETS ARE FIRING POSITIVELY, SET OLDSENSE POSITIVE AND CONTINUE
065367,000046:                                                                                                  #                IF JETS ARE NOT FIRING, SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT TEST
065368,000047: 
065369,000048:                                                                                                  #        2. RATE DEAD BAND TEST
065370,000049:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE, LEAVE
065371,000050:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
065372,000051:                                                                                                  #                IF JETS ARE FIRING POSITIVELY AND RATE IS   LESS  THAN TARGET RATE, LEAVE
065373,000052:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
065374,000053: 
065375,000054:                                                                                                  #        3. OUTER RATE LIMIT TEST (SPSSTART)
065376,000055:                                                                                                  #                IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
065377,000056:                                                                                                  #                        TO REDUCE RATE AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
065378,000057: 
065379,000058:                                                                                                  #        4. COAST ZONE TEST
065380,000059:                                                                                                  #                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-
065381,000060:                                                                                                  #                        TIVE AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
065382,000061:                                                                                                  #                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
065383,000062:                                                                                                  #                        AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
065384,000063: 
065385,000064:                                                                                                  #        5. INHIBITION LOGIC
065386,000065:                                                                                                  #                IF OLDSENSE IS NON-ZERO:
065387,000066:                                                                                                  #                        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
065388,000067:                                                                                                  #                        B) SET INHIBITION COUNTER* AND RETURN IF JET TIME IS ZERO
065389,000068:                                                                                                  #                        C) SET INHIBITION COUNTER,* SET JET TIME TO ZERO AND RETURN IF SIGN
065390,000069:                                                                                                  #                           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
065391,000070:                                                                                                  #                IF OLDSENSE IS ZERO:
065392,000071:                                                                                                  #                        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
065393,000072:                                                                                                  #                        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
065394,000073:                                                                                                  #                *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P, AND UV AXES,
065395,000074:                                                                                                  #                RESPECTIVELY, IN SPSRCS.  THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1508

065397,000076:                                                                                                  #                EACH DAP PASS.
065398,000077: 
065399,000078:                                                                                                  #        THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION RATE AT WHICH THIS ROUTINE IS CALLED
065400,000079:                                                                                                  #        AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT.  DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
065401,000080:                                                                                                  #        P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
065402,000081: 
065403,000082:                                                                                                  #  CALLING SEQUENCE:
065404,000083:                                                                                                  #                INHINT
065405,000084:                                                                                                  #                TC      IBNKCALL
065406,000085:                                                                                                  #                CADR    SPSRCS
065407,000086: 
065408,000087:                                                                                                  #  EXIT:
065409,000088:                                                                                                  #                TC      Q
065410,000089: 
065411,000090:                                                                                                  #  ALARM/ABORT MODE:     NONE
065412,000091: 
065413,000092:                                                                                                  #  SUBROUTINES CALLED:   NONE
065414,000093: 
065415,000094:                                                                                                  #  INPUT:                E, EDOT
065416,000095:                                                                                                  #                        TJP, TJV, TJU           TJ MUST NOT BE NEGATIVE ZERO
065417,000096: 
065418,000097:                                                                                                  #  OUTPUT:               TJP, TJV, TJU
065419,000098: 
065420,000099: 21,3646                                           BANK     21                                    
065421,000100: 21,2000                                           SETLOC   DAPS4                                 
065422,000101: 21,2000                                           BANK                                           
065423,000102: 
065424,000103: 21,3646                                           COUNT*   $$/DAPBU                              
065425,000104: 
065426,000105: 21,3646  E6,1525                                  EBANK=   TJU                                   
065427,000106: 21,3646           00632        RATELIM2           OCT      00632                                 #  1.125 DEG/SEC
065428,000107: 21,3647           34736        POSTHRST           CA       HALF                                  
065429,000108: 
065430,000109: 21,3650           51505                           NDX      AXISCTR                               
065431,000110: 21,3651           55525                           TS       TJU                                   
065432,000111: 21,3652           11745                           CCS      OLDSENSE                              
065433,000112: 21,3653           13673                           TCF      POSCHECK                              #  JETS FIRING POSITIVELY
065434,000113: 21,3654           13676                           TCF      CTRCHECK                              #  JETS OFF.  CHECK INHIBITION CTR
065435,000114: 21,3655           51505        NEGCHECK           INDEX    AXISCTR                               #  JETS FIRING NEGATIVELY
065436,000115: 21,3656           41525                           CS       TJU                                   
065437,000116: 21,3657           10000                           CCS      A                                     
065438,000117: 21,3660           00002                           TC       Q                                     #  RETURN
065439,000118: 21,3661           13663                           TCF      +2                                    
065440,000119: 21,3662           13663                           TCF      +1                                    #  JETS COMMANDED OFF.  SET CTR AND RETURN
065441,000120: 21,3663           51505        SETCTR             INDEX    AXISCTR                               #  JET FIRING REVERSAL COMMANDED.  SET CTR,
065442,000121: 21,3664           33705                           CA       UTIME                                 #  SET JET TIME TO ZERO, AND RETURN

Page 1509

065444,000123: 21,3665           51505                           INDEX    AXISCTR                               
065445,000124: 21,3666           55770                           TS       UJETCTR                               
065446,000125: 21,3667           34755        ZAPTJ              CA       ZERO                                  
065447,000126: 21,3670           51505                           INDEX    AXISCTR                               
065448,000127: 21,3671           55525                           TS       TJU                                   
065449,000128: 21,3672           00002                           TC       Q                                     
065450,000129: 21,3673           51505        POSCHECK           INDEX    AXISCTR                               
065451,000130: 21,3674           31525                           CA       TJU                                   
065452,000131: 21,3675           13657                           TCF      NEGCHECK   +2                         
065453,000132: 21,3676           51505        CTRCHECK           INDEX    AXISCTR                               #  CHECK JET INHIBITION COUNTER
065454,000133: 21,3677           11770                           CCS      UJETCTR                               
065455,000134: 21,3700           13702                           TCF      +2                                    
065456,000135: 21,3701           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
065457,000136: 21,3702           13667                           TCF      ZAPTJ                                 #  CTR IS POSITIVE.  INHIBIT FIRINGS
065458,000137: 21,3703           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
065459,000138: 21,3704           00004                           OCT      00004                                 
065460,000139: 21,3705           00012        UTIME              OCT      00012                                 
065461,000140: 21,3706           00012                           OCT      00012                                 
065462,000141: 21,3707  E6,1745               OLDSENSE           EQUALS   DAPTREG1                              
065463,000142: 21,3707           44753        NEGFIRE            CS       ONE                                   #  JETS FIRING NEGATIVELY
065464,000143: 21,3710           55745                           TS       OLDSENSE                              
065465,000144: 21,3711           31427                           CA       EDOT                                  
065466,000145: 21,3712           13716                           TCF      +4                                    
065467,000146: 21,3713           34753        PLUSFIRE           CA       ONE                                   
065468,000147: 21,3714           55745                           TS       OLDSENSE                              
065469,000148: 21,3715           41427                           CS       EDOT                                  #  RATE DEAD BAND TEST
065470,000149: 21,3716           22000                           LXCH     A                                     
065471,000150: 21,3717           40111                           CS       DAPBOOLS                              #  IF DRIFTBIT = 1, USE ZERO TARGET RATE
065472,000151: 21,3720           74744                           MASK     DRIFTBIT                              #  IF DRIFTBIT = 0, USE 0.10 RATE TARGET
065473,000152: 21,3721           10000                           CCS      A                                     
065474,000153: 21,3722           34767                           CA       RATEDB1                               
065475,000154: 21,3723           60001                           AD       L                                     
065476,000155: 21,3724           00006                           EXTEND                                         
065477,000156: 21,3725           63735                           BZMF     SPSSTART                              
065478,000157: 21,3726           13652                           TCF      POSTHRST   +3                         
065479,000158: 
065480,000159: 21,3727           51505        SPSRCS             INDEX    AXISCTR                               #  JET SENSE TEST
065481,000160: 21,3730           11525                           CCS      TJU                                   
065482,000161: 21,3731           13713                           TCF      PLUSFIRE                              #  JETS FIRING POSITIVELY
065483,000162: 21,3732           13734                           TCF      +2                                    
065484,000163: 21,3733           13707                           TCF      NEGFIRE                               #  JETS FIRING NEGATIVELY
065485,000164: 21,3734           55745                           TS       OLDSENSE                              #  JETS OFF
065486,000165: 21,3735           31427        SPSSTART           CA       EDOT                                  #  OUTER RATE LIMIT TEST
065487,000166: 21,3736           00006                           EXTEND                                         
065488,000167: 21,3737           74766                           MP       RATELIM1                              
065489,000168: 21,3740           10000                           CCS      A                                     
065490,000169: 21,3741           13760                           TCF      NEGTHRST                              #  OUTER RATE LIMIT EXCEEDED
065491,000170: 21,3742           13744                           TCF      +2                                    
065492,000171: 21,3743           13647                           TCF      POSTHRST                              #  OUTER RATE LIMIT EXCEEDED
065493,000172: 21,3744           31427                           CA       EDOT                                  #  COAST ZONE TEST

Page 1510

065495,000174: 21,3745           61752                           AD       E                                     
065496,000175: 21,3746           00006                           EXTEND                                         
065497,000176: 21,3747           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND.  FRESHSTART: 1.4 DEG
065498,000177: 21,3750           00006                           EXTEND                                         
065499,000178: 21,3751           13766                           BZF      TJZERO                                
065500,000179: 
065501,000180: 21,3752           00006                           EXTEND                                         
065502,000181: 21,3753           63762                           BZMF     +7                                    
065503,000182: 21,3754           31427                           CA       EDOT                                  
065504,000183: 21,3755           63646                           AD       RATELIM2                              
065505,000184: 21,3756           00006                           EXTEND                                         
065506,000185: 21,3757           63766                           BZMF     TJZERO                                
065507,000186: 21,3760           44736        NEGTHRST           CS       HALF                                  
065508,000187: 21,3761           13650                           TCF      POSTHRST   +1                         
065509,000188: 21,3762           43646                 +7        CS       RATELIM2                              
065510,000189: 21,3763           61427                           AD       EDOT                                  
065511,000190: 21,3764           00006                           EXTEND                                         
065512,000191: 21,3765           63647                           BZMF     POSTHRST                              
065513,000192: 21,3766           34755        TJZERO             CA       ZERO                                  
065514,000193: 21,3767           13650                           TCF      POSTHRST   +1                         
065515,000194: 
065516,000195: 21,3770     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
065517,000196: 21,3770     4767               RATEDB1            =        TBUILDFX                              #  = 00045, CORRESPONDS TO 0.101 DEG/SEC
065518,000197: 

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