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.

057829,000002:                                                                                                  ## Copyright:   Public domain.
057830,000003:                                                                                                  ## Filename:    ALARM_AND_ABORT.agc
057831,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
057832,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
057833,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
057834,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
057835,000008:                                                                                                  ##              that the code format has been changed to conform to the
057836,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
057837,000010:                                                                                                  ##              original YUL assembler.
057838,000011:                                                                                                  ## Reference:   pp. 1373-1377
057839,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
057840,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
057841,000014:                                                                                                  ## Mod history: 06/07/03 RSB.   Began transcribing.
057842,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
057843,000016:                                                                                                  ##              2010-10-25 JL   Indentation fixes.
057844,000017:                                                                                                  ##              2011-06-07 JL   Removed workarounds.
057845,000018:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
057846,000019:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
057847,000020:                                                                                                  ##                              numbers in 1701.pdf.
057848,000021:                                                                                                  ##              2017-02-28 RSB  Proofed comment text using octopus/ProoferComments.
057849,000022:                                                                                                  ##              2017-03-10 RSB  Comment-text fixes noted in proofing Luminary 116.
057850,000023: 

Page 1373

057852,000025:                                                                                                  #  THE FOLLOWING SUBROUTINE MAY BE CALLED TO DISPLAY A NON-ABORTIVE ALARM CONDITION.  IT MAY BE CALLED
057853,000026:                                                                                                  #  EITHER IN INTERRUPT OR UNDER EXECUTIVE CONTROL.
057854,000027: 
057855,000028:                                                                                                  #  CALLING SEQUENCE IS AS FOLLOWS:
057856,000029:                                                                                                  #                TC      ALARM
057857,000030:                                                                                                  #                OCT     AAANN           ALARM NO. NN IN GENERAL AREA AAA.
057858,000031:                                                                                                  #                                        (RETURNS HERE)
057859,000032: 
057860,000033:    5567                                           BLOCK    02                                    
057861,000034:    4000                                           SETLOC   FFTAG7                                
057862,000035:    4000                                           BANK                                           
057863,000036: 
057864,000037:    5567     0375                                  EBANK=   FAILREG                               
057865,000038: 
057866,000039:    5567                                           COUNT*   $$/ALARM                              
057867,000040: 
057868,000041:                                                                                                  #  ALARM TURNS ON THE PROGRAM ALARM LIGHT, BUT DOES NOT DISPLAY.
057869,000042: 
057870,000043:    5567           00004        ALARM              INHINT                                         
057871,000044: 
057872,000045:    5570           30002                           CA       Q                                     
057873,000046:    5571           55363        ALARM2             TS       ALMCADR                               
057874,000047:    5572           50002                           INDEX    Q                                     
057875,000048:    5573           30000                           CA       0                                     
057876,000049:    5574           54001        BORTENT            TS       L                                     
057877,000050: 
057878,000051:    5575           30006        PRIOENT            CA       BBANK                                 
057879,000052:    5576           00006                 +1        EXTEND                                         
057880,000053:    5577           04007                           ROR      SUPERBNK                              #  ADD SUPER BITS.
057881,000054:    5600           55364                           TS       ALMCADR    +1                         
057882,000055: 
057883,000056:    5601           30002        LARMENT            CA       Q                                     #  STORE RETURN FOR ALARM
057884,000057:    5602           54061                           TS       ITEMP1                                
057885,000058: 
057886,000059:    5603           10375        CHKFAIL1           CCS      FAILREG                               #  IS ANYTHING IN FAILREG
057887,000060:    5604           15610                           TCF      CHKFAIL2                              #  YES TRY NEXT REG
057888,000061:    5605           30001                           CA       L                                     
057889,000062:    5606           54375                           TS       FAILREG                               
057890,000063:    5607           15614                           TCF      PROGLARM                              #  TURN ALARM LIGHT ON FOR FIRST ALARM
057891,000064: 
057892,000065:    5610           10376        CHKFAIL2           CCS      FAILREG    +1                         
057893,000066:    5611           15614                           TCF      PROGLARM                              
057894,000067:    5612           30001                           CA       L                                     
057895,000068:    5613           54376                           TS       FAILREG    +1                         
057896,000069: 
057897,000070:    5614           22377        PROGLARM           LXCH     FAILREG    +2                         #  STORE AS "MOST RECENT" ALARM CODE
057898,000071: 
057899,000072:    5615           41035                           CS       DSPTAB     +11D                       #  TURN ON PROGRAM ALARM IF OFF
057900,000073:    5616           75632                           MASK     OCT40400                              
057901,000074:    5617           27035                           ADS      DSPTAB     +11D                       
057902,000075: 

Page 1374

057904,000077:    5620           56061        MULTEXIT           XCH      ITEMP1                                #  OBTAIN RETURN ADDRESS IN A
057905,000078:    5621           00003                           RELINT                                         
057906,000079:    5622           50000                           INDEX    A                                     
057907,000080:    5623           00001                           TC       1                                     
057908,000081: 
057909,000082:                                                                                                  #  PRIOLARM DISPLAYS V05N09 VIA PRIODSPR WITH 3 RETURNS TO THE USER FROM THE ASTRONAUT AT CALL LOC +1,+2,+3 AND
057910,000083:                                                                                                  #  AN IMMEDIATE RETURN TO THE USER AT CALL LOC +4.  EXAMPLE FOLLOWS,
057911,000084:                                                                                                  #                CAF     OCTXX           ALARM CODE
057912,000085:                                                                                                  #                TC      BANKCALL
057913,000086:                                                                                                  #                CADR    PRIOLARM
057914,000087:                                                                                                  #                ...     ...
057915,000088:                                                                                                  #                ...     ...
057916,000089:                                                                                                  #                ...     ...             ASTRONAUT RETURN
057917,000090:                                                                                                  #                TC      PHASCHNG        IMMEDIATE RETURN TO USER.  RESTART
057918,000091:                                                                                                  #                OCT     X.1             PHASE CHANGE FOR PRIO DISPLAY
057919,000092: 
057920,000093: 10,3563                                           BANK     10                                    
057921,000094: 10,2000                                           SETLOC   DISPLAYS                              
057922,000095: 10,2000                                           BANK                                           
057923,000096: 
057924,000097: 10,3563                                           COUNT*   $$/DSPLA                              
057925,000098: 10,3563           00004        PRIOLARM           INHINT                                         #  * * * KEEP IN DISPLAY ROUTINES BANK
057926,000099: 10,3564           54001                           TS       L                                     #  SAVE ALARM CODE
057927,000100: 
057928,000101: 10,3565           30133                           CA       BUF2                                  #  2 CADR OF PRIOLARM USER
057929,000102: 10,3566           55363                           TS       ALMCADR                               
057930,000103: 10,3567           30134                           CA       BUF2       +1                         
057931,000104: 10,3570           05576                           TC       PRIOENT    +1                         #  * LEAVE L ALONE
057932,000105: 10,3571           77467        -2SEC              DEC      -200       B-14                       #  *** DONT MOVE
057933,000106: 10,3572           35006                           CAF      V05N09                                
057934,000107: 10,3573           12505                           TCF      PRIODSPR                              
057935,000108: 
057936,000109:    5624                                           BLOCK    02                                    
057937,000110:    4000                                           SETLOC   FFTAG7                                
057938,000111:    4000                                           BANK                                           
057939,000112: 
057940,000113:    5624                                           COUNT*   $$/ALARM                              
057941,000114:    5624           00004        BAILOUT            INHINT                                         
057942,000115:    5625           30002                           CA       Q                                     
057943,000116:    5626           55363                           TS       ALMCADR                               
057944,000117: 
057945,000118:    5627           50002                           INDEX    Q                                     
057946,000119:    5630           30000                           CAF      0                                     
057947,000120:    5631           05574                           TC       BORTENT                               
057948,000121:    5632           40400        OCT40400           OCT      40400                                 
057949,000122: 
057950,000123:    5633           00004                           INHINT                                         
057951,000124:    5634           34752        WHIMPER            CA       TWO                                   
057952,000125:    5635           60005                           AD       Z                                     

Page 1375

057954,000127:    5636           54017                           TS       BRUPT                                 
057955,000128:    5637           50017                           RESUME                                         
057956,000129:    5640           04635                           TC       POSTJUMP                              #  RESUME SENDS CONTROL HERE
057957,000130:    5641           12763                           CADR     ENEMA                                 
057958,000131:    5642           00004        POODOO             INHINT                                         
057959,000132:    5643           30002                           CA       Q                                     
057960,000133:    5644           55363        ABORT2             TS       ALMCADR                               
057961,000134:    5645           50002                           INDEX    Q                                     
057962,000135:    5646           30000                           CAF      0                                     
057963,000136:    5647           05574                           TC       BORTENT                               
057964,000137:    5650           77770        OCT77770           OCT      77770                                 #  DON'T MOVE
057965,000138: 
057966,000139:    5651           34765                           CAF      OCT35                                 #  4.35SPOT FOR GOPOODOO
057967,000140:    5652           54001                           TS       L                                     
057968,000141:    5653           40000                           COM                                            
057969,000142:    5654           52760                           DXCH     -PHASE4                               
057970,000143:    5655           00004        GOPOODOO           INHINT                                         
057971,000144:    5656           04616                           TC       BANKCALL                              #  RESET STATEFLG, REINTFLG, AND NODOFLAG.
057972,000145:    5657           27746                           CADR     FLAGS                                 
057973,000146:    5660           30103                           CA       FLAGWRD7                              #  IS SERVICER CURRENTLY IN OPERATION?
057974,000147:    5661           74746                           MASK     V37FLBIT                              
057975,000148:    5662           10000                           CCS      A                                     
057976,000149:    5663           15671                           TCF      STRTIDLE                              
057977,000150:    5664           04616                           TC       BANKCALL                              #  TERMINATE GRPS 1, 3, 5, AND 6
057978,000151:    5665           12650                           CADR     V37KLEAN                              
057979,000152:    5666           04616                           TC       BANKCALL                              #  TERMINATE GRPS 2, 4, 1, 3, 5, AND 6
057980,000153:    5667           12641                           CADR     MR.KLEAN                              #        (I.E., GRP 4 LAST)
057981,000154:    5670           15634                           TCF      WHIMPER                               
057982,000155:    5671           35733        STRTIDLE           CAF      BBSERVDL                              
057983,000156:    5672           04727                           TC       SUPERSW                               
057984,000157:    5673           04616                           TC       BANKCALL                              #  PUT SERVICER INTO ITS "GROUND" STATE
057985,000158:    5674           57322                           CADR     SERVIDLE                              #  AND PROCEED TO GOTOPOOH.
057986,000159:    5675           00004        CCSHOLE            INHINT                                         
057987,000160:    5676           30002                           CA       Q                                     
057988,000161:    5677           05644                           TC       ABORT2                                
057989,000162:    5700           21103        OCT21103           OCT      21103                                 
057990,000163:    5701           00004        CURTAINS           INHINT                                         
057991,000164:    5702           30002                           CA       Q                                     
057992,000165:    5703           05571                           TC       ALARM2                                
057993,000166:    5704           00217        OCT217             OCT      00217                                 
057994,000167:    5705           01363                           TC       ALMCADR                               #  RETURN TO USER
057995,000168: 
057996,000169:    5706           00004        BAILOUT1           INHINT                                         
057997,000170:    5707           53364                           DXCH     ALMCADR                               
057998,000171:    5710           35732                           CAF      ADR40400                              
057999,000172:    5711           54061        BOTHABRT           TS       ITEMP1                                
058000,000173:    5712           50002                           INDEX    Q                                     
058001,000174:    5713           30000                           CAF      0                                     
058002,000175:    5714           54001                           TS       L                                     
058003,000176:    5715           15603                           TCF      CHKFAIL1                              
058004,000177: 

Page 1376

058006,000179:    5716           00004        POODOO1            INHINT                                         
058007,000180:    5717           53364                           DXCH     ALMCADR                               
058008,000181:    5720           35731                           CAF      ADR77770                              
058009,000182:    5721           15711                           TCF      BOTHABRT                              
058010,000183: 
058011,000184:    5722           00004        ALARM1             INHINT                                         
058012,000185:    5723           53364                           DXCH     ALMCADR                               
058013,000186:    5724           00004        ALMNCADR           INHINT                                         
058014,000187:    5725           50002                           INDEX    Q                                     
058015,000188:    5726           30000                           CA       0                                     
058016,000189:    5727           54001                           TS       L                                     
058017,000190:    5730           15601                           TCF      LARMENT                               
058018,000191: 
058019,000192:    5731           15650        ADR77770           TCF      OCT77770                              
058020,000193:    5732           15632        ADR40400           TCF      OCT40400                              
058021,000194:    5733     5155               DOALARM            EQUALS   ENDOFJOB                              
058022,000195:    5733  E7,1515                                  EBANK=   DVCNTR                                
058023,000196:    5733           56067        BBSERVDL           BBCON    SERVIDLE                              
058024,000197: 
058025,000198:                                                                                                  #  CALLING SEQUENCE FOR VARALARM
058026,000199:                                                                                                  #                CAF     (ALARM)
058027,000200:                                                                                                  #                TC      VARALARM
058028,000201: 
058029,000202:                                                                                                  #  VARALARM TURNS ON PROGRAM ALARM LIGHT BUT DOES NOT DISPLAY
058030,000203: 
058031,000204:    5734           00004        VARALARM           INHINT                                         
058032,000205: 
058033,000206:    5735           54001                           TS       L                                     #  SAVE USERS ALARM CODE
058034,000207: 
058035,000208:    5736           30002                           CA       Q                                     #  SAVE USERS Q
058036,000209:    5737           55363                           TS       ALMCADR                               
058037,000210: 
058038,000211:    5740           05575                           TC       PRIOENT                               
058039,000212:    5741           00014        OCT14              OCT      14                                    #  DONT MOVE
058040,000213: 
058041,000214:    5742           01363                           TC       ALMCADR                               #  RETURN TO USER
058042,000215: 
058043,000216:    5743     5634               ABORT              EQUALS   WHIMPER                               
058044,000217: 13,3746                                           BANK     13                                    
058045,000218: 13,2000                                           SETLOC   ABTFLGS                               
058046,000219: 13,2000                                           BANK                                           
058047,000220: 13,3746                                           COUNT*   $$/ALARM                              
058048,000221: 
058049,000222: 13,3746           44747        FLAGS              CS       STATEBIT                              
058050,000223: 13,3747           70077                           MASK     FLAGWRD3                              
058051,000224: 13,3750           54077                           TS       FLAGWRD3                              
058052,000225: 13,3751           44745                           CS       REINTBIT                              
058053,000226: 13,3752           70106                           MASK     FLGWRD10                              
058054,000227: 13,3753           54106                           TS       FLGWRD10                              
058055,000228: 13,3754           44753                           CS       NODOBIT                               
058056,000229: 13,3755           70076                           MASK     FLAGWRD2                              
058057,000230: 

Page 1377

058059,000232: 13,3756           54076                           TS       FLAGWRD2                              
058060,000233: 13,3757           00002                           TC       Q                                     
058061,000234: 
058062,000235: 

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