Source Code
This source code is very close to the Apollo Guidance Computer software for the
Apollo 13 Lunar module. This revision of the Luminary 131 program is from December
of 1969, whereas there was a later revision in January of 1970, and still another
revision in February, which is the code that flew on the mission.
As far as this transcription is concerned, it was originally from a copy made in 1991 of
a printout from the collection of AGC developer Don Eyles for collector David Craig.
It was subsequently scanned by Gary Neff, reprocessed for online
presentation at the now-discontinued History of Recent Science and Technology (HRST) website
of MIT's Dibner Institute (the full-quality scans being discarded in the process),
and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a
high-quality replacement scan for a completely illegible page was later provided by Gary
Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many
errors to be introduced into the transcription. Accordingly, a second scan of the same physical
printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive,
and used to correct the transcription errors. All of the scanned materials mentioned,
as well as other Luminary 131 related material, are available online.
Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017,
so the two scans are not identical in that respect. The page-headings in the printout read, in part:GAP: ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091 17:53 DEC. 19, 1969Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together. |
042538,000002: ## Copyright: Public domain.
042539,000003: ## Filename: INTER-BANK_COMMUNICATION.agc
042540,000004: ## Purpose: A section of Luminary 1C, revision 131.
042541,000005: ## It is part of the source code for the Lunar Module's (LM)
042542,000006: ## Apollo Guidance Computer (AGC) for Apollo 13.
042543,000007: ## This file is intended to be a faithful transcription, except
042544,000008: ## that the code format has been changed to conform to the
042545,000009: ## requirements of the yaYUL assembler rather than the
042546,000010: ## original YUL assembler.
042547,000011: ## Reference: pp. 992-995
042548,000012: ## Contact: Ron Burkey <info@sandroid.org>.
042549,000013: ## Website: www.ibiblio.org/apollo/index.html
042550,000014: ## Mod history: 05/30/03 RSB. Began transcribing.
042551,000015: ## 05/14/05 RSB Corrected website reference above.
042552,000016: ## 2011-05-07 JL Removed workaround.
042553,000017: ## 2017-01-06 RSB Page numbers now agree with those on the
042554,000018: ## original hardcopy, as opposed to the PDF page
042555,000019: ## numbers in 1701.pdf.
042556,000020: ## 2017-02-26 RSB Proofed comment text using octopus/ProoferComments.
042557,000021: ## 2017-03-13 RSB Comment-text fixes noted in proofing Luminary 116.
042558,000022: ## 2017-03-17 RSB Comment-text fixes identified in diff'ing
042559,000023: ## Luminary 99 vs Comanche 55.
042560,000024: ## 2021-05-30 ABS ISWCALLL -> ISWCALL
042561,000025:
Page 992 |
042563,000027: # THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
042564,000028: # CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
042565,000029:
042566,000030: 4616 BLOCK 02
042567,000031: 4616 COUNT* $$/BANK
042568,000032: 4616 52134 BANKCALL DXCH BUF2 # SAVE INCOMING A,L.
042569,000033: 4617 50002 INDEX Q # PICK UP CADR.
042570,000034: 4620 30000 CA 0
042571,000035: 4621 24002 INCR Q # SO WE RETURN TO THE LOC. AFTER THE CADR.
042572,000036:
042573,000037: # SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
042574,000038:
042575,000039: 4622 54001 SWCALL TS L
042576,000040: 4623 22004 LXCH FBANK # SWITCH BANKS, SAVING RETURN.
042577,000041: 4624 75012 MASK LOW10 # GET SUB-ADDRESS OF CADR.
042578,000042: 4625 56002 XCH Q # A,L NOW CONTAINS DP RETURN.
042579,000043: 4626 52134 DXCH BUF2 # RESTORING INPUTS IF THIS IS A BANKCALL.
042580,000044: 4627 50002 INDEX Q
042581,000045: 4630 02000 TC 10000 # SETTING Q TO SWRETURN.
042582,000046:
042583,000047: 4631 56134 SWRETURN XCH BUF2 +1 # COMES HERE TO RETURN TO CALLER. C(A,L)
042584,000048: 4632 56004 XCH FBANK # ARE PRESERVED FOR RETURN.
042585,000049: 4633 56134 XCH BUF2 +1
042586,000050: 4634 00133 TC BUF2
042587,000051:
042588,000052: # THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
042589,000053: # FOLLOWING THE TC POSTJUMP INSTRUCTION.
042590,000054:
042591,000055: 4635 56002 POSTJUMP XCH Q # SAVE INCOMING C(A).
042592,000056: 4636 50000 INDEX A # GET CADR.
042593,000057: 4637 30000 CA 0
042594,000058:
042595,000059: # BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
042596,000060:
042597,000061: 4640 54004 BANKJUMP TS FBANK
042598,000062: 4641 75012 MASK LOW10
042599,000063: 4642 56002 XCH Q # RESTORING INPUT C(A) IF THIS WAS A
042600,000064: 4643 50002 Q+10000 INDEX Q # POSTJUMP.
042601,000065: 4644 12000 PRIO12 TCF 10000 # PRIO12 = TCF 10000 = 12000
042602,000066:
Page 993 |
042604,000068: # THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
042605,000069:
042606,000070: 4645 35012 MAKECADR CAF LOW10
042607,000071: 4646 70133 MASK BUF2
042608,000072: 4647 60134 AD BUF2 +1
042609,000073: 4650 00002 TC Q
042610,000074:
042611,000075: 4651 54135 SUPDACAL TS MPTEMP
042612,000076: 4652 56004 XCH FBANK # SET FBANK FOR DATA.
042613,000077: 4653 00006 EXTEND
042614,000078: 4654 04007 ROR SUPERBNK # SAVE FBANK IN BITS 15-11, AND
042615,000079: 4655 56135 XCH MPTEMP # SUPERBANK IN BITS 7-5.
042616,000080: 4656 75012 MASK LOW10
042617,000081: 4657 56001 XCH L # SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
042618,000082: 4660 00004 INHINT # BECAUSE RUPT DOES NOT SAVE SUPERBANK.
042619,000083: 4661 00006 EXTEND
042620,000084: 4662 01007 WRITE SUPERBNK # SET SUPERBANK FOR DATA.
042621,000085: 4663 50001 INDEX L
042622,000086: 4664 32000 CA 10000 # PINBALL (FIX MEM DISP) PREVENTS DCA HERE
042623,000087: 4665 56135 XCH MPTEMP # SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
042624,000088: 4666 00006 EXTEND
042625,000089: 4667 01007 WRITE SUPERBNK # RESTORE SUPERBANK.
042626,000090: 4670 00003 RELINT
042627,000091: 4671 54004 TS FBANK # RESTORE FBANK.
042628,000092: 4672 30135 CA MPTEMP # RECOVER FIRST WORD OF DATA.
042629,000093: 4673 00002 RETURN # 24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
042630,000094:
Page 994 |
042632,000096: # THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
042633,000097:
042634,000098: 4674 52073 IBNKCALL DXCH RUPTREG3 # USES RUPTREG3,4 FOR DP RETURN ADDRESS.
042635,000099: 4675 50002 INDEX Q
042636,000100: 4676 30000 CAF 0
042637,000101: 4677 24002 INCR Q
042638,000102:
042639,000103: 4700 54001 ISWCALL TS L
042640,000104: 4701 22004 LXCH FBANK
042641,000105: 4702 75012 MASK LOW10
042642,000106: 4703 56002 XCH Q
042643,000107: 4704 52073 DXCH RUPTREG3
042644,000108: 4705 50002 INDEX Q
042645,000109: 4706 02000 TC 10000
042646,000110:
042647,000111: 4707 56073 ISWRETRN XCH RUPTREG4
042648,000112: 4710 56004 XCH FBANK
042649,000113: 4711 56073 XCH RUPTREG4
042650,000114: 4712 00072 TC RUPTREG3
042651,000115:
042652,000116: # 2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
042653,000117: # L TC USPRCADR
042654,000118: # L+1 CADR INTPRETX INTPRETX IS THE INTERPRETIVE CODING
042655,000119: # RETURN IS TO L+2
042656,000120:
042657,000121: 4713 54164 USPRCADR TS LOC # SAVE A
042658,000122: 4714 34744 CA BIT8
042659,000123: 4715 54023 TS EDOP # EXIT INSTRUCTION TO EDOP
042660,000124: 4716 30006 CA BBANK
042661,000125: 4717 54165 TS BANKSET # USER'S BBANK TO BANKSET
042662,000126: 4720 50002 INDEX Q
042663,000127: 4721 30000 CA 0
042664,000128: 4722 54004 TS FBANK # INTERPRETIVE BANK TO FBANK
042665,000129: 4723 75012 MASK LOW10 # YIELDS INTERPRETIVE RELATIVE ADDRESS
042666,000130: 4724 56002 XCH Q # INTERPRETIVE ADDRESS TO Q, FETCHING L+1
042667,000131: 4725 56164 XCH LOC # L+1 TO LOC, RETRIEVING ORIGINAL A
042668,000132: 4726 14643 TCF Q+10000
042669,000133:
Page 995 |
042671,000135: # THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
042672,000136:
042673,000137: # PSEUDO-FIXED OCTAL PSEUDO
042674,000138: # SUPERBANK SETTING S-REG. VALUE BANK NUMBERS ADDRESSES
042675,000139: # ---------- ------- ------------ ------------ ------------
042676,000140: # SUPERBANK 3 0XX 2000 - 3777 30 - 37 70000 - 107777 (WHERE XX CAN BE ANYTHING AND
042677,000141: # WILL USUALLY BE SEEN AS 11)
042678,000142: # SUPERBANK 4 100 2000 - 3777 40 - 47 110000 - 127777 (AS FAR AS IT CAN BE SEEN,
042679,000143: # ONLY BANKS 40-43 WILL EVER BE
042680,000144: # AND ARE PRESENTLY AVAILABLE)
042681,000145: # SUPERBANK 5 101 2000 - 3777 50 - 57 130000 - 147777 (PRESENTLY NOT AVAILABLE TO
042682,000146: # THE USER)
042683,000147: # SUPERBANK 6 110 2000 - 3777 60 - 67 150000 - 167777 (PRESENTLY NOT AVAILABLE TO
042684,000148: # THE USER)
042685,000149: # *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27. I.E., NO PROGRAM LIVING IN ANY
042686,000150: # SUPERBANK SHOULD USE SUPERSW. ***
042687,000151:
042688,000152: # SUPERSW MAY BE CALLED IN THIS FASHION:
042689,000153: # CAF ABBCON WHERE -- ABBCON BBCON SOMETHIN --
042690,000154: # TCR SUPERSW (THE SUPERBNK BITS ARE IN THE BBCON)
042691,000155: # ... ...
042692,000156: # . .
042693,000157: # . .
042694,000158: # OR IN THIS FASHION:
042695,000159: # CAF SUPERSET WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
042696,000160: # TCR SUPERSW SUPERBANK BIT CONSTANTS:
042697,000161: # ... ... SUPER011 OCTAL 60
042698,000162: # . . SUPER100 OCTAL 100
042699,000163: # . . SUPER101 OCTAL 120
042700,000164: # SUPER110 OCTAL 140
042701,000165:
042702,000166: 4727 00006 SUPERSW EXTEND
042703,000167: 4730 01007 WRITE SUPERBNK # WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
042704,000168: # CHANNEL 07
042705,000169: 4731 00002 TC Q # TC TO INSTRUCTION FOLLOWING
042706,000170: # TC SUPERSW
042707,000171:
End of include-file INTER-BANK_COMMUNICATION.agc. Parent file is MAIN.agc