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.

057870,000002:                                                                                                  ## Copyright:   Public domain.
057871,000003:                                                                                                  ## Filename:    ALARM_AND_ABORT.agc
057872,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
057873,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
057874,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
057875,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
057876,000008:                                                                                                  ##              that the code format has been changed to conform to the
057877,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
057878,000010:                                                                                                  ##              original YUL assembler.
057879,000011:                                                                                                  ## Reference:   pp. 1373-1377
057880,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
057881,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
057882,000014:                                                                                                  ## Mod history: 06/07/03 RSB.   Began transcribing.
057883,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
057884,000016:                                                                                                  ##              2010-10-25 JL   Indentation fixes.
057885,000017:                                                                                                  ##              2011-06-07 JL   Removed workarounds.
057886,000018:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
057887,000019:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
057888,000020:                                                                                                  ##                              numbers in 1701.pdf.
057889,000021:                                                                                                  ##              2017-02-28 RSB  Proofed comment text using octopus/ProoferComments.
057890,000022:                                                                                                  ##              2017-03-10 RSB  Comment-text fixes noted in proofing Luminary 116.
057891,000023: 

Page 1373

057893,000025:                                                                                                  #  THE FOLLOWING SUBROUTINE MAY BE CALLED TO DISPLAY A NON-ABORTIVE ALARM CONDITION.  IT MAY BE CALLED
057894,000026:                                                                                                  #  EITHER IN INTERRUPT OR UNDER EXECUTIVE CONTROL.
057895,000027: 
057896,000028:                                                                                                  #  CALLING SEQUENCE IS AS FOLLOWS:
057897,000029:                                                                                                  #                TC      ALARM
057898,000030:                                                                                                  #                OCT     AAANN           ALARM NO. NN IN GENERAL AREA AAA.
057899,000031:                                                                                                  #                                        (RETURNS HERE)
057900,000032: 
057901,000033:    5567                                           BLOCK    02                                    
057902,000034:    4000                                           SETLOC   FFTAG7                                
057903,000035:    4000                                           BANK                                           
057904,000036: 
057905,000037:    5567     0375                                  EBANK=   FAILREG                               
057906,000038: 
057907,000039:    5567                                           COUNT*   $$/ALARM                              
057908,000040: 
057909,000041:                                                                                                  #  ALARM TURNS ON THE PROGRAM ALARM LIGHT, BUT DOES NOT DISPLAY.
057910,000042: 
057911,000043:    5567           00004        ALARM              INHINT                                         
057912,000044: 
057913,000045:    5570           30002                           CA       Q                                     
057914,000046:    5571           55363        ALARM2             TS       ALMCADR                               
057915,000047:    5572           50002                           INDEX    Q                                     
057916,000048:    5573           30000                           CA       0                                     
057917,000049:    5574           54001        BORTENT            TS       L                                     
057918,000050: 
057919,000051:    5575           30006        PRIOENT            CA       BBANK                                 
057920,000052:    5576           00006                 +1        EXTEND                                         
057921,000053:    5577           04007                           ROR      SUPERBNK                              #  ADD SUPER BITS.
057922,000054:    5600           55364                           TS       ALMCADR    +1                         
057923,000055: 
057924,000056:    5601           30002        LARMENT            CA       Q                                     #  STORE RETURN FOR ALARM
057925,000057:    5602           54061                           TS       ITEMP1                                
057926,000058: 
057927,000059:    5603           10375        CHKFAIL1           CCS      FAILREG                               #  IS ANYTHING IN FAILREG
057928,000060:    5604           15610                           TCF      CHKFAIL2                              #  YES TRY NEXT REG
057929,000061:    5605           30001                           CA       L                                     
057930,000062:    5606           54375                           TS       FAILREG                               
057931,000063:    5607           15614                           TCF      PROGLARM                              #  TURN ALARM LIGHT ON FOR FIRST ALARM
057932,000064: 
057933,000065:    5610           10376        CHKFAIL2           CCS      FAILREG    +1                         
057934,000066:    5611           15614                           TCF      PROGLARM                              
057935,000067:    5612           30001                           CA       L                                     
057936,000068:    5613           54376                           TS       FAILREG    +1                         
057937,000069: 
057938,000070:    5614           22377        PROGLARM           LXCH     FAILREG    +2                         #  STORE AS "MOST RECENT" ALARM CODE
057939,000071: 
057940,000072:    5615           41035                           CS       DSPTAB     +11D                       #  TURN ON PROGRAM ALARM IF OFF
057941,000073:    5616           75632                           MASK     OCT40400                              
057942,000074:    5617           27035                           ADS      DSPTAB     +11D                       
057943,000075: 

Page 1374

057945,000077:    5620           56061        MULTEXIT           XCH      ITEMP1                                #  OBTAIN RETURN ADDRESS IN A
057946,000078:    5621           00003                           RELINT                                         
057947,000079:    5622           50000                           INDEX    A                                     
057948,000080:    5623           00001                           TC       1                                     
057949,000081: 
057950,000082:                                                                                                  #  PRIOLARM DISPLAYS V05N09 VIA PRIODSPR WITH 3 RETURNS TO THE USER FROM THE ASTRONAUT AT CALL LOC +1,+2,+3 AND
057951,000083:                                                                                                  #  AN IMMEDIATE RETURN TO THE USER AT CALL LOC +4.  EXAMPLE FOLLOWS,
057952,000084:                                                                                                  #                CAF     OCTXX           ALARM CODE
057953,000085:                                                                                                  #                TC      BANKCALL
057954,000086:                                                                                                  #                CADR    PRIOLARM
057955,000087:                                                                                                  #                ...     ...
057956,000088:                                                                                                  #                ...     ...
057957,000089:                                                                                                  #                ...     ...             ASTRONAUT RETURN
057958,000090:                                                                                                  #                TC      PHASCHNG        IMMEDIATE RETURN TO USER.  RESTART
057959,000091:                                                                                                  #                OCT     X.1             PHASE CHANGE FOR PRIO DISPLAY
057960,000092: 
057961,000093: 10,3563                                           BANK     10                                    
057962,000094: 10,2000                                           SETLOC   DISPLAYS                              
057963,000095: 10,2000                                           BANK                                           
057964,000096: 
057965,000097: 10,3563                                           COUNT*   $$/DSPLA                              
057966,000098: 10,3563           00004        PRIOLARM           INHINT                                         #  * * * KEEP IN DISPLAY ROUTINES BANK
057967,000099: 10,3564           54001                           TS       L                                     #  SAVE ALARM CODE
057968,000100: 
057969,000101: 10,3565           30133                           CA       BUF2                                  #  2 CADR OF PRIOLARM USER
057970,000102: 10,3566           55363                           TS       ALMCADR                               
057971,000103: 10,3567           30134                           CA       BUF2       +1                         
057972,000104: 10,3570           05576                           TC       PRIOENT    +1                         #  * LEAVE L ALONE
057973,000105: 10,3571           77467        -2SEC              DEC      -200       B-14                       #  *** DONT MOVE
057974,000106: 10,3572           35006                           CAF      V05N09                                
057975,000107: 10,3573           12505                           TCF      PRIODSPR                              
057976,000108: 
057977,000109:    5624                                           BLOCK    02                                    
057978,000110:    4000                                           SETLOC   FFTAG7                                
057979,000111:    4000                                           BANK                                           
057980,000112: 
057981,000113:    5624                                           COUNT*   $$/ALARM                              
057982,000114:    5624           00004        BAILOUT            INHINT                                         
057983,000115:    5625           30002                           CA       Q                                     
057984,000116:    5626           55363                           TS       ALMCADR                               
057985,000117: 
057986,000118:    5627           50002                           INDEX    Q                                     
057987,000119:    5630           30000                           CAF      0                                     
057988,000120:    5631           05574                           TC       BORTENT                               
057989,000121:    5632           40400        OCT40400           OCT      40400                                 
057990,000122: 
057991,000123:    5633           00004                           INHINT                                         
057992,000124:    5634           34752        WHIMPER            CA       TWO                                   
057993,000125:    5635           60005                           AD       Z                                     

Page 1375

057995,000127:    5636           54017                           TS       BRUPT                                 
057996,000128:    5637           50017                           RESUME                                         
057997,000129:    5640           04635                           TC       POSTJUMP                              #  RESUME SENDS CONTROL HERE
057998,000130:    5641           12763                           CADR     ENEMA                                 
057999,000131:    5642           00004        POODOO             INHINT                                         
058000,000132:    5643           30002                           CA       Q                                     
058001,000133:    5644           55363        ABORT2             TS       ALMCADR                               
058002,000134:    5645           50002                           INDEX    Q                                     
058003,000135:    5646           30000                           CAF      0                                     
058004,000136:    5647           05574                           TC       BORTENT                               
058005,000137:    5650           77770        OCT77770           OCT      77770                                 #  DON'T MOVE
058006,000138: 
058007,000139:    5651           34765                           CAF      OCT35                                 #  4.35SPOT FOR GOPOODOO
058008,000140:    5652           54001                           TS       L                                     
058009,000141:    5653           40000                           COM                                            
058010,000142:    5654           52760                           DXCH     -PHASE4                               
058011,000143:    5655           00004        GOPOODOO           INHINT                                         
058012,000144:    5656           04616                           TC       BANKCALL                              #  RESET STATEFLG, REINTFLG, AND NODOFLAG.
058013,000145:    5657           27746                           CADR     FLAGS                                 
058014,000146:    5660           30103                           CA       FLAGWRD7                              #  IS SERVICER CURRENTLY IN OPERATION?
058015,000147:    5661           74746                           MASK     V37FLBIT                              
058016,000148:    5662           10000                           CCS      A                                     
058017,000149:    5663           15671                           TCF      STRTIDLE                              
058018,000150:    5664           04616                           TC       BANKCALL                              #  TERMINATE GRPS 1, 3, 5, AND 6
058019,000151:    5665           12650                           CADR     V37KLEAN                              
058020,000152:    5666           04616                           TC       BANKCALL                              #  TERMINATE GRPS 2, 4, 1, 3, 5, AND 6
058021,000153:    5667           12641                           CADR     MR.KLEAN                              #        (I.E., GRP 4 LAST)
058022,000154:    5670           15634                           TCF      WHIMPER                               
058023,000155:    5671           35733        STRTIDLE           CAF      BBSERVDL                              
058024,000156:    5672           04727                           TC       SUPERSW                               
058025,000157:    5673           04616                           TC       BANKCALL                              #  PUT SERVICER INTO ITS "GROUND" STATE
058026,000158:    5674           57322                           CADR     SERVIDLE                              #  AND PROCEED TO GOTOPOOH.
058027,000159:    5675           00004        CCSHOLE            INHINT                                         
058028,000160:    5676           30002                           CA       Q                                     
058029,000161:    5677           05644                           TC       ABORT2                                
058030,000162:    5700           21103        OCT21103           OCT      21103                                 
058031,000163:    5701           00004        CURTAINS           INHINT                                         
058032,000164:    5702           30002                           CA       Q                                     
058033,000165:    5703           05571                           TC       ALARM2                                
058034,000166:    5704           00217        OCT217             OCT      00217                                 
058035,000167:    5705           01363                           TC       ALMCADR                               #  RETURN TO USER
058036,000168: 
058037,000169:    5706           00004        BAILOUT1           INHINT                                         
058038,000170:    5707           53364                           DXCH     ALMCADR                               
058039,000171:    5710           35732                           CAF      ADR40400                              
058040,000172:    5711           54061        BOTHABRT           TS       ITEMP1                                
058041,000173:    5712           50002                           INDEX    Q                                     
058042,000174:    5713           30000                           CAF      0                                     
058043,000175:    5714           54001                           TS       L                                     
058044,000176:    5715           15603                           TCF      CHKFAIL1                              
058045,000177: 

Page 1376

058047,000179:    5716           00004        POODOO1            INHINT                                         
058048,000180:    5717           53364                           DXCH     ALMCADR                               
058049,000181:    5720           35731                           CAF      ADR77770                              
058050,000182:    5721           15711                           TCF      BOTHABRT                              
058051,000183: 
058052,000184:    5722           00004        ALARM1             INHINT                                         
058053,000185:    5723           53364                           DXCH     ALMCADR                               
058054,000186:    5724           00004        ALMNCADR           INHINT                                         
058055,000187:    5725           50002                           INDEX    Q                                     
058056,000188:    5726           30000                           CA       0                                     
058057,000189:    5727           54001                           TS       L                                     
058058,000190:    5730           15601                           TCF      LARMENT                               
058059,000191: 
058060,000192:    5731           15650        ADR77770           TCF      OCT77770                              
058061,000193:    5732           15632        ADR40400           TCF      OCT40400                              
058062,000194:    5733     5155               DOALARM            EQUALS   ENDOFJOB                              
058063,000195:    5733  E7,1515                                  EBANK=   DVCNTR                                
058064,000196:    5733           56067        BBSERVDL           BBCON    SERVIDLE                              
058065,000197: 
058066,000198:                                                                                                  #  CALLING SEQUENCE FOR VARALARM
058067,000199:                                                                                                  #                CAF     (ALARM)
058068,000200:                                                                                                  #                TC      VARALARM
058069,000201: 
058070,000202:                                                                                                  #  VARALARM TURNS ON PROGRAM ALARM LIGHT BUT DOES NOT DISPLAY
058071,000203: 
058072,000204:    5734           00004        VARALARM           INHINT                                         
058073,000205: 
058074,000206:    5735           54001                           TS       L                                     #  SAVE USERS ALARM CODE
058075,000207: 
058076,000208:    5736           30002                           CA       Q                                     #  SAVE USERS Q
058077,000209:    5737           55363                           TS       ALMCADR                               
058078,000210: 
058079,000211:    5740           05575                           TC       PRIOENT                               
058080,000212:    5741           00014        OCT14              OCT      14                                    #  DONT MOVE
058081,000213: 
058082,000214:    5742           01363                           TC       ALMCADR                               #  RETURN TO USER
058083,000215: 
058084,000216:    5743     5634               ABORT              EQUALS   WHIMPER                               
058085,000217: 13,3746                                           BANK     13                                    
058086,000218: 13,2000                                           SETLOC   ABTFLGS                               
058087,000219: 13,2000                                           BANK                                           
058088,000220: 13,3746                                           COUNT*   $$/ALARM                              
058089,000221: 
058090,000222: 13,3746           44747        FLAGS              CS       STATEBIT                              
058091,000223: 13,3747           70077                           MASK     FLAGWRD3                              
058092,000224: 13,3750           54077                           TS       FLAGWRD3                              
058093,000225: 13,3751           44745                           CS       REINTBIT                              
058094,000226: 13,3752           70106                           MASK     FLGWRD10                              
058095,000227: 13,3753           54106                           TS       FLGWRD10                              
058096,000228: 13,3754           44753                           CS       NODOBIT                               
058097,000229: 13,3755           70076                           MASK     FLAGWRD2                              
058098,000230: 

Page 1377

058100,000232: 13,3756           54076                           TS       FLAGWRD2                              
058101,000233: 13,3757           00002                           TC       Q                                     
058102,000234: 
058103,000235: 

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