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.

061501,000002:                                                                                                  ## Copyright:   Public domain.
061502,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
061503,000004:                                                                                                  ## Purpose:     A section of Comanche revision 067.
061504,000005:                                                                                                  ##              It is part of the reconstructed source code for the flight
061505,000006:                                                                                                  ##              software for the Command Module's (CM) Apollo Guidance Computer
061506,000007:                                                                                                  ##              (AGC) for Apollo 12. No original listings of this program are
061507,000008:                                                                                                  ##              available; instead, this file was created via dissassembly of
061508,000009:                                                                                                  ##              dumps of Comanche 067 core rope modules and comparison with
061509,000010:                                                                                                  ##              other AGC programs.
061510,000011:                                                                                                  ## Assembler:   yaYUL
061511,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
061512,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
061513,000014:                                                                                                  ## Mod history: 2023-08-16 MAS  Created from Comanche 055.
061514,000015:                                                                                                  ##              2024-03-15 MAS  Updated for Comanche 067.
061515,000016: 
061516,000017:    7722                                           BLOCK    3                                     
061517,000018:    6000                                           SETLOC   FFTAG6                                
061518,000019:    6000                                           BANK                                           
061519,000020:    7722                                           COUNT    03/FLAG                               
061520,000021: 
061521,000022:    7722           54001        UPENT2             TS       L                                     #  WHICH FLAGWORD IS IT
061522,000023:    7723           75037                           MASK     OCT7                                  
061523,000024:    7724           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
061524,000025: 
061525,000026:    7725           75735                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
061526,000027:    7726           00004                           INHINT                                         #  PREVENT INTERUPTS
061527,000028:    7727           54061                           TS       ITEMP1                                #  STORE THE BIT INFORMATION TEMPORARIALY
061528,000029: 
061529,000030:    7730           50001                           NDX      L                                     
061530,000031:    7731           40074                           CS       FLAGWRD0                              
061531,000032:    7732           70061                           MASK     ITEMP1                                
061532,000033:    7733           50001                           NDX      L                                     
061533,000034:    7734           26074                           ADS      FLAGWRD0                              
061534,000035:    7735           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
061535,000036: 
061536,000037:    7736           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
061537,000038:    7737           00002                           TC       Q                                     #  RETURN
061538,000039: 
061539,000040:    7740           54001        DOWNENT2           TS       L                                     #  WHICH FLAGWORD IS IT
061540,000041:    7741           75037                           MASK     OCT7                                  
061541,000042:    7742           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
061542,000043: 
061543,000044:    7743           75735                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
061544,000045:    7744           40000                           COM                                            #  START TO PROCESS THE INFORMATION
061545,000046: 
061546,000047:    7745           00004                           INHINT                                         #  PREVENT INTERUPTS
061547,000048:    7746           50001                           NDX      L                                     
061548,000049:    7747           70074                           MASK     FLAGWRD0                              
061549,000050:    7750           50001                           NDX      L                                     
061550,000051:    7751           54074                           TS       FLAGWRD0                              
061551,000052:    7752           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
061552,000053: 
061553,000054:    7753           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
061554,000055:    7754           00002                           TC       Q                                     #  RETURN
061555,000056: 
061556,000057:    7755     5037               OCT7               EQUALS   SEVEN                                 
061557,000058: 10,3766                                           BANK     10                                    
061558,000059: 
061559,000060:                                                                                                  #  UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.  USING THEM, WHETHER OR
061560,000061:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
061561,000062:                                                                                                  #  EBANK SETTING.  A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
061562,000063:                                                                                                  #  ASSEMBLER.
061563,000064: 
061564,000065:                                                                                                  #  AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.  ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
061565,000066:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
061566,000067: 
061567,000068:                                                                                                  #  CALLING SEQUENCES ARE AS FOLLOWS:-
061568,000069:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
061569,000070:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
061570,000071: 
061571,000072:                                                                                                  #  RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
061572,000073:                                                                                                  #  UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
061573,000074: 
061574,000075:    5562                                           BLOCK    02                                    
061575,000076:    4000                                           SETLOC   FFTAG1                                
061576,000077:    4000                                           BANK                                           
061577,000078:    5562                                           COUNT*   $$/FLAG                               
061578,000079: 
061579,000080:    5562           30002        UPFLAG             CA       Q                                     
061580,000081:    5563           05600                           TC       DEBIT                                 
061581,000082:    5564           40000                           COM                                            #  +(15 - BIT)
061582,000083:    5565           00006                           EXTEND                                         
061583,000084:    5566           04001                           ROR      LCHAN                                 #  SET BIT
061584,000085:    5567           50061        COMFLAG            INDEX    ITEMP1                                
061585,000086:    5570           54074                           TS       FLAGWRD0                              
061586,000087:    5571           22063                           LXCH     ITEMP3                                
061587,000088:    5572           00003                           RELINT                                         
061588,000089:    5573           00001                           TC       L                                     
061589,000090: 
061590,000091:    5574           30002        DOWNFLAG           CA       Q                                     
061591,000092:    5575           05600                           TC       DEBIT                                 
061592,000093:    5576           70001                           MASK     L                                     #  RESET BIT
061593,000094:    5577           15567                           TCF      COMFLAG                               
061594,000095: 
061595,000096:    5600           65033        DEBIT              AD       ONE                                   #  GET DE BITS
061596,000097:    5601           00004                           INHINT                                         
061597,000098:    5602           54063                           TS       ITEMP3                                
061598,000099:    5603           35042                           CA       LOW4                                  #  DEC15
061599,000100:    5604           54061                           TS       ITEMP1                                
061600,000101:    5605           50063                           INDEX    ITEMP3                                
061601,000102:    5606           27777                           CA       0          -1                         #  ADRES
061602,000103:    5607           54001                           TS       L                                     
061603,000104:    5610           35035                           CA       ZERO                                  
061604,000105:    5611           00006                           EXTEND                                         
061605,000106:    5612           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
061606,000107:    5613           52062                           DXCH     ITEMP1                                
061607,000108:    5614           50061                           INDEX    ITEMP1                                
061608,000109:    5615           30074                           CA       FLAGWRD0                              
061609,000110:    5616           54001                           TS       L                                     #  CURRENT STATE
061610,000111:    5617           50062                           INDEX    ITEMP2                                
061611,000112:    5620           45015                           CS       BIT15                                 #  -(15 - BIT)
061612,000113:    5621           00002                           TC       Q                                     
061613,000114: 
061614,000115:                                                                                                  #  DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
061615,000116: 
061616,000117:                                                                                                  #  ENTRANCE REQUIREMENTS...
061617,000118:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
061618,000119:                                                                                                  #                TC      BANKCALL
061619,000120:                                                                                                  #                CADR    DELAYJOB
061620,000121: 
061621,000122: 06,3770                                           BANK     06                                    
061622,000123: 00,2000                                           SETLOC   DLAYJOB                               
061623,000124: 00,2000                                           BANK                                           
061624,000125: 
061625,000126:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
061626,000127: 
061627,000128: 00,3732                                           COUNT    00/DELAY                              
061628,000129: 
061629,000130: 00,3732           00004        DELAYJOB           INHINT                                         
061630,000131: 00,3733           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
061631,000132: 00,3734           36214                           CAF      DELAYNUM                              #  WAITLIST
061632,000133: 00,3735           54070        DELLOOP            TS       RUPTREG1                              
061633,000134: 00,3736           50000                           INDEX    A                                     
061634,000135: 00,3737           31141                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
061635,000136: 00,3740           00006                           EXTEND                                         
061636,000137: 00,3741           13746                           BZF      OK2DELAY                              #  YES
061637,000138: 
061638,000139: 00,3742           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
061639,000140: 00,3743           13735                           TCF      DELLOOP                               
061640,000141: 
061641,000142: 00,3744           07755                           TC       BAILOUT                               #  NO AVAILABLE LOCS AVAILABLE.
061642,000143: 00,3745           31104                           OCT      31104                                 
061643,000144: 
061644,000145: 00,3746           33766        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
061645,000146: 00,3747           54061                           TS       WAITEXIT                              
061646,000147: 
061647,000148: 00,3750           30004                           CA       FBANK                                 
061648,000149: 00,3751           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
061649,000150: 00,3752           54001                           TS       L                                     
061650,000151: 
061651,000152: 00,3753           33767                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
061652,000153: 00,3754           15271                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
061653,000154: 
061654,000155: 00,3755           04725        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
061655,000156: 
061656,000157: 00,3756           50070                           INDEX    RUPTREG1                              
061657,000158: 00,3757           55141                           TS       DELAYLOC                              #  SAVE DELAY CADRS
061658,000159: 
061659,000160: 00,3760           05211                           TC       JOBSLEEP                              
061660,000161: 
061661,000162: 00,3761           35035        WAKER              CAF      ZERO                                  
061662,000163: 00,3762           50006                           INDEX    BBANK                                 
061663,000164: 00,3763           57141                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE
061664,000165: 00,3764           05215                           TC       JOBWAKE                               
061665,000166: 
061666,000167: 00,3765           05340                           TC       TASKOVER                              
061667,000168: 
061668,000169: 00,3766           03753        TCSLEEP            GENADR   TCGETCAD   -2                         
061669,000170: 00,3767           03761        WAKECAD            GENADR   WAKER                                 
061670,000171: 
061671,000172:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
061672,000173:                                                                                                  #  WRITTEN BY D. EYLES
061673,000174:                                                                                                  #  MOD 1 BY KERNAN                               UTILITYM REV 17 11/18/67
061674,000175:                                                                                                  #  MOD 2 BY SCHULENBERG  (REMOVE RELINT)  SKIPPER REV 4 2/28/68
061675,000176: 
061676,000177:                                                                                                  #  THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
061677,000178:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
061678,000179: 
061679,000180:                                                                                                  #  GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
061680,000181:                                                                                                  #        I       CA      N-1             # OF QUANTITIES MINUS ONE.
061681,000182:                                                                                                  #        I +1    TC      GENTRAN         IN FIXED-FIXED.
061682,000183:                                                                                                  #        I +2    ADRES   L               STARTING ADRES OF DATA TO BE MOVED.
061683,000184:                                                                                                  #        I +3    ADRES   M               STARTING ADRES OF DUPLICATION BLOCK.
061684,000185:                                                                                                  #        I +4                            RETURNS HERE.
061685,000186: 
061686,000187:                                                                                                  #  GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
061687,000188:                                                                                                  #  A, L AND ITEMP1 ARE NOT PRESERVED.
061688,000189: 
061689,000190:    5622                                           BLOCK    02                                    
061690,000191:    4000                                           SETLOC   FFTAG4                                
061691,000192:    4000                                           BANK                                           
061692,000193: 
061693,000194:    5622     0061                                  EBANK=   ITEMP1                                
061694,000195: 
061695,000196:    5622                                           COUNT*   $$/TRAN                               
061696,000197: 
061697,000198:    5622           00004        GENTRAN            INHINT                                         
061698,000199:    5623           54061                           TS       ITEMP1                                #  SAVE N-1.
061699,000200:    5624           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
061700,000201:    5625           60000                           AD       0                                     #  ADRES (L + N - 1).
061701,000202:    5626           50000                           INDEX    A                                     
061702,000203:    5627           30000                           CA       0                                     #  C(ABOVE).
061703,000204:    5630           54001                           TS       L                                     #  SAVE DATA.
061704,000205:    5631           30061                           CA       ITEMP1                                
061705,000206:    5632           50002                           INDEX    Q                                     
061706,000207:    5633           60001                           AD       1                                     #  ADRES (M + N - 1).
061707,000208:    5634           50000                           INDEX    A                                     
061708,000209:    5635           22000                           LXCH     0                                     #  STUFF IT.
061709,000210:    5636           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
061710,000211:    5637           15623                           TCF      GENTRAN    +1                         
061711,000212:    5640           16710                           TCF      Q+2                                   #  RETURN TO CALLER.
061712,000213: 
061713,000214:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
061714,000215:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
061715,000216: 
061716,000217:    5641                                           COUNT*   $$/EXTVB                              
061717,000218: 
061718,000219:    5641           45027        B5OFF              CS       BIT5                                  
061719,000220:    5642           71044                           MASK     EXTVBACT                              
061720,000221:    5643           55044                           TS       EXTVBACT                              
061721,000222:    5644           05233                           TC       ENDOFJOB                              
061722,000223: 
061723,000224:                                                                                                  #  SUBROUTINES TO TURN OFF AND TURN ON TRACKER FAIL LIGHT.
061724,000225: 
061725,000226:    5645           00004        TRFAILOF           INHINT                                         
061726,000227:    5646           47704                           CS       OCT40200                              #  TURN OFF TRACKER LIGHT
061727,000228:    5647           71036                           MASK     DSPTAB     +11D                       
061728,000229:    5650           65015                           AD       BIT15                                 
061729,000230:    5651           55036                           TS       DSPTAB     +11D                       
061730,000231:    5652           41331                           CS       OPTMODES                              #  TO INSURE THAT OCDU FAIL WILL GO ON
061731,000232:    5653           75025                           MASK     BIT7                                  #  AGAIN IF IT WAS ON IN ADDITION TO
061732,000233:    5654           27331                           ADS      OPTMODES                              #  TRACKER FAIL.
061733,000234: 
061734,000235:    5655           00003        REQ                RELINT                                         
061735,000236:    5656           00002                           TC       Q                                     
061736,000237: 
061737,000238:    5657           00004        TRFAILON           INHINT                                         
061738,000239:    5660           41036                           CS       DSPTAB     +11D                       #  TURN ON
061739,000240:    5661           77704                           MASK     OCT40200                              
061740,000241:    5662           27036                           ADS      DSPTAB     +11D                       
061741,000242:    5663           15655                           TCF      REQ                                   
061742,000243: 
061743,000244: 
061744,000245: 
061745,000246: 

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