Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

065555,000002:                                                                                                  ## Copyright:   Public domain.
065556,000003:                                                                                                  ## Filename:    SPS_BACK-UP_RCS_CONTROL.agc
065557,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
065558,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
065559,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
065560,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
065561,000008:                                                                                                  ##              that the code format has been changed to conform to the
065562,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
065563,000010:                                                                                                  ##              original YUL assembler.
065564,000011:                                                                                                  ## Reference:   pp. 1505-1508
065565,000012:                                                                                                  ## Assembler:   yaYUL
065566,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
065567,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
065568,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
065569,000016:                                                                                                  ##              2016-12-12 MAS  Transcribed.
065570,000017:                                                                                                  ##              2016-12-26 RSB  Comment-text proofed using ProoferComments
065571,000018:                                                                                                  ##                              and corrected errors found.
065572,000019: 

Page 1505

065574,000021:                                                                                                  #  PROGRAM NAME:  SPSRCS
065575,000022: 
065576,000023:                                                                                                  #  AUTHOR:  EDGAR M. OSHIKA (AC ELECTRONICS)
065577,000024: 
065578,000025:                                                                                                  #  MODIFIED:  TO RETURN TO ALL AXES VIA Q BY P.S.WEISSMAN, OCT 7, 1968
065579,000026: 
065580,000027:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G.KALAN,FEB.14,1969
065581,000028:                                                                                                  #  FUNCTIONAL DESCRIPTION:
065582,000029: 
065583,000030:                                                                                                  #  THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
065584,000031:                                                                                                  #  PLANE LOGIC.
065585,000032: 
065586,000033:                                                                                                  #  1. JET SENSE TEST (SPSRCS)
065587,000034: 
065588,000035:                                                                                                  #  IF JETS ARE FIRING NEGATIVELY,SET OLDSENSE NEGATIVE AND CONTINUE
065589,000036:                                                                                                  #  IF JETS ARE FIRING POSITIVELY,SET OLDSENSE POSITIVE AND CONTINUE
065590,000037:                                                                                                  #  IF JETS ARE NOT FIRING,SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT  TEST
065591,000038: 
065592,000039:                                                                                                  #  2. RATE DEAD BAND TEST
065593,000040: 
065594,000041:                                                                                                  #  IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE,LEAVE
065595,000042:                                                                                                  #  JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
065596,000043:                                                                                                  #  IF JETS ARE FIRING POSITIVELY AND RATE IS   LESS  THAN TARGET RATE,LEAVE
065597,000044:                                                                                                  #  JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
065598,000045: 
065599,000046:                                                                                                  #  3. OUTER RATE LIMIT TEST (SPSSTART)
065600,000047: 
065601,000048:                                                                                                  #  IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
065602,000049:                                                                                                  #   TO REDUCE RATE AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
065603,000050: 
065604,000051:                                                                                                  #  4. COAST ZONE TEST
065605,000052: 
065606,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-
065607,000054:                                                                                                  #  TIVE AND CONTINUE. OTHERWISE,SET JET FIRING TIME TO ZERO AND CONTINUE.
065608,000055:                                                                                                  #  IF STATE IS ABOVE LINE  E + 4X EDOT > +1.4 DEG AND EDOT IS GREATER THAN -1.30 DEG/SEC, SET JET TIME NEGATIVE
065609,000056:                                                                                                  #  AND CONTINUE. OTHERWISE,SET JET FIRING TIME TO ZERO AND CONTINUE.
065610,000057: 
065611,000058:                                                                                                  #  5. INHIBITION LOGIC
065612,000059: 
065613,000060:                                                                                                  #  IF OLDSENSE IS NON-ZERO:
065614,000061:                                                                                                  #        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
065615,000062:                                                                                                  #        B) SET INHIBITION COUNTER*AND RETURN IF JET TIME IS ZERO
065616,000063:                                                                                                  #        C) SET INHIBITION COUNTER,*SET JET TIME TO ZERO AND RETURN IF SIGN
065617,000064:                                                                                                  #           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
065618,000065: 
065619,000066:                                                                                                  #  IF OLDSENSE IS ZERO:
065620,000067:                                                                                                  #        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
065621,000068:                                                                                                  #        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
065622,000069:                                                                                                  #  *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P,AND UV AXES,
065623,000070:                                                                                                  #  RESPECTIVELY,IN SPSRCS. THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1506

065625,000072:                                                                                                  #  EACH DAP PASS.
065626,000073: 
065627,000074:                                                                                                  #  THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION  RATE AT WHICH THIS ROUTINE IS CALLED
065628,000075:                                                                                                  #  AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT.   DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
065629,000076:                                                                                                  #  P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
065630,000077: 
065631,000078:                                                                                                  #  CALLING SEQUENCE:
065632,000079: 
065633,000080:                                                                                                  #           INHINT
065634,000081:                                                                                                  #                      TC     IBNKCALL
065635,000082:                                                                                                  #                      CADR   SPSRCS
065636,000083: 
065637,000084: 
065638,000085:                                                                                                  #  EXIT:
065639,000086:                                                                                                  #           TC     Q
065640,000087:                                                                                                  #  ALARM/ABORT MODE:    NONE
065641,000088: 
065642,000089:                                                                                                  #  SUBROUTINES CALLED:    NONE
065643,000090: 
065644,000091:                                                                                                  #  INPUT:      E,EDOT
065645,000092:                                                                                                  #              TJP, TJV, TJU                   TJ MUST NOT BE NEGATIVE ZERO
065646,000093: 
065647,000094:                                                                                                  #  OUTPUT:     TJP, TJV, TJU
065648,000095: 
065649,000096: 
065650,000097: 21,3606                                           BANK     21                                    
065651,000098: 21,2000                                           SETLOC   DAPS4                                 
065652,000099: 21,2000                                           BANK                                           
065653,000100: 
065654,000101: 21,3606                                           COUNT*   $$/DAPBU                              
065655,000102: 
065656,000103: 21,3606  E6,1525                                  EBANK=   TJU                                   
065657,000104: 21,3606           00632        RATELIM2           OCT      00632                                 #  1.125 DEG/SEC
065658,000105: 21,3607           34727        POSTHRST           CA       HALF                                  
065659,000106: 
065660,000107: 21,3610           51505                           NDX      AXISCTR                               
065661,000108: 21,3611           55525                           TS       TJU                                   
065662,000109: 21,3612           11744                           CCS      OLDSENSE                              
065663,000110: 21,3613           13633                           TCF      POSCHECK                              #  JETS FIRING POSITIVELY
065664,000111: 21,3614           13636                           TCF      CTRCHECK                              #  JETS OFF. CHECK INHIBITION CTR
065665,000112: 21,3615           51505        NEGCHECK           INDEX    AXISCTR                               #  JETS FIRING NEGATIVELY
065666,000113: 21,3616           41525                           CS       TJU                                   
065667,000114: 21,3617           10000                           CCS      A                                     
065668,000115: 21,3620           00002                           TC       Q                                     #  RETURN
065669,000116: 21,3621           13623                           TCF      +2                                    
065670,000117: 21,3622           13623                           TCF      +1                                    #  JETS COMMANDED OFF.SET CTR AND RETURN
065671,000118: 21,3623           51505        SETCTR             INDEX    AXISCTR                               #  JET FIRING REVERSAL COMMANDED. SET CTR,
065672,000119: 21,3624           33645                           CA       UTIME                                 #  SET JET TIME TO ZERO,AND RETURN

Page 1507

065674,000121: 21,3625           51505                           INDEX    AXISCTR                               
065675,000122: 21,3626           55767                           TS       UJETCTR                               
065676,000123: 21,3627           34746        ZAPTJ              CA       ZERO                                  
065677,000124: 21,3630           51505                           INDEX    AXISCTR                               
065678,000125: 21,3631           55525                           TS       TJU                                   
065679,000126: 21,3632           00002                           TC       Q                                     
065680,000127: 21,3633           51505        POSCHECK           INDEX    AXISCTR                               
065681,000128: 21,3634           31525                           CA       TJU                                   
065682,000129: 21,3635           13617                           TCF      NEGCHECK   +2                         
065683,000130: 21,3636           51505        CTRCHECK           INDEX    AXISCTR                               #  CHECK JET INHIBITION COUNTER
065684,000131: 21,3637           11767                           CCS      UJETCTR                               
065685,000132: 21,3640           13642                           TCF      +2                                    
065686,000133: 21,3641           00002                           TC       Q                                     #  CTR IS NOT POSITIVE. RETURN
065687,000134: 21,3642           13627                           TCF      ZAPTJ                                 #  CTR IS POSITIVE.INHIBIT FIRINGS
065688,000135: 21,3643           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.RETURN
065689,000136: 21,3644           00004                           OCT      00004                                 
065690,000137: 21,3645           00012        UTIME              OCT      00012                                 
065691,000138: 21,3646           00012                           OCT      00012                                 
065692,000139: 21,3647           44744        NEGFIRE            CS       ONE                                   #  JETS FIRING NEGATIVELY
065693,000140: 21,3650           55744                           TS       OLDSENSE                              
065694,000141: 21,3651           31427                           CA       EDOT                                  
065695,000142: 21,3652           13656                           TCF      +4                                    
065696,000143: 21,3653           34744        PLUSFIRE           CA       ONE                                   
065697,000144: 21,3654           55744                           TS       OLDSENSE                              
065698,000145: 21,3655           41427                           CS       EDOT                                  #  RATE DEAD BAND TEST
065699,000146: 21,3656           22000                           LXCH     A                                     
065700,000147: 21,3657           40111                           CS       DAPBOOLS                              #  IF DRIFTBIT = 1, USE ZERO TARGET RATE

A line is drawn immediately to the right of DRIFTBIT below.

065702,000149: 21,3660           74735                           MASK     DRIFTBIT                              #  IF DRIFTBIT = 0, USE 0.10 RATE TARGET
065703,000150: 21,3661           10000                           CCS      A                                     
065704,000151: 21,3662           34760                           CA       RATEDB1                               
065705,000152: 21,3663           60001                           AD       L                                     
065706,000153: 21,3664           00006                           EXTEND                                         
065707,000154: 21,3665           63675                           BZMF     SPSSTART                              
065708,000155: 21,3666           13612                           TCF      POSTHRST   +3                         
065709,000156: 
065710,000157: 21,3667           51505        SPSRCS             INDEX    AXISCTR                               #  JET SENSE TEST
065711,000158: 21,3670           11525                           CCS      TJU                                   
065712,000159: 21,3671           13653                           TCF      PLUSFIRE                              #  JETS FIRING POSITIVELY
065713,000160: 21,3672           13674                           TCF      +2                                    
065714,000161: 21,3673           13647                           TCF      NEGFIRE                               #  JETS FIRING NEGATIVELY
065715,000162: 21,3674           55744                           TS       OLDSENSE                              #  JETS OFF
065716,000163: 21,3675           31427        SPSSTART           CA       EDOT                                  #  OUTER RATE LIMIT TEST
065717,000164: 21,3676           00006                           EXTEND                                         
065718,000165: 21,3677           74757                           MP       RATELIM1                              
065719,000166: 21,3700           10000                           CCS      A                                     
065720,000167: 21,3701           13720                           TCF      NEGTHRST                              #  OUTER RATE LIMIT EXCEEDED
065721,000168: 21,3702           13704                           TCF      +2                                    
065722,000169: 21,3703           13607                           TCF      POSTHRST                              #  OUTER RATE LIMIT EXCEEDED
065723,000170: 21,3704           31427                           CA       EDOT                                  #  COAST ZONE TEST
065724,000171: 21,3705           61751                           AD       E                                     

Page 1508

065726,000173: 21,3706           00006                           EXTEND                                         
065727,000174: 21,3707           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND. FRESHSTART: 1.4 DEG
065728,000175: 21,3710           00006                           EXTEND                                         
065729,000176: 21,3711           13726                           BZF      TJZERO                                
065730,000177: 
065731,000178: 21,3712           00006                           EXTEND                                         
065732,000179: 21,3713           63722                           BZMF     +7                                    
065733,000180: 21,3714           31427                           CA       EDOT                                  
065734,000181: 21,3715           63606                           AD       RATELIM2                              
065735,000182: 21,3716           00006                           EXTEND                                         
065736,000183: 21,3717           63726                           BZMF     TJZERO                                
065737,000184: 21,3720           44727        NEGTHRST           CS       HALF                                  
065738,000185: 21,3721           13610                           TCF      POSTHRST   +1                         
065739,000186: 21,3722           43606                 +7        CS       RATELIM2                              
065740,000187: 21,3723           61427                           AD       EDOT                                  
065741,000188: 21,3724           00006                           EXTEND                                         
065742,000189: 21,3725           63607                           BZMF     POSTHRST                              
065743,000190: 21,3726           34746        TJZERO             CA       ZERO                                  
065744,000191: 21,3727           13610                           TCF      POSTHRST   +1                         
065745,000192: 
065746,000193: 
065747,000194: 21,3730     4757               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
065748,000195: 21,3730     4760               RATEDB1            =        TBUILDFX                              #   = 00045, CORRESPONDS TO 0.101 DEG/SEC

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