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.

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

Page 1373

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

Page 1374

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

Page 1375

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

Page 1376

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

Page 1377

058071,000232: 13,3756           54076                           TS       FLAGWRD2                              
058072,000233: 13,3757           00002                           TC       Q                                     
058073,000234: 
058074,000235: 

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