Source Code

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

The reconstruction began with source code of Zerlina 56, Luminary 210, and Luminary 131, previously transcribed from digitized copies of those programs. The code was created by combining the three, using Zerlina 56 as a base, since it was based off of Luminary 183. The differences between the three were carefully merged using the Luminary memos as a guide, with all changes made after Luminary 178 being backed out. 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 178 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.

064724,000002:                                                                                                  ## Copyright:   Public domain.
064725,000003:                                                                                                  ## Filename:    SPS_BACK-UP_RCS_CONTROL.agc
064726,000004:                                                                                                  ## Purpose:     A section of Luminary revision 178.
064727,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
064728,000006:                                                                                                  ##              release of the flight software for the Lunar Module's
064729,000007:                                                                                                  ##              (LM) Apollo Guidance Computer (AGC) for Apollo 14. The
064730,000008:                                                                                                  ##              code has been recreated from copies of Zerlina 56, Luminary
064731,000009:                                                                                                  ##              210, and Luminary 131, as well as many Luminary memos.
064732,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
064733,000011:                                                                                                  ##              exactly match those specified for Luminary 178 in NASA
064734,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
064735,000013:                                                                                                  ##              that the reconstruction is correct.
064736,000014:                                                                                                  ## Reference:   pp. 1495-1498
064737,000015:                                                                                                  ## Assembler:   yaYUL
064738,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
064739,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
064740,000018:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Zerlina 56.
064741,000019:                                                                                                  ##              2019-09-15 MAS  Restored the definition of OLDSENSE.
064742,000020: 

Page 1495

064744,000022:                                                                                                  #  PROGRAM NAME:  SPSRCS
064745,000023: 
064746,000024:                                                                                                  #  AUTHOR:  EDGAR M. OSHIKA (AC ELECTRONICS)
064747,000025: 
064748,000026:                                                                                                  #  MODIFIED:  TO RETURN TO ALL AXES VIA Q BY P.S.WEISSMAN, OCT 7, 1968
064749,000027: 
064750,000028:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G.KALAN,FEB.14,1969
064751,000029:                                                                                                  #  FUNCTIONAL DESCRIPTION:
064752,000030: 
064753,000031:                                                                                                  #  THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
064754,000032:                                                                                                  #  PLANE LOGIC.
064755,000033: 
064756,000034:                                                                                                  #  1. JET SENSE TEST (SPSRCS)
064757,000035: 
064758,000036:                                                                                                  #  IF JETS ARE FIRING NEGATIVELY,SET OLDSENSE NEGATIVE AND CONTINUE
064759,000037:                                                                                                  #  IF JETS ARE FIRING POSITIVELY,SET OLDSENSE POSITIVE AND CONTINUE
064760,000038:                                                                                                  #  IF JETS ARE NOT FIRING,SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT  TEST
064761,000039: 
064762,000040:                                                                                                  #  2. RATE DEAD BAND TEST
064763,000041: 
064764,000042:                                                                                                  #  IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE,LEAVE
064765,000043:                                                                                                  #  JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
064766,000044:                                                                                                  #  IF JETS ARE FIRING POSITIVELY AND RATE IS   LESS  THAN TARGET RATE,LEAVE
064767,000045:                                                                                                  #  JETS ON AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
064768,000046: 
064769,000047:                                                                                                  #  3. OUTER RATE LIMIT TEST (SPSSTART)
064770,000048: 
064771,000049:                                                                                                  #  IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
064772,000050:                                                                                                  #   TO REDUCE RATE AND GO TO INHIBITION LOGIC. OTHERWISE,CONTINUE.
064773,000051: 
064774,000052:                                                                                                  #  4. COAST ZONE TEST
064775,000053: 
064776,000054:                                                                                                  #  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-
064777,000055:                                                                                                  #  TIVE AND CONTINUE. OTHERWISE,SET JET FIRING TIME TO ZERO AND CONTINUE.
064778,000056:                                                                                                  #  IF STATE IS ABOVE LINE  E + 4X EDOT > +1.4 DEG AND EDOT IS GREATER THAN -1.30 DEG/SEC, SET JET TIME NEGATIVE
064779,000057:                                                                                                  #  AND CONTINUE. OTHERWISE,SET JET FIRING TIME TO ZERO AND CONTINUE.
064780,000058: 
064781,000059:                                                                                                  #  5. INHIBITION LOGIC
064782,000060: 
064783,000061:                                                                                                  #  IF OLDSENSE IS NON-ZERO:
064784,000062:                                                                                                  #        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
064785,000063:                                                                                                  #        B) SET INHIBITION COUNTER*AND RETURN IF JET TIME IS ZERO
064786,000064:                                                                                                  #        C) SET INHIBITION COUNTER,*SET JET TIME TO ZERO AND RETURN IF SIGN
064787,000065:                                                                                                  #           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
064788,000066: 
064789,000067:                                                                                                  #  IF OLDSENSE IS ZERO:
064790,000068:                                                                                                  #        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
064791,000069:                                                                                                  #        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
064792,000070:                                                                                                  #  *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P,AND UV AXES,
064793,000071:                                                                                                  #  RESPECTIVELY,IN SPSRCS. THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1496

064795,000073:                                                                                                  #  EACH DAP PASS.
064796,000074: 
064797,000075:                                                                                                  #  THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION  RATE AT WHICH THIS ROUTINE IS CALLED
064798,000076:                                                                                                  #  AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT.   DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
064799,000077:                                                                                                  #  P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
064800,000078: 
064801,000079:                                                                                                  #  CALLING SEQUENCE:
064802,000080: 
064803,000081:                                                                                                  #           INHINT
064804,000082:                                                                                                  #                      TC     IBNKCALL
064805,000083:                                                                                                  #                      CADR   SPSRCS
064806,000084: 
064807,000085: 
064808,000086:                                                                                                  #  EXIT:
064809,000087:                                                                                                  #           TC     Q
064810,000088:                                                                                                  #  ALARM/ABORT MODE:    NONE
064811,000089: 
064812,000090:                                                                                                  #  SUBROUTINES CALLED:    NONE
064813,000091: 
064814,000092:                                                                                                  #  INPUT:      E,EDOT
064815,000093:                                                                                                  #              TJP, TJV, TJU                   TJ MUST NOT BE NEGATIVE ZERO
064816,000094: 
064817,000095:                                                                                                  #  OUTPUT:     TJP, TJV, TJU
064818,000096: 
064819,000097: 
064820,000098: 21,3433                                           BANK     21                                    
064821,000099: 21,2000                                           SETLOC   DAPS4                                 
064822,000100: 21,2000                                           BANK                                           
064823,000101: 
064824,000102: 21,3433                                           COUNT*   $$/DAPBU                              
064825,000103: 
064826,000104: 21,3433  E6,1525                                  EBANK=   TJU                                   
064827,000105: 21,3433           00632        RATELIM2           OCT      00632                                 #  1.125 DEG/SEC
064828,000106: 21,3434           34736        POSTHRST           CA       HALF                                  
064829,000107: 
064830,000108: 21,3435           51505                           NDX      AXISCTR                               
064831,000109: 21,3436           55525                           TS       TJU                                   
064832,000110: 21,3437           11744                           CCS      OLDSENSE                              
064833,000111: 21,3440           13460                           TCF      POSCHECK                              #  JETS FIRING POSITIVELY
064834,000112: 21,3441           13463                           TCF      CTRCHECK                              #  JETS OFF. CHECK INHIBITION CTR
064835,000113: 21,3442           51505        NEGCHECK           INDEX    AXISCTR                               #  JETS FIRING NEGATIVELY
064836,000114: 21,3443           41525                           CS       TJU                                   
064837,000115: 21,3444           10000                           CCS      A                                     
064838,000116: 21,3445           00002                           TC       Q                                     #  RETURN
064839,000117: 21,3446           13450                           TCF      +2                                    
064840,000118: 21,3447           13450                           TCF      +1                                    #  JETS COMMANDED OFF.SET CTR AND RETURN
064841,000119: 21,3450           51505        SETCTR             INDEX    AXISCTR                               #  JET FIRING REVERSAL COMMANDED. SET CTR,
064842,000120: 21,3451           33472                           CA       UTIME                                 #  SET JET TIME TO ZERO,AND RETURN

Page 1497

064844,000122: 21,3452           51505                           INDEX    AXISCTR                               
064845,000123: 21,3453           55767                           TS       UJETCTR                               
064846,000124: 21,3454           34755        ZAPTJ              CA       ZERO                                  
064847,000125: 21,3455           51505                           INDEX    AXISCTR                               
064848,000126: 21,3456           55525                           TS       TJU                                   
064849,000127: 21,3457           00002                           TC       Q                                     
064850,000128: 21,3460           51505        POSCHECK           INDEX    AXISCTR                               
064851,000129: 21,3461           31525                           CA       TJU                                   
064852,000130: 21,3462           13444                           TCF      NEGCHECK   +2                         
064853,000131: 21,3463           51505        CTRCHECK           INDEX    AXISCTR                               #  CHECK JET INHIBITION COUNTER
064854,000132: 21,3464           11767                           CCS      UJETCTR                               
064855,000133: 21,3465           13467                           TCF      +2                                    
064856,000134: 21,3466           00002                           TC       Q                                     #  CTR IS NOT POSITIVE. RETURN
064857,000135: 21,3467           13454                           TCF      ZAPTJ                                 #  CTR IS POSITIVE.INHIBIT FIRINGS
064858,000136: 21,3470           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.RETURN
064859,000137: 21,3471           00004                           OCT      00004                                 
064860,000138: 21,3472           00012        UTIME              OCT      00012                                 
064861,000139: 21,3473           00012                           OCT      00012                                 
064862,000140: 21,3474  E6,1744               OLDSENSE           EQUALS   DAPTREG1                              
064863,000141: 21,3474           44753        NEGFIRE            CS       ONE                                   #  JETS FIRING NEGATIVELY
064864,000142: 21,3475           55744                           TS       OLDSENSE                              
064865,000143: 21,3476           31427                           CA       EDOT                                  
064866,000144: 21,3477           13503                           TCF      +4                                    
064867,000145: 21,3500           34753        PLUSFIRE           CA       ONE                                   
064868,000146: 21,3501           55744                           TS       OLDSENSE                              
064869,000147: 21,3502           41427                           CS       EDOT                                  #  RATE DEAD BAND TEST
064870,000148: 21,3503           22000                           LXCH     A                                     
064871,000149: 21,3504           40111                           CS       DAPBOOLS                              #  IF DRIFTBIT = 1, USE ZERO TARGET RATE
064872,000150: 21,3505           74744                           MASK     DRIFTBIT                              #  IF DRIFTBIT = 0, USE 0.10 RATE TARGET
064873,000151: 21,3506           10000                           CCS      A                                     
064874,000152: 21,3507           34767                           CA       RATEDB1                               
064875,000153: 21,3510           60001                           AD       L                                     
064876,000154: 21,3511           00006                           EXTEND                                         
064877,000155: 21,3512           63522                           BZMF     SPSSTART                              
064878,000156: 21,3513           13437                           TCF      POSTHRST   +3                         
064879,000157: 
064880,000158: 21,3514           51505        SPSRCS             INDEX    AXISCTR                               #  JET SENSE TEST
064881,000159: 21,3515           11525                           CCS      TJU                                   
064882,000160: 21,3516           13500                           TCF      PLUSFIRE                              #  JETS FIRING POSITIVELY
064883,000161: 21,3517           13521                           TCF      +2                                    
064884,000162: 21,3520           13474                           TCF      NEGFIRE                               #  JETS FIRING NEGATIVELY
064885,000163: 21,3521           55744                           TS       OLDSENSE                              #  JETS OFF
064886,000164: 21,3522           31427        SPSSTART           CA       EDOT                                  #  OUTER RATE LIMIT TEST
064887,000165: 21,3523           00006                           EXTEND                                         
064888,000166: 21,3524           74766                           MP       RATELIM1                              
064889,000167: 21,3525           10000                           CCS      A                                     
064890,000168: 21,3526           13545                           TCF      NEGTHRST                              #  OUTER RATE LIMIT EXCEEDED
064891,000169: 21,3527           13531                           TCF      +2                                    
064892,000170: 21,3530           13434                           TCF      POSTHRST                              #  OUTER RATE LIMIT EXCEEDED
064893,000171: 21,3531           31427                           CA       EDOT                                  #  COAST ZONE TEST
064894,000172: 21,3532           61751                           AD       E                                     

Page 1498

064896,000174: 21,3533           00006                           EXTEND                                         
064897,000175: 21,3534           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND. FRESHSTART: 1.4 DEG
064898,000176: 21,3535           00006                           EXTEND                                         
064899,000177: 21,3536           13553                           BZF      TJZERO                                
064900,000178: 
064901,000179: 21,3537           00006                           EXTEND                                         
064902,000180: 21,3540           63547                           BZMF     +7                                    
064903,000181: 21,3541           31427                           CA       EDOT                                  
064904,000182: 21,3542           63433                           AD       RATELIM2                              
064905,000183: 21,3543           00006                           EXTEND                                         
064906,000184: 21,3544           63553                           BZMF     TJZERO                                
064907,000185: 21,3545           44736        NEGTHRST           CS       HALF                                  
064908,000186: 21,3546           13435                           TCF      POSTHRST   +1                         
064909,000187: 21,3547           43433                 +7        CS       RATELIM2                              
064910,000188: 21,3550           61427                           AD       EDOT                                  
064911,000189: 21,3551           00006                           EXTEND                                         
064912,000190: 21,3552           63434                           BZMF     POSTHRST                              
064913,000191: 21,3553           34755        TJZERO             CA       ZERO                                  
064914,000192: 21,3554           13435                           TCF      POSTHRST   +1                         
064915,000193: 
064916,000194: 
064917,000195: 21,3555     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
064918,000196: 21,3555     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