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.

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

Page 1378

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

Page 1379

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

Page 1380

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

Page 1381

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

Page 1382

059694,000232: 21,3014           54106                           TS       FLGWRD10                              
059695,000233: 21,3015           44744                           CS       NODOBIT                               
059696,000234: 21,3016           70076                           MASK     FLAGWRD2                              
059697,000235: 21,3017           54076                           TS       FLAGWRD2                              
059698,000236: 21,3020           46017                           CS       BITS9+7                               
059699,000237: 21,3021  0000010               FLAGREF1           EQUALS   RNDVZFLG                              
059700,000238: 21,3021  0000006               FLAGREF2           EQUALS   P25FLAG                               
059701,000239: 21,3021           70074                           MASK     FLAGWRD0                              
059702,000240: 21,3022           54074                           TS       FLAGWRD0                              
059703,000241: 21,3023           40031                           CS       TRACKFLG                              
059704,000242: 21,3024           70075                           MASK     FLAGWRD1                              
059705,000243: 21,3025           54075                           TS       FLAGWRD1                              
059706,000244: 21,3026           00002                           TC       Q                                     
059707,000245: 
059708,000246: 

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