Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97. A bug (which had been around since at least Apollo 10, Luminary 69) was discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute revision into Rev 1, which is what actually flew rather than the Rev 0 presented here. A hardcopy of Rev 0 is known to exist — it belonged to AGC developer Allan Klumpp for many years — but unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus the code you see here had been reconstructed (we believe accurately) rather than transcribed. The first step of the reconstruction of the Rev 0 source code was the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection. The process of reverting the active portion of the source code (i.e., other than program comments) from Rev 1 to Rev 0 was very minor, consisting only of moving the position of the STARTSB1 label in FRESH START AND RESTART. Allan had previously given us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read, in part:

	GAP:  ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051

A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here.

066661,000002:                                                                                                  ## Copyright:   Public domain.
066662,000003:                                                                                                  ## Filename:    SPS_BACK-UP_RCS_CONTROL.agc
066663,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
066664,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the third release
066665,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
066666,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
066667,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
066668,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
066669,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
066670,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
066671,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
066672,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
066673,000014:                                                                                                  ##              the original YUL assembler.
066674,000015:                                                                                                  ##
066675,000016:                                                                                                  ## Assembler:   yaYUL
066676,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
066677,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
066678,000019:                                                                                                  ## Pages:       1507-1510
066679,000020:                                                                                                  ## Mod history: 2009-05-27 RSB  Adapted from the corresponding 
066680,000021:                                                                                                  ##                              Luminary131 file, using page 
066681,000022:                                                                                                  ##                              images from Luminary 1A.
066682,000023:                                                                                                  ##              2011-01-06 JL   Fixed pseudo-label indentation.
066683,000024:                                                                                                  ##              2016-12-18 RSB  Proofed text comments with octopus/ProoferComments
066684,000025:                                                                                                  ##                              and corrected the errors found.
066685,000026:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
066686,000027: 
066687,000028:                                                                                                  ## This source code has been transcribed or otherwise adapted from
066688,000029:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
066689,000030:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
066690,000031:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
066691,000032:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
066692,000033:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
066693,000034:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
066694,000035:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
066695,000036:                                                                                                  ## actually created.
066696,000037:                                                                                                  ##
066697,000038:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
066698,000039:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
066699,000040:                                                                                                  ## the listing from which it was transcribed. It has been verified to
066700,000041:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
066701,000042:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
066702,000043:                                                                                                  ##
066703,000044:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
066704,000045:                                                                                                  ##
066705,000046:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
066706,000047: 

Page 1507

066708,000049:                                                                                                  #  PROGRAM NAME:         SPSRCS
066709,000050:                                                                                                  #  AUTHOR:               EDGAR M. OSHIKA (AC ELECTRONICS)
066710,000051:                                                                                                  #  MODIFIED:             TO RETURN TO ALL AXES VIA Q BY P. S. WEISSMAN, OCT 7, 1968
066711,000052:                                                                                                  #  MODIFIED TO IMPROVE BENDING STABILITY BY G. KALAN, FEB. 14, 1969
066712,000053: 
066713,000054:                                                                                                  #  FUNCTIONAL DESCRIPTION:
066714,000055:                                                                                                  #        THIS PROGRAM CONTROLS THE FIRING OF ALL RCS JETS IN THE DOCKED CONFIGURATION ACCORDING TO THE FOLLOWING PHASE
066715,000056:                                                                                                  #        PLANE LOGIC.
066716,000057: 
066717,000058:                                                                                                  #        1. JET SENSE TEST (SPSRCS)
066718,000059:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY, SET OLDSENSE NEGATIVE AND CONTINUE
066719,000060:                                                                                                  #                IF JETS ARE FIRING POSITIVELY, SET OLDSENSE POSITIVE AND CONTINUE
066720,000061:                                                                                                  #                IF JETS ARE NOT FIRING, SET OLDSENSE TO ZERO AND GO TO OUTER RATE LIMIT TEST
066721,000062: 
066722,000063:                                                                                                  #        2. RATE DEAD BAND TEST
066723,000064:                                                                                                  #                IF JETS ARE FIRING NEGATIVELY AND RATE IS GREATER THAN TARGET RATE, LEAVE
066724,000065:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
066725,000066:                                                                                                  #                IF JETS ARE FIRING POSITIVELY AND RATE IS   LESS  THAN TARGET RATE, LEAVE
066726,000067:                                                                                                  #                        JETS ON AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
066727,000068: 
066728,000069:                                                                                                  #        3. OUTER RATE LIMIT TEST (SPSSTART)
066729,000070:                                                                                                  #                IF MAGNITUDE OF EDOT IS GREATER THAN 1.73 DEG/SEC SET JET FIRING TIME
066730,000071:                                                                                                  #                        TO REDUCE RATE AND GO TO INHIBITION LOGIC.  OTHERWISE, CONTINUE.
066731,000072: 
066732,000073:                                                                                                  #        4. COAST ZONE TEST
066733,000074:                                                                                                  #                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-
066734,000075:                                                                                                  #                        TIVE AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
066735,000076:                                                                                                  #                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
066736,000077:                                                                                                  #                        AND CONTINUE.  OTHERWISE, SET JET FIRING TIME TO ZERO AND CONTINUE.
066737,000078: 
066738,000079:                                                                                                  #        5. INHIBITION LOGIC
066739,000080:                                                                                                  #                IF OLDSENSE IS NON-ZERO:
066740,000081:                                                                                                  #                        A) RETURN IF JET TIME HAS SAME SIGN AS OLDSENSE
066741,000082:                                                                                                  #                        B) SET INHIBITION COUNTER* AND RETURN IF JET TIME IS ZERO
066742,000083:                                                                                                  #                        C) SET INHIBITION COUNTER,* SET JET TIME TO ZERO AND RETURN IF SIGN
066743,000084:                                                                                                  #                           OF JET TIME IS OPPOSITE TO THAT OF OLDSENSE
066744,000085:                                                                                                  #                IF OLDSENSE IS ZERO:
066745,000086:                                                                                                  #                        A) RETURN IF INHIBITION COUNTER IS NOT POSITIVE
066746,000087:                                                                                                  #                        B) SET JET TIME TO ZERO AND RETURN IF INHIBITION COUNTER IS POSITIVE
066747,000088:                                                                                                  #                *NOTE: INHIBITION COUNTERS CAN BE SET TO 4 OR 10 FOR THE P, AND UV AXES,
066748,000089:                                                                                                  #                RESPECTIVELY, IN SPSRCS.  THEY ARE DECREMENTED BY ONE AT THE BEGINNING OF

Page 1508

066750,000091:                                                                                                  #                EACH DAP PASS.
066751,000092: 
066752,000093:                                                                                                  #        THE MINIMUM PULSE WIDTH OF THIS CONTROLLER IS DETERMINED BY THE REPETITION RATE AT WHICH THIS ROUTINE IS CALLED
066753,000094:                                                                                                  #        AND IS NOMINALLY 100 MS FOR ALL AXES IN DRIFTING FLIGHT.  DURING POWERED FLIGHT THE MINIMUM IS 100 MS FOR THE
066754,000095:                                                                                                  #        P AXIS AND 200 MS FOR THE CONTROL OF THE U AND V AXES.
066755,000096: 
066756,000097:                                                                                                  #  CALLING SEQUENCE:
066757,000098:                                                                                                  #                INHINT
066758,000099:                                                                                                  #                TC      IBNKCALL
066759,000100:                                                                                                  #                CADR    SPSRCS
066760,000101: 
066761,000102:                                                                                                  #  EXIT:
066762,000103:                                                                                                  #                TC      Q
066763,000104: 
066764,000105:                                                                                                  #  ALARM/ABORT MODE:     NONE
066765,000106: 
066766,000107:                                                                                                  #  SUBROUTINES CALLED:   NONE
066767,000108: 
066768,000109:                                                                                                  #  INPUT:                E, EDOT
066769,000110:                                                                                                  #                        TJP, TJV, TJU           TJ MUST NOT BE NEGATIVE ZERO
066770,000111: 
066771,000112:                                                                                                  #  OUTPUT:               TJP, TJV, TJU
066772,000113: 
066773,000114: 21,3646                                           BANK     21                                    
066774,000115: 21,2000                                           SETLOC   DAPS4                                 
066775,000116: 21,2000                                           BANK                                           
066776,000117: 
066777,000118: 21,3646                                           COUNT*   $$/DAPBU                              
066778,000119: 
066779,000120: 21,3646  E6,1525                                  EBANK=   TJU                                   
066780,000121: 21,3646           00632        RATELIM2           OCT      00632                                 #  1.125 DEG/SEC
066781,000122: 21,3647           34736        POSTHRST           CA       HALF                                  
066782,000123: 
066783,000124: 21,3650           51505                           NDX      AXISCTR                               
066784,000125: 21,3651           55525                           TS       TJU                                   
066785,000126: 21,3652           11745                           CCS      OLDSENSE                              
066786,000127: 21,3653           13673                           TCF      POSCHECK                              #  JETS FIRING POSITIVELY
066787,000128: 21,3654           13676                           TCF      CTRCHECK                              #  JETS OFF.  CHECK INHIBITION CTR
066788,000129: 21,3655           51505        NEGCHECK           INDEX    AXISCTR                               #  JETS FIRING NEGATIVELY
066789,000130: 21,3656           41525                           CS       TJU                                   
066790,000131: 21,3657           10000                           CCS      A                                     
066791,000132: 21,3660           00002                           TC       Q                                     #  RETURN
066792,000133: 21,3661           13663                           TCF      +2                                    
066793,000134: 21,3662           13663                           TCF      +1                                    #  JETS COMMANDED OFF.  SET CTR AND RETURN
066794,000135: 21,3663           51505        SETCTR             INDEX    AXISCTR                               #  JET FIRING REVERSAL COMMANDED.  SET CTR,
066795,000136: 21,3664           33705                           CA       UTIME                                 #  SET JET TIME TO ZERO, AND RETURN

Page 1509

066797,000138: 21,3665           51505                           INDEX    AXISCTR                               
066798,000139: 21,3666           55770                           TS       UJETCTR                               
066799,000140: 21,3667           34755        ZAPTJ              CA       ZERO                                  
066800,000141: 21,3670           51505                           INDEX    AXISCTR                               
066801,000142: 21,3671           55525                           TS       TJU                                   
066802,000143: 21,3672           00002                           TC       Q                                     
066803,000144: 21,3673           51505        POSCHECK           INDEX    AXISCTR                               
066804,000145: 21,3674           31525                           CA       TJU                                   
066805,000146: 21,3675           13657                           TCF      NEGCHECK   +2                         
066806,000147: 21,3676           51505        CTRCHECK           INDEX    AXISCTR                               #  CHECK JET INHIBITION COUNTER
066807,000148: 21,3677           11770                           CCS      UJETCTR                               
066808,000149: 21,3700           13702                           TCF      +2                                    
066809,000150: 21,3701           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
066810,000151: 21,3702           13667                           TCF      ZAPTJ                                 #  CTR IS POSITIVE.  INHIBIT FIRINGS
066811,000152: 21,3703           00002                           TC       Q                                     #  CTR IS NOT POSITIVE.  RETURN
066812,000153: 21,3704           00004                           OCT      00004                                 
066813,000154: 21,3705           00012        UTIME              OCT      00012                                 
066814,000155: 21,3706           00012                           OCT      00012                                 
066815,000156: 21,3707  E6,1745               OLDSENSE           EQUALS   DAPTREG1                              
066816,000157: 21,3707           44753        NEGFIRE            CS       ONE                                   #  JETS FIRING NEGATIVELY
066817,000158: 21,3710           55745                           TS       OLDSENSE                              
066818,000159: 21,3711           31427                           CA       EDOT                                  
066819,000160: 21,3712           13716                           TCF      +4                                    
066820,000161: 21,3713           34753        PLUSFIRE           CA       ONE                                   
066821,000162: 21,3714           55745                           TS       OLDSENSE                              
066822,000163: 21,3715           41427                           CS       EDOT                                  #  RATE DEAD BAND TEST
066823,000164: 21,3716           22000                           LXCH     A                                     
066824,000165: 21,3717           40111                           CS       DAPBOOLS                              #  IF DRIFTBIT = 1, USE ZERO TARGET RATE
066825,000166: 21,3720           74744                           MASK     DRIFTBIT                              #  IF DRIFTBIT = 0, USE 0.10 RATE TARGET
066826,000167: 21,3721           10000                           CCS      A                                     
066827,000168: 21,3722           34767                           CA       RATEDB1                               
066828,000169: 21,3723           60001                           AD       L                                     
066829,000170: 21,3724           00006                           EXTEND                                         
066830,000171: 21,3725           63735                           BZMF     SPSSTART                              
066831,000172: 21,3726           13652                           TCF      POSTHRST   +3                         
066832,000173: 
066833,000174: 21,3727           51505        SPSRCS             INDEX    AXISCTR                               #  JET SENSE TEST
066834,000175: 21,3730           11525                           CCS      TJU                                   
066835,000176: 21,3731           13713                           TCF      PLUSFIRE                              #  JETS FIRING POSITIVELY
066836,000177: 21,3732           13734                           TCF      +2                                    
066837,000178: 21,3733           13707                           TCF      NEGFIRE                               #  JETS FIRING NEGATIVELY
066838,000179: 21,3734           55745                           TS       OLDSENSE                              #  JETS OFF
066839,000180: 21,3735           31427        SPSSTART           CA       EDOT                                  #  OUTER RATE LIMIT TEST
066840,000181: 21,3736           00006                           EXTEND                                         
066841,000182: 21,3737           74766                           MP       RATELIM1                              
066842,000183: 21,3740           10000                           CCS      A                                     
066843,000184: 21,3741           13760                           TCF      NEGTHRST                              #  OUTER RATE LIMIT EXCEEDED
066844,000185: 21,3742           13744                           TCF      +2                                    
066845,000186: 21,3743           13647                           TCF      POSTHRST                              #  OUTER RATE LIMIT EXCEEDED
066846,000187: 21,3744           31427                           CA       EDOT                                  #  COAST ZONE TEST

Page 1510

066848,000189: 21,3745           61752                           AD       E                                     
066849,000190: 21,3746           00006                           EXTEND                                         
066850,000191: 21,3747           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND.  FRESHSTART: 1.4 DEG
066851,000192: 21,3750           00006                           EXTEND                                         
066852,000193: 21,3751           13766                           BZF      TJZERO                                
066853,000194: 
066854,000195: 21,3752           00006                           EXTEND                                         
066855,000196: 21,3753           63762                           BZMF     +7                                    
066856,000197: 21,3754           31427                           CA       EDOT                                  
066857,000198: 21,3755           63646                           AD       RATELIM2                              
066858,000199: 21,3756           00006                           EXTEND                                         
066859,000200: 21,3757           63766                           BZMF     TJZERO                                
066860,000201: 21,3760           44736        NEGTHRST           CS       HALF                                  
066861,000202: 21,3761           13650                           TCF      POSTHRST   +1                         
066862,000203: 21,3762           43646                 +7        CS       RATELIM2                              
066863,000204: 21,3763           61427                           AD       EDOT                                  
066864,000205: 21,3764           00006                           EXTEND                                         
066865,000206: 21,3765           63647                           BZMF     POSTHRST                              
066866,000207: 21,3766           34755        TJZERO             CA       ZERO                                  
066867,000208: 21,3767           13650                           TCF      POSTHRST   +1                         
066868,000209: 
066869,000210: 21,3770     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
066870,000211: 21,3770     4767               RATEDB1            =        TBUILDFX                              #  = 00045, CORRESPONDS TO 0.101 DEG/SEC
066871,000212: 

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