Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

059477,000002:                                                                                                  ## Copyright:   Public domain.
059478,000003:                                                                                                  ## Filename:    ALARM_AND_ABORT.agc
059479,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
059480,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
059481,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
059482,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
059483,000008:                                                                                                  ##              that the code format has been changed to conform to the
059484,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
059485,000010:                                                                                                  ##              original YUL assembler.
059486,000011:                                                                                                  ## Reference:   pp. 1378-1382
059487,000012:                                                                                                  ## Assembler:   yaYUL
059488,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
059489,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
059490,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
059491,000016:                                                                                                  ##              2016-11-29 TB   Transcribed
059492,000017:                                                                                                  ##              2016-12-07 HG   Fix P00 -> POO
059493,000018:                                                                                                  ##              2016-12-11 HG   add missing operation MASK FLGWRD10
059494,000019:                                                                                                  ##              2016-12-12 HG   add [WORKAROUND] using SBANK=
059495,000020:                                                                                                  ##              2016-12-26 RSB  Comment-text proofed using ProoferComments
059496,000021:                                                                                                  ##                              and corrected errors found.
059497,000022:                                                                                                  ##              2017-06-17 MAS  Globally removed all SBANK= workarounds.
059498,000023: 

Page 1378

059500,000025:                                                                                                  #  THE FOLLOWING SUBROUTINE MAY BE CALLED TO DISPLAY A NON-ABORTIVE ALARM CONDITION.  IT MAY BE CALLED
059501,000026:                                                                                                  #  EITHER IN INTERRUPT OR UNDER EXECUTIVE CONTROL.
059502,000027: 
059503,000028:                                                                                                  #  CALLING SEQUENCE IS AS FOLLOWS:
059504,000029:                                                                                                  #                TC      ALARM
059505,000030:                                                                                                  #                OCT     AAANN           ALARM NO. NN IN GENERAL AREA AAA.
059506,000031:                                                                                                  #                                        (RETURNS HERE)
059507,000032: 
059508,000033:    5571                                           BLOCK    02                                    
059509,000034:    4000                                           SETLOC   FFTAG7                                
059510,000035:    4000                                           BANK                                           
059511,000036: 
059512,000037:    5571     0375                                  EBANK=   FAILREG                               
059513,000038: 
059514,000039:    5571                                           COUNT*   $$/ALARM                              
059515,000040:                                                                                                  #  ALARM TURNS ON THE PROGRAM ALARM LIGHT, BUT DOES NOT DISPLAY.
059516,000041: 
059517,000042:    5571           00004        ALARM              INHINT                                         
059518,000043: 
059519,000044:    5572           30002                           CA       Q                                     
059520,000045:    5573           55363        ALARM2             TS       ALMCADR                               
059521,000046:    5574           50002                           INDEX    Q                                     
059522,000047:    5575           30000                           CA       0                                     
059523,000048:    5576           54001        BORTENT            TS       L                                     
059524,000049: 
059525,000050:    5577           30006        PRIOENT            CA       BBANK                                 
059526,000051:    5600           00006                 +1        EXTEND                                         
059527,000052:    5601           04007                           ROR      SUPERBNK                              #  ADD SUPER BITS.
059528,000053:    5602           55364                           TS       ALMCADR    +1                         
059529,000054: 
059530,000055:    5603           30002        LARMENT            CA       Q                                     #  STORE RETURN FOR ALARM
059531,000056:    5604           54061                           TS       ITEMP1                                
059532,000057: 
059533,000058:    5605           10375        CHKFAIL1           CCS      FAILREG                               #  IS ANYTHING IN FAILREG
059534,000059:    5606           15612                           TCF      CHKFAIL2                              #  YES TRY NEXT REG
059535,000060:    5607           30001                           CA       L                                     
059536,000061:    5610           54375                           TS       FAILREG                               
059537,000062:    5611           15616                           TCF      PROGLARM                              #  TURN ALARM LIGHT ON FOR FIRST ALARM
059538,000063: 
059539,000064:    5612           10376        CHKFAIL2           CCS      FAILREG    +1                         
059540,000065:    5613           15616                           TCF      PROGLARM                              
059541,000066:    5614           30001                           CA       L                                     
059542,000067:    5615           54376                           TS       FAILREG    +1                         
059543,000068: 
059544,000069:    5616           22377        PROGLARM           LXCH     FAILREG    +2                         #  STORE AS "MOST RECENT" ALARM CODE
059545,000070: 
059546,000071:    5617           41035                           CS       DSPTAB     +11D                       #  TURN ON PROGRAM ALARM IF OFF
059547,000072:    5620           75634                           MASK     OCT40400                              
059548,000073:    5621           27035                           ADS      DSPTAB     +11D                       
059549,000074: 

Page 1379

059551,000076:    5622           56061        MULTEXIT           XCH      ITEMP1                                #  OBTAIN RETURN ADDRESS IN A
059552,000077:    5623           00003                           RELINT                                         
059553,000078:    5624           50000                           INDEX    A                                     
059554,000079:    5625           00001                           TC       1                                     
059555,000080: 
059556,000081:                                                                                                  #  PRIOLARM DISPLAYS V05N09 VIA PRIODSPR WITH 3 RETURNS TO THE USER FROM THE ASTRONAUT AT CALL LOC +1,+2,+3 AND
059557,000082:                                                                                                  #  AN IMMEDIATE RETURN TO THE USER AT CALL LOC +4.  EXAMPLE FOLLOWS,
059558,000083:                                                                                                  #                CAF     OCTXX           ALARM CODE
059559,000084:                                                                                                  #                TC      BANKCALL
059560,000085:                                                                                                  #                CADR    PRIOLARM
059561,000086:                                                                                                  #                ...     ...
059562,000087:                                                                                                  #                ...     ...
059563,000088:                                                                                                  #                ...     ...             ASTRONAUT RETURN
059564,000089:                                                                                                  #                TC      PHASCHNG        IMMEDIATE RETURN TO USER. RESTART
059565,000090:                                                                                                  #                OCT     X.1             PHASE CHANGE FOR PRIO DISPLAY
059566,000091: 
059567,000092: 10,3572                                           BANK     10                                    
059568,000093: 10,2000                                           SETLOC   DISPLAYS                              
059569,000094: 10,2000                                           BANK                                           
059570,000095: 
059571,000096: 10,3572                                           COUNT*   $$/DSPLA                              
059572,000097: 10,3572           00004        PRIOLARM           INHINT                                         #  * * * KEEP IN DISPLAY ROUTINES BANK
059573,000098: 10,3573           54001                           TS       L                                     #  SAVE ALARM CODE
059574,000099: 
059575,000100: 10,3574           30133                           CA       BUF2                                  #  2 CADR OF PRIOLARM USER
059576,000101: 10,3575           55363                           TS       ALMCADR                               
059577,000102: 10,3576           30134                           CA       BUF2       +1                         
059578,000103: 10,3577           05600                           TC       PRIOENT    +1                         #  * LEAVE L ALONE
059579,000104: 10,3600           77467        -2SEC              DEC      -200       B-14                       #  *** DONT MOVE
059580,000105: 10,3601           34777                           CAF      V05N09                                
059581,000106: 10,3602           12477                           TCF      PRIODSPR                              
059582,000107: 
059583,000108:    5626                                           BLOCK    02                                    
059584,000109:    4000                                           SETLOC   FFTAG7                                
059585,000110:    4000                                           BANK                                           
059586,000111: 
059587,000112:    5626                                           COUNT*   $$/ALARM                              
059588,000113:    5626           00004        BAILOUT            INHINT                                         
059589,000114:    5627           30002                           CA       Q                                     
059590,000115:    5630           55363                           TS       ALMCADR                               
059591,000116: 
059592,000117:    5631           50002                           INDEX    Q                                     
059593,000118:    5632           30000                           CAF      0                                     
059594,000119:    5633           05576                           TC       BORTENT                               
059595,000120:    5634           40400        OCT40400           OCT      40400                                 
059596,000121: 
059597,000122:    5635           00004                           INHINT                                         
059598,000123:    5636           34743        WHIMPER            CA       TWO                                   
059599,000124:    5637           60005                           AD       Z                                     

Page 1380

059601,000126:    5640           54017                           TS       BRUPT                                 
059602,000127:    5641           50017                           RESUME                                         
059603,000128:    5642           04626                           TC       POSTJUMP                              #  RESUME SENDS CONTROL HERE
059604,000129:    5643           12767                           CADR     ENEMA                                 
059605,000130:    5644           00004        POODOO             INHINT                                         
059606,000131:    5645           30002                           CA       Q                                     
059607,000132:    5646           55363        ABORT2             TS       ALMCADR                               
059608,000133:    5647           50002                           INDEX    Q                                     
059609,000134:    5650           30000                           CAF      0                                     
059610,000135:    5651           05576                           TC       BORTENT                               
059611,000136:    5652           77770        OCT77770           OCT      77770                                 #  DON'T MOVE
059612,000137: 
059613,000138:    5653           11043                           CCS      EXTVBACT                              #  DO BAILOUT NOT POODOO IF EXT. VB. ACTIVE
059614,000139:    5654           15635                           TCF      WHIMPER    -1                         
059615,000140: 
059616,000141:    5655           34756                           CAF      OCT35                                 #  4.35SPOT FOR GOPOODOO
059617,000142:    5656           54001                           TS       L                                     
059618,000143:    5657           40000                           COM                                            
059619,000144:    5660           52760                           DXCH     -PHASE4                               
059620,000145:    5661           00004        GOPOODOO           INHINT                                         
059621,000146:    5662           04607                           TC       BANKCALL                              #  RESET STATEFLG, REINTFLG, AND NODOFLAG.
059622,000147:                                                                                                  #    ALSO RNDVZFLG, P25FLAG AND TRACKFLG
059623,000148:    5663           43007                           CADR     FLAGS                                 
059624,000149:    5664           30103                           CA       FLAGWRD7                              #  IS SERVICER CURRENTLY IN OPERATION?
059625,000150:    5665           74737                           MASK     V37FLBIT                              
059626,000151:    5666           10000                           CCS      A                                     
059627,000152:    5667           15675                           TCF      STRTIDLE                              
059628,000153:    5670           04607                           TC       BANKCALL                              #  TERMINATE GRPS 1, 3, 5, AND 6
059629,000154:    5671           12654                           CADR     V37KLEAN                              
059630,000155:    5672           04607                           TC       BANKCALL                              #  TERMINATE GRPS 2, 4, 1, 3, 5, AND 6
059631,000156:    5673           12645                           CADR     MR.KLEAN                              #        (I.E., GRP 4 LAST)
059632,000157:    5674           15636                           TCF      WHIMPER                               
059633,000158:    5675           35737        STRTIDLE           CAF      BBSERVDL                              
059634,000159:    5676           04720                           TC       SUPERSW                               
059635,000160:    5677           04607                           TC       BANKCALL                              #  PUT SERVICER INTO ITS "GROUND" STATE
059636,000161:    5700           57324                           CADR     SERVIDLE                              #  AND PROCEED TO GOTOPOOH.
059637,000162:    5701           00004        CCSHOLE            INHINT                                         
059638,000163:    5702           30002                           CA       Q                                     
059639,000164:    5703           05646                           TC       ABORT2                                
059640,000165:    5704           21103        OCT21103           OCT      21103                                 
059641,000166:    5705           00004        CURTAINS           INHINT                                         
059642,000167:    5706           30002                           CA       Q                                     
059643,000168:    5707           05573                           TC       ALARM2                                
059644,000169:    5710           00217        OCT217             OCT      00217                                 
059645,000170:    5711           01363                           TC       ALMCADR                               #  RETURN TO USER
059646,000171: 
059647,000172:    5712           00004        BAILOUT1           INHINT                                         
059648,000173:    5713           53364                           DXCH     ALMCADR                               
059649,000174:    5714           35736                           CAF      ADR40400                              
059650,000175:    5715           54061        BOTHABRT           TS       ITEMP1                                
059651,000176: 

Page 1381

059653,000178:    5716           50002                           INDEX    Q                                     
059654,000179:    5717           30000                           CAF      0                                     
059655,000180:    5720           54001                           TS       L                                     
059656,000181:    5721           15605                           TCF      CHKFAIL1                              
059657,000182: 
059658,000183:    5722           00004        POODOO1            INHINT                                         
059659,000184:    5723           53364                           DXCH     ALMCADR                               
059660,000185:    5724           35735                           CAF      ADR77770                              
059661,000186:    5725           15715                           TCF      BOTHABRT                              
059662,000187: 
059663,000188:    5726           00004        ALARM1             INHINT                                         
059664,000189:    5727           53364                           DXCH     ALMCADR                               
059665,000190:    5730           00004        ALMNCADR           INHINT                                         
059666,000191:    5731           50002                           INDEX    Q                                     
059667,000192:    5732           30000                           CA       0                                     
059668,000193:    5733           54001                           TS       L                                     
059669,000194:    5734           15603                           TCF      LARMENT                               
059670,000195: 
059671,000196:    5735           15652        ADR77770           TCF      OCT77770                              
059672,000197:    5736           15634        ADR40400           TCF      OCT40400                              
059673,000198:    5737     5146               DOALARM            EQUALS   ENDOFJOB                              
059674,000199:    5737  E7,1515                                  EBANK=   DVCNTR                                
059675,000200:    5737           56067        BBSERVDL           BBCON    SERVIDLE                              
059676,000201: 
059677,000202:                                                                                                  #  CALLING SEQUENCE FOR VARALARM
059678,000203:                                                                                                  #                CAF     (ALARM)
059679,000204:                                                                                                  #                TC      VARALARM
059680,000205: 
059681,000206:                                                                                                  #  VARALARM TURNS ON PROGRAM ALARM LIGHT BUT DOES NOT DISPLAY
059682,000207: 
059683,000208:    5740           00004        VARALARM           INHINT                                         
059684,000209: 
059685,000210:    5741           54001                           TS       L                                     #  SAVE USERS ALARM CODE
059686,000211: 
059687,000212:    5742           30002                           CA       Q                                     #  SAVE USERS Q
059688,000213:    5743           55363                           TS       ALMCADR                               
059689,000214: 
059690,000215:    5744           05577                           TC       PRIOENT                               
059691,000216:    5745           00014        OCT14              OCT      14                                    #  DONT MOVE
059692,000217: 
059693,000218:    5746           01363                           TC       ALMCADR                               #  RETURN TO USER
059694,000219: 
059695,000220:    5747     5636               ABORT              EQUALS   WHIMPER                               
059696,000221: 21,2000                                           SETLOC   ABTFLGS                               
059697,000222: 21,2000                                           BANK                                           
059698,000223: 21,3007                                           COUNT*   $$/ALARM                              
059699,000224: 
059700,000225: 21,3007           44740        FLAGS              CS       STATEBIT                              
059701,000226: 21,3010           70077                           MASK     FLAGWRD3                              
059702,000227: 21,3011           54077                           TS       FLAGWRD3                              
059703,000228: 21,3012           44736                           CS       REINTBIT                              
059704,000229: 21,3013           70106                           MASK     FLGWRD10                              
059705,000230: 

Page 1382

059707,000232: 21,3014           54106                           TS       FLGWRD10                              
059708,000233: 21,3015           44744                           CS       NODOBIT                               
059709,000234: 21,3016           70076                           MASK     FLAGWRD2                              
059710,000235: 21,3017           54076                           TS       FLAGWRD2                              
059711,000236: 21,3020           46017                           CS       BITS9+7                               
059712,000237: 21,3021  0000010               FLAGREF1           EQUALS   RNDVZFLG                              
059713,000238: 21,3021  0000006               FLAGREF2           EQUALS   P25FLAG                               
059714,000239: 21,3021           70074                           MASK     FLAGWRD0                              
059715,000240: 21,3022           54074                           TS       FLAGWRD0                              
059716,000241: 21,3023           40031                           CS       TRACKFLG                              
059717,000242: 21,3024           70075                           MASK     FLAGWRD1                              
059718,000243: 21,3025           54075                           TS       FLAGWRD1                              
059719,000244: 21,3026           00002                           TC       Q                                     
059720,000245: 
059721,000246: 

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