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.

057694,000002:                                                                                                  ## Copyright:   Public domain.
057695,000003:                                                                                                  ## Filename:    ALARM_AND_ABORT.agc
057696,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
057697,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
057698,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
057699,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
057700,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
057701,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
057702,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
057703,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
057704,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
057705,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
057706,000014:                                                                                                  ##              resulting binary is.
057707,000015:                                                                                                  ## Reference:   pp. 1373-1377
057708,000016:                                                                                                  ## Assembler:   yaYUL
057709,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
057710,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
057711,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
057712,000020: 

Page 1373

057714,000022:                                                                                                  #  THE FOLLOWING SUBROUTINE MAY BE CALLED TO DISPLAY A NON-ABORTIVE ALARM CONDITION.  IT MAY BE CALLED
057715,000023:                                                                                                  #  EITHER IN INTERRUPT OR UNDER EXECUTIVE CONTROL.
057716,000024: 
057717,000025:                                                                                                  #  CALLING SEQUENCE IS AS FOLLOWS:
057718,000026:                                                                                                  #                TC      ALARM
057719,000027:                                                                                                  #                OCT     AAANN           ALARM NO. NN IN GENERAL AREA AAA.
057720,000028:                                                                                                  #                                        (RETURNS HERE)
057721,000029: 
057722,000030:    5567                                           BLOCK    02                                    
057723,000031:    4000                                           SETLOC   FFTAG7                                
057724,000032:    4000                                           BANK                                           
057725,000033: 
057726,000034:    5567     0375                                  EBANK=   FAILREG                               
057727,000035: 
057728,000036:    5567                                           COUNT*   $$/ALARM                              
057729,000037: 
057730,000038:                                                                                                  #  ALARM TURNS ON THE PROGRAM ALARM LIGHT, BUT DOES NOT DISPLAY.
057731,000039: 
057732,000040:    5567           00004        ALARM              INHINT                                         
057733,000041: 
057734,000042:    5570           30002                           CA       Q                                     
057735,000043:    5571           55363        ALARM2             TS       ALMCADR                               
057736,000044:    5572           50002                           INDEX    Q                                     
057737,000045:    5573           30000                           CA       0                                     
057738,000046:    5574           54001        BORTENT            TS       L                                     
057739,000047: 
057740,000048:    5575           30006        PRIOENT            CA       BBANK                                 
057741,000049:    5576           00006                 +1        EXTEND                                         
057742,000050:    5577           04007                           ROR      SUPERBNK                              #  ADD SUPER BITS.
057743,000051:    5600           55364                           TS       ALMCADR    +1                         
057744,000052: 
057745,000053:    5601           30002        LARMENT            CA       Q                                     #  STORE RETURN FOR ALARM
057746,000054:    5602           54061                           TS       ITEMP1                                
057747,000055: 
057748,000056:    5603           10375        CHKFAIL1           CCS      FAILREG                               #  IS ANYTHING IN FAILREG
057749,000057:    5604           15610                           TCF      CHKFAIL2                              #  YES TRY NEXT REG
057750,000058:    5605           30001                           CA       L                                     
057751,000059:    5606           54375                           TS       FAILREG                               
057752,000060:    5607           15614                           TCF      PROGLARM                              #  TURN ALARM LIGHT ON FOR FIRST ALARM
057753,000061: 
057754,000062:    5610           10376        CHKFAIL2           CCS      FAILREG    +1                         
057755,000063:    5611           15614                           TCF      PROGLARM                              
057756,000064:    5612           30001                           CA       L                                     
057757,000065:    5613           54376                           TS       FAILREG    +1                         
057758,000066: 
057759,000067:    5614           22377        PROGLARM           LXCH     FAILREG    +2                         #  STORE AS "MOST RECENT" ALARM CODE
057760,000068: 
057761,000069:    5615           41035                           CS       DSPTAB     +11D                       #  TURN ON PROGRAM ALARM IF OFF
057762,000070:    5616           75632                           MASK     OCT40400                              
057763,000071:    5617           27035                           ADS      DSPTAB     +11D                       
057764,000072: 

Page 1374

057766,000074:    5620           56061        MULTEXIT           XCH      ITEMP1                                #  OBTAIN RETURN ADDRESS IN A
057767,000075:    5621           00003                           RELINT                                         
057768,000076:    5622           50000                           INDEX    A                                     
057769,000077:    5623           00001                           TC       1                                     
057770,000078: 
057771,000079:                                                                                                  #  PRIOLARM DISPLAYS V05N09 VIA PRIODSPR WITH 3 RETURNS TO THE USER FROM THE ASTRONAUT AT CALL LOC +1,+2,+3 AND
057772,000080:                                                                                                  #  AN IMMEDIATE RETURN TO THE USER AT CALL LOC +4.  EXAMPLE FOLLOWS,
057773,000081:                                                                                                  #                CAF     OCTXX           ALARM CODE
057774,000082:                                                                                                  #                TC      BANKCALL
057775,000083:                                                                                                  #                CADR    PRIOLARM
057776,000084:                                                                                                  #                ...     ...
057777,000085:                                                                                                  #                ...     ...
057778,000086:                                                                                                  #                ...     ...             ASTRONAUT RETURN
057779,000087:                                                                                                  #                TC      PHASCHNG        IMMEDIATE RETURN TO USER.  RESTART
057780,000088:                                                                                                  #                OCT     X.1             PHASE CHANGE FOR PRIO DISPLAY
057781,000089: 
057782,000090: 10,3563                                           BANK     10                                    
057783,000091: 10,2000                                           SETLOC   DISPLAYS                              
057784,000092: 10,2000                                           BANK                                           
057785,000093: 
057786,000094: 10,3563                                           COUNT*   $$/DSPLA                              
057787,000095: 10,3563           00004        PRIOLARM           INHINT                                         #  * * * KEEP IN DISPLAY ROUTINES BANK
057788,000096: 10,3564           54001                           TS       L                                     #  SAVE ALARM CODE
057789,000097: 
057790,000098: 10,3565           30133                           CA       BUF2                                  #  2 CADR OF PRIOLARM USER
057791,000099: 10,3566           55363                           TS       ALMCADR                               
057792,000100: 10,3567           30134                           CA       BUF2       +1                         
057793,000101: 10,3570           05576                           TC       PRIOENT    +1                         #  * LEAVE L ALONE
057794,000102: 10,3571           77467        -2SEC              DEC      -200       B-14                       #  *** DONT MOVE
057795,000103: 10,3572           35006                           CAF      V05N09                                
057796,000104: 10,3573           12505                           TCF      PRIODSPR                              
057797,000105: 
057798,000106:    5624                                           BLOCK    02                                    
057799,000107:    4000                                           SETLOC   FFTAG7                                
057800,000108:    4000                                           BANK                                           
057801,000109: 
057802,000110:    5624                                           COUNT*   $$/ALARM                              
057803,000111:    5624           00004        BAILOUT            INHINT                                         
057804,000112:    5625           30002                           CA       Q                                     
057805,000113:    5626           55363                           TS       ALMCADR                               
057806,000114: 
057807,000115:    5627           50002                           INDEX    Q                                     
057808,000116:    5630           30000                           CAF      0                                     
057809,000117:    5631           05574                           TC       BORTENT                               
057810,000118:    5632           40400        OCT40400           OCT      40400                                 
057811,000119: 
057812,000120:    5633           00004                           INHINT                                         
057813,000121:    5634           34752        WHIMPER            CA       TWO                                   
057814,000122:    5635           60005                           AD       Z                                     

Page 1375

057816,000124:    5636           54017                           TS       BRUPT                                 
057817,000125:    5637           50017                           RESUME                                         
057818,000126:    5640           04635                           TC       POSTJUMP                              #  RESUME SENDS CONTROL HERE
057819,000127:    5641           12763                           CADR     ENEMA                                 
057820,000128:    5642           00004        POODOO             INHINT                                         
057821,000129:    5643           30002                           CA       Q                                     
057822,000130:    5644           55363        ABORT2             TS       ALMCADR                               
057823,000131:    5645           50002                           INDEX    Q                                     
057824,000132:    5646           30000                           CAF      0                                     
057825,000133:    5647           05574                           TC       BORTENT                               
057826,000134:    5650           77770        OCT77770           OCT      77770                                 #  DON'T MOVE
057827,000135: 
057828,000136:    5651           34765                           CAF      OCT35                                 #  4.35SPOT FOR GOPOODOO
057829,000137:    5652           54001                           TS       L                                     
057830,000138:    5653           40000                           COM                                            
057831,000139:    5654           52760                           DXCH     -PHASE4                               
057832,000140:    5655           00004        GOPOODOO           INHINT                                         
057833,000141:    5656           04616                           TC       BANKCALL                              #  RESET STATEFLG, REINTFLG, AND NODOFLAG.
057834,000142:    5657           27746                           CADR     FLAGS                                 
057835,000143:    5660           30103                           CA       FLAGWRD7                              #  IS SERVICER CURRENTLY IN OPERATION?
057836,000144:    5661           74746                           MASK     V37FLBIT                              
057837,000145:    5662           10000                           CCS      A                                     
057838,000146:    5663           15671                           TCF      STRTIDLE                              
057839,000147:    5664           04616                           TC       BANKCALL                              #  TERMINATE GRPS 1, 3, 5, AND 6
057840,000148:    5665           12650                           CADR     V37KLEAN                              
057841,000149:    5666           04616                           TC       BANKCALL                              #  TERMINATE GRPS 2, 4, 1, 3, 5, AND 6
057842,000150:    5667           12641                           CADR     MR.KLEAN                              #        (I.E., GRP 4 LAST)
057843,000151:    5670           15634                           TCF      WHIMPER                               
057844,000152:    5671           35733        STRTIDLE           CAF      BBSERVDL                              
057845,000153:    5672           04727                           TC       SUPERSW                               
057846,000154:    5673           04616                           TC       BANKCALL                              #  PUT SERVICER INTO ITS "GROUND" STATE
057847,000155:    5674           57322                           CADR     SERVIDLE                              #  AND PROCEED TO GOTOPOOH.
057848,000156:    5675           00004        CCSHOLE            INHINT                                         
057849,000157:    5676           30002                           CA       Q                                     
057850,000158:    5677           05644                           TC       ABORT2                                
057851,000159:    5700           21103        OCT21103           OCT      21103                                 
057852,000160:    5701           00004        CURTAINS           INHINT                                         
057853,000161:    5702           30002                           CA       Q                                     
057854,000162:    5703           05571                           TC       ALARM2                                
057855,000163:    5704           00217        OCT217             OCT      00217                                 
057856,000164:    5705           01363                           TC       ALMCADR                               #  RETURN TO USER
057857,000165: 
057858,000166:    5706           00004        BAILOUT1           INHINT                                         
057859,000167:    5707           53364                           DXCH     ALMCADR                               
057860,000168:    5710           35732                           CAF      ADR40400                              
057861,000169:    5711           54061        BOTHABRT           TS       ITEMP1                                
057862,000170:    5712           50002                           INDEX    Q                                     
057863,000171:    5713           30000                           CAF      0                                     
057864,000172:    5714           54001                           TS       L                                     
057865,000173:    5715           15603                           TCF      CHKFAIL1                              
057866,000174: 

Page 1376

057868,000176:    5716           00004        POODOO1            INHINT                                         
057869,000177:    5717           53364                           DXCH     ALMCADR                               
057870,000178:    5720           35731                           CAF      ADR77770                              
057871,000179:    5721           15711                           TCF      BOTHABRT                              
057872,000180: 
057873,000181:    5722           00004        ALARM1             INHINT                                         
057874,000182:    5723           53364                           DXCH     ALMCADR                               
057875,000183:    5724           00004        ALMNCADR           INHINT                                         
057876,000184:    5725           50002                           INDEX    Q                                     
057877,000185:    5726           30000                           CA       0                                     
057878,000186:    5727           54001                           TS       L                                     
057879,000187:    5730           15601                           TCF      LARMENT                               
057880,000188: 
057881,000189:    5731           15650        ADR77770           TCF      OCT77770                              
057882,000190:    5732           15632        ADR40400           TCF      OCT40400                              
057883,000191:    5733     5155               DOALARM            EQUALS   ENDOFJOB                              
057884,000192:    5733  E7,1515                                  EBANK=   DVCNTR                                
057885,000193:    5733           56067        BBSERVDL           BBCON    SERVIDLE                              
057886,000194: 
057887,000195:                                                                                                  #  CALLING SEQUENCE FOR VARALARM
057888,000196:                                                                                                  #                CAF     (ALARM)
057889,000197:                                                                                                  #                TC      VARALARM
057890,000198: 
057891,000199:                                                                                                  #  VARALARM TURNS ON PROGRAM ALARM LIGHT BUT DOES NOT DISPLAY
057892,000200: 
057893,000201:    5734           00004        VARALARM           INHINT                                         
057894,000202: 
057895,000203:    5735           54001                           TS       L                                     #  SAVE USERS ALARM CODE
057896,000204: 
057897,000205:    5736           30002                           CA       Q                                     #  SAVE USERS Q
057898,000206:    5737           55363                           TS       ALMCADR                               
057899,000207: 
057900,000208:    5740           05575                           TC       PRIOENT                               
057901,000209:    5741           00014        OCT14              OCT      14                                    #  DONT MOVE
057902,000210: 
057903,000211:    5742           01363                           TC       ALMCADR                               #  RETURN TO USER
057904,000212: 
057905,000213:    5743     5634               ABORT              EQUALS   WHIMPER                               
057906,000214: 13,3746                                           BANK     13                                    
057907,000215: 13,2000                                           SETLOC   ABTFLGS                               
057908,000216: 13,2000                                           BANK                                           
057909,000217: 13,3746                                           COUNT*   $$/ALARM                              
057910,000218: 
057911,000219: 13,3746           44747        FLAGS              CS       STATEBIT                              
057912,000220: 13,3747           70077                           MASK     FLAGWRD3                              
057913,000221: 13,3750           54077                           TS       FLAGWRD3                              
057914,000222: 13,3751           44745                           CS       REINTBIT                              
057915,000223: 13,3752           70106                           MASK     FLGWRD10                              
057916,000224: 13,3753           54106                           TS       FLGWRD10                              
057917,000225: 13,3754           44753                           CS       NODOBIT                               
057918,000226: 13,3755           70076                           MASK     FLAGWRD2                              
057919,000227: 

Page 1377

057921,000229: 13,3756           54076                           TS       FLAGWRD2                              
057922,000230: 13,3757           00002                           TC       Q                                     
057923,000231: 
057924,000232: 

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