Source Code
These source-code files are part of a reconstructed copy of Comanche 45/2 (AKA Manche45 revision 2),
the final, flown mission release of the Apollo 10 Command Module (CM) Apollo Guidance
Computer (AGC) software. Comanche 45/2 was preceded by Comanche 44 and Comanche 45. The
reconstruction is believed to be exactly accurate, but in the absence of an actual Apollo-era
listing of Comanche 45/2, some explanation of the reconstruction process is needed
to insure confidence in that accuracy.
The starting point was the source code of Comanche 45 (itself previously accurately reconstructed). Comanche 45 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 45 and 45/2. The now-reconstructed Comanche 45/2 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 tend to match those in the Comanche 55, the most-similar revision of Comanche for which we have access to an actual non-reconstructed hardcopy; the source code would likely have different page numbers in a contemporary Comanche 45 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 44. Here's a guide to the Apollo documentation referenced in those annotations:
|
063007,000002: ## Copyright: Public domain.
063008,000003: ## Filename: SERVICE_ROUTINES.agc
063009,000004: ## Purpose: A section of Manche45 revision 2.
063010,000005: ## It is part of the reconstructed source code for the
063011,000006: ## final, flown release of the flight software for the Command
063012,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
063013,000008: ## The code has been recreated from a copy of Comanche 055. It
063014,000009: ## has been adapted such that the resulting bugger words
063015,000010: ## exactly match those specified for Manche 45/2 in NASA drawing
063016,000011: ## 2021153D, which gives relatively high confidence that the
063017,000012: ## reconstruction is correct.
063018,000013: ## Assembler: yaYUL
063019,000014: ## Contact: Ron Burkey <info@sandroid.org>.
063020,000015: ## Website: www.ibiblio.org/apollo/index.html
063021,000016: ## Mod history: 2020-12-24 MAS Created from Comanche 45.
063022,000017:
Page 1485 |
063024,000019: 7722 BLOCK 3
063025,000020: 6000 SETLOC FFTAG6
063026,000021: 6000 BANK
063027,000022: 7722 COUNT 03/FLAG
063028,000023:
063029,000024: 7722 54001 UPENT2 TS L # WHICH FLAGWORD IS IT
063030,000025: 7723 75023 MASK OCT7
063031,000026: 7724 56001 XCH L # SAVE IN L FOR INDEXING
063032,000027:
063033,000028: 7725 75731 MASK OCT77770 # OBTAIN THE BIT INFORMATION
063034,000029: 7726 00004 INHINT # PREVENT INTERUPTS
063035,000030: 7727 54061 TS ITEMP1 # STORE THE BIT INFORMATION TEMPORARIALY
063036,000031:
063037,000032: 7730 50001 NDX L
063038,000033: 7731 40074 CS FLAGWRD0
063039,000034: 7732 70061 MASK ITEMP1
063040,000035: 7733 50001 NDX L
063041,000036: 7734 26074 ADS FLAGWRD0
063042,000037: 7735 00003 RELINT # RELEASE INTERUPT INHIBIT
063043,000038:
063044,000039: 7736 24002 INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
063045,000040: 7737 00002 TC Q # RETURN
063046,000041:
063047,000042: 7740 54001 DOWNENT2 TS L # WHICH FLAGWORD IS IT
063048,000043: 7741 75023 MASK OCT7
063049,000044: 7742 56001 XCH L # SAVE IN L FOR INDEXING
063050,000045:
063051,000046: 7743 75731 MASK OCT77770 # OBTAIN THE BIT INFORMATION
063052,000047: 7744 40000 COM # START TO PROCESS THE INFORMATION
063053,000048:
063054,000049: 7745 00004 INHINT # PREVENT INTERUPTS
063055,000050: 7746 50001 NDX L
063056,000051: 7747 70074 MASK FLAGWRD0
063057,000052: 7750 50001 NDX L
063058,000053: 7751 54074 TS FLAGWRD0
063059,000054: 7752 00003 RELINT # RELEASE INTERUPT INHIBIT
063060,000055:
063061,000056: 7753 24002 INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
063062,000057: 7754 00002 TC Q # RETURN
063063,000058:
063064,000059: 7755 5023 OCT7 EQUALS SEVEN
063065,000060: 10,3766 BANK 10
063066,000061:
Page 1486 |
063068,000063: # UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES. USING THEM, WHETHER OR
063069,000064: # NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
063070,000065: # EBANK SETTING. A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
063071,000066: # ASSEMBLER.
063072,000067:
063073,000068: # AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS. ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
063074,000069: # NAME ANY BIT IN ERASABLE MEMORY.
063075,000070:
063076,000071: # CALLING SEQUENCES ARE AS FOLLOWS:-
063077,000072: # TC UPFLAG TC DOWNFLAG
063078,000073: # ADRES NAME OF FLAG ADRES NAME OF FLAG
063079,000074:
063080,000075: # RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
063081,000076: # UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
063082,000077:
063083,000078: 5546 BLOCK 02
063084,000079: 4000 SETLOC FFTAG1
063085,000080: 4000 BANK
063086,000081: 5546 COUNT* $$/FLAG
063087,000082:
063088,000083: 5546 30002 UPFLAG CA Q
063089,000084: 5547 05564 TC DEBIT
063090,000085: 5550 40000 COM # +(15 - BIT)
063091,000086: 5551 00006 EXTEND
063092,000087: 5552 04001 ROR LCHAN # SET BIT
063093,000088: 5553 50061 COMFLAG INDEX ITEMP1
063094,000089: 5554 54074 TS FLAGWRD0
063095,000090: 5555 22063 LXCH ITEMP3
063096,000091: 5556 00003 RELINT
063097,000092: 5557 00001 TC L
063098,000093:
063099,000094: 5560 30002 DOWNFLAG CA Q
063100,000095: 5561 05564 TC DEBIT
063101,000096: 5562 70001 MASK L # RESET BIT
063102,000097: 5563 15553 TCF COMFLAG
063103,000098:
063104,000099: 5564 65017 DEBIT AD ONE # GET DE BITS
063105,000100: 5565 00004 INHINT
063106,000101: 5566 54063 TS ITEMP3
063107,000102: 5567 35026 CA LOW4 # DEC15
063108,000103: 5570 54061 TS ITEMP1
063109,000104: 5571 50063 INDEX ITEMP3
063110,000105: 5572 27777 CA 0 -1 # ADRES
063111,000106: 5573 54001 TS L
063112,000107: 5574 35021 CA ZERO
Page 1487 |
063114,000109: 5575 00006 EXTEND
063115,000110: 5576 10061 DV ITEMP1 # A = FLAGWRD, L = (15 - BIT)
063116,000111: 5577 52062 DXCH ITEMP1
063117,000112: 5600 50061 INDEX ITEMP1
063118,000113: 5601 30074 CA FLAGWRD0
063119,000114: 5602 54001 TS L # CURRENT STATE
063120,000115: 5603 50062 INDEX ITEMP2
063121,000116: 5604 45001 CS BIT15 # -(15 - BIT)
063122,000117: 5605 00002 TC Q
063123,000118:
Page 1488 |
063125,000120: # DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
063126,000121:
063127,000122: # ENTRANCE REQUIREMENTS...
063128,000123: # CAF DT DELAY JOB FOR DT CENTISECS
063129,000124: # TC BANKCALL
063130,000125: # CADR DELAYJOB
063131,000126:
063132,000127: 06,3770 BANK 06
063133,000128: 00,2000 SETLOC DLAYJOB
063134,000129: 00,2000 BANK
063135,000130:
063136,000131: # THIS MUST REMAIN IN BANK 0 *****************************************
063137,000132:
063138,000133: 00,3732 COUNT 00/DELAY
063139,000134:
063140,000135: 00,3732 00004 DELAYJOB INHINT
063141,000136: 00,3733 54002 TS Q # STORE DELAY DT IN Q FOR DLY -1 IN
063142,000137: 00,3734 36214 CAF DELAYNUM # WAITLIST
063143,000138: 00,3735 54070 DELLOOP TS RUPTREG1
063144,000139: 00,3736 50000 INDEX A
063145,000140: 00,3737 31141 CA DELAYLOC # IS THIS DELAYLOC AVAILABLE
063146,000141: 00,3740 00006 EXTEND
063147,000142: 00,3741 13746 BZF OK2DELAY # YES
063148,000143:
063149,000144: 00,3742 10070 CCS RUPTREG1 # NO, TRY NEXT DELAYLOC
063150,000145: 00,3743 13735 TCF DELLOOP
063151,000146:
063152,000147: 00,3744 07755 TC BAILOUT # NO AVAILABLE LOCS AVAILABLE.
063153,000148: 00,3745 01104 OCT 1104
063154,000149:
063155,000150: 00,3746 33766 OK2DELAY CA TCSLEEP # SET WAITLIST IMMEDIATE RETURN
063156,000151: 00,3747 54061 TS WAITEXIT
063157,000152:
063158,000153: 00,3750 30004 CA FBANK
063159,000154: 00,3751 60070 AD RUPTREG1 # STORE BBANK FOR TASK CALL
063160,000155: 00,3752 54001 TS L
063161,000156:
063162,000157: 00,3753 33767 CAF WAKECAD # STORE CADR FOR TASK CALL
063163,000158: 00,3754 15255 TCF DLY2 -1 # DLY IS IN WAITLIST ROUTINE
063164,000159:
063165,000160: 00,3755 04711 TCGETCAD TC MAKECADR # GET CALLERS FCADR
063166,000161:
063167,000162: 00,3756 50070 INDEX RUPTREG1
063168,000163: 00,3757 55141 TS DELAYLOC # SAVE DELAY CADRS
063169,000164:
063170,000165: 00,3760 05175 TC JOBSLEEP
063171,000166:
063172,000167: 00,3761 35021 WAKER CAF ZERO
063173,000168: 00,3762 50006 INDEX BBANK
063174,000169: 00,3763 57141 XCH DELAYLOC # MAKE DELAYLOC AVAILABLE
Page 1489 |
063176,000171: 00,3764 05201 TC JOBWAKE
063177,000172:
063178,000173: 00,3765 05324 TC TASKOVER
063179,000174:
063180,000175: 00,3766 03753 TCSLEEP GENADR TCGETCAD -2
063181,000176: 00,3767 03761 WAKECAD GENADR WAKER
063182,000177:
Page 1490 |
063184,000179: # GENTRAN, A BLOCK TRANSFER ROUTINE.
063185,000180: # WRITTEN BY D. EYLES
063186,000181: # MOD 1 BY KERNAN UTILITYM REV 17 11/18/67
063187,000182: # MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
063188,000183:
063189,000184: # THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
063190,000185: # CONSECUTIVE ERASABLE LOCATIONS. IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
063191,000186:
063192,000187: # GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT. THE CALLING SEQUENCE IS:
063193,000188: # I CA N-1 # OF QUANTITIES MINUS ONE.
063194,000189: # I +1 TC GENTRAN IN FIXED-FIXED.
063195,000190: # I +2 ADRES L STARTING ADRES OF DATA TO BE MOVED.
063196,000191: # I +3 ADRES M STARTING ADRES OF DUPLICATION BLOCK.
063197,000192: # I +4 RETURNS HERE.
063198,000193:
063199,000194: # GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
063200,000195: # A, L AND ITEMP1 ARE NOT PRESERVED.
063201,000196:
063202,000197: 5606 BLOCK 02
063203,000198: 4000 SETLOC FFTAG4
063204,000199: 4000 BANK
063205,000200:
063206,000201: 5606 0061 EBANK= ITEMP1
063207,000202:
063208,000203: 5606 COUNT* $$/TRAN
063209,000204:
063210,000205: 5606 00004 GENTRAN INHINT
063211,000206: 5607 54061 TS ITEMP1 # SAVE N-1.
063212,000207: 5610 50002 INDEX Q # C(Q) = ADRES L.
063213,000208: 5611 60000 AD 0 # ADRES (L + N - 1).
063214,000209: 5612 50000 INDEX A
063215,000210: 5613 30000 CA 0 # C(ABOVE).
063216,000211: 5614 54001 TS L # SAVE DATA.
063217,000212: 5615 30061 CA ITEMP1
063218,000213: 5616 50002 INDEX Q
063219,000214: 5617 60001 AD 1 # ADRES (M + N - 1).
063220,000215: 5620 50000 INDEX A
063221,000216: 5621 22000 LXCH 0 # STUFF IT.
063222,000217: 5622 10061 CCS ITEMP1 # LOOP UNTIL N-1 = 0.
063223,000218: 5623 15607 TCF GENTRAN +1
063224,000219: 5624 16710 TCF Q+2 # RETURN TO CALLER.
063225,000220:
Page 1491 |
063227,000222: # B5OFF ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
063228,000223: # MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
063229,000224:
063230,000225: 5625 COUNT* $$/EXTVB
063231,000226:
063232,000227: 5625 45013 B5OFF CS BIT5
063233,000228: 5626 71044 MASK EXTVBACT
063234,000229: 5627 55044 TS EXTVBACT
063235,000230: 5630 05217 TC ENDOFJOB
063236,000231:
Page 1492 |
063238,000233: # SUBROUTINES TO TURN OFF AND TURN ON TRACKER FAIL LIGHT.
063239,000234:
063240,000235: 5631 00004 TRFAILOF INHINT
063241,000236: 5632 47704 CS OCT40200 # TURN OFF TRACKER LIGHT
063242,000237: 5633 71036 MASK DSPTAB +11D
063243,000238: 5634 65001 AD BIT15
063244,000239: 5635 55036 TS DSPTAB +11D
063245,000240: 5636 41331 CS OPTMODES # TO INSURE THAT OCDU FAIL WILL GO ON
063246,000241: 5637 75011 MASK BIT7 # AGAIN IF IT WAS ON IN ADDITION TO
063247,000242: 5640 27331 ADS OPTMODES # TRACKER FAIL.
063248,000243:
063249,000244: 5641 00003 REQ RELINT
063250,000245: 5642 00002 TC Q
063251,000246:
063252,000247: 5643 00004 TRFAILON INHINT
063253,000248: 5644 41036 CS DSPTAB +11D # TURN ON
063254,000249: 5645 77704 MASK OCT40200
063255,000250: 5646 27036 ADS DSPTAB +11D
063256,000251: 5647 15641 TCF REQ
063257,000252:
063258,000253:
063259,000254:
063260,000255:
End of include-file SERVICE_ROUTINES.agc. Parent file is MAIN.agc