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.

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

Page 1374

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

Page 1375

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

Page 1376

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

Page 1377

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

Page 1378

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

Page 1379

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

Page 1380

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

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