Source Code

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

The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 96 listing.

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.

063845,000002:                                                                                                  ## Copyright:   Public domain.
063846,000003:                                                                                                  ## Filename:    SPS_BACK-UP_RCS_CONTROL.agc
063847,000004:                                                                                                  ## Purpose:     A section of Luminary revision 96.
063848,000005:                                                                                                  ##              It is part of the reconstructed source code for the
063849,000006:                                                                                                  ##              original release of the flight software for the Lunar 
063850,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
063851,000008:                                                                                                  ##              The code has been recreated from a previously reconstructed
063852,000009:                                                                                                  ##              copy of Luminary 97 by undoing changes described in anomaly
063853,000010:                                                                                                  ##              report LNY-59. The code has been adapted such that the
063854,000011:                                                                                                  ##              resulting bugger words exactly match those specified for
063855,000012:                                                                                                  ##              Luminary 96 in NASA drawing 2021152D, which gives relatively
063856,000013:                                                                                                  ##              high confidence that the reconstruction is correct.
063857,000014:                                                                                                  ## Reference:   pp. 1507-1510
063858,000015:                                                                                                  ## Assembler:   yaYUL
063859,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
063860,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
063861,000018:                                                                                                  ## Mod history: 2019-08-04 MAS  Created from Luminary 97.
063862,000019: 

Page 1507

063864,000021:                                                                                                  #  PROGRAM NAME:         SPSRCS
063865,000022:                                                                                                  #  AUTHOR:               EDGAR M. OSHIKA (AC ELECTRONICS)
063866,000023:                                                                                                  #  MODIFIED:             TO RETURN TO ALL AXES VIA Q BY P. S. WEISSMAN, OCT 7, 1968
063867,000024:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G. KALAN, FEB. 14, 1969
063868,000025: 
063869,000026:                                                                                                  #  FUNCTIONAL DESCRIPTION:
063870,000027:                                                                                                  #        THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
063871,000028:                                                                                                  #        PLANE LOGIC.
063872,000029: 
063873,000030:                                                                                                  #        1. JET SENSE TEST (SPSRCS)
063874,000031:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY, SET OLDSENSE NEGATIVE AND CONTINUE
063875,000032:                                                                                                  #                IF JETS ARE FIRING POSITIVELY, SET OLDSENSE POSITIVE AND CONTINUE
063876,000033:                                                                                                  #                IF JETS ARE NOT FIRING, SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT TEST
063877,000034: 
063878,000035:                                                                                                  #        2. RATE DEAD BAND TEST
063879,000036:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE, LEAVE
063880,000037:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
063881,000038:                                                                                                  #                IF JETS ARE FIRING POSITIVELY AND RATE IS   LESS  THAN TARGET RATE, LEAVE
063882,000039:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
063883,000040: 
063884,000041:                                                                                                  #        3. OUTER RATE LIMIT TEST (SPSSTART)
063885,000042:                                                                                                  #                IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
063886,000043:                                                                                                  #                        TO REDUCE RATE AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
063887,000044: 
063888,000045:                                                                                                  #        4. COAST ZONE TEST
063889,000046:                                                                                                  #                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-
063890,000047:                                                                                                  #                        TIVE AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
063891,000048:                                                                                                  #                IF STATE IS ABOVE LINE E + 4 X EDOT > +1.4 DEG AND EDOT IS GREATER THAN -1.30 DEG/SEC, SET JET TIME NEGATIVE
063892,000049:                                                                                                  #                        AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
063893,000050: 
063894,000051:                                                                                                  #        5. INHIBITION LOGIC
063895,000052:                                                                                                  #                IF OLDSENSE IS NON-ZERO:
063896,000053:                                                                                                  #                        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
063897,000054:                                                                                                  #                        B) SET INHIBITION COUNTER* AND RETURN IF JET TIME IS ZERO
063898,000055:                                                                                                  #                        C) SET INHIBITION COUNTER,* SET JET TIME TO ZERO AND RETURN IF SIGN
063899,000056:                                                                                                  #                           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
063900,000057:                                                                                                  #                IF OLDSENSE IS ZERO:
063901,000058:                                                                                                  #                        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
063902,000059:                                                                                                  #                        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
063903,000060:                                                                                                  #                *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P, AND UV AXES,
063904,000061:                                                                                                  #                RESPECTIVELY, IN SPSRCS.  THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1508

063906,000063:                                                                                                  #                EACH DAP PASS.
063907,000064: 
063908,000065:                                                                                                  #        THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION RATE AT WHICH THIS ROUTINE IS CALLED
063909,000066:                                                                                                  #        AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT.  DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
063910,000067:                                                                                                  #        P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
063911,000068: 
063912,000069:                                                                                                  #  CALLING SEQUENCE:
063913,000070:                                                                                                  #                INHINT
063914,000071:                                                                                                  #                TC      IBNKCALL
063915,000072:                                                                                                  #                CADR    SPSRCS
063916,000073: 
063917,000074:                                                                                                  #  EXIT:
063918,000075:                                                                                                  #                TC      Q
063919,000076: 
063920,000077:                                                                                                  #  ALARM/ABORT MODE:     NONE
063921,000078: 
063922,000079:                                                                                                  #  SUBROUTINES CALLED:   NONE
063923,000080: 
063924,000081:                                                                                                  #  INPUT:                E, EDOT
063925,000082:                                                                                                  #                        TJP, TJV, TJU           TJ MUST NOT BE NEGATIVE ZERO
063926,000083: 
063927,000084:                                                                                                  #  OUTPUT:               TJP, TJV, TJU
063928,000085: 
063929,000086: 21,3646                                           BANK     21                                    
063930,000087: 21,2000                                           SETLOC   DAPS4                                 
063931,000088: 21,2000                                           BANK                                           
063932,000089: 
063933,000090: 21,3646                                           COUNT*   $$/DAPBU                              
063934,000091: 
063935,000092: 21,3646  E6,1525                                  EBANK=   TJU                                   
063936,000093: 21,3646           00632        RATELIM2           OCT      00632                                 #  1.125 DEG/SEC
063937,000094: 21,3647           34736        POSTHRST           CA       HALF                                  
063938,000095: 
063939,000096: 21,3650           51505                           NDX      AXISCTR                               
063940,000097: 21,3651           55525                           TS       TJU                                   
063941,000098: 21,3652           11745                           CCS      OLDSENSE                              
063942,000099: 21,3653           13673                           TCF      POSCHECK                              #  JETS FIRING POSITIVELY
063943,000100: 21,3654           13676                           TCF      CTRCHECK                              #  JETS OFF.  CHECK INHIBITION CTR
063944,000101: 21,3655           51505        NEGCHECK           INDEX    AXISCTR                               #  JETS FIRING NEGATIVELY
063945,000102: 21,3656           41525                           CS       TJU                                   
063946,000103: 21,3657           10000                           CCS      A                                     
063947,000104: 21,3660           00002                           TC       Q                                     #  RETURN
063948,000105: 21,3661           13663                           TCF      +2                                    
063949,000106: 21,3662           13663                           TCF      +1                                    #  JETS COMMANDED OFF.  SET CTR AND RETURN
063950,000107: 21,3663           51505        SETCTR             INDEX    AXISCTR                               #  JET FIRING REVERSAL COMMANDED.  SET CTR,
063951,000108: 21,3664           33705                           CA       UTIME                                 #  SET JET TIME TO ZERO, AND RETURN

Page 1509

063953,000110: 21,3665           51505                           INDEX    AXISCTR                               
063954,000111: 21,3666           55770                           TS       UJETCTR                               
063955,000112: 21,3667           34755        ZAPTJ              CA       ZERO                                  
063956,000113: 21,3670           51505                           INDEX    AXISCTR                               
063957,000114: 21,3671           55525                           TS       TJU                                   
063958,000115: 21,3672           00002                           TC       Q                                     
063959,000116: 21,3673           51505        POSCHECK           INDEX    AXISCTR                               
063960,000117: 21,3674           31525                           CA       TJU                                   
063961,000118: 21,3675           13657                           TCF      NEGCHECK   +2                         
063962,000119: 21,3676           51505        CTRCHECK           INDEX    AXISCTR                               #  CHECK JET INHIBITION COUNTER
063963,000120: 21,3677           11770                           CCS      UJETCTR                               
063964,000121: 21,3700           13702                           TCF      +2                                    
063965,000122: 21,3701           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
063966,000123: 21,3702           13667                           TCF      ZAPTJ                                 #  CTR IS POSITIVE.  INHIBIT FIRINGS
063967,000124: 21,3703           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
063968,000125: 21,3704           00004                           OCT      00004                                 
063969,000126: 21,3705           00012        UTIME              OCT      00012                                 
063970,000127: 21,3706           00012                           OCT      00012                                 
063971,000128: 21,3707  E6,1745               OLDSENSE           EQUALS   DAPTREG1                              
063972,000129: 21,3707           44753        NEGFIRE            CS       ONE                                   #  JETS FIRING NEGATIVELY
063973,000130: 21,3710           55745                           TS       OLDSENSE                              
063974,000131: 21,3711           31427                           CA       EDOT                                  
063975,000132: 21,3712           13716                           TCF      +4                                    
063976,000133: 21,3713           34753        PLUSFIRE           CA       ONE                                   
063977,000134: 21,3714           55745                           TS       OLDSENSE                              
063978,000135: 21,3715           41427                           CS       EDOT                                  #  RATE DEAD BAND TEST
063979,000136: 21,3716           22000                           LXCH     A                                     
063980,000137: 21,3717           40111                           CS       DAPBOOLS                              #  IF DRIFTBIT = 1, USE ZERO TARGET RATE
063981,000138: 21,3720           74744                           MASK     DRIFTBIT                              #  IF DRIFTBIT = 0, USE 0.10 RATE TARGET
063982,000139: 21,3721           10000                           CCS      A                                     
063983,000140: 21,3722           34767                           CA       RATEDB1                               
063984,000141: 21,3723           60001                           AD       L                                     
063985,000142: 21,3724           00006                           EXTEND                                         
063986,000143: 21,3725           63735                           BZMF     SPSSTART                              
063987,000144: 21,3726           13652                           TCF      POSTHRST   +3                         
063988,000145: 
063989,000146: 21,3727           51505        SPSRCS             INDEX    AXISCTR                               #  JET SENSE TEST
063990,000147: 21,3730           11525                           CCS      TJU                                   
063991,000148: 21,3731           13713                           TCF      PLUSFIRE                              #  JETS FIRING POSITIVELY
063992,000149: 21,3732           13734                           TCF      +2                                    
063993,000150: 21,3733           13707                           TCF      NEGFIRE                               #  JETS FIRING NEGATIVELY
063994,000151: 21,3734           55745                           TS       OLDSENSE                              #  JETS OFF
063995,000152: 21,3735           31427        SPSSTART           CA       EDOT                                  #  OUTER RATE LIMIT TEST
063996,000153: 21,3736           00006                           EXTEND                                         
063997,000154: 21,3737           74766                           MP       RATELIM1                              
063998,000155: 21,3740           10000                           CCS      A                                     
063999,000156: 21,3741           13760                           TCF      NEGTHRST                              #  OUTER RATE LIMIT EXCEEDED
064000,000157: 21,3742           13744                           TCF      +2                                    
064001,000158: 21,3743           13647                           TCF      POSTHRST                              #  OUTER RATE LIMIT EXCEEDED
064002,000159: 21,3744           31427                           CA       EDOT                                  #  COAST ZONE TEST

Page 1510

064004,000161: 21,3745           61752                           AD       E                                     
064005,000162: 21,3746           00006                           EXTEND                                         
064006,000163: 21,3747           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND.  FRESHSTART: 1.4 DEG
064007,000164: 21,3750           00006                           EXTEND                                         
064008,000165: 21,3751           13766                           BZF      TJZERO                                
064009,000166: 
064010,000167: 21,3752           00006                           EXTEND                                         
064011,000168: 21,3753           63762                           BZMF     +7                                    
064012,000169: 21,3754           31427                           CA       EDOT                                  
064013,000170: 21,3755           63646                           AD       RATELIM2                              
064014,000171: 21,3756           00006                           EXTEND                                         
064015,000172: 21,3757           63766                           BZMF     TJZERO                                
064016,000173: 21,3760           44736        NEGTHRST           CS       HALF                                  
064017,000174: 21,3761           13650                           TCF      POSTHRST   +1                         
064018,000175: 21,3762           43646                 +7        CS       RATELIM2                              
064019,000176: 21,3763           61427                           AD       EDOT                                  
064020,000177: 21,3764           00006                           EXTEND                                         
064021,000178: 21,3765           63647                           BZMF     POSTHRST                              
064022,000179: 21,3766           34755        TJZERO             CA       ZERO                                  
064023,000180: 21,3767           13650                           TCF      POSTHRST   +1                         
064024,000181: 
064025,000182: 21,3770     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
064026,000183: 21,3770     4767               RATEDB1            =        TBUILDFX                              #  = 00045, CORRESPONDS TO 0.101 DEG/SEC
064027,000184: 

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