Source Code
These source-code files are part of a reconstructed copy of Comanche 72, the
first release of the Apollo Guidance Computer (AGC) Command Module (CM) software
for Apollo 13.
They have been adapted from sources files created from a listing of Comanche 55. These source files were updated to match binary dumps of a set of Comanche 67 rope modules. They were then further modified by applying known changes between Comanche 67 and Comanche 72. A binary dump of module B2 of Comanche 72, part number 2010802-021, was also used to validate changes made to banks 05-13. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments. Since no contemporary listings of Comanche 72 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. |
061988,000002: ## Copyright: Public domain.
061989,000003: ## Filename: SERVICE_ROUTINES.agc
061990,000004: ## Purpose: A section of Comanche revision 072.
061991,000005: ## It is part of the reconstructed source code for the first
061992,000006: ## release of the software for the Command Module's (CM) Apollo
061993,000007: ## Guidance Computer (AGC) for Apollo 13. No original listings
061994,000008: ## of this program are available; instead, this file was recreated
061995,000009: ## from a printout of Comanche 055, binary dumps of a set of
061996,000010: ## Comanche 067 rope modules, and changelogs between Comanche 067
061997,000011: ## and 072. It has been adapted such that the resulting bugger words
061998,000012: ## exactly match those specified for Comanche 072 in NASA drawing
061999,000013: ## 2021153G, which gives relatively high confidence that the
062000,000014: ## reconstruction is correct.
062001,000015: ## Assembler: yaYUL
062002,000016: ## Contact: Ron Burkey <info@sandroid.org>.
062003,000017: ## Website: www.ibiblio.org/apollo/index.html
062004,000018: ## Mod history: 2024-05-13 MAS Created from Comanche 067.
062005,000019:
062006,000020: 7722 BLOCK 3
062007,000021: 6000 SETLOC FFTAG6
062008,000022: 6000 BANK
062009,000023: 7722 COUNT 03/FLAG
062010,000024:
062011,000025: 7722 54001 UPENT2 TS L # WHICH FLAGWORD IS IT
062012,000026: 7723 75037 MASK OCT7
062013,000027: 7724 56001 XCH L # SAVE IN L FOR INDEXING
062014,000028:
062015,000029: 7725 75735 MASK OCT77770 # OBTAIN THE BIT INFORMATION
062016,000030: 7726 00004 INHINT # PREVENT INTERUPTS
062017,000031: 7727 54061 TS ITEMP1 # STORE THE BIT INFORMATION TEMPORARIALY
062018,000032:
062019,000033: 7730 50001 NDX L
062020,000034: 7731 40074 CS FLAGWRD0
062021,000035: 7732 70061 MASK ITEMP1
062022,000036: 7733 50001 NDX L
062023,000037: 7734 26074 ADS FLAGWRD0
062024,000038: 7735 00003 RELINT # RELEASE INTERUPT INHIBIT
062025,000039:
062026,000040: 7736 24002 INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
062027,000041: 7737 00002 TC Q # RETURN
062028,000042:
062029,000043: 7740 54001 DOWNENT2 TS L # WHICH FLAGWORD IS IT
062030,000044: 7741 75037 MASK OCT7
062031,000045: 7742 56001 XCH L # SAVE IN L FOR INDEXING
062032,000046:
062033,000047: 7743 75735 MASK OCT77770 # OBTAIN THE BIT INFORMATION
062034,000048: 7744 40000 COM # START TO PROCESS THE INFORMATION
062035,000049:
062036,000050: 7745 00004 INHINT # PREVENT INTERUPTS
062037,000051: 7746 50001 NDX L
062038,000052: 7747 70074 MASK FLAGWRD0
062039,000053: 7750 50001 NDX L
062040,000054: 7751 54074 TS FLAGWRD0
062041,000055: 7752 00003 RELINT # RELEASE INTERUPT INHIBIT
062042,000056:
062043,000057: 7753 24002 INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
062044,000058: 7754 00002 TC Q # RETURN
062045,000059:
062046,000060: 7755 5037 OCT7 EQUALS SEVEN
062047,000061: 10,3766 BANK 10
062048,000062:
062049,000063: # UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES. USING THEM, WHETHER OR
062050,000064: # NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
062051,000065: # EBANK SETTING. A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
062052,000066: # ASSEMBLER.
062053,000067:
062054,000068: # AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS. ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
062055,000069: # NAME ANY BIT IN ERASABLE MEMORY.
062056,000070:
062057,000071: # CALLING SEQUENCES ARE AS FOLLOWS:-
062058,000072: # TC UPFLAG TC DOWNFLAG
062059,000073: # ADRES NAME OF FLAG ADRES NAME OF FLAG
062060,000074:
062061,000075: # RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
062062,000076: # UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
062063,000077:
062064,000078: 5562 BLOCK 02
062065,000079: 4000 SETLOC FFTAG1
062066,000080: 4000 BANK
062067,000081: 5562 COUNT* $$/FLAG
062068,000082:
062069,000083: 5562 30002 UPFLAG CA Q
062070,000084: 5563 05600 TC DEBIT
062071,000085: 5564 40000 COM # +(15 - BIT)
062072,000086: 5565 00006 EXTEND
062073,000087: 5566 04001 ROR LCHAN # SET BIT
062074,000088: 5567 50061 COMFLAG INDEX ITEMP1
062075,000089: 5570 54074 TS FLAGWRD0
062076,000090: 5571 22063 LXCH ITEMP3
062077,000091: 5572 00003 RELINT
062078,000092: 5573 00001 TC L
062079,000093:
062080,000094: 5574 30002 DOWNFLAG CA Q
062081,000095: 5575 05600 TC DEBIT
062082,000096: 5576 70001 MASK L # RESET BIT
062083,000097: 5577 15567 TCF COMFLAG
062084,000098:
062085,000099: 5600 65033 DEBIT AD ONE # GET DE BITS
062086,000100: 5601 00004 INHINT
062087,000101: 5602 54063 TS ITEMP3
062088,000102: 5603 35042 CA LOW4 # DEC15
062089,000103: 5604 54061 TS ITEMP1
062090,000104: 5605 50063 INDEX ITEMP3
062091,000105: 5606 27777 CA 0 -1 # ADRES
062092,000106: 5607 54001 TS L
062093,000107: 5610 35035 CA ZERO
062094,000108: 5611 00006 EXTEND
062095,000109: 5612 10061 DV ITEMP1 # A = FLAGWRD, L = (15 - BIT)
062096,000110: 5613 52062 DXCH ITEMP1
062097,000111: 5614 50061 INDEX ITEMP1
062098,000112: 5615 30074 CA FLAGWRD0
062099,000113: 5616 54001 TS L # CURRENT STATE
062100,000114: 5617 50062 INDEX ITEMP2
062101,000115: 5620 45015 CS BIT15 # -(15 - BIT)
062102,000116: 5621 00002 TC Q
062103,000117:
062104,000118: # DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
062105,000119:
062106,000120: # ENTRANCE REQUIREMENTS...
062107,000121: # CAF DT DELAY JOB FOR DT CENTISECS
062108,000122: # TC BANKCALL
062109,000123: # CADR DELAYJOB
062110,000124:
062111,000125: 06,3770 BANK 06
062112,000126: 00,2000 SETLOC DLAYJOB
062113,000127: 00,2000 BANK
062114,000128:
062115,000129: # THIS MUST REMAIN IN BANK 0 *****************************************
062116,000130:
062117,000131: 00,3732 COUNT 00/DELAY
062118,000132:
062119,000133: 00,3732 00004 DELAYJOB INHINT
062120,000134: 00,3733 54002 TS Q # STORE DELAY DT IN Q FOR DLY -1 IN
062121,000135: 00,3734 36214 CAF DELAYNUM # WAITLIST
062122,000136: 00,3735 54070 DELLOOP TS RUPTREG1
062123,000137: 00,3736 50000 INDEX A
062124,000138: 00,3737 31141 CA DELAYLOC # IS THIS DELAYLOC AVAILABLE
062125,000139: 00,3740 00006 EXTEND
062126,000140: 00,3741 13746 BZF OK2DELAY # YES
062127,000141:
062128,000142: 00,3742 10070 CCS RUPTREG1 # NO, TRY NEXT DELAYLOC
062129,000143: 00,3743 13735 TCF DELLOOP
062130,000144:
062131,000145: 00,3744 07755 TC BAILOUT # NO AVAILABLE LOCS AVAILABLE.
062132,000146: 00,3745 31104 OCT 31104
062133,000147:
062134,000148: 00,3746 33766 OK2DELAY CA TCSLEEP # SET WAITLIST IMMEDIATE RETURN
062135,000149: 00,3747 54061 TS WAITEXIT
062136,000150:
062137,000151: 00,3750 30004 CA FBANK
062138,000152: 00,3751 60070 AD RUPTREG1 # STORE BBANK FOR TASK CALL
062139,000153: 00,3752 54001 TS L
062140,000154:
062141,000155: 00,3753 33767 CAF WAKECAD # STORE CADR FOR TASK CALL
062142,000156: 00,3754 15271 TCF DLY2 -1 # DLY IS IN WAITLIST ROUTINE
062143,000157:
062144,000158: 00,3755 04725 TCGETCAD TC MAKECADR # GET CALLERS FCADR
062145,000159:
062146,000160: 00,3756 50070 INDEX RUPTREG1
062147,000161: 00,3757 55141 TS DELAYLOC # SAVE DELAY CADRS
062148,000162:
062149,000163: 00,3760 05211 TC JOBSLEEP
062150,000164:
062151,000165: 00,3761 35035 WAKER CAF ZERO
062152,000166: 00,3762 50006 INDEX BBANK
062153,000167: 00,3763 57141 XCH DELAYLOC # MAKE DELAYLOC AVAILABLE
062154,000168: 00,3764 05215 TC JOBWAKE
062155,000169:
062156,000170: 00,3765 05340 TC TASKOVER
062157,000171:
062158,000172: 00,3766 03753 TCSLEEP GENADR TCGETCAD -2
062159,000173: 00,3767 03761 WAKECAD GENADR WAKER
062160,000174:
062161,000175: # GENTRAN, A BLOCK TRANSFER ROUTINE.
062162,000176: # WRITTEN BY D. EYLES
062163,000177: # MOD 1 BY KERNAN UTILITYM REV 17 11/18/67
062164,000178: # MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
062165,000179:
062166,000180: # THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
062167,000181: # CONSECUTIVE ERASABLE LOCATIONS. IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
062168,000182:
062169,000183: # GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT. THE CALLING SEQUENCE IS:
062170,000184: # I CA N-1 # OF QUANTITIES MINUS ONE.
062171,000185: # I +1 TC GENTRAN IN FIXED-FIXED.
062172,000186: # I +2 ADRES L STARTING ADRES OF DATA TO BE MOVED.
062173,000187: # I +3 ADRES M STARTING ADRES OF DUPLICATION BLOCK.
062174,000188: # I +4 RETURNS HERE.
062175,000189:
062176,000190: # GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
062177,000191: # A, L AND ITEMP1 ARE NOT PRESERVED.
062178,000192:
062179,000193: 5622 BLOCK 02
062180,000194: 4000 SETLOC FFTAG4
062181,000195: 4000 BANK
062182,000196:
062183,000197: 5622 0061 EBANK= ITEMP1
062184,000198:
062185,000199: 5622 COUNT* $$/TRAN
062186,000200:
062187,000201: 5622 00004 GENTRAN INHINT
062188,000202: 5623 54061 TS ITEMP1 # SAVE N-1.
062189,000203: 5624 50002 INDEX Q # C(Q) = ADRES L.
062190,000204: 5625 60000 AD 0 # ADRES (L + N - 1).
062191,000205: 5626 50000 INDEX A
062192,000206: 5627 30000 CA 0 # C(ABOVE).
062193,000207: 5630 54001 TS L # SAVE DATA.
062194,000208: 5631 30061 CA ITEMP1
062195,000209: 5632 50002 INDEX Q
062196,000210: 5633 60001 AD 1 # ADRES (M + N - 1).
062197,000211: 5634 50000 INDEX A
062198,000212: 5635 22000 LXCH 0 # STUFF IT.
062199,000213: 5636 10061 CCS ITEMP1 # LOOP UNTIL N-1 = 0.
062200,000214: 5637 15623 TCF GENTRAN +1
062201,000215: 5640 16710 TCF Q+2 # RETURN TO CALLER.
062202,000216:
062203,000217: # B5OFF ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
062204,000218: # MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
062205,000219:
062206,000220: 5641 COUNT* $$/EXTVB
062207,000221:
062208,000222: 5641 45027 B5OFF CS BIT5
062209,000223: 5642 71044 MASK EXTVBACT
062210,000224: 5643 55044 TS EXTVBACT
062211,000225: 5644 05233 TC ENDOFJOB
062212,000226:
062213,000227: # SUBROUTINES TO TURN OFF AND TURN ON TRACKER FAIL LIGHT.
062214,000228:
062215,000229: 5645 00004 TRFAILOF INHINT
062216,000230: 5646 47704 CS OCT40200 # TURN OFF TRACKER LIGHT
062217,000231: 5647 71036 MASK DSPTAB +11D
062218,000232: 5650 65015 AD BIT15
062219,000233: 5651 55036 TS DSPTAB +11D
062220,000234: 5652 41331 CS OPTMODES # TO INSURE THAT OCDU FAIL WILL GO ON
062221,000235: 5653 75025 MASK BIT7 # AGAIN IF IT WAS ON IN ADDITION TO
062222,000236: 5654 27331 ADS OPTMODES # TRACKER FAIL.
062223,000237:
062224,000238: 5655 00003 REQ RELINT
062225,000239: 5656 00002 TC Q
062226,000240:
062227,000241: 5657 00004 TRFAILON INHINT
062228,000242: 5660 41036 CS DSPTAB +11D # TURN ON
062229,000243: 5661 77704 MASK OCT40200
062230,000244: 5662 27036 ADS DSPTAB +11D
062231,000245: 5663 15655 TCF REQ
062232,000246:
062233,000247:
062234,000248:
062235,000249:
End of include-file SERVICE_ROUTINES.agc. Parent file is MAIN.agc