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
	16:27 JULY 14,1969
Note that the date is the date of the printout, not the date of the program revision.

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

Page 1507

065379,000034:                                                                                                  #  PROGRAM NAME:         SPSRCS
065380,000035:                                                                                                  #  AUTHOR:               EDGAR M. OSHIKA (AC ELECTRONICS)
065381,000036:                                                                                                  #  MODIFIED:             TO RETURN TO ALL AXES VIA Q BY P. S. WEISSMAN, OCT 7, 1968
065382,000037:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G. KALAN, FEB. 14, 1969
065383,000038: 
065384,000039:                                                                                                  #  FUNCTIONAL DESCRIPTION:
065385,000040:                                                                                                  #        THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
065386,000041:                                                                                                  #        PLANE LOGIC.
065387,000042: 
065388,000043:                                                                                                  #        1. JET SENSE TEST (SPSRCS)
065389,000044:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY, SET OLDSENSE NEGATIVE AND CONTINUE
065390,000045:                                                                                                  #                IF JETS ARE FIRING POSITIVELY, SET OLDSENSE POSITIVE AND CONTINUE
065391,000046:                                                                                                  #                IF JETS ARE NOT FIRING, SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT TEST
065392,000047: 
065393,000048:                                                                                                  #        2. RATE DEAD BAND TEST
065394,000049:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE, LEAVE
065395,000050:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
065396,000051:                                                                                                  #                IF JETS ARE FIRING POSITIVELY AND RATE IS   LESS  THAN TARGET RATE, LEAVE
065397,000052:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
065398,000053: 
065399,000054:                                                                                                  #        3. OUTER RATE LIMIT TEST (SPSSTART)
065400,000055:                                                                                                  #                IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
065401,000056:                                                                                                  #                        TO REDUCE RATE AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
065402,000057: 
065403,000058:                                                                                                  #        4. COAST ZONE TEST
065404,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-
065405,000060:                                                                                                  #                        TIVE AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
065406,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
065407,000062:                                                                                                  #                        AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
065408,000063: 
065409,000064:                                                                                                  #        5. INHIBITION LOGIC
065410,000065:                                                                                                  #                IF OLDSENSE IS NON-ZERO:
065411,000066:                                                                                                  #                        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
065412,000067:                                                                                                  #                        B) SET INHIBITION COUNTER* AND RETURN IF JET TIME IS ZERO
065413,000068:                                                                                                  #                        C) SET INHIBITION COUNTER,* SET JET TIME TO ZERO AND RETURN IF SIGN
065414,000069:                                                                                                  #                           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
065415,000070:                                                                                                  #                IF OLDSENSE IS ZERO:
065416,000071:                                                                                                  #                        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
065417,000072:                                                                                                  #                        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
065418,000073:                                                                                                  #                *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P, AND UV AXES,
065419,000074:                                                                                                  #                RESPECTIVELY, IN SPSRCS.  THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1508

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

Page 1509

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

Page 1510

065519,000174: 21,3745           61752                           AD       E                                     
065520,000175: 21,3746           00006                           EXTEND                                         
065521,000176: 21,3747           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND.  FRESHSTART: 1.4 DEG
065522,000177: 21,3750           00006                           EXTEND                                         
065523,000178: 21,3751           13766                           BZF      TJZERO                                
065524,000179: 
065525,000180: 21,3752           00006                           EXTEND                                         
065526,000181: 21,3753           63762                           BZMF     +7                                    
065527,000182: 21,3754           31427                           CA       EDOT                                  
065528,000183: 21,3755           63646                           AD       RATELIM2                              
065529,000184: 21,3756           00006                           EXTEND                                         
065530,000185: 21,3757           63766                           BZMF     TJZERO                                
065531,000186: 21,3760           44736        NEGTHRST           CS       HALF                                  
065532,000187: 21,3761           13650                           TCF      POSTHRST   +1                         
065533,000188: 21,3762           43646                 +7        CS       RATELIM2                              
065534,000189: 21,3763           61427                           AD       EDOT                                  
065535,000190: 21,3764           00006                           EXTEND                                         
065536,000191: 21,3765           63647                           BZMF     POSTHRST                              
065537,000192: 21,3766           34755        TJZERO             CA       ZERO                                  
065538,000193: 21,3767           13650                           TCF      POSTHRST   +1                         
065539,000194: 
065540,000195: 21,3770     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
065541,000196: 21,3770     4767               RATEDB1            =        TBUILDFX                              #  = 00045, CORRESPONDS TO 0.101 DEG/SEC
065542,000197: 

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