Source Code

These source-code files are part of a reconstructed copy of Comanche 67, the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 12.

They have been adapted from sources files for Comanche 55, and updated via disassembly of binary dumps of original core rope memory modules, part numbers 2003972-1081, 2003972-1091, 2003972-1111, 2003972-1121, 2003972-1131, and 2003972-1141.

Since only binary dumps (rather than listings) of Comanche 67 are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

058606,000002:                                                                                                  ## Copyright:   Public domain.
058607,000003:                                                                                                  ## Filename:    RESTARTS_ROUTINE.agc
058608,000004:                                                                                                  ## Purpose:     A section of Comanche revision 067.
058609,000005:                                                                                                  ##              It is part of the reconstructed source code for the flight
058610,000006:                                                                                                  ##              software for the Command Module's (CM) Apollo Guidance Computer
058611,000007:                                                                                                  ##              (AGC) for Apollo 12. No original listings of this program are
058612,000008:                                                                                                  ##              available; instead, this file was created via dissassembly of
058613,000009:                                                                                                  ##              dumps of Comanche 067 core rope modules and comparison with
058614,000010:                                                                                                  ##              other AGC programs.
058615,000011:                                                                                                  ## Assembler:   yaYUL
058616,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058617,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058618,000014:                                                                                                  ## Mod history: 2023-08-16 MAS  Created from Comanche 055.
058619,000015: 
058620,000016: 01,3520                                           BANK     01                                    
058621,000017: 01,2000                                           SETLOC   RESTART                               
058622,000018: 01,2000                                           BANK                                           
058623,000019: 
058624,000020: 01,3520  E3,1436                                  EBANK=   PHSNAME1                              #  GOPROG MUST SWITCH TO THIS EBANK
058625,000021: 
058626,000022: 01,3520                                           COUNT    01/RSROU                              
058627,000023: 
058628,000024: 01,3520           30161        RESTARTS           CA       MPAC       +5                         #  GET GROUP NUMBER -1
058629,000025: 01,3521           60000                           DOUBLE                                         #  SAVE FOR INDEXING
058630,000026: 01,3522           54155                           TS       TEMP2G                                
058631,000027: 
058632,000028: 01,3523           33762                           CA       PHS2CADR                              #  SET UP EXIT IN CASE IT IS AN EVEN
058633,000029: 01,3524           54157                           TS       TEMPSWCH                              #  TABLE PHASE
058634,000030: 
058635,000031: 01,3525           33557                           CA       RTRNCADR                              #  TO SAVE TIME ASSUME IT WILL GET NEXT
058636,000032: 01,3526           54707                           TS       GOLOC      +2                         #  GROUP AFTER THIS
058637,000033: 
058638,000034: 01,3527           30154                           CA       TEMPPHS                               
058639,000035: 01,3530           75065                           MASK     OCT1400                               
058640,000036: 01,3531           10000                           CCS      A                                     #  IS IT A VARIABLE OR TABLE RESTART
058641,000037: 01,3532           13543                           TCF      ITSAVAR                               #  IT:S A VARIABLE RESTART
058642,000038: 
058643,000039: 01,3533           10154        GETPART2           CCS      TEMPPHS                               #  IS IT AN X.1 RESTART
058644,000040: 01,3534           10000                           CCS      A                                     
058645,000041: 01,3535           13643                           TCF      ITSATBL                               #  NO, ITS A TABLE RESTART
058646,000042: 
058647,000043: 01,3536           35102                           CA       PRIO14                                #  IT IS AN X.1 RESTART, THEREFORE START
058648,000044: 01,3537           05163                           TC       FINDVAC                               #  THE DISPLAY RESTART JOB
058649,000045: 01,3540  E3,1400                                  EBANK=   LST1                                  
058650,000046: 01,3540           03261 20063                     2CADR    INITDSP                               
058651,000047: 
058652,000048: 01,3542           03557                           TC       RTRNCADR                              #  FINISHED WITH THIS GROUP, GET NEXT ONE
058653,000049: 
058654,000050: 01,3543           75065        ITSAVAR            MASK     OCT1400                               #  IS IT TYPE B ?
058655,000051: 01,3544           10000                           CCS      A                                     
058656,000052: 01,3545           13614                           TCF      ITSLIKEB                              #  YES, IT IS TYPE B
058657,000053: 
058658,000054: 01,3546           00006                           EXTEND                                         #  STORE THE JOB (OR TASK) 2CADR FOR EXIT
058659,000055: 01,3547           50155                           NDX      TEMP2G                                
058660,000056: 01,3550           31437                           DCA      PHSNAME1                              
058661,000057: 01,3551           52706                           DXCH     GOLOC                                 
058662,000058: 
058663,000059: 01,3552           30154                           CA       TEMPPHS                               #  SEE IF THIS IS A JOB, TASK, OR A LONGCAL
058664,000060: 01,3553           75037                           MASK     OCT7                                  
058665,000061: 01,3554           67715                           AD       MINUS2                                
058666,000062: 01,3555           10000                           CCS      A                                     
058667,000063: 01,3556           13726                           TCF      ITSLNGCL                              #  ITS A LONGCALL
058668,000064: 
058669,000065: 01,3557           04711        RTRNCADR           TC       SWRETURN                              #  CANT GET HERE
058670,000066: 01,3560           13562                           TCF      ITSAWAIT                              
058671,000067: 
058672,000068: 01,3561           13627                           TCF      ITSAJOB                               #  ITS A JOB
058673,000069: 
058674,000070: 01,3562           33766        ITSAWAIT           CA       WTLTCADR                              #  SET UP WAITLIST CALL
058675,000071: 01,3563           54704                           TS       GOLOC      -1                         
058676,000072: 
058677,000073: 01,3564           50155                           NDX      TEMP2G                                #  DIRECTLY STORED
058678,000074: 01,3565           31054                           CA       PHSPRDT1                              
058679,000075: 01,3566           10000        TIMETEST           CCS      A                                     #  IS IT AN IMMEDIATE RESTART
058680,000076: 01,3567           24000                           INCR     A                                     #  NO,
058681,000077: 01,3570           13573                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
058682,000078: 
058683,000079: 01,3571           15514                           TCF      ITSINDIR                              #  STORED INDIRECTLY
058684,000080: 
058685,000081: 01,3572           13612                           TCF      IMEDIATE                              #  IT WANTS AN IMMEDIATE RESTART
058686,000082: 
058687,000083:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
058688,000084: 
058689,000085:    5514                                           BLOCK    02                                    
058690,000086:    4000                                           SETLOC   FFTAG2                                
058691,000087:    4000                                           BANK                                           
058692,000088: 
058693,000089:    5514                                           COUNT    02/RSROU                              
058694,000090: 
058695,000091:    5514           22706        ITSINDIR           LXCH     GOLOC      +1                         #  GET THE CORRECT E BANK IN CASE THIS IS
058696,000092:    5515           22006                           LXCH     BB                                    #  SWITCHED ERRASIBLE
058697,000093: 
058698,000094:    5516           50000                           NDX      A                                     #  GET THE TIME INDIRECTLY
058699,000095:    5517           30001                           CA       1                                     
058700,000096: 
058701,000097:    5520           22006                           LXCH     BB                                    #  RESTORE THE BB AND GOLOC
058702,000098:    5521           22706                           LXCH     GOLOC      +1                         
058703,000099: 
058704,000100:    5522           13573                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
058705,000101: 
058706,000102:                                                                                                  #  ***** YOU MAY RETURN TO SWITCHED FIXED *****
058707,000103: 
058708,000104: 01,3573                                           BANK     01                                    
058709,000105: 01,2000                                           SETLOC   RESTART                               
058710,000106: 01,2000                                           BANK                                           
058711,000107: 
058712,000108: 01,3573                                           COUNT    01/RSROU                              
058713,000109: 
058714,000110: 01,3573           40000        FINDTIME           COM                                            #  MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
058715,000111: 01,3574           54001                           TS       L                                     #  AND SAVE
058716,000112: 01,3575           50155                           NDX      TEMP2G                                
058717,000113: 01,3576           41053                           CS       TBASE1                                
058718,000114: 01,3577           00006                           EXTEND                                         
058719,000115: 01,3600           60025                           SU       TIME1                                 
058720,000116: 01,3601           10000                           CCS      A                                     
058721,000117: 01,3602           40000                           COM                                            
058722,000118: 01,3603           67700                           AD       OCT37776                              
058723,000119: 01,3604           65033                           AD       ONE                                   
058724,000120: 01,3605           60001                           AD       L                                     
058725,000121: 01,3606           10000                           CCS      A                                     
058726,000122: 01,3607           35035                           CA       ZERO                                  
058727,000123: 01,3610           13612                           TCF      +2                                    
058728,000124: 01,3611           13612                           TCF      +1                                    
058729,000125: 01,3612           65033        IMEDIATE           AD       ONE                                   
058730,000126: 01,3613           00704                           TC       GOLOC      -1                         
058731,000127: 01,3614           33557        ITSLIKEB           CA       RTRNCADR                              #  TYPE B, SO STORE RETURN IN
058732,000128: 01,3615           54157                           TS       TEMPSWCH                              #  TEMPSWCH IN CASE OF AN EVEN PHASE
058733,000129: 
058734,000130: 01,3616           33763                           CA       PRT2CADR                              #  SET UP EXIT TO GET TABLE PART OF THIS
058735,000131: 01,3617           54707                           TS       GOLOC      +2                         #  VARIABLE TYPE OF PHASE
058736,000132: 
058737,000133: 01,3620           30154                           CA       TEMPPHS                               #  MAKE THE PHASE LOOK RIGHT FOR THE TABLE
058738,000134: 01,3621           76043                           MASK     OCT177                                #  PART OF THIS VARIABLE PHASE
058739,000135: 01,3622           54154                           TS       TEMPPHS                               
058740,000136: 
058741,000137: 01,3623           00006                           EXTEND                                         
058742,000138: 01,3624           50155                           NDX      TEMP2G                                #  OBTAIN THE JOB:S 2CADR
058743,000139: 01,3625           31437                           DCA      PHSNAME1                              
058744,000140: 01,3626           52706                           DXCH     GOLOC                                 
058745,000141: 
058746,000142: 01,3627           50155        ITSAJOB            NDX      TEMP2G                                #  NOW ADD THE PRIORITY AND LET:S GO
058747,000143: 01,3630           31054                           CA       PHSPRDT1                              
058748,000144: 01,3631           54704        CHKNOVAC           TS       GOLOC      -1                         #  SAVE PRIO UNTIL WE SEE IF ITS
058749,000145: 01,3632           00006                           EXTEND                                         #  A FINDVAC OR A NOVAC
058750,000146: 01,3633           63637                           BZMF     ITSNOVAC                              
058751,000147: 
058752,000148: 01,3634           33765                           CAF      FVACCADR                              #  POSITIVE, SET UP FINDVAC CALL.
058753,000149: 01,3635           56704                           XCH      GOLOC      -1                         #  PICK UP PRIO,
058754,000150: 01,3636           00704                           TC       GOLOC      -1                         #  AND GO
058755,000151: 
058756,000152: 01,3637           33767        ITSNOVAC           CAF      NOVACADR                              #  NEGATIVE,
058757,000153: 01,3640           56704                           XCH      GOLOC      -1                         #  SET UP NOVAC CALL,
058758,000154: 01,3641           40000                           COM                                            #  CORRECT PRIO,
058759,000155: 01,3642           00704                           TC       GOLOC      -1                         #  AND GO
058760,000156: 
058761,000157: 01,3643           54020        ITSATBL            TS       CYR                                   #  FIND OUT IF THE PHASE IS ODD OR EVEN
058762,000158: 01,3644           10020                           CCS      CYR                                   
058763,000159: 01,3645           13646                           TCF      +1                                    #  IT:S EVEN
058764,000160: 01,3646           13744                           TCF      ITSEVEN                               
058765,000161: 
058766,000162: 01,3647           33557                           CA       RTRNCADR                              #  IN CASE THIS IS THE SECOND PART OF A
058767,000163: 01,3650           54707                           TS       GOLOC      +2                         #  TYPE B RESTART, WE NEED PROPER EXIT
058768,000164: 01,3651           30154                           CA       TEMPPHS                               #  SET UP POINTER FOR FINDING OUR PLACE IN
058769,000165: 01,3652           54021                           TS       SR                                    #  THE RESTART TABLES
058770,000166: 01,3653           60021                           AD       SR                                    
058771,000167: 01,3654           50155                           NDX      TEMP2G                                
058772,000168: 01,3655           62001                           AD       SIZETAB    +1                         
058773,000169: 01,3656           54156                           TS       POINTER                               
058774,000170: 
058775,000171: 01,3657           00006        CONTBL2            EXTEND                                         #  FIND OUT WHAT:S IN THE TABLE
058776,000172: 01,3660           50156                           NDX      POINTER                               
058777,000173: 01,3661           32002                           DCA      CADRTAB                               #  GET THE 2CADR
058778,000174: 
058779,000175: 01,3662           22706                           LXCH     GOLOC      +1                         #  STORE THE BB INFORMATION
058780,000176: 
058781,000177: 01,3663           10000                           CCS      A                                     #  IS IT A JOB OR IS IT TIMED
058782,000178: 01,3664           24000                           INCR     A                                     #  POSITIVE, MUST BE A JOB
058783,000179: 01,3665           13740                           TCF      ITSAJOB2                              
058784,000180: 
058785,000181: 01,3666           24000                           INCR     A                                     #  MUST BE EITHER A WAITLIST OR LONGCALL
058786,000182: 01,3667           54705                           TS       GOLOC                                 #  LET-S STORE THE CORRECT CADR
058787,000183: 
058788,000184: 01,3670           33766                           CA       WTLTCADR                              #  SET UP OUR EXIT TO WAITLIST
058789,000185: 01,3671           54704                           TS       GOLOC      -1                         
058790,000186: 
058791,000187: 01,3672           30706                           CA       GOLOC      +1                         #  NOW FIND OUT IF IT IS A WAITLIST CALL
058792,000188: 01,3673           75022                           MASK     BIT10                                 #  THIS SHOULD BE ONE IF WE HAVE -BB
058793,000189: 01,3674           10000                           CCS      A                                     #  FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
058794,000190:                                                                                                  #  6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
058795,000191:                                                                                                  #  IN IMPORTANCE ANYWAY.  BIT 4
058796,000192: 01,3675           13733                           TCF      ITSWTLST                              #  IT IS A WAITLIST CALL
058797,000193: 
058798,000194: 01,3676           50156                           NDX      POINTER                               #  OBTAIN THE ORIGINAL DELTA T
058799,000195: 01,3677           32000                           CA       PRDTTAB                               #  ADDRESS FOR THIS LONGCALL
058800,000196: 
058801,000197: 01,3700           15523                           TCF      ITSLGCL1                              #  NOW GO GET THE DELTA TIME
058802,000198: 
058803,000199:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
058804,000200: 
058805,000201:    5523                                           BLOCK    02                                    
058806,000202:    4000                                           SETLOC   FFTAG2                                
058807,000203:    4000                                           BANK                                           
058808,000204: 
058809,000205:    5523                                           COUNT    02/RSROU                              
058810,000206: 
058811,000207:    5523           22706        ITSLGCL1           LXCH     GOLOC      +1                         #  OBTAIN THE CORRECT E BANK
058812,000208:    5524           22006                           LXCH     BB                                    
058813,000209:    5525           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR E AND F BANKS
058814,000210: 
058815,000211:    5526           00006                           EXTEND                                         #  GET THE DELTA TIME
058816,000212:    5527           50000                           NDX      A                                     
058817,000213:    5530           30001                           DCA      0                                     
058818,000214:    5531           22706                           LXCH     GOLOC      +1                         #  RESTORE OUR E AND F BANK
058819,000215:    5532           22006                           LXCH     BB                                    #  RESTORE THE TASKS E AND F BANKS
058820,000216:    5533           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR L
058821,000217:    5534           13701                           TCF      ITSLGCL2                              #  NOW LET:S PROCESS THIS LONGCALL
058822,000218: 
058823,000219:                                                                                                  #  ***** YOU MAY RETURN TO SWITCHED FIXED *****
058824,000220: 
058825,000221: 01,3701                                           BANK     01                                    
058826,000222: 01,2000                                           SETLOC   RESTART                               
058827,000223: 01,2000                                           BANK                                           
058828,000224: 
058829,000225: 01,3701                                           COUNT    01/RSROU                              
058830,000226: 01,3701           53140        ITSLGCL2           DXCH     LONGTIME                              
058831,000227: 
058832,000228: 01,3702           00006                           EXTEND                                         #  CALCULATE TIME LEFT
058833,000229: 01,3703           40025                           DCS      TIME2                                 
058834,000230: 01,3704           21140                           DAS      LONGTIME                              
058835,000231: 01,3705           00006                           EXTEND                                         
058836,000232: 01,3706           31136                           DCA      LONGBASE                              
058837,000233: 01,3707           21140                           DAS      LONGTIME                              
058838,000234: 
058839,000235: 01,3710           11137                           CCS      LONGTIME                              #  FIND OUT HOW THIS SHOULD BE RESTARTED
058840,000236: 01,3711           13721                           TCF      LONGCLCL                              
058841,000237: 01,3712           13714                           TCF      +2                                    
058842,000238: 01,3713           13607                           TCF      IMEDIATE   -3                         
058843,000239: 01,3714           11140                           CCS      LONGTIME   +1                         
058844,000240: 01,3715           13721                           TCF      LONGCLCL                              
058845,000241: 01,3716           13717                           NOOP                                           #  CAN:T GET HERE *********
058846,000242: 01,3717           13607                           TCF      IMEDIATE   -3                         
058847,000243: 01,3720           13612                           TCF      IMEDIATE                              
058848,000244: 
058849,000245: 01,3721           33764        LONGCLCL           CA       LGCLCADR                              #  WE WILL GO TO LONGCALL
058850,000246: 01,3722           54704                           TS       GOLOC      -1                         
058851,000247: 
058852,000248: 01,3723           00006                           EXTEND                                         #  PREPARE OUR ENTRY TO LONGCALL
058853,000249: 01,3724           31140                           DCA      LONGTIME                              
058854,000250: 01,3725           00704                           TC       GOLOC      -1                         
058855,000251: 
058856,000252: 01,3726           33766        ITSLNGCL           CA       WTLTCADR                              #  ASSUME IT WILL GO TO WAITLIST
058857,000253: 01,3727           54704                           TS       GOLOC      -1                         
058858,000254: 
058859,000255: 01,3730           50155                           NDX      TEMP2G                                
058860,000256: 01,3731           41054                           CS       PHSPRDT1                              #  GET THE DELTA T ADDRESS
058861,000257: 
058862,000258: 01,3732           15523                           TCF      ITSLGCL1                              #  NOW GET THE DELTA TIME
058863,000259: 
058864,000260: 01,3733           40706        ITSWTLST           CS       GOLOC      +1                         #  CORRECT THE BBCON INFORMATION
058865,000261: 01,3734           54706                           TS       GOLOC      +1                         
058866,000262: 01,3735           50156                           NDX      POINTER                               #  GET THE DT AND FIND OUT IF IT WAS STORED
058867,000263: 01,3736           32000                           CA       PRDTTAB                               #  DIRECTLY OR INDIRECTLY
058868,000264: 
058869,000265: 01,3737           13566                           TCF      TIMETEST                              #  FIND OUT HOW THE TIME IS STORED
058870,000266: 
058871,000267: 01,3740           56705        ITSAJOB2           XCH      GOLOC                                 #  STORE THE CADR
058872,000268: 
058873,000269: 01,3741           50156                           NDX      POINTER                               #  ADD THE PRIORITY AND LET:S GO
058874,000270: 01,3742           32000                           CA       PRDTTAB                               
058875,000271: 
058876,000272: 01,3743           13631                           TCF      CHKNOVAC                              
058877,000273: 
058878,000274: 01,3744           30157        ITSEVEN            CA       TEMPSWCH                              #  SET UP FOR EITHER THE SECOND PART OF THE
058879,000275: 01,3745           54707                           TS       GOLOC      +2                         #  TABLE, OR A RETURN FOR THE NEXT GROUP
058880,000276: 
058881,000277: 01,3746           50155                           NDX      TEMP2G                                #  SET UP POINTER FOR OUR LOCATION WITHIN
058882,000278: 01,3747           32000                           CA       SIZETAB                               #  THE TABLE
058883,000279: 01,3750           60154                           AD       TEMPPHS                               #  THIS MAY LOOK BAD BUT LET:S SEE YOU DO
058884,000280: 01,3751           60154                           AD       TEMPPHS                               #  BETTER IN TIME OR NUMBERR OF LOCATIONS
058885,000281: 01,3752           60154                           AD       TEMPPHS                               
058886,000282: 01,3753           54156                           TS       POINTER                               
058887,000283: 
058888,000284: 01,3754           13657                           TCF      CONTBL2                               #  NOW PROCESS WHAT IS IN THE TABLE
058889,000285: 
058890,000286: 01,3755           36214        PHSPART2           CA       THREE                                 #  SET THE POINTER FOR THE SECOND HALF OF
058891,000287: 01,3756           26156                           ADS      POINTER                               #  THE TABLE
058892,000288: 
058893,000289: 01,3757           33557                           CA       RTRNCADR                              #  THIS WILL BE OUR LAST TIME THROUGH THE
058894,000290: 01,3760           54707                           TS       GOLOC      +2                         #  EVEN TABLE, SO AFTER IT GET THE NEXT
058895,000291:                                                                                                  #  GROUP
058896,000292: 01,3761           13657                           TCF      CONTBL2                               #  SO LET:S GET THE SECOND ENTRY IN THE TBL
058897,000293: 
058898,000294: 01,3762     0154               TEMPPHS            EQUALS   MPAC                                  
058899,000295: 01,3762     0155               TEMP2G             EQUALS   MPAC       +1                         
058900,000296: 01,3762     0156               POINTER            EQUALS   MPAC       +2                         
058901,000297: 01,3762     0157               TEMPSWCH           EQUALS   MPAC       +3                         
058902,000298: 01,3762     0705               GOLOC              EQUALS   VAC5       +20D                       
058903,000299: 01,3762     7715               MINUS2             EQUALS   NEG2                                  
058904,000300: 01,3762     6043               OCT177             EQUALS   LOW7                                  
058905,000301: 
058906,000302: 01,3762           03755        PHS2CADR           GENADR   PHSPART2                              
058907,000303: 01,3763           03533        PRT2CADR           GENADR   GETPART2                              
058908,000304: 01,3764           05356        LGCLCADR           GENADR   LONGCALL                              
058909,000305: 01,3765           05163        FVACCADR           GENADR   FINDVAC                               
058910,000306: 01,3766           05261        WTLTCADR           GENADR   WAITLIST                              
058911,000307: 01,3767           05150        NOVACADR           GENADR   NOVAC                                 
058912,000308: 
058913,000309: 
058914,000310: 
058915,000311: 

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