Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the second release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 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.

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

Page 1507

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

Page 1508

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

Page 1509

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

Page 1510

066826,000189: 21,3745           61752                           AD       E                                     
066827,000190: 21,3746           00006                           EXTEND                                         
066828,000191: 21,3747           71411                           MP       DKDB                                  #  PAD LOADED DEADBAND.  FRESHSTART: 1.4 DEG
066829,000192: 21,3750           00006                           EXTEND                                         
066830,000193: 21,3751           13766                           BZF      TJZERO                                
066831,000194: 
066832,000195: 21,3752           00006                           EXTEND                                         
066833,000196: 21,3753           63762                           BZMF     +7                                    
066834,000197: 21,3754           31427                           CA       EDOT                                  
066835,000198: 21,3755           63646                           AD       RATELIM2                              
066836,000199: 21,3756           00006                           EXTEND                                         
066837,000200: 21,3757           63766                           BZMF     TJZERO                                
066838,000201: 21,3760           44736        NEGTHRST           CS       HALF                                  
066839,000202: 21,3761           13650                           TCF      POSTHRST   +1                         
066840,000203: 21,3762           43646                 +7        CS       RATELIM2                              
066841,000204: 21,3763           61427                           AD       EDOT                                  
066842,000205: 21,3764           00006                           EXTEND                                         
066843,000206: 21,3765           63647                           BZMF     POSTHRST                              
066844,000207: 21,3766           34755        TJZERO             CA       ZERO                                  
066845,000208: 21,3767           13650                           TCF      POSTHRST   +1                         
066846,000209: 
066847,000210: 21,3770     4766               RATELIM1           =        CALLCODE                              #  = 00032, CORRESPONDING TO 1.73 DEG/SEC
066848,000211: 21,3770     4767               RATEDB1            =        TBUILDFX                              #  = 00045, CORRESPONDS TO 0.101 DEG/SEC
066849,000212: 

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