Source Code
These source-code files are part of a reconstructed copy of Comanche 44, the
initial release (though not the final mission release) of the Apollo 10
Command Module (CM) Apollo Guidance Computer (AGC) software. Subsequent releases
were Comanche 45 and Comanche 45/2 (the flown release on Apollo 10). The reconstruction
is believed to be exactly accurate, but in the absence of an actual Apollo-era
listing of Comanche 44, some explanation of the reconstruction process is needed
to insure confidence in that accuracy.
The starting point was the source code of Comanche 51 (separately previously reconstructed from an Apollo-era listing of Comanche 55, flown on Apollo 11). Comanche 51 source code was then modified by undoing changes known to have been made between revisions 44 and 51. The now-reconstructed Comanche 44 source code was verified by assembling it and checking that the assembled code had the expected known-correct memory-bank checksums. Note that page numbers in the reconstructed code match those on the Comanche 55 printout, although the source code would likely have different page numbers in a contemporary Comanche 44 listing. Annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change relative to Comanche 51. Here's a guide to the Apollo documentation referenced in those annotations:
Comments expected to have been present in the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC Project's GitHub repository. |
063590,000002: ## Copyright: Public domain.
063591,000003: ## Filename: SERVICE_ROUTINES.agc
063592,000004: ## Purpose: A section of Comanche revision 044.
063593,000005: ## It is part of the reconstructed source code for the
063594,000006: ## original release of the flight software for the Command
063595,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
063596,000008: ## The code has been recreated from a copy of Comanche 055. It
063597,000009: ## has been adapted such that the resulting bugger words
063598,000010: ## exactly match those specified for Comanche 44 in NASA drawing
063599,000011: ## 2021153D, which gives relatively high confidence that the
063600,000012: ## reconstruction is correct.
063601,000013: ## Assembler: yaYUL
063602,000014: ## Contact: Ron Burkey <info@sandroid.org>.
063603,000015: ## Website: www.ibiblio.org/apollo/index.html
063604,000016: ## Mod history: 2020-12-03 MAS Created from Comanche 51.
063605,000017:
Page 1485 |
063607,000019: 7722 BLOCK 3
063608,000020: 6000 SETLOC FFTAG6
063609,000021: 6000 BANK
063610,000022: 7722 COUNT 03/FLAG
063611,000023:
063612,000024: 7722 54001 UPENT2 TS L # WHICH FLAGWORD IS IT
063613,000025: 7723 75023 MASK OCT7
063614,000026: 7724 56001 XCH L # SAVE IN L FOR INDEXING
063615,000027:
063616,000028: 7725 75731 MASK OCT77770 # OBTAIN THE BIT INFORMATION
063617,000029: 7726 00004 INHINT # PREVENT INTERUPTS
063618,000030: 7727 54061 TS ITEMP1 # STORE THE BIT INFORMATION TEMPORARIALY
063619,000031:
063620,000032: 7730 50001 NDX L
063621,000033: 7731 40074 CS FLAGWRD0
063622,000034: 7732 70061 MASK ITEMP1
063623,000035: 7733 50001 NDX L
063624,000036: 7734 26074 ADS FLAGWRD0
063625,000037: 7735 00003 RELINT # RELEASE INTERUPT INHIBIT
063626,000038:
063627,000039: 7736 24002 INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
063628,000040: 7737 00002 TC Q # RETURN
063629,000041:
063630,000042: 7740 54001 DOWNENT2 TS L # WHICH FLAGWORD IS IT
063631,000043: 7741 75023 MASK OCT7
063632,000044: 7742 56001 XCH L # SAVE IN L FOR INDEXING
063633,000045:
063634,000046: 7743 75731 MASK OCT77770 # OBTAIN THE BIT INFORMATION
063635,000047: 7744 40000 COM # START TO PROCESS THE INFORMATION
063636,000048:
063637,000049: 7745 00004 INHINT # PREVENT INTERUPTS
063638,000050: 7746 50001 NDX L
063639,000051: 7747 70074 MASK FLAGWRD0
063640,000052: 7750 50001 NDX L
063641,000053: 7751 54074 TS FLAGWRD0
063642,000054: 7752 00003 RELINT # RELEASE INTERUPT INHIBIT
063643,000055:
063644,000056: 7753 24002 INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
063645,000057: 7754 00002 TC Q # RETURN
063646,000058:
063647,000059: 7755 5023 OCT7 EQUALS SEVEN
063648,000060: 10,3766 BANK 10
063649,000061:
Page 1486 |
063651,000063: # UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES. USING THEM, WHETHER OR
063652,000064: # NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
063653,000065: # EBANK SETTING. A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
063654,000066: # ASSEMBLER.
063655,000067:
063656,000068: # AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS. ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
063657,000069: # NAME ANY BIT IN ERASABLE MEMORY.
063658,000070:
063659,000071: # CALLING SEQUENCES ARE AS FOLLOWS:-
063660,000072: # TC UPFLAG TC DOWNFLAG
063661,000073: # ADRES NAME OF FLAG ADRES NAME OF FLAG
063662,000074:
063663,000075: # RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
063664,000076: # UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
063665,000077:
063666,000078: 5546 BLOCK 02
063667,000079: 4000 SETLOC FFTAG1
063668,000080: 4000 BANK
063669,000081: 5546 COUNT* $$/FLAG
063670,000082:
063671,000083: 5546 30002 UPFLAG CA Q
063672,000084: 5547 05564 TC DEBIT
063673,000085: 5550 40000 COM # +(15 - BIT)
063674,000086: 5551 00006 EXTEND
063675,000087: 5552 04001 ROR LCHAN # SET BIT
063676,000088: 5553 50061 COMFLAG INDEX ITEMP1
063677,000089: 5554 54074 TS FLAGWRD0
063678,000090: 5555 22063 LXCH ITEMP3
063679,000091: 5556 00003 RELINT
063680,000092: 5557 00001 TC L
063681,000093:
063682,000094: 5560 30002 DOWNFLAG CA Q
063683,000095: 5561 05564 TC DEBIT
063684,000096: 5562 70001 MASK L # RESET BIT
063685,000097: 5563 15553 TCF COMFLAG
063686,000098:
063687,000099: 5564 65017 DEBIT AD ONE # GET DE BITS
063688,000100: 5565 00004 INHINT
063689,000101: 5566 54063 TS ITEMP3
063690,000102: 5567 35026 CA LOW4 # DEC15
063691,000103: 5570 54061 TS ITEMP1
063692,000104: 5571 50063 INDEX ITEMP3
063693,000105: 5572 27777 CA 0 -1 # ADRES
063694,000106: 5573 54001 TS L
063695,000107: 5574 35021 CA ZERO
Page 1487 |
063697,000109: 5575 00006 EXTEND
063698,000110: 5576 10061 DV ITEMP1 # A = FLAGWRD, L = (15 - BIT)
063699,000111: 5577 52062 DXCH ITEMP1
063700,000112: 5600 50061 INDEX ITEMP1
063701,000113: 5601 30074 CA FLAGWRD0
063702,000114: 5602 54001 TS L # CURRENT STATE
063703,000115: 5603 50062 INDEX ITEMP2
063704,000116: 5604 45001 CS BIT15 # -(15 - BIT)
063705,000117: 5605 00002 TC Q
063706,000118:
Page 1488 |
063708,000120: # DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
063709,000121:
063710,000122: # ENTRANCE REQUIREMENTS...
063711,000123: # CAF DT DELAY JOB FOR DT CENTISECS
063712,000124: # TC BANKCALL
063713,000125: # CADR DELAYJOB
063714,000126:
063715,000127: 06,3770 BANK 06
063716,000128: 00,2000 SETLOC DLAYJOB
063717,000129: 00,2000 BANK
063718,000130:
063719,000131: # THIS MUST REMAIN IN BANK 0 *****************************************
063720,000132:
063721,000133: 00,3732 COUNT 00/DELAY
063722,000134:
063723,000135: 00,3732 00004 DELAYJOB INHINT
063724,000136: 00,3733 54002 TS Q # STORE DELAY DT IN Q FOR DLY -1 IN
063725,000137: 00,3734 36214 CAF DELAYNUM # WAITLIST
063726,000138: 00,3735 54070 DELLOOP TS RUPTREG1
063727,000139: 00,3736 50000 INDEX A
063728,000140: 00,3737 31141 CA DELAYLOC # IS THIS DELAYLOC AVAILABLE
063729,000141: 00,3740 00006 EXTEND
063730,000142: 00,3741 13746 BZF OK2DELAY # YES
063731,000143:
063732,000144: 00,3742 10070 CCS RUPTREG1 # NO, TRY NEXT DELAYLOC
063733,000145: 00,3743 13735 TCF DELLOOP
063734,000146:
063735,000147: 00,3744 07755 TC BAILOUT # NO AVAILABLE LOCS AVAILABLE.
063736,000148: 00,3745 01104 OCT 1104
063737,000149:
063738,000150: 00,3746 33766 OK2DELAY CA TCSLEEP # SET WAITLIST IMMEDIATE RETURN
063739,000151: 00,3747 54061 TS WAITEXIT
063740,000152:
063741,000153: 00,3750 30004 CA FBANK
063742,000154: 00,3751 60070 AD RUPTREG1 # STORE BBANK FOR TASK CALL
063743,000155: 00,3752 54001 TS L
063744,000156:
063745,000157: 00,3753 33767 CAF WAKECAD # STORE CADR FOR TASK CALL
063746,000158: 00,3754 15255 TCF DLY2 -1 # DLY IS IN WAITLIST ROUTINE
063747,000159:
063748,000160: 00,3755 04711 TCGETCAD TC MAKECADR # GET CALLERS FCADR
063749,000161:
063750,000162: 00,3756 50070 INDEX RUPTREG1
063751,000163: 00,3757 55141 TS DELAYLOC # SAVE DELAY CADRS
063752,000164:
063753,000165: 00,3760 05175 TC JOBSLEEP
063754,000166:
063755,000167: 00,3761 35021 WAKER CAF ZERO
063756,000168: 00,3762 50006 INDEX BBANK
063757,000169: 00,3763 57141 XCH DELAYLOC # MAKE DELAYLOC AVAILABLE
Page 1489 |
063759,000171: 00,3764 05201 TC JOBWAKE
063760,000172:
063761,000173: 00,3765 05324 TC TASKOVER
063762,000174:
063763,000175: 00,3766 03753 TCSLEEP GENADR TCGETCAD -2
063764,000176: 00,3767 03761 WAKECAD GENADR WAKER
063765,000177:
Page 1490 |
063767,000179: # GENTRAN, A BLOCK TRANSFER ROUTINE.
063768,000180: # WRITTEN BY D. EYLES
063769,000181: # MOD 1 BY KERNAN UTILITYM REV 17 11/18/67
063770,000182: # MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
063771,000183:
063772,000184: # THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
063773,000185: # CONSECUTIVE ERASABLE LOCATIONS. IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
063774,000186:
063775,000187: # GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT. THE CALLING SEQUENCE IS:
063776,000188: # I CA N-1 # OF QUANTITIES MINUS ONE.
063777,000189: # I +1 TC GENTRAN IN FIXED-FIXED.
063778,000190: # I +2 ADRES L STARTING ADRES OF DATA TO BE MOVED.
063779,000191: # I +3 ADRES M STARTING ADRES OF DUPLICATION BLOCK.
063780,000192: # I +4 RETURNS HERE.
063781,000193:
063782,000194: # GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
063783,000195: # A, L AND ITEMP1 ARE NOT PRESERVED.
063784,000196:
063785,000197: 5606 BLOCK 02
063786,000198: 4000 SETLOC FFTAG4
063787,000199: 4000 BANK
063788,000200:
063789,000201: 5606 0061 EBANK= ITEMP1
063790,000202:
063791,000203: 5606 COUNT* $$/TRAN
063792,000204:
063793,000205: 5606 00004 GENTRAN INHINT
063794,000206: 5607 54061 TS ITEMP1 # SAVE N-1.
063795,000207: 5610 50002 INDEX Q # C(Q) = ADRES L.
063796,000208: 5611 60000 AD 0 # ADRES (L + N - 1).
063797,000209: 5612 50000 INDEX A
063798,000210: 5613 30000 CA 0 # C(ABOVE).
063799,000211: 5614 54001 TS L # SAVE DATA.
063800,000212: 5615 30061 CA ITEMP1
063801,000213: 5616 50002 INDEX Q
063802,000214: 5617 60001 AD 1 # ADRES (M + N - 1).
063803,000215: 5620 50000 INDEX A
063804,000216: 5621 22000 LXCH 0 # STUFF IT.
063805,000217: 5622 10061 CCS ITEMP1 # LOOP UNTIL N-1 = 0.
063806,000218: 5623 15607 TCF GENTRAN +1
063807,000219: 5624 16710 TCF Q+2 # RETURN TO CALLER.
063808,000220:
Page 1491 |
063810,000222: # B5OFF ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
063811,000223: # MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
063812,000224:
063813,000225: 5625 COUNT* $$/EXTVB
063814,000226:
063815,000227: 5625 45013 B5OFF CS BIT5
063816,000228: 5626 71044 MASK EXTVBACT
063817,000229: 5627 55044 TS EXTVBACT
063818,000230: 5630 05217 TC ENDOFJOB
063819,000231:
Page 1492 |
063821,000233: # SUBROUTINES TO TURN OFF AND TURN ON TRACKER FAIL LIGHT.
063822,000234:
063823,000235: 5631 00004 TRFAILOF INHINT
063824,000236: 5632 47704 CS OCT40200 # TURN OFF TRACKER LIGHT
063825,000237: 5633 71036 MASK DSPTAB +11D
063826,000238: 5634 65001 AD BIT15
063827,000239: 5635 55036 TS DSPTAB +11D
063828,000240: 5636 41331 CS OPTMODES # TO INSURE THAT OCDU FAIL WILL GO ON
063829,000241: 5637 75011 MASK BIT7 # AGAIN IF IT WAS ON IN ADDITION TO
063830,000242: 5640 27331 ADS OPTMODES # TRACKER FAIL.
063831,000243:
063832,000244: 5641 00003 REQ RELINT
063833,000245: 5642 00002 TC Q
063834,000246:
063835,000247: 5643 00004 TRFAILON INHINT
063836,000248: 5644 41036 CS DSPTAB +11D # TURN ON
063837,000249: 5645 77704 MASK OCT40200
063838,000250: 5646 27036 ADS DSPTAB +11D
063839,000251: 5647 15641 TCF REQ
063840,000252:
063841,000253:
063842,000254:
063843,000255:
End of include-file SERVICE_ROUTINES.agc. Parent file is MAIN.agc