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 Colossus 249 (Apollo 9) 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 055 OF AGC PROGRAM COMANCHE BY NASA 2021113-051
	10:28 APR.  1,1969
Note that the date is the date of the printout, not the date of the program revision.

064683,000002:                                                                                                  ## Copyright:   Public domain.
064684,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
064685,000004:                                                                                                  ## Purpose:     Part of the source code for Comanche, build 055. It
064686,000005:                                                                                                  ##              is part of the source code for the Command Module's
064687,000006:                                                                                                  ##              (CM) Apollo Guidance Computer (AGC), Apollo 11.
064688,000007:                                                                                                  ## Assembler:   yaYUL
064689,000008:                                                                                                  ## Reference:   pp. 1485-1492
064690,000009:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>
064691,000010:                                                                                                  ## Website:     http://www.ibiblio.org/apollo.
064692,000011:                                                                                                  ## Mod history: 2009-05-07 RSB  Adapted from Colossus249 file of the same
064693,000012:                                                                                                  ##                              name, and page images. Corrected various 
064694,000013:                                                                                                  ##                              typos in the transcription of program 
064695,000014:                                                                                                  ##                              comments, and these should be back-ported  
064696,000015:                                                                                                  ##                              to Colossus249.
064697,000016:                                                                                                  ##              2016-12-22 RSB  Proofed comment text using octopus/ProoferComments
064698,000017:                                                                                                  ##                              and corrected the errors found.
064699,000018:                                                                                                  ##              2017-01-18 RSB  Fixed comment-text errors noted while diff'ing
064700,000019:                                                                                                  ##                              vs Colossus 249.
064701,000020:                                                                                                  ##
064702,000021:                                                                                                  ## The contents of the "Comanche055" files, in general, are transcribed 
064703,000022:                                                                                                  ## from scanned documents. 
064704,000023:                                                                                                  ##
064705,000024:                                                                                                  ##       Assemble revision 055 of AGC program Comanche by NASA
064706,000025:                                                                                                  ##       2021113-051.  April 1, 1969.  
064707,000026:                                                                                                  ##
064708,000027:                                                                                                  ##       This AGC program shall also be referred to as Colossus 2A
064709,000028:                                                                                                  ##
064710,000029:                                                                                                  ##       Prepared by
064711,000030:                                                                                                  ##                       Massachusetts Institute of Technology
064712,000031:                                                                                                  ##                       75 Cambridge Parkway
064713,000032:                                                                                                  ##                       Cambridge, Massachusetts
064714,000033:                                                                                                  ##
064715,000034:                                                                                                  ##       under NASA contract NAS 9-4065.
064716,000035:                                                                                                  ##
064717,000036:                                                                                                  ## Refer directly to the online document mentioned above for further
064718,000037:                                                                                                  ## information.  Please report any errors to info@sandroid.org.
064719,000038: 

Page 1485

064721,000040:    7722                                           BLOCK    3                                     
064722,000041:    6000                                           SETLOC   FFTAG6                                
064723,000042:    6000                                           BANK                                           
064724,000043:    7722                                           COUNT    03/FLAG                               
064725,000044: 
064726,000045:    7722           54001        UPENT2             TS       L                                     #  WHICH FLAGWORD IS IT
064727,000046:    7723           75023                           MASK     OCT7                                  
064728,000047:    7724           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
064729,000048: 
064730,000049:    7725           75731                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
064731,000050:    7726           00004                           INHINT                                         #  PREVENT INTERUPTS
064732,000051:    7727           54061                           TS       ITEMP1                                #  STORE THE BIT INFORMATION TEMPORARIALY
064733,000052: 
064734,000053:    7730           50001                           NDX      L                                     
064735,000054:    7731           40074                           CS       FLAGWRD0                              
064736,000055:    7732           70061                           MASK     ITEMP1                                
064737,000056:    7733           50001                           NDX      L                                     
064738,000057:    7734           26074                           ADS      FLAGWRD0                              
064739,000058:    7735           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
064740,000059: 
064741,000060:    7736           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
064742,000061:    7737           00002                           TC       Q                                     #  RETURN
064743,000062: 
064744,000063:    7740           54001        DOWNENT2           TS       L                                     #  WHICH FLAGWORD IS IT
064745,000064:    7741           75023                           MASK     OCT7                                  
064746,000065:    7742           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
064747,000066: 
064748,000067:    7743           75731                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
064749,000068:    7744           40000                           COM                                            #  START TO PROCESS THE INFORMATION
064750,000069: 
064751,000070:    7745           00004                           INHINT                                         #  PREVENT INTERUPTS
064752,000071:    7746           50001                           NDX      L                                     
064753,000072:    7747           70074                           MASK     FLAGWRD0                              
064754,000073:    7750           50001                           NDX      L                                     
064755,000074:    7751           54074                           TS       FLAGWRD0                              
064756,000075:    7752           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
064757,000076: 
064758,000077:    7753           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
064759,000078:    7754           00002                           TC       Q                                     #  RETURN
064760,000079: 
064761,000080:    7755     5023               OCT7               EQUALS   SEVEN                                 
064762,000081: 10,3766                                           BANK     10                                    
064763,000082: 

Page 1486

064765,000084:                                                                                                  #  UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.  USING THEM, WHETHER OR
064766,000085:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
064767,000086:                                                                                                  #  EBANK SETTING.  A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
064768,000087:                                                                                                  #  ASSEMBLER.
064769,000088: 
064770,000089:                                                                                                  #  AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.  ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
064771,000090:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
064772,000091: 
064773,000092:                                                                                                  #  CALLING SEQUENCES ARE AS FOLLOWS:-
064774,000093:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
064775,000094:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
064776,000095: 
064777,000096:                                                                                                  #  RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
064778,000097:                                                                                                  #  UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
064779,000098: 
064780,000099:    5546                                           BLOCK    02                                    
064781,000100:    4000                                           SETLOC   FFTAG1                                
064782,000101:    4000                                           BANK                                           
064783,000102:    5546                                           COUNT*   $$/FLAG                               
064784,000103: 
064785,000104:    5546           30002        UPFLAG             CA       Q                                     
064786,000105:    5547           05564                           TC       DEBIT                                 
064787,000106:    5550           40000                           COM                                            #  +(15 - BIT)
064788,000107:    5551           00006                           EXTEND                                         
064789,000108:    5552           04001                           ROR      LCHAN                                 #  SET BIT
064790,000109:    5553           50061        COMFLAG            INDEX    ITEMP1                                
064791,000110:    5554           54074                           TS       FLAGWRD0                              
064792,000111:    5555           22063                           LXCH     ITEMP3                                
064793,000112:    5556           00003                           RELINT                                         
064794,000113:    5557           00001                           TC       L                                     
064795,000114: 
064796,000115:    5560           30002        DOWNFLAG           CA       Q                                     
064797,000116:    5561           05564                           TC       DEBIT                                 
064798,000117:    5562           70001                           MASK     L                                     #  RESET BIT
064799,000118:    5563           15553                           TCF      COMFLAG                               
064800,000119: 
064801,000120:    5564           65017        DEBIT              AD       ONE                                   #  GET DE BITS
064802,000121:    5565           00004                           INHINT                                         
064803,000122:    5566           54063                           TS       ITEMP3                                
064804,000123:    5567           35026                           CA       LOW4                                  #  DEC15
064805,000124:    5570           54061                           TS       ITEMP1                                
064806,000125:    5571           50063                           INDEX    ITEMP3                                
064807,000126:    5572           27777                           CA       0          -1                         #  ADRES
064808,000127:    5573           54001                           TS       L                                     
064809,000128:    5574           35021                           CA       ZERO                                  

Page 1487

064811,000130:    5575           00006                           EXTEND                                         
064812,000131:    5576           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
064813,000132:    5577           52062                           DXCH     ITEMP1                                
064814,000133:    5600           50061                           INDEX    ITEMP1                                
064815,000134:    5601           30074                           CA       FLAGWRD0                              
064816,000135:    5602           54001                           TS       L                                     #  CURRENT STATE
064817,000136:    5603           50062                           INDEX    ITEMP2                                
064818,000137:    5604           45001                           CS       BIT15                                 #  -(15 - BIT)
064819,000138:    5605           00002                           TC       Q                                     
064820,000139: 

Page 1488

064822,000141:                                                                                                  #  DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
064823,000142: 
064824,000143:                                                                                                  #  ENTRANCE REQUIREMENTS...
064825,000144:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
064826,000145:                                                                                                  #                TC      BANKCALL
064827,000146:                                                                                                  #                CADR    DELAYJOB
064828,000147: 
064829,000148: 06,3770                                           BANK     06                                    
064830,000149: 00,2000                                           SETLOC   DLAYJOB                               
064831,000150: 00,2000                                           BANK                                           
064832,000151: 
064833,000152:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
064834,000153: 
064835,000154: 00,3732                                           COUNT    00/DELAY                              
064836,000155: 
064837,000156: 00,3732           00004        DELAYJOB           INHINT                                         
064838,000157: 00,3733           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
064839,000158: 00,3734           36214                           CAF      DELAYNUM                              #  WAITLIST
064840,000159: 00,3735           54070        DELLOOP            TS       RUPTREG1                              
064841,000160: 00,3736           50000                           INDEX    A                                     
064842,000161: 00,3737           31141                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
064843,000162: 00,3740           00006                           EXTEND                                         
064844,000163: 00,3741           13746                           BZF      OK2DELAY                              #  YES
064845,000164: 
064846,000165: 00,3742           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
064847,000166: 00,3743           13735                           TCF      DELLOOP                               
064848,000167: 
064849,000168: 00,3744           07755                           TC       BAILOUT                               #  NO AVAILABLE LOCS AVAILABLE.
064850,000169: 00,3745           01104                           OCT      1104                                  
064851,000170: 
064852,000171: 00,3746           33766        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
064853,000172: 00,3747           54061                           TS       WAITEXIT                              
064854,000173: 
064855,000174: 00,3750           30004                           CA       FBANK                                 
064856,000175: 00,3751           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
064857,000176: 00,3752           54001                           TS       L                                     
064858,000177: 
064859,000178: 00,3753           33767                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
064860,000179: 00,3754           15255                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
064861,000180: 
064862,000181: 00,3755           04711        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
064863,000182: 
064864,000183: 00,3756           50070                           INDEX    RUPTREG1                              
064865,000184: 00,3757           55141                           TS       DELAYLOC                              #  SAVE DELAY CADRS
064866,000185: 
064867,000186: 00,3760           05175                           TC       JOBSLEEP                              
064868,000187: 
064869,000188: 00,3761           35021        WAKER              CAF      ZERO                                  
064870,000189: 00,3762           50006                           INDEX    BBANK                                 
064871,000190: 00,3763           57141                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE

Page 1489

064873,000192: 00,3764           05201                           TC       JOBWAKE                               
064874,000193: 
064875,000194: 00,3765           05324                           TC       TASKOVER                              
064876,000195: 
064877,000196: 00,3766           03753        TCSLEEP            GENADR   TCGETCAD   -2                         
064878,000197: 00,3767           03761        WAKECAD            GENADR   WAKER                                 
064879,000198: 

Page 1490

064881,000200:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
064882,000201:                                                                                                  #  WRITTEN BY D. EYLES
064883,000202:                                                                                                  #  MOD 1 BY KERNAN                               UTILITYM REV 17 11/18/67
064884,000203:                                                                                                  #  MOD 2 BY SCHULENBERG  (REMOVE RELINT)  SKIPPER REV 4 2/28/68
064885,000204: 
064886,000205:                                                                                                  #  THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
064887,000206:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
064888,000207: 
064889,000208:                                                                                                  #  GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
064890,000209:                                                                                                  #        I       CA      N-1             # OF QUANTITIES MINUS ONE.
064891,000210:                                                                                                  #        I +1    TC      GENTRAN         IN FIXED-FIXED.
064892,000211:                                                                                                  #        I +2    ADRES   L               STARTING ADRES OF DATA TO BE MOVED.
064893,000212:                                                                                                  #        I +3    ADRES   M               STARTING ADRES OF DUPLICATION BLOCK.
064894,000213:                                                                                                  #        I +4                            RETURNS HERE.
064895,000214: 
064896,000215:                                                                                                  #  GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
064897,000216:                                                                                                  #  A, L AND ITEMP1 ARE NOT PRESERVED.
064898,000217: 
064899,000218:    5606                                           BLOCK    02                                    
064900,000219:    4000                                           SETLOC   FFTAG4                                
064901,000220:    4000                                           BANK                                           
064902,000221: 
064903,000222:    5606     0061                                  EBANK=   ITEMP1                                
064904,000223: 
064905,000224:    5606                                           COUNT*   $$/TRAN                               
064906,000225: 
064907,000226:    5606           00004        GENTRAN            INHINT                                         
064908,000227:    5607           54061                           TS       ITEMP1                                #  SAVE N-1.
064909,000228:    5610           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
064910,000229:    5611           60000                           AD       0                                     #  ADRES (L + N - 1).
064911,000230:    5612           50000                           INDEX    A                                     
064912,000231:    5613           30000                           CA       0                                     #  C(ABOVE).
064913,000232:    5614           54001                           TS       L                                     #  SAVE DATA.
064914,000233:    5615           30061                           CA       ITEMP1                                
064915,000234:    5616           50002                           INDEX    Q                                     
064916,000235:    5617           60001                           AD       1                                     #  ADRES (M + N - 1).
064917,000236:    5620           50000                           INDEX    A                                     
064918,000237:    5621           22000                           LXCH     0                                     #  STUFF IT.
064919,000238:    5622           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
064920,000239:    5623           15607                           TCF      GENTRAN    +1                         
064921,000240:    5624           16710                           TCF      Q+2                                   #  RETURN TO CALLER.
064922,000241: 

Page 1491

064924,000243:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
064925,000244:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
064926,000245: 
064927,000246:    5625                                           COUNT*   $$/EXTVB                              
064928,000247: 
064929,000248:    5625           45013        B5OFF              CS       BIT5                                  
064930,000249:    5626           71044                           MASK     EXTVBACT                              
064931,000250:    5627           55044                           TS       EXTVBACT                              
064932,000251:    5630           05217                           TC       ENDOFJOB                              
064933,000252: 

Page 1492

064935,000254:                                                                                                  #  SUBROUTINES TO TURN OFF AND TURN ON TRACKER FAIL LIGHT.
064936,000255: 
064937,000256:    5631           00004        TRFAILOF           INHINT                                         
064938,000257:    5632           47704                           CS       OCT40200                              #  TURN OFF TRACKER LIGHT
064939,000258:    5633           71036                           MASK     DSPTAB     +11D                       
064940,000259:    5634           65001                           AD       BIT15                                 
064941,000260:    5635           55036                           TS       DSPTAB     +11D                       
064942,000261:    5636           41331                           CS       OPTMODES                              #  TO INSURE THAT OCDU FAIL WILL GO ON
064943,000262:    5637           75011                           MASK     BIT7                                  #  AGAIN IF IT WAS ON IN ADDITION TO
064944,000263:    5640           27331                           ADS      OPTMODES                              #  TRACKER FAIL.
064945,000264: 
064946,000265:    5641           00003        REQ                RELINT                                         
064947,000266:    5642           00002                           TC       Q                                     
064948,000267: 
064949,000268:    5643           00004        TRFAILON           INHINT                                         
064950,000269:    5644           41036                           CS       DSPTAB     +11D                       #  TURN ON
064951,000270:    5645           77704                           MASK     OCT40200                              
064952,000271:    5646           27036                           ADS      DSPTAB     +11D                       
064953,000272:    5647           15641                           TCF      REQ                                   
064954,000273: 
064955,000274: 
064956,000275: 
064957,000276: 

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