Source Code

These source-code files were from the printout at the MIT Museum, with many thanks to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing it to us. The printout was digitally photographed by Paul Fjeld. A team of volunteers transcribed the source code manually from these images or, where appropriate, modified already-transcribed but similar source Luminary 131 (Apollo 13) source code to agree with the images from the printout. Note that the page images presented online are of reduced quality, and that higher-quality images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 001 OF AGC PROGRAM LMY99 BY NASA 2021112-061
	20'35 OCT. 28,1968
Note that the date is the date of the printout, not the date of the program revision.

058934,000002:                                                                                                  ## Copyright:   Public domain.
058935,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
058936,000004:                                                                                                  ## Purpose:     Part of the source code for Luminary 1A build 099.
058937,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
058938,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 11.
058939,000007:                                                                                                  ## Assembler:   yaYUL
058940,000008:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058941,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo.
058942,000010:                                                                                                  ## Pages:       1374-1380
058943,000011:                                                                                                  ## Mod history: 2009-05-10 SN   (Sergio Navarro).  Started adapting
058944,000012:                                                                                                  ##                              from the Luminary131/ file of the same
058945,000013:                                                                                                  ##                              name, using Luminary099 page images.
058946,000014:                                                                                                  ##              2016-12-18 RSB  Proofed text comments with octopus/ProoferComments
058947,000015:                                                                                                  ##                              and corrected the errors found.
058948,000016:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 5-way
058949,000017:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
058950,000018: 
058951,000019:                                                                                                  ## This source code has been transcribed or otherwise adapted from
058952,000020:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
058953,000021:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
058954,000022:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
058955,000023:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
058956,000024:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
058957,000025:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
058958,000026:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
058959,000027:                                                                                                  ## actually created.
058960,000028:                                                                                                  ##
058961,000029:                                                                                                  ## Notations on the hardcopy document read, in part:
058962,000030:                                                                                                  ##
058963,000031:                                                                                                  ##      Assemble revision 001 of AGC program LMY99 by NASA 2021112-61
058964,000032:                                                                                                  ##      16:27 JULY 14, 1969 
058965,000033: 

Page 1374

058967,000035: 10,3544                                           BANK     10                                    
058968,000036: 10,2000                                           SETLOC   DISPLAYS                              
058969,000037: 10,2000                                           BANK                                           
058970,000038: 10,3544                                           COUNT*   $$/DSPLA                              
058971,000039: 
058972,000040: 10,3544           00004        UPENT2             INHINT                                         
058973,000041: 10,3545           75660                           MASK     OCT77770                              
058974,000042: 10,3546           54001                           TS       L                                     
058975,000043: 10,3547           40100                           CS       FLAGWRD4                              
058976,000044: 10,3550           70001                           MASK     L                                     
058977,000045: 10,3551           26100                           ADS      FLAGWRD4                              
058978,000046: 10,3552           00003        JOIN               RELINT                                         
058979,000047: 10,3553           16737                           TCF      Q+1                                   
058980,000048: 
058981,000049: 10,3554           00004        DOWNENT2           INHINT                                         
058982,000050: 10,3555           75660                           MASK     OCT77770                              
058983,000051: 10,3556           40000                           COM                                            
058984,000052: 10,3557           70100                           MASK     FLAGWRD4                              
058985,000053: 10,3560           54100                           TS       FLAGWRD4                              
058986,000054: 10,3561           13552                           TCF      JOIN                                  
058987,000055: 
058988,000056: 10,3562     4757               OCT7               EQUALS   SEVEN                                 
058989,000057: 

Page 1375

058991,000059:                                                                                                  #  UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.  USING THEM, WHETHER OR
058992,000060:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
058993,000061:                                                                                                  #  EBANK SETTING.  A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
058994,000062:                                                                                                  #  ASSEMBLER.
058995,000063: 
058996,000064:                                                                                                  #  AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.  ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
058997,000065:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
058998,000066: 
058999,000067:                                                                                                  #  CALLING SEQUENCES ARE AS FOLLOWS :-
059000,000068:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
059001,000069:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
059002,000070: 
059003,000071:                                                                                                  #  RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
059004,000072:                                                                                                  #  UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
059005,000073: 
059006,000074:    5504                                           BLOCK    02                                    
059007,000075:    4000                                           SETLOC   FFTAG1                                
059008,000076:    4000                                           BANK                                           
059009,000077:    5504                                           COUNT*   $$/FLAG                               
059010,000078: 
059011,000079:    5504           30002        UPFLAG             CA       Q                                     
059012,000080:    5505           05522                           TC       DEBIT                                 
059013,000081:    5506           40000                           COM                                            #  +(15 - BIT)
059014,000082:    5507           00006                           EXTEND                                         
059015,000083:    5510           04001                           ROR      LCHAN                                 #  SET BIT
059016,000084:    5511           50061        COMFLAG            INDEX    ITEMP1                                
059017,000085:    5512           54074                           TS       FLAGWRD0                              
059018,000086:    5513           22063                           LXCH     ITEMP3                                
059019,000087:    5514           00003                           RELINT                                         
059020,000088:    5515           00001                           TC       L                                     
059021,000089: 
059022,000090:    5516           30002        DOWNFLAG           CA       Q                                     
059023,000091:    5517           05522                           TC       DEBIT                                 
059024,000092:    5520           70001                           MASK     L                                     #  RESET BIT
059025,000093:    5521           15511                           TCF      COMFLAG                               
059026,000094: 
059027,000095:    5522           64753        DEBIT              AD       ONE                                   #  GET DE BITS
059028,000096:    5523           00004                           INHINT                                         
059029,000097:    5524           54063                           TS       ITEMP3                                
059030,000098:    5525           34762                           CA       LOW4                                  #  DEC15
059031,000099:    5526           54061                           TS       ITEMP1                                
059032,000100:    5527           50063                           INDEX    ITEMP3                                
059033,000101:    5530           27777                           CA       0          -1                         #  ADRES
059034,000102:    5531           54001                           TS       L                                     
059035,000103:    5532           34755                           CA       ZERO                                  

Page 1376

059037,000105:    5533           00006                           EXTEND                                         
059038,000106:    5534           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
059039,000107:    5535           52062                           DXCH     ITEMP1                                
059040,000108:    5536           50061                           INDEX    ITEMP1                                
059041,000109:    5537           30074                           CA       FLAGWRD0                              
059042,000110:    5540           54001                           TS       L                                     #  CURRENT STATE
059043,000111:    5541           50062                           INDEX    ITEMP2                                
059044,000112:    5542           44735                           CS       BIT15                                 #  -(15 - BIT)
059045,000113:    5543           00002                           TC       Q                                     
059046,000114: 

Page 1377

059048,000116:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
059049,000117: 
059050,000118:                                                                                                  #  ENTRANCE REQUIREMENTS ...
059051,000119:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
059052,000120:                                                                                                  #                TC      BANKCALL
059053,000121:                                                                                                  #                CADR    DELAYJOB
059054,000122: 
059055,000123: 06,3764                                           BANK     06                                    
059056,000124: 00,2000                                           SETLOC   DLAYJOB                               
059057,000125: 00,2000                                           BANK                                           
059058,000126: 
059059,000127:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
059060,000128: 
059061,000129: 00,3735                                           COUNT*   $$/DELAY                              
059062,000130: 00,3735           00004        DELAYJOB           INHINT                                         
059063,000131: 00,3736           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
059064,000132: 00,3737           34752                           CAF      DELAYNUM                              #  WAITLIST
059065,000133: 00,3740           54070        DELLOOP            TS       RUPTREG1                              
059066,000134: 00,3741           50000                           INDEX    A                                     
059067,000135: 00,3742           31326                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
059068,000136: 00,3743           00006                           EXTEND                                         
059069,000137: 00,3744           13752                           BZF      OK2DELAY                              #  YES
059070,000138: 
059071,000139: 00,3745           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
059072,000140: 00,3746           13740                           TCF      DELLOOP                               
059073,000141: 
059074,000142: 00,3747           52134                           DXCH     BUF2                                  
059075,000143: 00,3750           05716                           TC       BAILOUT1                              #  NO AVAILABLE LOCS.
059076,000144: 00,3751           01104                           OCT      1104                                  
059077,000145: 
059078,000146: 00,3752           33772        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
059079,000147: 00,3753           54061                           TS       WAITEXIT                              
059080,000148: 
059081,000149: 00,3754           30004                           CA       FBANK                                 
059082,000150: 00,3755           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
059083,000151: 00,3756           54001                           TS       L                                     
059084,000152: 
059085,000153: 00,3757           33773                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
059086,000154: 00,3760           15211                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
059087,000155: 
059088,000156: 00,3761           04645        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
059089,000157: 
059090,000158: 00,3762           50070                           INDEX    RUPTREG1                              
059091,000159: 00,3763           55326                           TS       DELAYLOC                              #  SAVE DELAY CADRS
059092,000160: 
059093,000161: 00,3764           05133                           TC       JOBSLEEP                              
059094,000162: 
059095,000163: 00,3765           34755        WAKER              CAF      ZERO                                  
059096,000164: 00,3766           50006                           INDEX    BBANK                                 
059097,000165: 00,3767           57326                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE

Page 1378

059099,000167: 00,3770           05137                           TC       JOBWAKE                               
059100,000168: 
059101,000169: 00,3771           05261                           TC       TASKOVER                              
059102,000170: 
059103,000171: 00,3772           03757        TCSLEEP            GENADR   TCGETCAD   -2                         
059104,000172: 00,3773           03765        WAKECAD            GENADR   WAKER                                 
059105,000173: 

Page 1379

059107,000175:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
059108,000176:                                                                                                  #  WRITTEN BY D. EYLES
059109,000177:                                                                                                  #  MOD 1 BY KERNAN                               UTILITYM REV 17 11/18/67
059110,000178:                                                                                                  #  MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
059111,000179: 
059112,000180:                                                                                                  #  THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
059113,000181:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
059114,000182: 
059115,000183:                                                                                                  #  GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
059116,000184:                                                                                                  #        I       CA      N-1             # OF QUANTITIES MINUS ONE.
059117,000185:                                                                                                  #        I +1    TC      GENTRAN         IN FIXED-FIXED.
059118,000186:                                                                                                  #        I +2    ADRES   L               STARTING ADRES OF DATA TO BE MOVED.
059119,000187:                                                                                                  #        I +3    ADRES   M               STARTING ADRES OF DUPLICATION BLOCK.
059120,000188:                                                                                                  #        I +4                            RETURNS HERE.
059121,000189: 
059122,000190:                                                                                                  #  GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
059123,000191:                                                                                                  #  A, L AND ITEMP1 ARE NOT PRESERVED.
059124,000192: 
059125,000193:    5544                                           BLOCK    02                                    
059126,000194:    4000                                           SETLOC   FFTAG4                                
059127,000195:    4000                                           BANK                                           
059128,000196: 
059129,000197:    5544     0061                                  EBANK=   ITEMP1                                
059130,000198: 
059131,000199:    5544                                           COUNT*   $$/TRAN                               
059132,000200: 
059133,000201:    5544           00004        GENTRAN            INHINT                                         
059134,000202:    5545           54061                           TS       ITEMP1                                #  SAVE N-1.
059135,000203:    5546           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
059136,000204:    5547           60000                           AD       0                                     #  ADRES (L + N - 1).
059137,000205:    5550           50000                           INDEX    A                                     
059138,000206:    5551           30000                           CA       0                                     #  C(ABOVE).
059139,000207:    5552           54001                           TS       L                                     #  SAVE DATA.
059140,000208:    5553           30061                           CA       ITEMP1                                
059141,000209:    5554           50002                           INDEX    Q                                     
059142,000210:    5555           60001                           AD       1                                     #  ADRES (M + N - 1).
059143,000211:    5556           50000                           INDEX    A                                     
059144,000212:    5557           22000                           LXCH     0                                     #  STUFF IT.
059145,000213:    5560           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
059146,000214:    5561           15545                           TCF      GENTRAN    +1                         
059147,000215:    5562           16741                           TCF      Q+2                                   #  RETURN TO CALLER.
059148,000216: 

Page 1380

059150,000218:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
059151,000219:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
059152,000220: 
059153,000221:    5563                                           COUNT*   $$/EXTVB                              
059154,000222: 
059155,000223:    5563           44747        B5OFF              CS       BIT5                                  
059156,000224:    5564           71044                           MASK     EXTVBACT                              
059157,000225:    5565           55044                           TS       EXTVBACT                              
059158,000226:    5566           05155                           TC       ENDOFJOB                              
059159,000227: 
059160,000228: 
059161,000229: 

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