Source Code

These source-code files are part of a reconstructed copy of LM131 revision 1, the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 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.

007621,000002:                                                                                                  ## Copyright:   Public domain.
007622,000003:                                                                                                  ## Filename:    RCS_FAILURE_MONITOR.agc
007623,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
007624,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
007625,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
007626,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
007627,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
007628,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
007629,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
007630,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
007631,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
007632,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
007633,000014:                                                                                                  ##              resulting binary is.
007634,000015:                                                                                                  ## Reference:   pp. 192-194
007635,000016:                                                                                                  ## Assembler:   yaYUL
007636,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
007637,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
007638,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
007639,000020: 

Page 192

007641,000022:                                                                                                  #  PROGRAM DESCRIPTION
007642,000023: 
007643,000024:                                                                                                  #  AUTHOR: J S MILLER
007644,000025: 
007645,000026:                                                                                                  #  MODIFIED 6 MARCH 1968 BY P S WEISSMAN TO SET UP JOB FOR 1/ACCS WHEN THE MASKS ARE CHANGED.
007646,000027: 
007647,000028:                                                                                                  #  THIS ROUTINE IS ATTACHED TO T4RUPT, AND IS ENTERED EVERY 480 MS.  ITS FUNCTION IS TO EXAMINE THE LOW 8 BITS
007648,000029:                                                                                                  #  OF CHANNEL 32 TO SEE IF ANY ISOLATION-VALVE CLOSURE BITS HAVE APPEARED OR DISAPPEARED (THE CREW IS WARNED OF JET
007649,000030:                                                                                                  #  FAILURES BY LAMPS LIT BY THE GRUMMAN FAILURE-DETECTION CIRCUITRY; THEY MAY RESPOND BY OPERATING SWITCHES WHICH
007650,000031:                                                                                                  #  ISOLATE PAIRS OF JETS FROM THE PROPELLANT TANKS AND SET BITS IN CHANNEL 32).  IN THE EVENT THAT CHANNEL 32 BITS
007651,000032:                                                                                                  #  DIFFER FROM 'PVALVEST', THE RECORD OF ACTIONS TAKEN BY THIS ROUTINE, THE APPROPRIATE BITS IN 'CH5MASK' &
007652,000033:                                                                                                  #  'CH6MASK', USED BY THE DAP JET-SELECTION LOGIC, ARE UPDATED, AS IS 'PVALVEST'.  TO SPEED UP & SHORTEN THE
007653,000034:                                                                                                  #  ROUTINE, NO MORE THAN ONE CHANGE IS ACCEPTED PER ENTRY.  THE HIGHEST-NUMBERED BIT IN CHANNEL 32 WHICH REQUIRES
007654,000035:                                                                                                  #  ACTION IS THE ONE PROCESSED.
007655,000036: 
007656,000037:                                                                                                  #  THE CODING IN THE FAILURE MONITOR HAS BEEN WRITTEN SO AS TO HAVE ALMOST COMPLETE RESTART PROTECTION.  FOR
007657,000038:                                                                                                  #  EXAMPLE, NO ASSUMPTION IS MADE WHEN SETTING A 'CH5MASK' BIT TO 1 THAT THE PREVIOUS STATE IS 0, ALTHOUGH IT OF
007658,000039:                                                                                                  #  COURSE SHOULD BE.  ONE CASE WHICH MAY BE SEEN TO EVADE PROTECTION IS THE OCCURRENCE OF A RESTART AFTER UPDATING
007659,000040:                                                                                                  #  ONE OR BOTH DAP MASK-WORDS BUT BEFORE UPDATING 'PVALVEST', COUPLED WITH A CHANGE IN THE VALVE-BIT BACK TO ITS
007660,000041:                                                                                                  #  FORMER STATE.  THE CONSEQUENCE OF THIS IS THAT THE NEXT ENTRY WOULD NOT SEE THE CHANGE INCOMPLETELY INCORP-
007661,000042:                                                                                                  #  ORATED BY THE LAST PASS (BECAUSE IT WENT AWAY AT JUST THE RIGHT TIME), BUT THE DAP MASK-WORDS WILL BE INCORRECT.
007662,000043:                                                                                                  #  THIS COMBINATION OF EVENTS SEEMS QUITE REMOTE, BUT NOT IMPOSSIBLE UNLESS THE CREW OPERATES THE SWITCHES AT HALF-
007663,000044:                                                                                                  #  SECOND INTERVALS OR LONGER.  IN ANY EVENT, A DISAGREEMENT BETWEEN REALITY AND THE DAP MASKS WILL BE CURED IF
007664,000045:                                                                                                  #  THE MISINTERPRETED SWITCH IS REVERSED AND THEN RESTORED TO ITS CORRECT POSITION (SLOWLY).
007665,000046: 
007666,000047:                                                                                                  #  CALLING SEQUENCE:
007667,000048: 
007668,000049:                                                                                                  #        TCF     RCSMONIT                (IN INTERRUPT MODE, EVERY 480 MS.)
007669,000050: 
007670,000051:                                                                                                  #  EXIT: TCF RCSMONEX (ALL PATHS EXIT VIA SUCH AN INSTRUCTION)
007671,000052: 
007672,000053: 06,3164     5270               RCSMONEX           EQUALS   RESUME                                
007673,000054: 
007674,000055:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED:
007675,000056: 
007676,000057:                                                                                                  #        VIA FRESH START:        PVALVEST        =       +0      (ALL JETS ENABLED)
007677,000058:                                                                                                  #                                CH5MASK,CH6MASK =       +0      (ALL JETS OK)
007678,000059: 
007679,000060:                                                                                                  #  OUTPUT:       CH5MASK & CH6MASK UPDATED (1'S WHERE JETS NOT TO BE USED, IN CHANNEL 5 & 6 FORMAT)
007680,000061:                                                                                                  #                PVALTEST UPDATED (1,S WHEN VALVE CLOSURES HAVE BEEN TRANSLATED INTO CH5MASK & CH6MASK; CHAN 32 FORMAT)
007681,000062:                                                                                                  #                JOB TO DO 1/ACCS.
007682,000063: 
007683,000064:                                                                                                  #  DEBRIS:  A, L, Q AND DEBRIS OF NOVAC.
007684,000065: 
007685,000066:                                                                                                  #  SUBROUTINE CALLED:  NOVAC.
007686,000067: 
007687,000068: 06,3164     1257                                  EBANK=   CH5MASK                               
007688,000069: 
007689,000070: 23,2000                                           BANK     23                                    
007690,000071: 06,2000                                           SETLOC   RCSMONT                               
007691,000072: 06,2000                                           BANK                                           

Page 193

007693,000074: 06,3164                                           COUNT*   $$/T4RCS                              
007694,000075: 
007695,000076: 06,3164  06,3164               RCSMONIT           EQUALS   RCSMON                                
007696,000077: 
007697,000078: 06,3164           44755        RCSMON             CS       ZERO                                  
007698,000079: 06,3165           00006                           EXTEND                                         
007699,000080: 06,3166           06032                           RXOR     CHAN32                                #  PICK UP + INVERT INVERTED CHANNEL 32.
007700,000081: 06,3167           74357                           MASK     LOW8                                  #  KEEP JET-FAIL BITS ONLY.
007701,000082: 06,3170           54002                           TS       Q                                     
007702,000083: 
007703,000084: 06,3171           41273                           CS       PVALVEST                              #        -   -
007704,000085: 06,3172           70002                           MASK     Q                                     #  FORM PC + PC.
007705,000086: 06,3173           54001                           TS       L                                     #        (P = PREVIOUS ISOLATION VALVE STATE,
007706,000087: 06,3174           40002                           CS       Q                                     #         C = CURRENT VALVE STATE (CH32)).
007707,000088: 06,3175           71273                           MASK     PVALVEST                              
007708,000089: 06,3176           26001                           ADS      L                                     #  RESULT NZ INDICATES ACTION REQUIRED.
007709,000090: 
007710,000091: 06,3177           00006                           EXTEND                                         
007711,000092: 06,3200           15270                           BZF      RCSMONEX                              #  QUIT IF NO ACTION REQUIRED.
007712,000093: 
007713,000094: 06,3201           00006                           EXTEND                                         
007714,000095: 06,3202           74745                           MP       BIT7                                  #  MOVE BITS 8-1 OF A TO 14-7 OF L.
007715,000096: 06,3203           56001                           XCH      L                                     #  ZERO TO L IN THE PROCESS.
007716,000097: 
007717,000098: 06,3204           24001                 -3        INCR     L                                     
007718,000099: 06,3205           60000                           DOUBLE                                         #  BOUND TO GET OVERFLOW IN THIS LOOP,
007719,000100: 06,3206           54000                           OVSK                                           #  SINCE WE ASSURED INITIAL NZ IN A.
007720,000101: 06,3207           13204                           TCF      -3                                    
007721,000102: 
007722,000103: 06,3210           50001                           INDEX    L                                     
007723,000104: 06,3211           34743                           CA       BIT8       -1                         #  SAVE THE RELEVANT BIT (8-1).
007724,000105: 06,3212           54002                           TS       Q                                     
007725,000106: 06,3213           71273                           MASK     PVALVEST                              #  LOOK AT PREVIOUS VALVE STATE BIT.
007726,000107: 06,3214           10000                           CCS      A                                     
007727,000108: 06,3215           13231                           TCF      VOPENED                               #  THE VALVE HAS JUST BEEN OPENED.
007728,000109: 
007729,000110: 06,3216           41257                           CS       CH5MASK                               #  THE VALVE HAS JUST BEEN CLOSED.
007730,000111: 06,3217           50001                           INDEX    L                                     
007731,000112: 06,3220           73250                           MASK     5FAILTAB                              
007732,000113: 06,3221           27257                           ADS      CH5MASK                               #  SET INHIBIT BIT FOR CHANNEL 5 JET.
007733,000114: 
007734,000115: 06,3222           41260                           CS       CH6MASK                               
007735,000116: 06,3223           50001                           INDEX    L                                     
007736,000117: 06,3224           73260                           MASK     6FAILTAB                              
007737,000118: 06,3225           27260                           ADS      CH6MASK                               #  SET INGIBIT BIT FOR CHANNEL 6 JET.
007738,000119: 
007739,000120: 06,3226           30002                           CA       Q                                     
007740,000121: 06,3227           27273                           ADS      PVALVEST                              #  RECORD ACTION TAKEN.
007741,000122: 
007742,000123: 06,3230           13244                           TCF      1/ACCFIX                              #  SET UP 1/ACCJOB AND EXIT.
007743,000124: 

Page 194

007745,000126: 06,3231           50001        VOPENED            INDEX    L                                     #  A VALVE HAS JUST BEEN OPENED.
007746,000127: 06,3232           43250                           CS       5FAILTAB                              
007747,000128: 06,3233           71257                           MASK     CH5MASK                               
007748,000129: 06,3234           55257                           TS       CH5MASK                               #  REMOVE INHIBIT BIT FOR CHANNEL 5 JET.
007749,000130: 
007750,000131: 06,3235           50001                           INDEX    L                                     
007751,000132: 06,3236           43260                           CS       6FAILTAB                              
007752,000133: 06,3237           71260                           MASK     CH6MASK                               
007753,000134: 06,3240           55260                           TS       CH6MASK                               #  REMOVE INHIBIT BIT FOR CHANNEL 6 JET.
007754,000135: 
007755,000136: 06,3241           40002                           CS       Q                                     
007756,000137: 06,3242           71273                           MASK     PVALVEST                              
007757,000138: 06,3243           55273                           TS       PVALVEST                              #  RECORD ACTION TAKEN.
007758,000139: 
007759,000140: 06,3244           37720        1/ACCFIX           CAF      PRIO27                                #  SET UP 1/ACCS SO THAT THE SWITCH CURVES
007760,000141: 06,3245           05072                           TC       NOVAC                                 #        FOR TJETLAW CAN BE MODIFIED IF CH5MASK
007761,000142: 06,3246  E6,1536                                  EBANK=   AOSQ                                  #        HAS BEEN ALTERED.
007762,000143: 06,3246           03652 42106                     2CADR    1/ACCJOB                              
007763,000144: 
007764,000145: 06,3250           15270                           TCF      RCSMONEX                              #  EXIT.
007765,000146: 
007766,000147: 06,3251                        5FAILTAB           EQUALS   -1                                    #  CH 5 JET BIT CORRESPONDING TO CH 32 BIT:
007767,000148: 06,3251           00040                           OCT      00040                                 #  8
007768,000149: 06,3252           00020                           OCT      00020                                 #  7
007769,000150: 06,3253           00100                           OCT      00100                                 #  6
007770,000151: 06,3254           00200                           OCT      00200                                 #  5
007771,000152: 06,3255           00010                           OCT      00010                                 #  4
007772,000153: 06,3256           00001                           OCT      00001                                 #  3
007773,000154: 06,3257           00004                           OCT      00004                                 #  2
007774,000155: 06,3260           00002                           OCT      00002                                 #  1
007775,000156: 
007776,000157: 06,3261                        6FAILTAB           EQUALS   -1                                    #  CH 6 JET BIT CORRESPONDING TO CH 32 BIT:
007777,000158: 06,3261           00010                           OCT      00010                                 #  8
007778,000159: 06,3262           00020                           OCT      00020                                 #  7
007779,000160: 06,3263           00004                           OCT      00004                                 #  6
007780,000161: 06,3264           00200                           OCT      00200                                 #  5
007781,000162: 06,3265           00001                           OCT      00001                                 #  4
007782,000163: 06,3266           00002                           OCT      00002                                 #  3
007783,000164: 06,3267           00040                           OCT      00040                                 #  2
007784,000165: 06,3270           00100                           OCT      00100                                 #  1
007785,000166: 
007786,000167: 

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