Source Code

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

The reconstruction began with reconstructed source code for Luminary 173. Changes between revision 163 and 173 were backed out, as described by Luminary memos 157 and 158. 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 163 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.

064551,000002:                                                                                                  ## Copyright:   Public domain.
064552,000003:                                                                                                  ## Filename:    SPS_BACK-UP_RCS_CONTROL.agc
064553,000004:                                                                                                  ## Purpose:     A section of Luminary revision 163.
064554,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
064555,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
064556,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
064557,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
064558,000009:                                                                                                  ##              Luminary 173, as well as Luminary memos 157 amd 158.
064559,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
064560,000011:                                                                                                  ##              exactly match those specified for Luminary 163 in NASA
064561,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
064562,000013:                                                                                                  ##              that the reconstruction is correct.
064563,000014:                                                                                                  ## Reference:   pp. 1495-1498
064564,000015:                                                                                                  ## Assembler:   yaYUL
064565,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
064566,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
064567,000018:                                                                                                  ## Mod history: 2019-08-21 MAS  Created from Luminary 173.
064568,000019: 

Page 1495

064570,000021:                                                                                                  #  PROGRAM NAME:  SPSRCS
064571,000022: 
064572,000023:                                                                                                  #  AUTHOR:  EDGAR M. OSHIKA (AC ELECTRONICS)
064573,000024: 
064574,000025:                                                                                                  #  MODIFIED:  TO RETURN TO ALL AXES VIA Q BY P.S.WEISSMAN, OCT 7, 1968
064575,000026: 
064576,000027:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G.KALAN,FEB.14,1969
064577,000028:                                                                                                  #  FUNCTIONAL DESCRIPTION:
064578,000029: 
064579,000030:                                                                                                  #  THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
064580,000031:                                                                                                  #  PLANE LOGIC.
064581,000032: 
064582,000033:                                                                                                  #  1. JET SENSE TEST (SPSRCS)
064583,000034: 
064584,000035:                                                                                                  #  IF JETS ARE FIRING NEGATIVELY,SET OLDSENSE NEGATIVE AND CONTINUE
064585,000036:                                                                                                  #  IF JETS ARE FIRING POSITIVELY,SET OLDSENSE POSITIVE AND CONTINUE
064586,000037:                                                                                                  #  IF JETS ARE NOT FIRING,SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT  TEST
064587,000038: 
064588,000039:                                                                                                  #  2. RATE DEAD BAND TEST
064589,000040: 
064590,000041:                                                                                                  #  IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE,LEAVE
064591,000042:                                                                                                  #  JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
064592,000043:                                                                                                  #  IF JETS ARE FIRING POSITIVELY AND RATE IS   LESS  THAN TARGET RATE,LEAVE
064593,000044:                                                                                                  #  JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
064594,000045: 
064595,000046:                                                                                                  #  3. OUTER RATE LIMIT TEST (SPSSTART)
064596,000047: 
064597,000048:                                                                                                  #  IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
064598,000049:                                                                                                  #   TO REDUCE RATE AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
064599,000050: 
064600,000051:                                                                                                  #  4. COAST ZONE TEST
064601,000052: 
064602,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-
064603,000054:                                                                                                  #  TIVE AND CONTINUE. OTHERWISE,SET JET FIRING TIME TO ZERO AND CONTINUE.
064604,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
064605,000056:                                                                                                  #  AND CONTINUE. OTHERWISE,SET JET FIRING TIME TO ZERO AND CONTINUE.
064606,000057: 
064607,000058:                                                                                                  #  5. INHIBITION LOGIC
064608,000059: 
064609,000060:                                                                                                  #  IF OLDSENSE IS NON-ZERO:
064610,000061:                                                                                                  #        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
064611,000062:                                                                                                  #        B) SET INHIBITION COUNTER*AND RETURN IF JET TIME IS ZERO
064612,000063:                                                                                                  #        C) SET INHIBITION COUNTER,*SET JET TIME TO ZERO AND RETURN IF SIGN
064613,000064:                                                                                                  #           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
064614,000065: 
064615,000066:                                                                                                  #  IF OLDSENSE IS ZERO:
064616,000067:                                                                                                  #        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
064617,000068:                                                                                                  #        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
064618,000069:                                                                                                  #  *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P,AND UV AXES,
064619,000070:                                                                                                  #  RESPECTIVELY,IN SPSRCS. THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1496

064621,000072:                                                                                                  #  EACH DAP PASS.
064622,000073: 
064623,000074:                                                                                                  #  THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION  RATE AT WHICH THIS ROUTINE IS CALLED
064624,000075:                                                                                                  #  AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT.   DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
064625,000076:                                                                                                  #  P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
064626,000077: 
064627,000078:                                                                                                  #  CALLING SEQUENCE:
064628,000079: 
064629,000080:                                                                                                  #           INHINT
064630,000081:                                                                                                  #                      TC     IBNKCALL
064631,000082:                                                                                                  #                      CADR   SPSRCS
064632,000083: 
064633,000084: 
064634,000085:                                                                                                  #  EXIT:
064635,000086:                                                                                                  #           TC     Q
064636,000087:                                                                                                  #  ALARM/ABORT MODE:    NONE
064637,000088: 
064638,000089:                                                                                                  #  SUBROUTINES CALLED:    NONE
064639,000090: 
064640,000091:                                                                                                  #  INPUT:      E,EDOT
064641,000092:                                                                                                  #              TJP, TJV, TJU                   TJ MUST NOT BE NEGATIVE ZERO
064642,000093: 
064643,000094:                                                                                                  #  OUTPUT:     TJP, TJV, TJU
064644,000095: 
064645,000096: 
064646,000097: 21,3640                                           BANK     21                                    
064647,000098: 21,2000                                           SETLOC   DAPS4                                 
064648,000099: 21,2000                                           BANK                                           
064649,000100: 
064650,000101: 21,3640                                           COUNT*   $$/DAPBU                              
064651,000102: 
064652,000103: 21,3640  E6,1525                                  EBANK=   TJU                                   
064653,000104: 21,3640           00632        RATELIM2           OCT      00632                                 #  1.125 DEG/SEC
064654,000105: 21,3641           34736        POSTHRST           CA       HALF                                  
064655,000106: 
064656,000107: 21,3642           51505                           NDX      AXISCTR                               
064657,000108: 21,3643           55525                           TS       TJU                                   
064658,000109: 21,3644           11744                           CCS      OLDSENSE                              
064659,000110: 21,3645           13665                           TCF      POSCHECK                              #  JETS FIRING POSITIVELY
064660,000111: 21,3646           13670                           TCF      CTRCHECK                              #  JETS OFF. CHECK INHIBITION CTR
064661,000112: 21,3647           51505        NEGCHECK           INDEX    AXISCTR                               #  JETS FIRING NEGATIVELY
064662,000113: 21,3650           41525                           CS       TJU                                   
064663,000114: 21,3651           10000                           CCS      A                                     
064664,000115: 21,3652           00002                           TC       Q                                     #  RETURN
064665,000116: 21,3653           13655                           TCF      +2                                    
064666,000117: 21,3654           13655                           TCF      +1                                    #  JETS COMMANDED OFF.SET CTR AND RETURN
064667,000118: 21,3655           51505        SETCTR             INDEX    AXISCTR                               #  JET FIRING REVERSAL COMMANDED. SET CTR,
064668,000119: 21,3656           33677                           CA       UTIME                                 #  SET JET TIME TO ZERO,AND RETURN

Page 1497

064670,000121: 21,3657           51505                           INDEX    AXISCTR                               
064671,000122: 21,3660           55767                           TS       UJETCTR                               
064672,000123: 21,3661           34755        ZAPTJ              CA       ZERO                                  
064673,000124: 21,3662           51505                           INDEX    AXISCTR                               
064674,000125: 21,3663           55525                           TS       TJU                                   
064675,000126: 21,3664           00002                           TC       Q                                     
064676,000127: 21,3665           51505        POSCHECK           INDEX    AXISCTR                               
064677,000128: 21,3666           31525                           CA       TJU                                   
064678,000129: 21,3667           13651                           TCF      NEGCHECK   +2                         
064679,000130: 21,3670           51505        CTRCHECK           INDEX    AXISCTR                               #  CHECK JET INHIBITION COUNTER
064680,000131: 21,3671           11767                           CCS      UJETCTR                               
064681,000132: 21,3672           13674                           TCF      +2                                    
064682,000133: 21,3673           00002                           TC       Q                                     #  CTR IS NOT POSITIVE. RETURN
064683,000134: 21,3674           13661                           TCF      ZAPTJ                                 #  CTR IS POSITIVE.INHIBIT FIRINGS
064684,000135: 21,3675           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.RETURN
064685,000136: 21,3676           00004                           OCT      00004                                 
064686,000137: 21,3677           00012        UTIME              OCT      00012                                 
064687,000138: 21,3700           00012                           OCT      00012                                 
064688,000139: 21,3701  E6,1744               OLDSENSE           EQUALS   DAPTREG1                              
064689,000140: 21,3701           44753        NEGFIRE            CS       ONE                                   #  JETS FIRING NEGATIVELY
064690,000141: 21,3702           55744                           TS       OLDSENSE                              
064691,000142: 21,3703           31427                           CA       EDOT                                  
064692,000143: 21,3704           13710                           TCF      +4                                    
064693,000144: 21,3705           34753        PLUSFIRE           CA       ONE                                   
064694,000145: 21,3706           55744                           TS       OLDSENSE                              
064695,000146: 21,3707           41427                           CS       EDOT                                  #  RATE DEAD BAND TEST
064696,000147: 21,3710           22000                           LXCH     A                                     
064697,000148: 21,3711           40111                           CS       DAPBOOLS                              #  IF DRIFTBIT = 1, USE ZERO TARGET RATE
064698,000149: 21,3712           74744                           MASK     DRIFTBIT                              #  IF DRIFTBIT = 0, USE 0.10 RATE TARGET
064699,000150: 21,3713           10000                           CCS      A                                     
064700,000151: 21,3714           34767                           CA       RATEDB1                               
064701,000152: 21,3715           60001                           AD       L                                     
064702,000153: 21,3716           00006                           EXTEND                                         
064703,000154: 21,3717           63727                           BZMF     SPSSTART                              
064704,000155: 21,3720           13644                           TCF      POSTHRST   +3                         
064705,000156: 
064706,000157: 21,3721           51505        SPSRCS             INDEX    AXISCTR                               #  JET SENSE TEST
064707,000158: 21,3722           11525                           CCS      TJU                                   
064708,000159: 21,3723           13705                           TCF      PLUSFIRE                              #  JETS FIRING POSITIVELY
064709,000160: 21,3724           13726                           TCF      +2                                    
064710,000161: 21,3725           13701                           TCF      NEGFIRE                               #  JETS FIRING NEGATIVELY
064711,000162: 21,3726           55744                           TS       OLDSENSE                              #  JETS OFF
064712,000163: 21,3727           31427        SPSSTART           CA       EDOT                                  #  OUTER RATE LIMIT TEST
064713,000164: 21,3730           00006                           EXTEND                                         
064714,000165: 21,3731           74766                           MP       RATELIM1                              
064715,000166: 21,3732           10000                           CCS      A                                     
064716,000167: 21,3733           13752                           TCF      NEGTHRST                              #  OUTER RATE LIMIT EXCEEDED
064717,000168: 21,3734           13736                           TCF      +2                                    
064718,000169: 21,3735           13641                           TCF      POSTHRST                              #  OUTER RATE LIMIT EXCEEDED
064719,000170: 21,3736           31427                           CA       EDOT                                  #  COAST ZONE TEST
064720,000171: 21,3737           61751                           AD       E                                     

Page 1498

064722,000173: 21,3740           00006                           EXTEND                                         
064723,000174: 21,3741           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND. FRESHSTART: 1.4 DEG
064724,000175: 21,3742           00006                           EXTEND                                         
064725,000176: 21,3743           13760                           BZF      TJZERO                                
064726,000177: 
064727,000178: 21,3744           00006                           EXTEND                                         
064728,000179: 21,3745           63754                           BZMF     +7                                    
064729,000180: 21,3746           31427                           CA       EDOT                                  
064730,000181: 21,3747           63640                           AD       RATELIM2                              
064731,000182: 21,3750           00006                           EXTEND                                         
064732,000183: 21,3751           63760                           BZMF     TJZERO                                
064733,000184: 21,3752           44736        NEGTHRST           CS       HALF                                  
064734,000185: 21,3753           13642                           TCF      POSTHRST   +1                         
064735,000186: 21,3754           43640                 +7        CS       RATELIM2                              
064736,000187: 21,3755           61427                           AD       EDOT                                  
064737,000188: 21,3756           00006                           EXTEND                                         
064738,000189: 21,3757           63641                           BZMF     POSTHRST                              
064739,000190: 21,3760           34755        TJZERO             CA       ZERO                                  
064740,000191: 21,3761           13642                           TCF      POSTHRST   +1                         
064741,000192: 
064742,000193: 
064743,000194: 21,3762     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
064744,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