Source Code

These source-code files were derived from scans of the Colossus 237 (Apollo 8 Command Module) program listing from the private collection of original AGC developer Fred Martin. Scanning was by Ron Burkey. Pre-existing Colossus 249 (Apollo 9 CM) source files were used as a template, and changes between Colossus 249 and Colossus 237 were manually transcribed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional 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 237 OF AGC PROGRAM COLOSSUS 
	BY NASA 2021111-031  1:17 AUG. 24, 1968
Note that the date is the date of the printout, not the date of the program revision.

061619,000002:                                                                                                  ## Copyright:   Public domain.
061620,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
061621,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus build 237.
061622,000005:                                                                                                  ##              This is for the Command Module's (CM) Apollo Guidance
061623,000006:                                                                                                  ##              Computer (AGC), for Apollo 8.
061624,000007:                                                                                                  ## Assembler:   yaYUL
061625,000008:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
061626,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
061627,000010:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Colossus237/
061628,000011:                                                                                                  ## Mod history: 2011-04-17 JL   Adapted from corresponding Colossus 249 file.
061629,000012:                                                                                                  ##              2017-01-01 RSB  Proofed comment text using octopus/ProoferComments,
061630,000013:                                                                                                  ##                              and fixed errors found.
061631,000014: 

Page 1449

061633,000016:    7717                                           BLOCK    3                                     
061634,000017:    6000                                           SETLOC   FFTAG6                                
061635,000018:    6000                                           BANK                                           
061636,000019:    7717                                           COUNT    03/FLAG                               
061637,000020: 
061638,000021:    7717           54001        UPENT2             TS       L                                     #  WHICH FLAGWORD IS IT
061639,000022:    7720           74716                           MASK     OCT7                                  
061640,000023:    7721           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
061641,000024: 
061642,000025:    7722           75630                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
061643,000026:    7723           00004                           INHINT                                         #  PREVENT INTERUPTS
061644,000027:    7724           54061                           TS       ITEMP1                                #  STORE THE BIT INFORMATION TEMPORARIALY
061645,000028: 
061646,000029:    7725           50001                           NDX      L                                     
061647,000030:    7726           40074                           CS       FLAGWRD0                              
061648,000031:    7727           70061                           MASK     ITEMP1                                
061649,000032:    7730           50001                           NDX      L                                     
061650,000033:    7731           26074                           ADS      FLAGWRD0                              
061651,000034:    7732           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
061652,000035: 
061653,000036:    7733           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
061654,000037:    7734           00002                           TC       Q                                     #  RETURN
061655,000038: 
061656,000039:    7735           54001        DOWNENT2           TS       L                                     #  WHICH FLAGWORD IS IT
061657,000040:    7736           74716                           MASK     OCT7                                  
061658,000041:    7737           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
061659,000042: 
061660,000043:    7740           75630                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
061661,000044:    7741           40000                           COM                                            #  START TO PROCESS THE INFORMATION
061662,000045: 
061663,000046:    7742           00004                           INHINT                                         #  PREVENT INTERUPTS
061664,000047:    7743           50001                           NDX      L                                     
061665,000048:    7744           70074                           MASK     FLAGWRD0                              
061666,000049:    7745           50001                           NDX      L                                     
061667,000050:    7746           54074                           TS       FLAGWRD0                              
061668,000051:    7747           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
061669,000052: 
061670,000053:    7750           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
061671,000054:    7751           00002                           TC       Q                                     #  RETURN
061672,000055: 
061673,000056:    7752     4716               OCT7               EQUALS   SEVEN                                 
061674,000057: 10,3671                                           BANK     10                                    
061675,000058: 

Page 1450

061677,000060:                                                                                                  #      UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.   USING THEM, WHETHER OR
061678,000061:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
061679,000062:                                                                                                  #  EBANK SETTING.   A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
061680,000063:                                                                                                  #  ASSEMBLER.
061681,000064: 
061682,000065:                                                                                                  #      AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.   ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
061683,000066:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
061684,000067: 
061685,000068:                                                                                                  #      CALLING SEQUENCES ARE AS FOLLOWS:-
061686,000069: 
061687,000070:                                                                                                  #                      TC     UPFLAG                    TC     DOWNFLAG
061688,000071:                                                                                                  #                      ADRES  NAME OF FLAG              ADRES  NAME OF FLAG
061689,000072: 
061690,000073:                                                                                                  #      RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
061691,000074: 
061692,000075:                                                                                                  #      UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
061693,000076: 
061694,000077:    5435                                           BLOCK    02                                    
061695,000078:    4000                                           SETLOC   FFTAG1                                
061696,000079:    4000                                           BANK                                           
061697,000080:    5435                                           COUNT*   $$/FLAG                               
061698,000081: 
061699,000082:    5435           30002        UPFLAG             CA       Q                                     
061700,000083:    5436           05453                           TC       DEBIT                                 
061701,000084:    5437           40000                           COM                                            #  +(15 - BIT)
061702,000085:    5440           00006                           EXTEND                                         
061703,000086:    5441           04001                           ROR      LCHAN                                 #  SET BIT
061704,000087:    5442           50061        COMFLAG            INDEX    ITEMP1                                
061705,000088:    5443           54074                           TS       FLAGWRD0                              
061706,000089:    5444           22063                           LXCH     ITEMP3                                
061707,000090:    5445           00003                           RELINT                                         
061708,000091:    5446           00001                           TC       L                                     
061709,000092: 
061710,000093: 
061711,000094:    5447           30002        DOWNFLAG           CA       Q                                     
061712,000095:    5450           05453                           TC       DEBIT                                 
061713,000096:    5451           70001                           MASK     L                                     #  RESET BIT
061714,000097:    5452           15442                           TCF      COMFLAG                               
061715,000098: 
061716,000099: 
061717,000100:    5453           64712        DEBIT              AD       ONE                                   #  GET DE BITS
061718,000101:    5454           00004                           INHINT                                         
061719,000102:    5455           54063                           TS       ITEMP3                                
061720,000103:    5456           34721                           CA       LOW4                                  #  DEC15
061721,000104:    5457           54061                           TS       ITEMP1                                
061722,000105:    5460           50063                           INDEX    ITEMP3                                
061723,000106:    5461           27777                           CA       0          -1                         #  ADRES
061724,000107:    5462           54001                           TS       L                                     
061725,000108:    5463           34714                           CA       ZERO                                  

Page 1451

061727,000110:    5464           00006                           EXTEND                                         
061728,000111:    5465           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
061729,000112:    5466           52062                           DXCH     ITEMP1                                
061730,000113:    5467           50061                           INDEX    ITEMP1                                
061731,000114:    5470           30074                           CA       FLAGWRD0                              
061732,000115:    5471           54001                           TS       L                                     #  CURRENT STATE
061733,000116:    5472           50062                           INDEX    ITEMP2                                
061734,000117:    5473           44674                           CS       BIT15                                 #  -(15 - BIT)
061735,000118:    5474           00002                           TC       Q                                     
061736,000119: 

Page 1452

061738,000121:                                                                                                  #  DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
061739,000122: 
061740,000123:                                                                                                  #  ENTRANCE REQUIREMENTS...
061741,000124:                                                                                                  #                                                   CAF    DT              DELAY JOB FOR DT CENTISECS
061742,000125:                                                                                                  #                                                   TC     BANKCALL
061743,000126:                                                                                                  #                                                   CADR   DELAYJOB
061744,000127: 
061745,000128: 06,3651                                           BANK     06                                    
061746,000129: 00,2000                                           SETLOC   DLAYJOB                               
061747,000130: 00,2000                                           BANK                                           
061748,000131: 
061749,000132:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
061750,000133: 00,3730                                           COUNT    00/DELAY                              
061751,000134: 
061752,000135: 00,3730           00004        DELAYJOB           INHINT                                         
061753,000136: 00,3731           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
061754,000137: 
061755,000138: 00,3732           36214                           CAF      DELAYNUM                              #  WAITLIST
061756,000139: 00,3733           54070        DELLOOP            TS       RUPTREG1                              
061757,000140: 00,3734           50000                           INDEX    A                                     
061758,000141: 00,3735           31141                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
061759,000142: 00,3736           00006                           EXTEND                                         
061760,000143: 00,3737           13744                           BZF      OK2DELAY                              #  YES
061761,000144: 
061762,000145: 00,3740           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
061763,000146: 00,3741           13733                           TCF      DELLOOP                               
061764,000147: 
061765,000148: 00,3742           05604                           TC       BAILOUT                               #  NO AVAILABLE LOCS AVAILABLE.
061766,000149: 00,3743           01104                           OCT      1104                                  
061767,000150: 
061768,000151: 00,3744           33764        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
061769,000152: 00,3745           54061                           TS       WAITEXIT                              
061770,000153: 
061771,000154: 00,3746           30004                           CA       FBANK                                 
061772,000155: 00,3747           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
061773,000156: 00,3750           54001                           TS       L                                     
061774,000157: 
061775,000158: 00,3751           33765                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
061776,000159: 00,3752           15146                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
061777,000160: 
061778,000161: 00,3753           04604        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
061779,000162: 
061780,000163: 00,3754           50070                           INDEX    RUPTREG1                              
061781,000164: 00,3755           55141                           TS       DELAYLOC                              #  SAVE DELAY CADRS
061782,000165: 
061783,000166: 00,3756           05070                           TC       JOBSLEEP                              
061784,000167: 
061785,000168: 00,3757           34714        WAKER              CAF      ZERO                                  
061786,000169: 00,3760           50006                           INDEX    BBANK                                 
061787,000170: 00,3761           57141                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE

Page 1453

061789,000172: 00,3762           05074                           TC       JOBWAKE                               
061790,000173: 
061791,000174: 00,3763           05213                           TC       TASKOVER                              
061792,000175: 
061793,000176: 00,3764           03751        TCSLEEP            GENADR   TCGETCAD   -2                         
061794,000177: 00,3765           03757        WAKECAD            GENADR   WAKER                                 
061795,000178: 

Page 1454

061797,000180:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
061798,000181: 
061799,000182:                                                                                                  #  WRITTEN BY D. EYLES
061800,000183:                                                                                                  #  MOD 1 BY KERNAN                                                         UTILITYM REV 17 11/18/67
061801,000184: 
061802,000185:                                                                                                  #  MOD 2 BY SCHULENBERG  (REMOVE RELINT)   SKIPPER REV 4 2/28/68
061803,000186: 
061804,000187:                                                                                                  #           THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
061805,000188:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
061806,000189: 
061807,000190:                                                                                                  #           GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
061808,000191: 
061809,000192:                                                                                                  #                                          I        CA     N-1             # OF QUANTITIES MINUS ONE.
061810,000193:                                                                                                  #                                          I +1     TC     GENTRAN         IN FIXED-FIXED.
061811,000194:                                                                                                  #                                          I +2     ADRES  L               STARTING ADRES OF DATA TO BE MOVED.
061812,000195:                                                                                                  #                                          I +3     ADRES  M               STARTING ADRES OF DUPLICATION BLOCK.
061813,000196:                                                                                                  #                                          I +4                            RETURNS HERE.
061814,000197: 
061815,000198:                                                                                                  #           GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
061816,000199: 
061817,000200:                                                                                                  #           A, L AND ITEMP1 ARE NOT PRESERVED.
061818,000201: 
061819,000202:    5475                                           BLOCK    02                                    
061820,000203:    4000                                           SETLOC   FFTAG4                                
061821,000204:    4000                                           BANK                                           
061822,000205: 
061823,000206:    5475     0061                                  EBANK=   ITEMP1                                
061824,000207: 
061825,000208:    5475                                           COUNT*   $$/TRAN                               
061826,000209: 
061827,000210:    5475           00004        GENTRAN            INHINT                                         
061828,000211:    5476           54061                           TS       ITEMP1                                #  SAVE N-1.
061829,000212:    5477           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
061830,000213:    5500           60000                           AD       0                                     #  ADRES (L + N - 1).
061831,000214:    5501           50000                           INDEX    A                                     
061832,000215:    5502           30000                           CA       0                                     #  C(ABOVE).
061833,000216:    5503           54001                           TS       L                                     #  SAVE DATA.
061834,000217:    5504           30061                           CA       ITEMP1                                
061835,000218:    5505           50002                           INDEX    Q                                     
061836,000219:    5506           60001                           AD       1                                     #  ADRES (M + N - 1).
061837,000220:    5507           50000                           INDEX    A                                     
061838,000221:    5510           22000                           LXCH     0                                     #  STUFF IT.
061839,000222:    5511           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
061840,000223:    5512           15476                           TCF      GENTRAN    +1                         
061841,000224:    5513           16710                           TCF      Q+2                                   #  RETURN TO CALLER.
061842,000225: 

Page 1455

061844,000227:                                                                                                  #  B5OFF   ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
061845,000228: 
061846,000229:                                                                                                  #           MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
061847,000230: 
061848,000231:    5514                                           COUNT*   $$/EXTVB                              
061849,000232: 
061850,000233:    5514           44706        B5OFF              CS       BIT5                                  
061851,000234:    5515           71044                           MASK     EXTVBACT                              
061852,000235:    5516           55044                           TS       EXTVBACT                              
061853,000236:    5517           05112                           TC       ENDOFJOB                              
061854,000237: 

Page 1456

061856,000239:                                                                                                  #  SUBROUTINES TO TURNOFF AND TURN ON TRACKER FAIL LIGHT.
061857,000240: 
061858,000241:    5520           00004        TRFAILOF           INHINT                                         
061859,000242:    5521           47704                           CS       OCT40200                              #  TURN OFF TRACKER LIGHT
061860,000243:    5522           71036                           MASK     DSPTAB     +11D                       
061861,000244:    5523           64674                           AD       BIT15                                 
061862,000245:    5524           55036                           TS       DSPTAB     +11D                       
061863,000246:    5525           41331                           CS       OPTMODES                              #  TO INSURE THAT OCDU FAIL WILL GO ON
061864,000247:    5526           74704                           MASK     BIT7                                  #  AGAIN IF IT WAS ON IN ADDITION TO
061865,000248:    5527           27331                           ADS      OPTMODES                              #  TRACKER FAIL.
061866,000249: 
061867,000250:    5530           00003        REQ                RELINT                                         
061868,000251:    5531           00002                           TC       Q                                     
061869,000252: 
061870,000253:    5532           00004        TRFAILON           INHINT                                         
061871,000254:    5533           41036                           CS       DSPTAB     +11D                       #  TURN ON
061872,000255:    5534           77704                           MASK     OCT40200                              
061873,000256:    5535           27036                           ADS      DSPTAB     +11D                       
061874,000257:    5536           15530                           TCF      REQ                                   

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