Source Code

These source-code files derive from a printout of Luminary 116 (the Apollo 12 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Ron Burkey, 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 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071
	19:09 AUG. 11,1969
Note that the date is the date of the printout, not the date of the program revision.

058214,000002:                                                                                                  ## Copyright:   Public domain.
058215,000003:                                                                                                  ## Filename:    ALARM_AND_ABORT.agc
058216,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
058217,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM) 
058218,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
058219,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
058220,000008:                                                                                                  ##              that the code format has been changed to conform to the
058221,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
058222,000010:                                                                                                  ##              original YUL assembler.
058223,000011:                                                                                                  ## Reference:   pp. 1371-1375
058224,000012:                                                                                                  ## Assembler:   yaYUL
058225,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058226,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058227,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
058228,000016:                                                                                                  ##              2017-02-03 RRB  Updated for Luminary 116.
058229,000017:                                                                                                  ##              2017-03-01 HG   Fix Page number 
058230,000018:                                                                                                  ##                              Fix operand      : -> L
058231,000019:                                                                                                  ##                                  operator  LXCH -> TS
058232,000020:                                                                                                  ##              2017-03-10 RSB  Proofed comment text via 3-way diff vs
058233,000021:                                                                                                  ##                              Luminary 99 and 132 ... no problems found.
058234,000022: 

Page 1371

058236,000024:                                                                                                  #           THE FOLLOWING SUBROUTINE MAY BE CALLED TO DISPLAY A NON-ABORTIVE ALARM CONDITION. IT MAY BE CALLED
058237,000025:                                                                                                  #  EITHER IN INTERRUPT OR UNDER EXECUTIVE CONTROL.
058238,000026: 
058239,000027:                                                                                                  #  CALLING SEQUENCE IS AS FOLLOWS:
058240,000028:                                                                                                  #                TC      ALARM
058241,000029:                                                                                                  #                OCT     AAANN           ALARM NO. NN IN GENERAL AREA AAA.
058242,000030:                                                                                                  #                                        (RETURNS HERE)
058243,000031: 
058244,000032:    5567                                           BLOCK    02                                    
058245,000033:    4000                                           SETLOC   FFTAG7                                
058246,000034:    4000                                           BANK                                           
058247,000035: 
058248,000036:    5567     0375                                  EBANK=   FAILREG                               
058249,000037: 
058250,000038:    5567                                           COUNT*   $$/ALARM                              
058251,000039:                                                                                                  #  ALARM TURNS ON THE PROGRAM ALARM LIGHT, BUT DOES NOT DISPLAY.
058252,000040: 
058253,000041:    5567           00004        ALARM              INHINT                                         
058254,000042: 
058255,000043:    5570           30002                           CA       Q                                     
058256,000044:    5571           55363        ALARM2             TS       ALMCADR                               
058257,000045:    5572           50002                           INDEX    Q                                     
058258,000046:    5573           30000                           CA       0                                     
058259,000047:    5574           54001        BORTENT            TS       L                                     
058260,000048: 
058261,000049:    5575           30006        PRIOENT            CA       BBANK                                 
058262,000050:    5576           00006                 +1        EXTEND                                         
058263,000051:    5577           04007                           ROR      SUPERBNK                              #  ADD SUPER BITS.
058264,000052:    5600           55364                           TS       ALMCADR    +1                         
058265,000053: 
058266,000054:    5601           30002        LARMENT            CA       Q                                     #  STORE RETURN FOR ALARM
058267,000055:    5602           54061                           TS       ITEMP1                                
058268,000056: 
058269,000057:    5603           10375        CHKFAIL1           CCS      FAILREG                               #  IS ANYTHING IN FAILREG
058270,000058:    5604           15610                           TCF      CHKFAIL2                              #  YES TRY NEXT REG
058271,000059:    5605           30001                           CA       L                                     
058272,000060:    5606           54375                           TS       FAILREG                               
058273,000061:    5607           15614                           TCF      PROGLARM                              #  TURN ALARM LIGHT ON FOR FIRST ALARM
058274,000062: 
058275,000063:    5610           10376        CHKFAIL2           CCS      FAILREG    +1                         
058276,000064:    5611           15614                           TCF      PROGLARM                              
058277,000065:    5612           30001                           CA       L                                     
058278,000066:    5613           54376                           TS       FAILREG    +1                         
058279,000067: 
058280,000068: 
058281,000069:    5614           22377        PROGLARM           LXCH     FAILREG    +2                         #  STORE AS "MOST RECENT" ALARM CODE
058282,000070: 
058283,000071:    5615           41035                           CS       DSPTAB     +11D                       #  TURN ON PROGRAM ALARM IF OFF       
058284,000072:    5616           75632                           MASK     OCT40400                              
058285,000073:    5617           27035                           ADS      DSPTAB     +11D                       

Page 1372

058287,000075: 
058288,000076:    5620           56061        MULTEXIT           XCH      ITEMP1                                #  OBTAIN RETURN ADDRESS IN A
058289,000077:    5621           00003                           RELINT                                         
058290,000078:    5622           50000                           INDEX    A                                     
058291,000079:    5623           00001                           TC       1                                     
058292,000080: 
058293,000081:                                                                                                  #  PRIOLARM DISPLAYS V05N09 VIA PRIODSPR WITH 3 RETURNS TO THE USER FROM THE ASTRONAUT AT CALL LOC +1,+2,+3 AND
058294,000082:                                                                                                  #  AN IMMEDIATE RETURN TO THE USER AT CALL LOC +4. EXAMPLE FOLLOWS,
058295,000083:                                                                                                  #                CAF     OCTXX           ALARM CODE
058296,000084:                                                                                                  #                TC      BANKCALL
058297,000085:                                                                                                  #                CADR    PRIOLARM
058298,000086: 
058299,000087:                                                                                                  #                ...     ...
058300,000088:                                                                                                  #                ...     ...
058301,000089:                                                                                                  #                ...     ...             ASTRONAUT RETURN
058302,000090:                                                                                                  #                TC      PHASCHNG        IMMEDIATE RETURN TO USER.  RESTART
058303,000091:                                                                                                  #                OCT     X.1             PHASE CHANGE FOR PRIO DISPLAY
058304,000092: 
058305,000093: 10,3563                                           BANK     10                                    
058306,000094: 10,2000                                           SETLOC   DISPLAYS                              
058307,000095: 10,2000                                           BANK                                           
058308,000096: 
058309,000097: 10,3563                                           COUNT*   $$/DSPLA                              
058310,000098: 10,3563           00004        PRIOLARM           INHINT                                         #  * * * KEEP IN DISPLAY ROUTINES BANK
058311,000099: 10,3564           54001                           TS       L                                     #  SAVE ALARM CODE
058312,000100: 
058313,000101: 10,3565           30133                           CA       BUF2                                  #  2 CADR OF PRIOLARM USER
058314,000102: 10,3566           55363                           TS       ALMCADR                               
058315,000103: 10,3567           30134                           CA       BUF2       +1                         
058316,000104: 10,3570           05576                           TC       PRIOENT    +1                         #  * LEAVE L ALONE
058317,000105: 10,3571           77467        -2SEC              DEC      -200       B-14                       #  *** DONT MOVE
058318,000106: 10,3572           35006                           CAF      V05N09                                
058319,000107: 10,3573           12505                           TCF      PRIODSPR                              
058320,000108: 
058321,000109:    5624                                           BLOCK    02                                    
058322,000110:    4000                                           SETLOC   FFTAG7                                
058323,000111:    4000                                           BANK                                           
058324,000112: 
058325,000113:    5624                                           COUNT*   $$/ALARM                              
058326,000114:    5624           00004        BAILOUT            INHINT                                         
058327,000115:    5625           30002                           CA       Q                                     
058328,000116:    5626           55363                           TS       ALMCADR                               
058329,000117: 
058330,000118:    5627           50002                           INDEX    Q                                     
058331,000119:    5630           30000                           CAF      0                                     
058332,000120:    5631           05574                           TC       BORTENT                               
058333,000121:    5632           40400        OCT40400           OCT      40400                                 
058334,000122: 
058335,000123:    5633           00004                           INHINT                                         
058336,000124:    5634           34752        WHIMPER            CA       TWO                                   
058337,000125:    5635           60005                           AD       Z                                     

Page 1373

058339,000127:    5636           54017                           TS       BRUPT                                 
058340,000128:    5637           50017                           RESUME                                         

The command RESUME is circled in red ink - RRB 2017

058342,000130:    5640           04635                           TC       POSTJUMP                              #  RESUME SENDS CONTROL HERE
058343,000131:    5641           12763                           CADR     ENEMA                                 
058344,000132:    5642           00004        POODOO             INHINT                                         
058345,000133:    5643           30002                           CA       Q                                     
058346,000134:    5644           55363        ABORT2             TS       ALMCADR                               
058347,000135:    5645           50002                           INDEX    Q                                     
058348,000136:    5646           30000                           CAF      0                                     
058349,000137:    5647           05574                           TC       BORTENT                               
058350,000138:    5650           77770        OCT77770           OCT      77770                                 #  DON'T MOVE
058351,000139: 
058352,000140:    5651           34765                           CAF      OCT35                                 #  4.35SPOT FOR GOPOODOO
058353,000141:    5652           54001                           TS       L                                     
058354,000142:    5653           40000                           COM                                            
058355,000143:    5654           52760                           DXCH     -PHASE4                               
058356,000144:    5655           00004        GOPOODOO           INHINT                                         
058357,000145:    5656           04616                           TC       BANKCALL                              #  RESET STATEFLG, REINTFLG, AND NODOFLAG.
058358,000146:    5657           27750                           CADR     FLAGS                                 
058359,000147:    5660           30103                           CA       FLAGWRD7                              #  IS SERVICER CURRENTLY IN OPERATION?
058360,000148:    5661           74746                           MASK     V37FLBIT                              
058361,000149:    5662           10000                           CCS      A                                     
058362,000150:    5663           15671                           TCF      STRTIDLE                              
058363,000151:    5664           04616                           TC       BANKCALL                              #  TERMINATE GRPS 1, 3, 5, AND 6
058364,000152:    5665           12650                           CADR     V37KLEAN                              
058365,000153:    5666           04616                           TC       BANKCALL                              #  TERMINATE GRPS 2, 4, 1, 3, 5, AND 6
058366,000154:    5667           12641                           CADR     MR.KLEAN                              #        (I.E., GRP 4 LAST)
058367,000155:    5670           15634                           TCF      WHIMPER                               
058368,000156:    5671           35733        STRTIDLE           CAF      BBSERVDL                              
058369,000157:    5672           04727                           TC       SUPERSW                               
058370,000158:    5673           04616                           TC       BANKCALL                              #  PUT SERVICER INTO ITS "GROUND" STATE
058371,000159:    5674           57321                           CADR     SERVIDLE                              #  AND PROCEED TO GOTOPOOH.
058372,000160:    5675           00004        CCSHOLE            INHINT                                         
058373,000161:    5676           30002                           CA       Q                                     
058374,000162:    5677           05644                           TC       ABORT2                                
058375,000163:    5700           21103        OCT21103           OCT      21103                                 
058376,000164:    5701           00004        CURTAINS           INHINT                                         
058377,000165:    5702           30002                           CA       Q                                     
058378,000166:    5703           05571                           TC       ALARM2                                
058379,000167:    5704           00217        OCT217             OCT      00217                                 
058380,000168:    5705           01363                           TC       ALMCADR                               #  RETURN TO USER
058381,000169: 
058382,000170:    5706           00004        BAILOUT1           INHINT                                         
058383,000171:    5707           53364                           DXCH     ALMCADR                               
058384,000172:    5710           35732                           CAF      ADR40400                              
058385,000173:    5711           54061        BOTHABRT           TS       ITEMP1                                
058386,000174:    5712           50002                           INDEX    Q                                     
058387,000175:    5713           30000                           CAF      0                                     
058388,000176:    5714           54001                           TS       L                                     
058389,000177:    5715           15603                           TCF      CHKFAIL1                              

Page 1374

058391,000179:    5716           00004        POODOO1            INHINT                                         
058392,000180:    5717           53364                           DXCH     ALMCADR                               
058393,000181:    5720           35731                           CAF      ADR77770                              
058394,000182:    5721           15711                           TCF      BOTHABRT                              
058395,000183: 
058396,000184:    5722           00004        ALARM1             INHINT                                         
058397,000185:    5723           53364                           DXCH     ALMCADR                               
058398,000186:    5724           00004        ALMNCADR           INHINT                                         
058399,000187:    5725           50002                           INDEX    Q                                     
058400,000188:    5726           30000                           CA       0                                     
058401,000189:    5727           54001                           TS       L                                     
058402,000190:    5730           15601                           TCF      LARMENT                               
058403,000191: 
058404,000192:    5731           15650        ADR77770           TCF      OCT77770                              
058405,000193:    5732           15632        ADR40400           TCF      OCT40400                              
058406,000194:    5733     5155               DOALARM            EQUALS   ENDOFJOB                              
058407,000195:    5733  E7,1515                                  EBANK=   DVCNTR                                
058408,000196:    5733           56067        BBSERVDL           BBCON    SERVIDLE                              
058409,000197:                                                                                                  #  CALLING SEQUENCE FOR VARALARM
058410,000198: 
058411,000199:                                                                                                  #                CAF     (ALARM)
058412,000200:                                                                                                  #                TC      VARALARM
058413,000201: 
058414,000202:                                                                                                  #  VARALARM TURNS ON PROGRAM ALARM LIGHT BUT DOES NOT DISPLAY
058415,000203: 
058416,000204:    5734           00004        VARALARM           INHINT                                         
058417,000205: 
058418,000206:    5735           54001                           TS       L                                     #  SAVE USERS ALARM CODE
058419,000207: 
058420,000208:    5736           30002                           CA       Q                                     #  SAVE USERS Q
058421,000209:    5737           55363                           TS       ALMCADR                               
058422,000210: 
058423,000211:    5740           05575                           TC       PRIOENT                               
058424,000212:    5741           00014        OCT14              OCT      14                                    #  DONT MOVE
058425,000213: 
058426,000214:    5742           01363                           TC       ALMCADR                               #  RETURN TO USER
058427,000215: 
058428,000216:    5743     5634               ABORT              EQUALS   WHIMPER                               
058429,000217: 13,3750                                           BANK     13                                    
058430,000218: 13,2000                                           SETLOC   ABTFLGS                               
058431,000219: 13,2000                                           BANK                                           
058432,000220: 13,3750                                           COUNT*   $$/ALARM                              
058433,000221: 
058434,000222: 13,3750           44747        FLAGS              CS       STATEBIT                              
058435,000223: 13,3751           70077                           MASK     FLAGWRD3                              
058436,000224: 13,3752           54077                           TS       FLAGWRD3                              
058437,000225: 13,3753           44745                           CS       REINTBIT                              
058438,000226: 13,3754           70106                           MASK     FLGWRD10                              
058439,000227: 13,3755           54106                           TS       FLGWRD10                              
058440,000228: 13,3756           44753                           CS       NODOBIT                               
058441,000229: 13,3757           70076                           MASK     FLAGWRD2                              

Page 1375

058443,000231: 13,3760           54076                           TS       FLAGWRD2                              
058444,000232: 13,3761           00002                           TC       Q                                     
058445,000233: 

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