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.

058577,000002:                                                                                                  ## Copyright:   Public domain.
058578,000003:                                                                                                  ## Filename:    RESTARTS_ROUTINE.agc
058579,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus build 237.
058580,000005:                                                                                                  ##              This is for the Command Module's (CM) Apollo Guidance
058581,000006:                                                                                                  ##              Computer (AGC), for Apollo 8.
058582,000007:                                                                                                  ## Assembler:   yaYUL
058583,000008:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
058584,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058585,000010:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Colossus237/
058586,000011:                                                                                                  ## Mod history: 2011-04-17 JL   Adapted from corresponding Colossus 249 file.
058587,000012:                                                                                                  ##              2017-01-01 RSB  Proofed comment text using octopus/ProoferComments,
058588,000013:                                                                                                  ##                              and fixed errors found.
058589,000014:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes noted in proofing Luminary 116.
058590,000015: 

Page 1378

058592,000017: 01,3520                                           BANK     01                                    
058593,000018: 01,2000                                           SETLOC   RESTART                               
058594,000019: 01,2000                                           BANK                                           
058595,000020: 
058596,000021: 01,3520  E3,1436                                  EBANK=   PHSNAME1                              #  GOPROG MUST SWITCH TO THIS EBANK
058597,000022: 
058598,000023: 01,3520                                           COUNT    01/RSROU                              
058599,000024: 
058600,000025: 01,3520           30161        RESTARTS           CA       MPAC       +5                         #  GET GROUP NUMBER -1
058601,000026: 01,3521           60000                           DOUBLE                                         #  SAVE FOR INDEXING
058602,000027: 01,3522           54155                           TS       TEMP2G                                
058603,000028: 
058604,000029: 01,3523           33762                           CA       PHS2CADR                              #  SET UP EXIT IN CASE IT IS AN EVEN
058605,000030: 01,3524           54157                           TS       TEMPSWCH                              #  TABLE PHASE
058606,000031: 
058607,000032: 01,3525           33557                           CA       RTRNCADR                              #  TO SAVE TIME ASSUME IT WILL GET NEXT
058608,000033: 01,3526           54707                           TS       GOLOC      +2                         #  GROUP AFTER THIS
058609,000034: 
058610,000035: 01,3527           30154                           CA       TEMPPHS                               
058611,000036: 01,3530           74744                           MASK     OCT1400                               
058612,000037: 01,3531           10000                           CCS      A                                     #  IS IT A VARIABLE OR TABLE RESTART
058613,000038: 01,3532           13543                           TCF      ITSAVAR                               #  IT:S A VARIABLE RESTART
058614,000039: 
058615,000040: 01,3533           10154        GETPART2           CCS      TEMPPHS                               #  IS IT AN X.1 RESTART
058616,000041: 01,3534           10000                           CCS      A                                     
058617,000042: 01,3535           13643                           TCF      ITSATBL                               #  NO, ITS A TABLE RESTART
058618,000043: 
058619,000044: 01,3536           34761                           CA       PRIO14                                #  IT IS AN X.1 RESTART, THEREFORE START
058620,000045: 01,3537           05042                           TC       FINDVAC                               #  THE DISPLAY RESTART JOB
058621,000046: 01,3540  E3,1400                                  EBANK=   LST1                                  
058622,000047: 01,3540           03165 20103                     2CADR    INITDSP                               
058623,000048: 
058624,000049: 01,3542           03557                           TC       RTRNCADR                              #  FINISHED WITH THIS GROUP, GET NEXT ONE
058625,000050: 
058626,000051: 01,3543           74744        ITSAVAR            MASK     OCT1400                               #  IS IT TYPE B ?
058627,000052: 01,3544           10000                           CCS      A                                     
058628,000053: 01,3545           13614                           TCF      ITSLIKEB                              #  YES,IT IS TYPE B
058629,000054: 
058630,000055: 01,3546           00006                           EXTEND                                         #  STORE THE JOB (OR TASK) 2CADR FOR EXIT
058631,000056: 01,3547           50155                           NDX      TEMP2G                                
058632,000057: 01,3550           31437                           DCA      PHSNAME1                              
058633,000058: 01,3551           52706                           DXCH     GOLOC                                 
058634,000059: 
058635,000060: 01,3552           30154                           CA       TEMPPHS                               #  SEE IF THIS IS A JOB, TASK, OR A LONGCAL
058636,000061: 01,3553           74716                           MASK     OCT7                                  
058637,000062: 01,3554           67715                           AD       MINUS2                                
058638,000063: 01,3555           10000                           CCS      A                                     
058639,000064: 01,3556           13726                           TCF      ITSLNGCL                              #  ITS A LONGCALL
058640,000065: 

Page 1379

058642,000067: 01,3557           04570        RTRNCADR           TC       SWRETURN                              #  CANT GET HERE
058643,000068: 01,3560           13562                           TCF      ITSAWAIT                              
058644,000069: 
058645,000070: 01,3561           13627                           TCF      ITSAJOB                               #  ITS A JOB
058646,000071: 
058647,000072: 01,3562           33766        ITSAWAIT           CA       WTLTCADR                              #  SET UP WAITLIST CALL
058648,000073: 01,3563           54704                           TS       GOLOC      -1                         
058649,000074: 
058650,000075: 01,3564           50155                           NDX      TEMP2G                                #  DIRECTLY STORED
058651,000076: 01,3565           31054                           CA       PHSPRDT1                              
058652,000077: 01,3566           10000        TIMETEST           CCS      A                                     #  IS IT AN IMMEDIATE RESTART
058653,000078: 01,3567           24000                           INCR     A                                     #  NO,
058654,000079: 01,3570           13573                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
058655,000080: 
058656,000081: 01,3571           15367                           TCF      ITSINDIR                              #  STORED INDIRECTLY
058657,000082: 
058658,000083: 01,3572           13612                           TCF      IMEDIATE                              #  IT WANTS AN IMMEDIATE RESTART
058659,000084: 
058660,000085:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
058661,000086: 
058662,000087:    5367                                           BLOCK    02                                    
058663,000088:    4000                                           SETLOC   FFTAG2                                
058664,000089:    4000                                           BANK                                           
058665,000090: 
058666,000091:    5367                                           COUNT    02/RSROU                              
058667,000092: 
058668,000093:    5367           22706        ITSINDIR           LXCH     GOLOC      +1                         #  GET THE CORRECT E BANK IN CASE THIS IS
058669,000094:    5370           22006                           LXCH     BB                                    #  SWITCHED ERRASIBLE
058670,000095: 
058671,000096:    5371           50000                           NDX      A                                     #  GET THE TIME INDIRECTLY
058672,000097:    5372           30001                           CA       1                                     
058673,000098: 
058674,000099:    5373           22006                           LXCH     BB                                    #  RESTORE THE BB AND GOLOC
058675,000100:    5374           22706                           LXCH     GOLOC      +1                         
058676,000101: 
058677,000102:    5375           13573                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
058678,000103: 
058679,000104:                                                                                                  #  ***** YOU MAY RETURN TO SWITCHED FIXED *****
058680,000105: 
058681,000106: 01,3573                                           BANK     01                                    
058682,000107: 01,2000                                           SETLOC   RESTART                               
058683,000108: 01,2000                                           BANK                                           
058684,000109: 
058685,000110: 01,3573                                           COUNT    01/RSROU                              
058686,000111: 
058687,000112: 01,3573           40000        FINDTIME           COM                                            #  MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
058688,000113: 01,3574           54001                           TS       L                                     #  AND SAVE
058689,000114: 01,3575           50155                           NDX      TEMP2G                                
058690,000115: 01,3576           41053                           CS       TBASE1                                
058691,000116: 01,3577           00006                           EXTEND                                         

Page 1380

058693,000118: 01,3600           60025                           SU       TIME1                                 
058694,000119: 01,3601           10000                           CCS      A                                     
058695,000120: 01,3602           40000                           COM                                            
058696,000121: 01,3603           67700                           AD       OCT37776                              
058697,000122: 01,3604           64712                           AD       ONE                                   
058698,000123: 01,3605           60001                           AD       L                                     
058699,000124: 01,3606           10000                           CCS      A                                     
058700,000125: 01,3607           34714                           CA       ZERO                                  
058701,000126: 01,3610           13612                           TCF      +2                                    
058702,000127: 01,3611           13612                           TCF      +1                                    
058703,000128: 01,3612           64712        IMEDIATE           AD       ONE                                   
058704,000129: 01,3613           00704                           TC       GOLOC      -1                         
058705,000130: 01,3614           33557        ITSLIKEB           CA       RTRNCADR                              #  TYPE B,             SO STORE RETURN IN
058706,000131: 01,3615           54157                           TS       TEMPSWCH                              #  TEMPSWCH IN CASE OF AN EVEN PHASE
058707,000132: 
058708,000133: 01,3616           33763                           CA       PRT2CADR                              #  SET UP EXIT TO GET TABLE PART OF THIS
058709,000134: 01,3617           54707                           TS       GOLOC      +2                         #  VARIABLE TYPE OF PHASE
058710,000135: 
058711,000136: 01,3620           30154                           CA       TEMPPHS                               #  MAKE THE PHASE LOOK RIGHT FOR THE TABLE
058712,000137: 01,3621           76043                           MASK     OCT177                                #  PART OF THIS VARIABLE PHASE
058713,000138: 01,3622           54154                           TS       TEMPPHS                               
058714,000139: 
058715,000140: 01,3623           00006                           EXTEND                                         
058716,000141: 01,3624           50155                           NDX      TEMP2G                                #  OBTAIN THE JOB:S 2CADR
058717,000142: 01,3625           31437                           DCA      PHSNAME1                              
058718,000143: 01,3626           52706                           DXCH     GOLOC                                 
058719,000144: 
058720,000145: 01,3627           50155        ITSAJOB            NDX      TEMP2G                                #  NOW ADD THE PRIORITY AND LET:S GO
058721,000146: 01,3630           31054                           CA       PHSPRDT1                              
058722,000147: 01,3631           54704        CHKNOVAC           TS       GOLOC      -1                         #  SAVE PRIO UNTIL WE SEE IF ITS
058723,000148: 01,3632           00006                           EXTEND                                         #  A FINDVAC OR A NOVAC
058724,000149: 01,3633           63637                           BZMF     ITSNOVAC                              
058725,000150: 
058726,000151: 01,3634           33765                           CAF      FVACCADR                              #  POSITIVE, SET UP FINDVAC CALL.
058727,000152: 01,3635           56704                           XCH      GOLOC      -1                         #  PICK UP PRIO,
058728,000153: 01,3636           00704                           TC       GOLOC      -1                         #  AND GO
058729,000154: 
058730,000155: 01,3637           33767        ITSNOVAC           CAF      NOVACADR                              #  NEGATIVE,
058731,000156: 01,3640           56704                           XCH      GOLOC      -1                         #  SET UP NOVAC CALL,
058732,000157: 01,3641           40000                           COM                                            #  CORRECT PRIO,
058733,000158: 01,3642           00704                           TC       GOLOC      -1                         #  AND GO
058734,000159: 
058735,000160: 01,3643           54020        ITSATBL            TS       CYR                                   #  FIND OUT IF THE PHASE IS ODD OR EVEN
058736,000161: 01,3644           10020                           CCS      CYR                                   
058737,000162: 01,3645           13646                           TCF      +1                                    #  IT:S EVEN
058738,000163: 01,3646           13744                           TCF      ITSEVEN                               
058739,000164: 
058740,000165: 01,3647           33557                           CA       RTRNCADR                              #  IN CASE THIS IS THE SECOND PART OF A
058741,000166: 01,3650           54707                           TS       GOLOC      +2                         #  TYPE B RESTART, WE NEED PROPER EXIT
058742,000167: 

Page 1381

058744,000169: 01,3651           30154                           CA       TEMPPHS                               #  SET UP POINTER FOR FINDING OUR PLACE IN
058745,000170: 01,3652           54021                           TS       SR                                    #  THE RESTART TABLES
058746,000171: 01,3653           60021                           AD       SR                                    
058747,000172: 01,3654           50155                           NDX      TEMP2G                                
058748,000173: 01,3655           62001                           AD       SIZETAB    +1                         
058749,000174: 01,3656           54156                           TS       POINTER                               
058750,000175: 
058751,000176: 01,3657           00006        CONTBL2            EXTEND                                         #  FIND OUT WHAT:S IN THE TABLE
058752,000177: 01,3660           50156                           NDX      POINTER                               
058753,000178: 01,3661           32002                           DCA      CADRTAB                               #  GET THE 2CADR
058754,000179: 
058755,000180: 01,3662           22706                           LXCH     GOLOC      +1                         #  STORE THE BB INFORMATION
058756,000181: 
058757,000182: 01,3663           10000                           CCS      A                                     #  IS IT A JOB OR IS IT  TIMED
058758,000183: 01,3664           24000                           INCR     A                                     #  POSITIVE, MUST BE A JOB
058759,000184: 01,3665           13740                           TCF      ITSAJOB2                              
058760,000185: 
058761,000186: 01,3666           24000                           INCR     A                                     #  MUST BE EITHER A WAITLIST OR LONGCALL
058762,000187: 01,3667           54705                           TS       GOLOC                                 #  LET-S STORE THE CORRECT CADR
058763,000188: 
058764,000189: 01,3670           33766                           CA       WTLTCADR                              #  SET UP OUR EXIT TO WAITLIST
058765,000190: 01,3671           54704                           TS       GOLOC      -1                         
058766,000191: 
058767,000192: 01,3672           30706                           CA       GOLOC      +1                         #  NOW FIND OUT IF IT IS A WAITLIST CALL
058768,000193: 01,3673           74701                           MASK     BIT10                                 #  THIS SHOULD BE ONE IF WE HAVE -BB
058769,000194: 01,3674           10000                           CCS      A                                     #  FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
058770,000195:                                                                                                  #                                          6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
058771,000196:                                                                                                  #                                          IN IMPORTANCE ANYWAY. BIT 4
058772,000197: 01,3675           13733                           TCF      ITSWTLST                              #  IT IS A WAITLIST CALL
058773,000198: 
058774,000199: 01,3676           50156                           NDX      POINTER                               #  OBTAIN THE ORIGINAL DELTA T
058775,000200: 01,3677           32000                           CA       PRDTTAB                               #  ADDRESS FOR THIS LONGCALL
058776,000201: 
058777,000202: 01,3700           15376                           TCF      ITSLGCL1                              #  NOW GO GET THE DELTA TIME
058778,000203: 
058779,000204:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
058780,000205: 
058781,000206:    5376                                           BLOCK    02                                    
058782,000207:    4000                                           SETLOC   FFTAG2                                
058783,000208:    4000                                           BANK                                           
058784,000209: 
058785,000210:    5376                                           COUNT    02/RSROU                              
058786,000211: 
058787,000212:    5376           22706        ITSLGCL1           LXCH     GOLOC      +1                         #  OBTAIN THE CORRECT E BANK
058788,000213:    5377           22006                           LXCH     BB                                    
058789,000214:    5400           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR E AND F BANKS
058790,000215: 
058791,000216:    5401           00006                           EXTEND                                         #  GET THE DELTA TIME
058792,000217:    5402           50000                           NDX      A                                     
058793,000218:    5403           30001                           DCA      0                                     

Page 1382

058795,000220:    5404           22706                           LXCH     GOLOC      +1                         #  RESTORE OUR E AND F BANK
058796,000221:    5405           22006                           LXCH     BB                                    #  RESTORE THE TASKS E AND F BANKS
058797,000222:    5406           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR L
058798,000223: 
058799,000224:    5407           13701                           TCF      ITSLGCL2                              #  NOW LET:S PROCESS THIS LONGCALL
058800,000225: 
058801,000226:                                                                                                  #  ***** YOU  MAY RETURN TO  SWITCHED FIXED *****
058802,000227: 
058803,000228: 01,3701                                           BANK     01                                    
058804,000229: 01,2000                                           SETLOC   RESTART                               
058805,000230: 01,2000                                           BANK                                           
058806,000231: 
058807,000232: 01,3701                                           COUNT    01/RSROU                              
058808,000233: 
058809,000234: 01,3701           53140        ITSLGCL2           DXCH     LONGTIME                              
058810,000235: 
058811,000236: 01,3702           00006                           EXTEND                                         #  CALCULATE TIME LEFT
058812,000237: 01,3703           40025                           DCS      TIME2                                 
058813,000238: 01,3704           21140                           DAS      LONGTIME                              
058814,000239: 01,3705           00006                           EXTEND                                         
058815,000240: 01,3706           31136                           DCA      LONGBASE                              
058816,000241: 01,3707           21140                           DAS      LONGTIME                              
058817,000242: 
058818,000243: 01,3710           11137                           CCS      LONGTIME                              #  FIND OUT HOW THIS SHOULD BE RESTARTED
058819,000244: 01,3711           13721                           TCF      LONGCLCL                              
058820,000245: 01,3712           13714                           TCF      +2                                    
058821,000246: 01,3713           13607                           TCF      IMEDIATE   -3                         
058822,000247: 01,3714           11140                           CCS      LONGTIME   +1                         
058823,000248: 01,3715           13721                           TCF      LONGCLCL                              
058824,000249: 01,3716           13717                           NOOP                                           #  CAN:T GET HERE    *********
058825,000250: 01,3717           13607                           TCF      IMEDIATE   -3                         
058826,000251: 01,3720           13612                           TCF      IMEDIATE                              
058827,000252: 
058828,000253: 01,3721           33764        LONGCLCL           CA       LGCLCADR                              #  WE WILL GO TO LONGCALL
058829,000254: 01,3722           54704                           TS       GOLOC      -1                         
058830,000255: 
058831,000256: 01,3723           00006                           EXTEND                                         #  PREPARE OUR ENTRY TO LONGCALL
058832,000257: 01,3724           31140                           DCA      LONGTIME                              
058833,000258: 01,3725           00704                           TC       GOLOC      -1                         
058834,000259: 
058835,000260: 01,3726           33766        ITSLNGCL           CA       WTLTCADR                              #  ASSUME IT WILL GO TO WAITLIST
058836,000261: 01,3727           54704                           TS       GOLOC      -1                         
058837,000262: 
058838,000263: 01,3730           50155                           NDX      TEMP2G                                
058839,000264: 01,3731           41054                           CS       PHSPRDT1                              #  GET THE DELTA T ADDRESS
058840,000265: 
058841,000266: 01,3732           15376                           TCF      ITSLGCL1                              #  NOW GET THE DELTA TIME
058842,000267: 
058843,000268: 01,3733           40706        ITSWTLST           CS       GOLOC      +1                         #  CORRECT THE BBCON INFORMATION
058844,000269: 01,3734           54706                           TS       GOLOC      +1                         

Page 1383

058846,000271: 01,3735           50156                           NDX      POINTER                               #  GET THE DT AND FIND OUT IF IT WAS STORED
058847,000272: 01,3736           32000                           CA       PRDTTAB                               #  DIRECTLY OR INDIRECTLY
058848,000273: 
058849,000274: 01,3737           13566                           TCF      TIMETEST                              #  FIND OUT HOW THE TIME IS STORED
058850,000275: 
058851,000276: 01,3740           56705        ITSAJOB2           XCH      GOLOC                                 #  STORE THE CADR
058852,000277: 
058853,000278: 01,3741           50156                           NDX      POINTER                               #  ADD THE PRIORITY AND LET:S GO
058854,000279: 01,3742           32000                           CA       PRDTTAB                               
058855,000280: 
058856,000281: 01,3743           13631                           TCF      CHKNOVAC                              
058857,000282: 
058858,000283: 01,3744           30157        ITSEVEN            CA       TEMPSWCH                              #  SET UP FOR EITHER THE SECOND PART OF THE
058859,000284: 01,3745           54707                           TS       GOLOC      +2                         #  TABLE, OR A RETURN FOR THE NEXT GROUP
058860,000285: 
058861,000286: 01,3746           50155                           NDX      TEMP2G                                #  SET UP POINTER FOR OUR LOCATION WITHIN
058862,000287: 01,3747           32000                           CA       SIZETAB                               #  THE TABLE
058863,000288: 01,3750           60154                           AD       TEMPPHS                               #  THIS MAY LOOK BAD BUT LET:S SEE YOU DO
058864,000289: 01,3751           60154                           AD       TEMPPHS                               #  BETTER IN TIME OR NUMBERR OF LOCATIONS
058865,000290: 01,3752           60154                           AD       TEMPPHS                               
058866,000291: 01,3753           54156                           TS       POINTER                               
058867,000292: 
058868,000293: 01,3754           13657                           TCF      CONTBL2                               #  NOW PROCESS WHAT IS IN THE TABLE
058869,000294: 
058870,000295: 01,3755           36214        PHSPART2           CA       THREE                                 #  SET THE POINTER FOR THE SECOND HALF OF
058871,000296: 01,3756           26156                           ADS      POINTER                               #  THE TABLE
058872,000297: 
058873,000298: 01,3757           33557                           CA       RTRNCADR                              #  THIS WILL BE OUR LAST TIME THROUGH THE
058874,000299: 01,3760           54707                           TS       GOLOC      +2                         #  EVEN TABLE , SO AFTER IT  GET THE NEXT
058875,000300:                                                                                                  #  GROUP
058876,000301: 01,3761           13657                           TCF      CONTBL2                               #  SO LET:S GET THE SECOND ENTRY IN THE TBL
058877,000302: 
058878,000303: 01,3762     0154               TEMPPHS            EQUALS   MPAC                                  
058879,000304: 01,3762     0155               TEMP2G             EQUALS   MPAC       +1                         
058880,000305: 01,3762     0156               POINTER            EQUALS   MPAC       +2                         
058881,000306: 01,3762     0157               TEMPSWCH           EQUALS   MPAC       +3                         
058882,000307: 01,3762     0705               GOLOC              EQUALS   VAC5       +20D                       
058883,000308: 01,3762     7715               MINUS2             EQUALS   NEG2                                  
058884,000309: 01,3762     6043               OCT177             EQUALS   LOW7                                  
058885,000310: 
058886,000311: 
058887,000312: 01,3762           03755        PHS2CADR           GENADR   PHSPART2                              
058888,000313: 01,3763           03533        PRT2CADR           GENADR   GETPART2                              
058889,000314: 01,3764           05231        LGCLCADR           GENADR   LONGCALL                              
058890,000315: 01,3765           05042        FVACCADR           GENADR   FINDVAC                               
058891,000316: 01,3766           05140        WTLTCADR           GENADR   WAITLIST                              
058892,000317: 01,3767           05027        NOVACADR           GENADR   NOVAC                                 

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