Source Code

This source code is very close to the Apollo Guidance Computer software for the Apollo 13 Lunar module. This revision of the Luminary 131 program is from December of 1969, whereas there was a later revision in January of 1970, and still another revision in February, which is the code that flew on the mission. As far as this transcription is concerned, it was originally from a copy made in 1991 of a printout from the collection of AGC developer Don Eyles for collector David Craig. It was subsequently scanned by Gary Neff, reprocessed for online presentation at the now-discontinued History of Recent Science and Technology (HRST) website of MIT's Dibner Institute (the full-quality scans being discarded in the process), and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a high-quality replacement scan for a completely illegible page was later provided by Gary Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many errors to be introduced into the transcription. Accordingly, a second scan of the same physical printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive, and used to correct the transcription errors. All of the scanned materials mentioned, as well as other Luminary 131 related material, are available online. Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017, so the two scans are not identical in that respect. The page-headings in the printout read, in part:
	GAP:  ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091
	17:53 DEC. 19, 1969
Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together.

007699,000002:                                                                                                  ## Copyright:   Public domain.
007700,000003:                                                                                                  ## Filename:    RCS_FAILURE_MONITOR.agc
007701,000004:                                                                                                  ## Purpose:     RCS FAILURE MONITOR code for for Luminary 1C, revision 131.
007702,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
007703,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
007704,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
007705,000008:                                                                                                  ##              that the code format has been changed to conform to the
007706,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the 
007707,000010:                                                                                                  ##              original YUL assembler.
007708,000011:                                                                                                  ## Reference:   pp. 192-194
007709,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
007710,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
007711,000014:                                                                                                  ## Mod history: 05/05/03 RSB.   Began transcribing.
007712,000015:                                                                                                  ##              05/14/05 RSB    Corrected website references above.
007713,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
007714,000017:                                                                                                  ##                              original harcopy, as opposed to the PDF page
007715,000018:                                                                                                  ##                              numbers in 1701.pdf.
007716,000019:                                                                                                  ##              2017-02-16 RSB  Proofed comment text using octopus/ProoferComments.
007717,000020:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes noted in proofing Luminary 116.
007718,000021:                                                                                                  ##              2017-08-18 RSB  Comment-text bug identified in ZERLINA 56.
007719,000022:                                                                                                  ##              2021-05-30 ABS  Added missing RCSMON definition to match scans.
007720,000023: 

Page 192

007722,000025:                                                                                                  #  PROGRAM DESCRIPTION
007723,000026: 
007724,000027:                                                                                                  #  AUTHOR: J S MILLER
007725,000028: 
007726,000029:                                                                                                  #  MODIFIED 6 MARCH 1968 BY P S WEISSMAN TO SET UP JOB FOR 1/ACCS WHEN THE MASKS ARE CHANGED.
007727,000030: 
007728,000031:                                                                                                  #  THIS ROUTINE IS ATTACHED TO T4RUPT, AND IS ENTERED EVERY 480 MS.  ITS FUNCTION IS TO EXAMINE THE LOW 8 BITS
007729,000032:                                                                                                  #  OF CHANNEL 32 TO SEE IF ANY ISOLATION-VALVE CLOSURE BITS HAVE APPEARED OR DISAPPEARED (THE CREW IS WARNED OF JET
007730,000033:                                                                                                  #  FAILURES BY LAMPS LIT BY THE GRUMMAN FAILURE-DETECTION CIRCUITRY; THEY MAY RESPOND BY OPERATING SWITCHES WHICH
007731,000034:                                                                                                  #  ISOLATE PAIRS OF JETS FROM THE PROPELLANT TANKS AND SET BITS IN CHANNEL 32).  IN THE EVENT THAT CHANNEL 32 BITS
007732,000035:                                                                                                  #  DIFFER FROM 'PVALVEST', THE RECORD OF ACTIONS TAKEN BY THIS ROUTINE, THE APPROPRIATE BITS IN 'CH5MASK' &
007733,000036:                                                                                                  #  'CH6MASK', USED BY THE DAP JET-SELECTION LOGIC, ARE UPDATED, AS IS 'PVALVEST'.  TO SPEED UP & SHORTEN THE
007734,000037:                                                                                                  #  ROUTINE, NO MORE THAN ONE CHANGE IS ACCEPTED PER ENTRY.  THE HIGHEST-NUMBERED BIT IN CHANNEL 32 WHICH REQUIRES
007735,000038:                                                                                                  #  ACTION IS THE ONE PROCESSED.
007736,000039: 
007737,000040:                                                                                                  #  THE CODING IN THE FAILURE MONITOR HAS BEEN WRITTEN SO AS TO HAVE ALMOST COMPLETE RESTART PROTECTION.  FOR
007738,000041:                                                                                                  #  EXAMPLE, NO ASSUMPTION IS MADE WHEN SETTING A 'CH5MASK' BIT TO 1 THAT THE PREVIOUS STATE IS 0, ALTHOUGH IT OF
007739,000042:                                                                                                  #  COURSE SHOULD BE.  ONE CASE WHICH MAY BE SEEN TO EVADE PROTECTION IS THE OCCURRENCE OF A RESTART AFTER UPDATING
007740,000043:                                                                                                  #  ONE OR BOTH DAP MASK-WORDS BUT BEFORE UPDATING 'PVALVEST', COUPLED WITH A CHANGE IN THE VALVE-BIT BACK TO ITS
007741,000044:                                                                                                  #  FORMER STATE.  THE CONSEQUENCE OF THIS IS THAT THE NEXT ENTRY WOULD NOT SEE THE CHANGE INCOMPLETELY INCORP-
007742,000045:                                                                                                  #  ORATED BY THE LAST PASS (BECAUSE IT WENT AWAY AT JUST THE RIGHT TIME), BUT THE DAP MASK-WORDS WILL BE INCORRECT.
007743,000046:                                                                                                  #  THIS COMBINATION OF EVENTS SEEMS QUITE REMOTE, BUT NOT IMPOSSIBLE UNLESS THE CREW OPERATES THE SWITCHES AT HALF-
007744,000047:                                                                                                  #  SECOND INTERVALS OR LONGER.  IN ANY EVENT, A DISAGREEMENT BETWEEN REALITY AND THE DAP MASKS WILL BE CURED IF
007745,000048:                                                                                                  #  THE MISINTERPRETED SWITCH IS REVERSED AND THEN RESTORED TO ITS CORRECT POSITION (SLOWLY).
007746,000049: 
007747,000050:                                                                                                  #  CALLING SEQUENCE:
007748,000051: 
007749,000052:                                                                                                  #        TCF     RCSMONIT                (IN INTERRUPT MODE, EVERY 480 MS.)
007750,000053: 
007751,000054:                                                                                                  #  EXIT: TCF RCSMONEX (ALL PATHS EXIT VIA SUCH AN INSTRUCTION)
007752,000055: 
007753,000056: 06,3164     5270               RCSMONEX           EQUALS   RESUME                                
007754,000057: 
007755,000058:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED:
007756,000059: 
007757,000060:                                                                                                  #        VIA FRESH START:        PVALVEST        =       +0      (ALL JETS ENABLED)
007758,000061:                                                                                                  #                                CH5MASK,CH6MASK =       +0      (ALL JETS OK)
007759,000062: 
007760,000063:                                                                                                  #  OUTPUT:       CH5MASK & CH6MASK UPDATED (1'S WHERE JETS NOT TO BE USED, IN CHANNEL 5 & 6 FORMAT)
007761,000064:                                                                                                  #                PVALTEST UPDATED (1,S WHEN VALVE CLOSURES HAVE BEEN TRANSLATED INTO CH5MASK & CH6MASK; CHAN 32 FORMAT)
007762,000065:                                                                                                  #                JOB TO DO 1/ACCS.
007763,000066: 
007764,000067:                                                                                                  #  DEBRIS:  A, L, Q AND DEBRIS OF NOVAC.
007765,000068: 
007766,000069:                                                                                                  #  SUBROUTINE CALLED:  NOVAC.
007767,000070: 
007768,000071: 06,3164     1257                                  EBANK=   CH5MASK                               
007769,000072: 
007770,000073: 23,2000                                           BANK     23                                    
007771,000074: 06,2000                                           SETLOC   RCSMONT                               
007772,000075: 06,2000                                           BANK                                           

Page 193

007774,000077: 06,3164                                           COUNT*   $$/T4RCS                              
007775,000078: 
007776,000079: 06,3164  06,3164               RCSMONIT           EQUALS   RCSMON                                
007777,000080: 
007778,000081: 06,3164           44755        RCSMON             CS       ZERO                                  
007779,000082: 06,3165           00006                           EXTEND                                         
007780,000083: 06,3166           06032                           RXOR     CHAN32                                #  PICK UP + INVERT INVERTED CHANNEL 32.
007781,000084: 06,3167           74357                           MASK     LOW8                                  #  KEEP JET-FAIL BITS ONLY.
007782,000085: 06,3170           54002                           TS       Q                                     
007783,000086: 
007784,000087: 06,3171           41273                           CS       PVALVEST                              #        -   -
007785,000088: 06,3172           70002                           MASK     Q                                     #  FORM PC + PC.
007786,000089: 06,3173           54001                           TS       L                                     #        (P = PREVIOUS ISOLATION VALVE STATE,
007787,000090: 06,3174           40002                           CS       Q                                     #         C = CURRENT VALVE STATE (CH32)).
007788,000091: 06,3175           71273                           MASK     PVALVEST                              
007789,000092: 06,3176           26001                           ADS      L                                     #  RESULT NZ INDICATES ACTION REQUIRED.
007790,000093: 
007791,000094: 06,3177           00006                           EXTEND                                         
007792,000095: 06,3200           15270                           BZF      RCSMONEX                              #  QUIT IF NO ACTION REQUIRED.
007793,000096: 
007794,000097: 06,3201           00006                           EXTEND                                         
007795,000098: 06,3202           74745                           MP       BIT7                                  #  MOVE BITS 8-1 OF A TO 14-7 OF L.
007796,000099: 06,3203           56001                           XCH      L                                     #  ZERO TO L IN THE PROCESS.
007797,000100: 
007798,000101: 06,3204           24001                 -3        INCR     L                                     
007799,000102: 06,3205           60000                           DOUBLE                                         #  BOUND TO GET OVERFLOW IN THIS LOOP,
007800,000103: 06,3206           54000                           OVSK                                           #  SINCE WE ASSURED INITIAL NZ IN A.
007801,000104: 06,3207           13204                           TCF      -3                                    
007802,000105: 
007803,000106: 06,3210           50001                           INDEX    L                                     
007804,000107: 06,3211           34743                           CA       BIT8       -1                         #  SAVE THE RELEVANT BIT (8-1).
007805,000108: 06,3212           54002                           TS       Q                                     
007806,000109: 06,3213           71273                           MASK     PVALVEST                              #  LOOK AT PREVIOUS VALVE STATE BIT.
007807,000110: 06,3214           10000                           CCS      A                                     
007808,000111: 06,3215           13231                           TCF      VOPENED                               #  THE VALVE HAS JUST BEEN OPENED.
007809,000112: 
007810,000113: 06,3216           41257                           CS       CH5MASK                               #  THE VALVE HAS JUST BEEN CLOSED.
007811,000114: 06,3217           50001                           INDEX    L                                     
007812,000115: 06,3220           73250                           MASK     5FAILTAB                              
007813,000116: 06,3221           27257                           ADS      CH5MASK                               #  SET INHIBIT BIT FOR CHANNEL 5 JET.
007814,000117: 
007815,000118: 06,3222           41260                           CS       CH6MASK                               
007816,000119: 06,3223           50001                           INDEX    L                                     
007817,000120: 06,3224           73260                           MASK     6FAILTAB                              
007818,000121: 06,3225           27260                           ADS      CH6MASK                               #  SET INGIBIT BIT FOR CHANNEL 6 JET.
007819,000122: 
007820,000123: 06,3226           30002                           CA       Q                                     
007821,000124: 06,3227           27273                           ADS      PVALVEST                              #  RECORD ACTION TAKEN.
007822,000125: 
007823,000126: 06,3230           13244                           TCF      1/ACCFIX                              #  SET UP 1/ACCJOB AND EXIT.
007824,000127: 

Page 194

007826,000129: 06,3231           50001        VOPENED            INDEX    L                                     #  A VALVE HAS JUST BEEN OPENED.
007827,000130: 06,3232           43250                           CS       5FAILTAB                              
007828,000131: 06,3233           71257                           MASK     CH5MASK                               
007829,000132: 06,3234           55257                           TS       CH5MASK                               #  REMOVE INHIBIT BIT FOR CHANNEL 5 JET.
007830,000133: 
007831,000134: 06,3235           50001                           INDEX    L                                     
007832,000135: 06,3236           43260                           CS       6FAILTAB                              
007833,000136: 06,3237           71260                           MASK     CH6MASK                               
007834,000137: 06,3240           55260                           TS       CH6MASK                               #  REMOVE INHIBIT BIT FOR CHANNEL 6 JET.
007835,000138: 
007836,000139: 06,3241           40002                           CS       Q                                     
007837,000140: 06,3242           71273                           MASK     PVALVEST                              
007838,000141: 06,3243           55273                           TS       PVALVEST                              #  RECORD ACTION TAKEN.
007839,000142: 
007840,000143: 06,3244           37720        1/ACCFIX           CAF      PRIO27                                #  SET UP 1/ACCS SO THAT THE SWITCH CURVES
007841,000144: 06,3245           05072                           TC       NOVAC                                 #        FOR TJETLAW CAN BE MODIFIED IF CH5MASK
007842,000145: 06,3246  E6,1536                                  EBANK=   AOSQ                                  #        HAS BEEN ALTERED.
007843,000146: 06,3246           03652 42106                     2CADR    1/ACCJOB                              
007844,000147: 
007845,000148: 06,3250           15270                           TCF      RCSMONEX                              #  EXIT.
007846,000149: 
007847,000150: 06,3251                        5FAILTAB           EQUALS   -1                                    #  CH 5 JET BIT CORRESPONDING TO CH 32 BIT:
007848,000151: 06,3251           00040                           OCT      00040                                 #  8
007849,000152: 06,3252           00020                           OCT      00020                                 #  7
007850,000153: 06,3253           00100                           OCT      00100                                 #  6
007851,000154: 06,3254           00200                           OCT      00200                                 #  5
007852,000155: 06,3255           00010                           OCT      00010                                 #  4
007853,000156: 06,3256           00001                           OCT      00001                                 #  3
007854,000157: 06,3257           00004                           OCT      00004                                 #  2
007855,000158: 06,3260           00002                           OCT      00002                                 #  1
007856,000159: 
007857,000160: 06,3261                        6FAILTAB           EQUALS   -1                                    #  CH 6 JET BIT CORRESPONDING TO CH 32 BIT:
007858,000161: 06,3261           00010                           OCT      00010                                 #  8
007859,000162: 06,3262           00020                           OCT      00020                                 #  7
007860,000163: 06,3263           00004                           OCT      00004                                 #  6
007861,000164: 06,3264           00200                           OCT      00200                                 #  5
007862,000165: 06,3265           00001                           OCT      00001                                 #  4
007863,000166: 06,3266           00002                           OCT      00002                                 #  3
007864,000167: 06,3267           00040                           OCT      00040                                 #  2
007865,000168: 06,3270           00100                           OCT      00100                                 #  1
007866,000169: 
007867,000170: 

End of include-file RCS_FAILURE_MONITOR.agc.  Parent file is MAIN.agc