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.

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

Page 1449

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

Page 1450

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

Page 1451

061716,000110:    5464           00006                           EXTEND                                         
061717,000111:    5465           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
061718,000112:    5466           52062                           DXCH     ITEMP1                                
061719,000113:    5467           50061                           INDEX    ITEMP1                                
061720,000114:    5470           30074                           CA       FLAGWRD0                              
061721,000115:    5471           54001                           TS       L                                     #  CURRENT STATE
061722,000116:    5472           50062                           INDEX    ITEMP2                                
061723,000117:    5473           44674                           CS       BIT15                                 #  -(15 - BIT)
061724,000118:    5474           00002                           TC       Q                                     
061725,000119: 

Page 1452

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

Page 1453

061778,000172: 00,3762           05074                           TC       JOBWAKE                               
061779,000173: 
061780,000174: 00,3763           05213                           TC       TASKOVER                              
061781,000175: 
061782,000176: 00,3764           03751        TCSLEEP            GENADR   TCGETCAD   -2                         
061783,000177: 00,3765           03757        WAKECAD            GENADR   WAKER                                 
061784,000178: 

Page 1454

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

Page 1455

061833,000227:                                                                                                  #  B5OFF   ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
061834,000228: 
061835,000229:                                                                                                  #           MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
061836,000230: 
061837,000231:    5514                                           COUNT*   $$/EXTVB                              
061838,000232: 
061839,000233:    5514           44706        B5OFF              CS       BIT5                                  
061840,000234:    5515           71044                           MASK     EXTVBACT                              
061841,000235:    5516           55044                           TS       EXTVBACT                              
061842,000236:    5517           05112                           TC       ENDOFJOB                              
061843,000237: 

Page 1456

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

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