Source Code
These source code files are a reconstruction of Sundance, the Apollo 9 LM (Lunar Module) AGC
(Apollo Guidance Computer) flight software, created from binary dumps of original core rope
program modules, as follows:
Since only binary dumps (rather than listings) of Sundance 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. |
053974,000002: ## Copyright: Public domain.
053975,000003: ## Filename: SERVICE_ROUTINES.agc
053976,000004: ## Purpose: A section of a reconstructed, mixed version of Sundance
053977,000005: ## It is part of the reconstructed source code for the Lunar
053978,000006: ## Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
053979,000007: ## No original listings of this program are available;
053980,000008: ## instead, this file was created via disassembly of dumps
053981,000009: ## of various revisions of Sundance core rope modules.
053982,000010: ## Assembler: yaYUL
053983,000011: ## Contact: Ron Burkey <info@sandroid.org>.
053984,000012: ## Website: www.ibiblio.org/apollo/index.html
053985,000013: ## Mod history: 2020-06-17 MAS Created from Luminary 69.
053986,000014:
053987,000015: ## Sundance 292
053988,000016:
053989,000017: 7722 BLOCK 3
053990,000018: 6000 SETLOC FFTAG6
053991,000019: 6000 BANK
053992,000020: 7722 COUNT* $$/FLAG
053993,000021:
053994,000022: 7722 50002 -2 INDEX Q
053995,000023: 7723 30000 CA 0
053996,000024: 7724 54001 UPENT2 TS L # WHICH FLAGWORD IS IT
053997,000025: 7725 75032 MASK OCT7
053998,000026: 7726 56001 XCH L # SAVE IN L FOR INDEXING
053999,000027:
054000,000028: 7727 77716 MASK OCT77770 # OBTAIN THE BIT INFORMATION
054001,000029: 7730 00004 INHINT # PREVENT INTERUPTS
054002,000030: 7731 54061 TS ITEMP1 # STORE THE BIT INFORMATION TEMPORARIALY
054003,000031:
054004,000032: 7732 50001 NDX L
054005,000033: 7733 40074 CS FLAGWRD0
054006,000034: 7734 70061 MASK ITEMP1
054007,000035: 7735 50001 NDX L
054008,000036: 7736 26074 ADS FLAGWRD0
054009,000037: 7737 00003 RELINT # RELEASE INTERUPT INHIBIT
054010,000038:
054011,000039: 7740 24002 INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
054012,000040: 7741 00002 TC Q # RETURN
054013,000041:
054014,000042: 7742 50002 -2 INDEX Q
054015,000043: 7743 30000 CA 0
054016,000044: 7744 54001 DOWNENT2 TS L # WHICH FLAGWORD IS IT
054017,000045: 7745 75032 MASK OCT7
054018,000046: 7746 56001 XCH L # SAVE IN L FOR INDEXING
054019,000047:
054020,000048: 7747 77716 MASK OCT77770 # OBTAIN THE BIT INFORMATION
054021,000049: 7750 40000 COM # START TO PROCESS THE INFORMATION
054022,000050:
054023,000051: 7751 00004 INHINT # PREVENT INTERUPTS
054024,000052: 7752 50001 NDX L
054025,000053: 7753 70074 MASK FLAGWRD0
054026,000054: 7754 50001 NDX L
054027,000055: 7755 54074 TS FLAGWRD0
054028,000056: 7756 00003 RELINT # RELEASE INTERUPT INHIBIT
054029,000057:
054030,000058: 7757 24002 INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
054031,000059: 7760 00002 TC Q # RETURN
054032,000060:
054033,000061: 7761 5032 OCT7 EQUALS SEVEN
054034,000062:
054035,000063: # UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES. USING THEM, WHETHER OR
054036,000064: # NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
054037,000065: # EBANK SETTING. A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
054038,000066: # ASSEMBLER.
054039,000067:
054040,000068: # AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS. ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
054041,000069: # NAME ANY BIT IN ERASABLE MEMORY.
054042,000070:
054043,000071: # CALLING SEQUENCES ARE AS FOLLOWS :-
054044,000072: # TC UPFLAG TC DOWNFLAG
054045,000073: # ADRES NAME OF FLAG ADRES NAME OF FLAG
054046,000074:
054047,000075: # RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
054048,000076:
054049,000077: # UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
054050,000078:
054051,000079: 5563 BLOCK 02
054052,000080: 4000 SETLOC FFTAG1
054053,000081: 4000 BANK
054054,000082: 5563 COUNT* $$/FLAG
054055,000083:
054056,000084: 5563 30002 UPFLAG CA Q
054057,000085: 5564 05601 TC DEBIT
054058,000086: 5565 40000 COM # +(15 - BIT)
054059,000087: 5566 00006 EXTEND
054060,000088: 5567 04001 ROR LCHAN # SET BIT
054061,000089: 5570 50061 COMFLAG INDEX ITEMP1
054062,000090: 5571 54074 TS FLAGWRD0
054063,000091: 5572 22063 LXCH ITEMP3
054064,000092: 5573 00003 RELINT
054065,000093: 5574 00001 TC L
054066,000094:
054067,000095: 5575 30002 DOWNFLAG CA Q
054068,000096: 5576 05601 TC DEBIT
054069,000097: 5577 70001 MASK L # RESET BIT
054070,000098: 5600 15570 TCF COMFLAG
054071,000099:
054072,000100: 5601 65026 DEBIT AD ONE # GET DE BITS
054073,000101: 5602 00004 INHINT
054074,000102: 5603 54063 TS ITEMP3
054075,000103: 5604 35035 CA LOW4 # DEC15
054076,000104: 5605 54061 TS ITEMP1
054077,000105: 5606 50063 INDEX ITEMP3
054078,000106: 5607 27777 CA 0 -1 # ADRES
054079,000107: 5610 54001 TS L
054080,000108: 5611 35030 CA ZERO
054081,000109: 5612 00006 EXTEND
054082,000110: 5613 10061 DV ITEMP1 # A = FLAGWRD, L = (15 - BIT)
054083,000111: 5614 52062 DXCH ITEMP1
054084,000112: 5615 50061 INDEX ITEMP1
054085,000113: 5616 30074 CA FLAGWRD0
054086,000114: 5617 54001 TS L # CURRENT STATE
054087,000115: 5620 50062 INDEX ITEMP2
054088,000116: 5621 45010 CS BIT15 # -(15 - BIT)
054089,000117: 5622 00002 TC Q
054090,000118:
054091,000119: # DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
054092,000120:
054093,000121: # ENTRANCE REQUIREMENTS ...
054094,000122: # CAF DT DELAY JOB FOR DT CENTISECS
054095,000123: # TC BANKCALL
054096,000124: # CADR DELAYJOB
054097,000125:
054098,000126: 06,3712 BANK 06
054099,000127: 00,2000 SETLOC DLAYJOB
054100,000128: 00,2000 BANK
054101,000129:
054102,000130: # THIS MUST REMAIN IN BANK 0 *****************************************
054103,000131:
054104,000132: 00,3730 COUNT* $$/DELAY
054105,000133: 00,3730 00004 DELAYJOB INHINT
054106,000134: 00,3731 54002 TS Q # STORE DELAY DT IN Q FOR DLY -1 IN
054107,000135:
054108,000136: 00,3732 35025 CAF DELAYNUM # WAITLIST
054109,000137: 00,3733 54070 DELLOOP TS RUPTREG1
054110,000138: 00,3734 50000 INDEX A
054111,000139: 00,3735 31332 CA DELAYLOC # IS THIS DELAYLOC AVAILABLE
054112,000140: 00,3736 00006 EXTEND
054113,000141: 00,3737 13744 BZF OK2DELAY # YES
054114,000142:
054115,000143: 00,3740 10070 CCS RUPTREG1 # NO, TRY NEXT DELAYLOC
054116,000144: 00,3741 13733 TCF DELLOOP
054117,000145:
054118,000146: 00,3742 05713 TC ABORT # NO AVAILABLE LOCS.
054119,000147: 00,3743 01104 OCT 1104
054120,000148:
054121,000149: 00,3744 33764 OK2DELAY CA TCSLEEP # SET WAITLIST IMMEDIATE RETURN
054122,000150: 00,3745 54061 TS WAITEXIT
054123,000151:
054124,000152: 00,3746 30004 CA FBANK
054125,000153: 00,3747 60070 AD RUPTREG1 # STORE BBANK FOR TASK CALL
054126,000154: 00,3750 54001 TS L
054127,000155:
054128,000156: 00,3751 33765 CAF WAKECAD # STORE CADR FOR TASK CALL
054129,000157: 00,3752 15260 TCF DLY2 -1 # DLY IS IN WAITLIST ROUTINE
054130,000158:
054131,000159: 00,3753 04704 TCGETCAD TC MAKECADR # GET CALLERS FCADR
054132,000160:
054133,000161: 00,3754 50070 INDEX RUPTREG1
054134,000162: 00,3755 55332 TS DELAYLOC # SAVE DELAY CADRS
054135,000163:
054136,000164: 00,3756 05203 TC JOBSLEEP
054137,000165:
054138,000166: 00,3757 35030 WAKER CAF ZERO
054139,000167: 00,3760 50006 INDEX BBANK
054140,000168: 00,3761 57332 XCH DELAYLOC # MAKE DELAYLOC AVAILABLE
054141,000169: 00,3762 05207 TC JOBWAKE
054142,000170:
054143,000171: 00,3763 05321 TC TASKOVER
054144,000172:
054145,000173: 00,3764 03751 TCSLEEP GENADR TCGETCAD -2
054146,000174: 00,3765 03757 WAKECAD GENADR WAKER
054147,000175:
054148,000176: # GENTRAN, A BLOCK TRANSFER ROUTINE.
054149,000177:
054150,000178: # WRITTEN BY D. EYLES
054151,000179: # MOD 1 BY KERNAN UTILITYM REV 17 11/18/67
054152,000180:
054153,000181: # MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
054154,000182:
054155,000183: # THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
054156,000184: # CONSECUTIVE ERASABLE LOCATIONS. IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
054157,000185:
054158,000186: # GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT. THE CALLING SEQUENCE IS:
054159,000187: # I CA N-1 # OF QUANTITIES MINUS ONE.
054160,000188: # I +1 TC GENTRAN IN FIXED-FIXED.
054161,000189: # I +2 ADRES L STARTING ADRES OF DATA TO BE MOVED.
054162,000190: # I +3 ADRES M STARTING ADRES OF DUPLICATION BLOCK.
054163,000191: # I +4 RETURNS HERE.
054164,000192:
054165,000193: # GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
054166,000194: # A, L AND ITEMP1 ARE NOT PRESERVED.
054167,000195:
054168,000196: 5623 BLOCK 02
054169,000197: 4000 SETLOC FFTAG4
054170,000198: 4000 BANK
054171,000199:
054172,000200: 5623 0061 EBANK= ITEMP1
054173,000201:
054174,000202: 5623 COUNT* $$/TRAN
054175,000203:
054176,000204: 5623 00004 GENTRAN INHINT
054177,000205: 5624 54061 TS ITEMP1 # SAVE N-1.
054178,000206: 5625 50002 INDEX Q # C(Q) = ADRES L.
054179,000207: 5626 60000 AD 0 # ADRES (L + N - 1).
054180,000208: 5627 50000 INDEX A
054181,000209: 5630 30000 CA 0 # C(ABOVE).
054182,000210: 5631 54001 TS L # SAVE DATA.
054183,000211: 5632 30061 CA ITEMP1
054184,000212: 5633 50002 INDEX Q
054185,000213: 5634 60001 AD 1 # ADRES (M + N - 1).
054186,000214: 5635 50000 INDEX A
054187,000215: 5636 22000 LXCH 0 # STUFF IT.
054188,000216: 5637 10061 CCS ITEMP1 # LOOP UNTIL N-1 = 0.
054189,000217: 5640 15624 TCF GENTRAN +1
054190,000218: 5641 16715 TCF Q+2 # RETURN TO CALLER.
054191,000219:
054192,000220: # B5OFF ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
054193,000221: # MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
054194,000222:
054195,000223: 5642 COUNT* $$/EXTVB
054196,000224:
054197,000225: 5642 45022 B5OFF CS BIT5
054198,000226: 5643 71045 MASK EXTVBACT
054199,000227: 5644 55045 TS EXTVBACT
054200,000228: 5645 05225 TC ENDOFJOB
054201,000229:
The following function, which assembles to address 7766, was added in Sundance 302. Unfortunately, we only have revision 292 of this bank. We have not yet figured out what it does, but it is only called from extended verbs and so likely either does something with EXTVBACT or marks. Until we determine its purpose, it is equated to TCQ to allow it to perform no function. |
054206,000234: 5646 6716 UNK7766 EQUALS TCQ
End of include-file SERVICE_ROUTINES.agc. Parent file is MAIN.agc