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.

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

Page 1378

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

Page 1379

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

Page 1380

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

Page 1381

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

Page 1382

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

Page 1383

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

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