Source Code

These source-code files are part of a reconstructed copy of Luminary 173, the second (unflown) release of the Apollo 14 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 178. Changes between revision 173 and 178 were backed out, as described by Luminary memo 167 (revision 1). The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 173 listing would be different.

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.

064619,000002:                                                                                                  ## Copyright:   Public domain.
064620,000003:                                                                                                  ## Filename:    SPS_BACK-UP_RCS_CONTROL.agc
064621,000004:                                                                                                  ## Purpose:     A section of Luminary revision 173.
064622,000005:                                                                                                  ##              It is part of the reconstructed source code for the second
064623,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
064624,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
064625,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
064626,000009:                                                                                                  ##              Luminary 178, as well as Luminary memo 167 (revision 1).
064627,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
064628,000011:                                                                                                  ##              exactly match those specified for Luminary 173 in NASA
064629,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
064630,000013:                                                                                                  ##              that the reconstruction is correct.
064631,000014:                                                                                                  ## Reference:   pp. 1495-1498
064632,000015:                                                                                                  ## Assembler:   yaYUL
064633,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
064634,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
064635,000018:                                                                                                  ## Mod history: 2019-09-18 MAS  Created from Luminary 178.
064636,000019: 

Page 1495

064638,000021:                                                                                                  #  PROGRAM NAME:  SPSRCS
064639,000022: 
064640,000023:                                                                                                  #  AUTHOR:  EDGAR M. OSHIKA (AC ELECTRONICS)
064641,000024: 
064642,000025:                                                                                                  #  MODIFIED:  TO RETURN TO ALL AXES VIA Q BY P.S.WEISSMAN, OCT 7, 1968
064643,000026: 
064644,000027:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G.KALAN,FEB.14,1969
064645,000028:                                                                                                  #  FUNCTIONAL DESCRIPTION:
064646,000029: 
064647,000030:                                                                                                  #  THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
064648,000031:                                                                                                  #  PLANE LOGIC.
064649,000032: 
064650,000033:                                                                                                  #  1. JET SENSE TEST (SPSRCS)
064651,000034: 
064652,000035:                                                                                                  #  IF JETS ARE FIRING NEGATIVELY,SET OLDSENSE NEGATIVE AND CONTINUE
064653,000036:                                                                                                  #  IF JETS ARE FIRING POSITIVELY,SET OLDSENSE POSITIVE AND CONTINUE
064654,000037:                                                                                                  #  IF JETS ARE NOT FIRING,SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT  TEST
064655,000038: 
064656,000039:                                                                                                  #  2. RATE DEAD BAND TEST
064657,000040: 
064658,000041:                                                                                                  #  IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE,LEAVE
064659,000042:                                                                                                  #  JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
064660,000043:                                                                                                  #  IF JETS ARE FIRING POSITIVELY AND RATE IS   LESS  THAN TARGET RATE,LEAVE
064661,000044:                                                                                                  #  JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
064662,000045: 
064663,000046:                                                                                                  #  3. OUTER RATE LIMIT TEST (SPSSTART)
064664,000047: 
064665,000048:                                                                                                  #  IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
064666,000049:                                                                                                  #   TO REDUCE RATE AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
064667,000050: 
064668,000051:                                                                                                  #  4. COAST ZONE TEST
064669,000052: 
064670,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-
064671,000054:                                                                                                  #  TIVE AND CONTINUE. OTHERWISE,SET JET FIRING TIME TO ZERO AND CONTINUE.
064672,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
064673,000056:                                                                                                  #  AND CONTINUE. OTHERWISE,SET JET FIRING TIME TO ZERO AND CONTINUE.
064674,000057: 
064675,000058:                                                                                                  #  5. INHIBITION LOGIC
064676,000059: 
064677,000060:                                                                                                  #  IF OLDSENSE IS NON-ZERO:
064678,000061:                                                                                                  #        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
064679,000062:                                                                                                  #        B) SET INHIBITION COUNTER*AND RETURN IF JET TIME IS ZERO
064680,000063:                                                                                                  #        C) SET INHIBITION COUNTER,*SET JET TIME TO ZERO AND RETURN IF SIGN
064681,000064:                                                                                                  #           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
064682,000065: 
064683,000066:                                                                                                  #  IF OLDSENSE IS ZERO:
064684,000067:                                                                                                  #        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
064685,000068:                                                                                                  #        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
064686,000069:                                                                                                  #  *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P,AND UV AXES,
064687,000070:                                                                                                  #  RESPECTIVELY,IN SPSRCS. THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1496

064689,000072:                                                                                                  #  EACH DAP PASS.
064690,000073: 
064691,000074:                                                                                                  #  THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION  RATE AT WHICH THIS ROUTINE IS CALLED
064692,000075:                                                                                                  #  AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT.   DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
064693,000076:                                                                                                  #  P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
064694,000077: 
064695,000078:                                                                                                  #  CALLING SEQUENCE:
064696,000079: 
064697,000080:                                                                                                  #           INHINT
064698,000081:                                                                                                  #                      TC     IBNKCALL
064699,000082:                                                                                                  #                      CADR   SPSRCS
064700,000083: 
064701,000084: 
064702,000085:                                                                                                  #  EXIT:
064703,000086:                                                                                                  #           TC     Q
064704,000087:                                                                                                  #  ALARM/ABORT MODE:    NONE
064705,000088: 
064706,000089:                                                                                                  #  SUBROUTINES CALLED:    NONE
064707,000090: 
064708,000091:                                                                                                  #  INPUT:      E,EDOT
064709,000092:                                                                                                  #              TJP, TJV, TJU                   TJ MUST NOT BE NEGATIVE ZERO
064710,000093: 
064711,000094:                                                                                                  #  OUTPUT:     TJP, TJV, TJU
064712,000095: 
064713,000096: 
064714,000097: 21,3640                                           BANK     21                                    
064715,000098: 21,2000                                           SETLOC   DAPS4                                 
064716,000099: 21,2000                                           BANK                                           
064717,000100: 
064718,000101: 21,3640                                           COUNT*   $$/DAPBU                              
064719,000102: 
064720,000103: 21,3640  E6,1525                                  EBANK=   TJU                                   
064721,000104: 21,3640           00632        RATELIM2           OCT      00632                                 #  1.125 DEG/SEC
064722,000105: 21,3641           34736        POSTHRST           CA       HALF                                  
064723,000106: 
064724,000107: 21,3642           51505                           NDX      AXISCTR                               
064725,000108: 21,3643           55525                           TS       TJU                                   
064726,000109: 21,3644           11744                           CCS      OLDSENSE                              
064727,000110: 21,3645           13665                           TCF      POSCHECK                              #  JETS FIRING POSITIVELY
064728,000111: 21,3646           13670                           TCF      CTRCHECK                              #  JETS OFF. CHECK INHIBITION CTR
064729,000112: 21,3647           51505        NEGCHECK           INDEX    AXISCTR                               #  JETS FIRING NEGATIVELY
064730,000113: 21,3650           41525                           CS       TJU                                   
064731,000114: 21,3651           10000                           CCS      A                                     
064732,000115: 21,3652           00002                           TC       Q                                     #  RETURN
064733,000116: 21,3653           13655                           TCF      +2                                    
064734,000117: 21,3654           13655                           TCF      +1                                    #  JETS COMMANDED OFF.SET CTR AND RETURN
064735,000118: 21,3655           51505        SETCTR             INDEX    AXISCTR                               #  JET FIRING REVERSAL COMMANDED. SET CTR,
064736,000119: 21,3656           33677                           CA       UTIME                                 #  SET JET TIME TO ZERO,AND RETURN

Page 1497

064738,000121: 21,3657           51505                           INDEX    AXISCTR                               
064739,000122: 21,3660           55767                           TS       UJETCTR                               
064740,000123: 21,3661           34755        ZAPTJ              CA       ZERO                                  
064741,000124: 21,3662           51505                           INDEX    AXISCTR                               
064742,000125: 21,3663           55525                           TS       TJU                                   
064743,000126: 21,3664           00002                           TC       Q                                     
064744,000127: 21,3665           51505        POSCHECK           INDEX    AXISCTR                               
064745,000128: 21,3666           31525                           CA       TJU                                   
064746,000129: 21,3667           13651                           TCF      NEGCHECK   +2                         
064747,000130: 21,3670           51505        CTRCHECK           INDEX    AXISCTR                               #  CHECK JET INHIBITION COUNTER
064748,000131: 21,3671           11767                           CCS      UJETCTR                               
064749,000132: 21,3672           13674                           TCF      +2                                    
064750,000133: 21,3673           00002                           TC       Q                                     #  CTR IS NOT POSITIVE. RETURN
064751,000134: 21,3674           13661                           TCF      ZAPTJ                                 #  CTR IS POSITIVE.INHIBIT FIRINGS
064752,000135: 21,3675           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.RETURN
064753,000136: 21,3676           00004                           OCT      00004                                 
064754,000137: 21,3677           00012        UTIME              OCT      00012                                 
064755,000138: 21,3700           00012                           OCT      00012                                 
064756,000139: 21,3701  E6,1744               OLDSENSE           EQUALS   DAPTREG1                              
064757,000140: 21,3701           44753        NEGFIRE            CS       ONE                                   #  JETS FIRING NEGATIVELY
064758,000141: 21,3702           55744                           TS       OLDSENSE                              
064759,000142: 21,3703           31427                           CA       EDOT                                  
064760,000143: 21,3704           13710                           TCF      +4                                    
064761,000144: 21,3705           34753        PLUSFIRE           CA       ONE                                   
064762,000145: 21,3706           55744                           TS       OLDSENSE                              
064763,000146: 21,3707           41427                           CS       EDOT                                  #  RATE DEAD BAND TEST
064764,000147: 21,3710           22000                           LXCH     A                                     
064765,000148: 21,3711           40111                           CS       DAPBOOLS                              #  IF DRIFTBIT = 1, USE ZERO TARGET RATE
064766,000149: 21,3712           74744                           MASK     DRIFTBIT                              #  IF DRIFTBIT = 0, USE 0.10 RATE TARGET
064767,000150: 21,3713           10000                           CCS      A                                     
064768,000151: 21,3714           34767                           CA       RATEDB1                               
064769,000152: 21,3715           60001                           AD       L                                     
064770,000153: 21,3716           00006                           EXTEND                                         
064771,000154: 21,3717           63727                           BZMF     SPSSTART                              
064772,000155: 21,3720           13644                           TCF      POSTHRST   +3                         
064773,000156: 
064774,000157: 21,3721           51505        SPSRCS             INDEX    AXISCTR                               #  JET SENSE TEST
064775,000158: 21,3722           11525                           CCS      TJU                                   
064776,000159: 21,3723           13705                           TCF      PLUSFIRE                              #  JETS FIRING POSITIVELY
064777,000160: 21,3724           13726                           TCF      +2                                    
064778,000161: 21,3725           13701                           TCF      NEGFIRE                               #  JETS FIRING NEGATIVELY
064779,000162: 21,3726           55744                           TS       OLDSENSE                              #  JETS OFF
064780,000163: 21,3727           31427        SPSSTART           CA       EDOT                                  #  OUTER RATE LIMIT TEST
064781,000164: 21,3730           00006                           EXTEND                                         
064782,000165: 21,3731           74766                           MP       RATELIM1                              
064783,000166: 21,3732           10000                           CCS      A                                     
064784,000167: 21,3733           13752                           TCF      NEGTHRST                              #  OUTER RATE LIMIT EXCEEDED
064785,000168: 21,3734           13736                           TCF      +2                                    
064786,000169: 21,3735           13641                           TCF      POSTHRST                              #  OUTER RATE LIMIT EXCEEDED
064787,000170: 21,3736           31427                           CA       EDOT                                  #  COAST ZONE TEST
064788,000171: 21,3737           61751                           AD       E                                     

Page 1498

064790,000173: 21,3740           00006                           EXTEND                                         
064791,000174: 21,3741           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND. FRESHSTART: 1.4 DEG
064792,000175: 21,3742           00006                           EXTEND                                         
064793,000176: 21,3743           13760                           BZF      TJZERO                                
064794,000177: 
064795,000178: 21,3744           00006                           EXTEND                                         
064796,000179: 21,3745           63754                           BZMF     +7                                    
064797,000180: 21,3746           31427                           CA       EDOT                                  
064798,000181: 21,3747           63640                           AD       RATELIM2                              
064799,000182: 21,3750           00006                           EXTEND                                         
064800,000183: 21,3751           63760                           BZMF     TJZERO                                
064801,000184: 21,3752           44736        NEGTHRST           CS       HALF                                  
064802,000185: 21,3753           13642                           TCF      POSTHRST   +1                         
064803,000186: 21,3754           43640                 +7        CS       RATELIM2                              
064804,000187: 21,3755           61427                           AD       EDOT                                  
064805,000188: 21,3756           00006                           EXTEND                                         
064806,000189: 21,3757           63641                           BZMF     POSTHRST                              
064807,000190: 21,3760           34755        TJZERO             CA       ZERO                                  
064808,000191: 21,3761           13642                           TCF      POSTHRST   +1                         
064809,000192: 
064810,000193: 
064811,000194: 21,3762     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
064812,000195: 21,3762     4767               RATEDB1            =        TBUILDFX                              #   = 00045, CORRESPONDS TO 0.101 DEG/SEC

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