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.

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

Page 1485

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

Page 1486

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

Page 1487

064794,000130:    5575           00006                           EXTEND                                         
064795,000131:    5576           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
064796,000132:    5577           52062                           DXCH     ITEMP1                                
064797,000133:    5600           50061                           INDEX    ITEMP1                                
064798,000134:    5601           30074                           CA       FLAGWRD0                              
064799,000135:    5602           54001                           TS       L                                     #  CURRENT STATE
064800,000136:    5603           50062                           INDEX    ITEMP2                                
064801,000137:    5604           45001                           CS       BIT15                                 #  -(15 - BIT)
064802,000138:    5605           00002                           TC       Q                                     
064803,000139: 

Page 1488

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

Page 1489

064856,000192: 00,3764           05201                           TC       JOBWAKE                               
064857,000193: 
064858,000194: 00,3765           05324                           TC       TASKOVER                              
064859,000195: 
064860,000196: 00,3766           03753        TCSLEEP            GENADR   TCGETCAD   -2                         
064861,000197: 00,3767           03761        WAKECAD            GENADR   WAKER                                 
064862,000198: 

Page 1490

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

Page 1491

064907,000243:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
064908,000244:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
064909,000245: 
064910,000246:    5625                                           COUNT*   $$/EXTVB                              
064911,000247: 
064912,000248:    5625           45013        B5OFF              CS       BIT5                                  
064913,000249:    5626           71044                           MASK     EXTVBACT                              
064914,000250:    5627           55044                           TS       EXTVBACT                              
064915,000251:    5630           05217                           TC       ENDOFJOB                              
064916,000252: 

Page 1492

064918,000254:                                                                                                  #  SUBROUTINES TO TURN OFF AND TURN ON TRACKER FAIL LIGHT.
064919,000255: 
064920,000256:    5631           00004        TRFAILOF           INHINT                                         
064921,000257:    5632           47704                           CS       OCT40200                              #  TURN OFF TRACKER LIGHT
064922,000258:    5633           71036                           MASK     DSPTAB     +11D                       
064923,000259:    5634           65001                           AD       BIT15                                 
064924,000260:    5635           55036                           TS       DSPTAB     +11D                       
064925,000261:    5636           41331                           CS       OPTMODES                              #  TO INSURE THAT OCDU FAIL WILL GO ON
064926,000262:    5637           75011                           MASK     BIT7                                  #  AGAIN IF IT WAS ON IN ADDITION TO
064927,000263:    5640           27331                           ADS      OPTMODES                              #  TRACKER FAIL.
064928,000264: 
064929,000265:    5641           00003        REQ                RELINT                                         
064930,000266:    5642           00002                           TC       Q                                     
064931,000267: 
064932,000268:    5643           00004        TRFAILON           INHINT                                         
064933,000269:    5644           41036                           CS       DSPTAB     +11D                       #  TURN ON
064934,000270:    5645           77704                           MASK     OCT40200                              
064935,000271:    5646           27036                           ADS      DSPTAB     +11D                       
064936,000272:    5647           15641                           TCF      REQ                                   
064937,000273: 
064938,000274: 
064939,000275: 
064940,000276: 

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