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
	16:27 JULY 14,1969
Note that the date is the date of the printout, not the date of the program revision.

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

Page 1374

058988,000035: 10,3544                                           BANK     10                                    
058989,000036: 10,2000                                           SETLOC   DISPLAYS                              
058990,000037: 10,2000                                           BANK                                           
058991,000038: 10,3544                                           COUNT*   $$/DSPLA                              
058992,000039: 
058993,000040: 10,3544           00004        UPENT2             INHINT                                         
058994,000041: 10,3545           75660                           MASK     OCT77770                              
058995,000042: 10,3546           54001                           TS       L                                     
058996,000043: 10,3547           40100                           CS       FLAGWRD4                              
058997,000044: 10,3550           70001                           MASK     L                                     
058998,000045: 10,3551           26100                           ADS      FLAGWRD4                              
058999,000046: 10,3552           00003        JOIN               RELINT                                         
059000,000047: 10,3553           16737                           TCF      Q+1                                   
059001,000048: 
059002,000049: 10,3554           00004        DOWNENT2           INHINT                                         
059003,000050: 10,3555           75660                           MASK     OCT77770                              
059004,000051: 10,3556           40000                           COM                                            
059005,000052: 10,3557           70100                           MASK     FLAGWRD4                              
059006,000053: 10,3560           54100                           TS       FLAGWRD4                              
059007,000054: 10,3561           13552                           TCF      JOIN                                  
059008,000055: 
059009,000056: 10,3562     4757               OCT7               EQUALS   SEVEN                                 
059010,000057: 

Page 1375

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

Page 1376

059058,000105:    5533           00006                           EXTEND                                         
059059,000106:    5534           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
059060,000107:    5535           52062                           DXCH     ITEMP1                                
059061,000108:    5536           50061                           INDEX    ITEMP1                                
059062,000109:    5537           30074                           CA       FLAGWRD0                              
059063,000110:    5540           54001                           TS       L                                     #  CURRENT STATE
059064,000111:    5541           50062                           INDEX    ITEMP2                                
059065,000112:    5542           44735                           CS       BIT15                                 #  -(15 - BIT)
059066,000113:    5543           00002                           TC       Q                                     
059067,000114: 

Page 1377

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

Page 1378

059120,000167: 00,3770           05137                           TC       JOBWAKE                               
059121,000168: 
059122,000169: 00,3771           05261                           TC       TASKOVER                              
059123,000170: 
059124,000171: 00,3772           03757        TCSLEEP            GENADR   TCGETCAD   -2                         
059125,000172: 00,3773           03765        WAKECAD            GENADR   WAKER                                 
059126,000173: 

Page 1379

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

Page 1380

059171,000218:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
059172,000219:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
059173,000220: 
059174,000221:    5563                                           COUNT*   $$/EXTVB                              
059175,000222: 
059176,000223:    5563           44747        B5OFF              CS       BIT5                                  
059177,000224:    5564           71044                           MASK     EXTVBACT                              
059178,000225:    5565           55044                           TS       EXTVBACT                              
059179,000226:    5566           05155                           TC       ENDOFJOB                              
059180,000227: 
059181,000228: 
059182,000229: 

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