Source Code
This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release
of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97.
A bug (which had been around since at least Apollo 10, Luminary 69) was
discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute
revision into Rev 1,
which is what actually flew rather than
the Rev 0 presented here. A hardcopy of Rev 0 is known to
exist — it belonged to AGC developer Allan Klumpp for many years — but
unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus
the code you see here had been reconstructed (we believe accurately) rather than
transcribed. The first step of the reconstruction of the Rev 0 source code was
the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection.
The process of reverting the active portion of the source code (i.e., other than
program comments) from Rev 1 to Rev 0 was very minor, consisting
only of moving the position of the STARTSB1 label in
FRESH START AND RESTART. Allan had previously given
us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums
identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read,
in part:GAP: ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051 A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here. |
044334,000002: ## Copyright: Public domain.
044335,000003: ## Filename: INTER-BANK_COMMUNICATION.agc
044336,000004: ## Purpose: Part of the reconstructed source code for LMY99 Rev 0,
044337,000005: ## otherwise known as Luminary Rev 99, the third release
044338,000006: ## of the Apollo Guidance Computer (AGC) software for Apollo 11.
044339,000007: ## It differs from LMY99 Rev 1 (the flown version) only in the
044340,000008: ## placement of a single label. The corrections shown here have
044341,000009: ## been verified to have the same bank checksums as AGC developer
044342,000010: ## Allan Klumpp's copy of Luminary Rev 99, and so are believed
044343,000011: ## to be accurate. This file is intended to be a faithful
044344,000012: ## recreation, except that the code format has been changed to
044345,000013: ## conform to the requirements of the yaYUL assembler rather than
044346,000014: ## the original YUL assembler.
044347,000015: ##
044348,000016: ## Assembler: yaYUL
044349,000017: ## Contact: Ron Burkey <info@sandroid.org>.
044350,000018: ## Website: www.ibiblio.org/apollo.
044351,000019: ## Pages: 998-1001
044352,000020: ## Mod history: 2009-05-24 RSB Adapted from the corresponding
044353,000021: ## Luminary131 file, using page
044354,000022: ## images from Luminary 1A.
044355,000023: ## 2011-05-08 JL Removed workaround.
044356,000024: ## 2016-12-17 RSB Proofed text comments with octopus/ProoferComments
044357,000025: ## and corrected the errors found.
044358,000026: ## 2017-03-13 RSB Comment-text fixes noted in proofing Luminary 116.
044359,000027: ## 2017-03-17 RSB Comment-text fixes identified in diff'ing
044360,000028: ## Luminary 99 vs Comanche 55.
044361,000029: ## 2017-08-01 MAS Created from LMY99 Rev 1.
044362,000030: ## 2021-05-30 ABS ISWCALLL -> ISWCALL
044363,000031:
044364,000032: ## This source code has been transcribed or otherwise adapted from
044365,000033: ## digitized images of a hardcopy from the MIT Museum. The digitization
044366,000034: ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
044367,000035: ## the Museum. Many thanks to both. The images (with suitable reduction
044368,000036: ## in storage size and consequent reduction in image quality as well) are
044369,000037: ## available online at www.ibiblio.org/apollo. If for some reason you
044370,000038: ## find that the images are illegible, contact me at info@sandroid.org
044371,000039: ## about getting access to the (much) higher-quality images which Paul
044372,000040: ## actually created.
044373,000041: ##
044374,000042: ## The code has been modified to match LMY99 Revision 0, otherwise
044375,000043: ## known as Luminary Revision 99, the Apollo 11 software release preceeding
044376,000044: ## the listing from which it was transcribed. It has been verified to
044377,000045: ## contain the same bank checksums as AGC developer Allan Klumpp's listing
044378,000046: ## of Luminary Revision 99 (for which we do not have scans).
044379,000047: ##
044380,000048: ## Notations on Allan Klumpp's listing read, in part:
044381,000049: ##
044382,000050: ## ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
044383,000051:
Page 998 |
044385,000053: # THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
044386,000054: # CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
044387,000055:
044388,000056: 4616 BLOCK 02
044389,000057: 4616 COUNT* $$/BANK
044390,000058: 4616 52134 BANKCALL DXCH BUF2 # SAVE INCOMING A,L.
044391,000059: 4617 50002 INDEX Q # PICK UP CADR.
044392,000060: 4620 30000 CA 0
044393,000061: 4621 24002 INCR Q # SO WE RETURN TO THE LOC. AFTER THE CADR.
044394,000062:
044395,000063: # SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
044396,000064:
044397,000065: 4622 54001 SWCALL TS L
044398,000066: 4623 22004 LXCH FBANK # SWITCH BANKS, SAVING RETURN.
044399,000067: 4624 75012 MASK LOW10 # GET SUB-ADDRESS OF CADR.
044400,000068: 4625 56002 XCH Q # A,L NOW CONTAINS DP RETURN.
044401,000069: 4626 52134 DXCH BUF2 # RESTORING INPUTS IF THIS IS A BANKCALL.
044402,000070: 4627 50002 INDEX Q
044403,000071: 4630 02000 TC 10000 # SETTING Q TO SWRETURN.
044404,000072:
044405,000073: 4631 56134 SWRETURN XCH BUF2 +1 # COMES HERE TO RETURN TO CALLER. C(A,L)
044406,000074: 4632 56004 XCH FBANK # ARE PRESERVED FOR RETURN.
044407,000075: 4633 56134 XCH BUF2 +1
044408,000076: 4634 00133 TC BUF2
044409,000077:
044410,000078: # THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
044411,000079: # FOLLOWING THE TC POSTJUMP INSTRUCTION.
044412,000080:
044413,000081: 4635 56002 POSTJUMP XCH Q # SAVE INCOMING C(A).
044414,000082: 4636 50000 INDEX A # GET CADR.
044415,000083: 4637 30000 CA 0
044416,000084:
044417,000085: # BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
044418,000086:
044419,000087: 4640 54004 BANKJUMP TS FBANK
044420,000088: 4641 75012 MASK LOW10
044421,000089: 4642 56002 XCH Q # RESTORING INPUT C(A) IF THIS WAS A
044422,000090: 4643 50002 Q+10000 INDEX Q # POSTJUMP.
044423,000091: 4644 12000 PRIO12 TCF 10000 # PRIO12 = TCF 10000 = 12000
044424,000092:
Page 999 |
044426,000094: # THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
044427,000095:
044428,000096: 4645 35012 MAKECADR CAF LOW10
044429,000097: 4646 70133 MASK BUF2
044430,000098: 4647 60134 AD BUF2 +1
044431,000099: 4650 00002 TC Q
044432,000100:
044433,000101: 4651 54135 SUPDACAL TS MPTEMP
044434,000102: 4652 56004 XCH FBANK # SET FBANK FOR DATA.
044435,000103: 4653 00006 EXTEND
044436,000104: 4654 04007 ROR SUPERBNK # SAVE FBANK IN BITS 15-11, AND
044437,000105: 4655 56135 XCH MPTEMP # SUPERBANK IN BITS 7-5.
044438,000106: 4656 75012 MASK LOW10
044439,000107: 4657 56001 XCH L # SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
044440,000108: 4660 00004 INHINT # BECAUSE RUPT DOES NOT SAVE SUPERBANK.
044441,000109: 4661 00006 EXTEND
044442,000110: 4662 01007 WRITE SUPERBNK # SET SUPERBANK FOR DATA.
044443,000111: 4663 50001 INDEX L
044444,000112: 4664 32000 CA 10000 # PINBALL (FIX MEM DISP) PREVENTS DCA HERE
044445,000113: 4665 56135 XCH MPTEMP # SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
044446,000114: 4666 00006 EXTEND
044447,000115: 4667 01007 WRITE SUPERBNK # RESTORE SUPERBANK.
044448,000116: 4670 00003 RELINT
044449,000117: 4671 54004 TS FBANK # RESTORE FBANK.
044450,000118: 4672 30135 CA MPTEMP # RECOVER FIRST WORD OF DATA.
044451,000119: 4673 00002 RETURN # 24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
044452,000120:
Page 1000 |
044454,000122: # THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
044455,000123:
044456,000124: 4674 52073 IBNKCALL DXCH RUPTREG3 # USES RUPTREG3,4 FOR DP RETURN ADDRESS.
044457,000125: 4675 50002 INDEX Q
044458,000126: 4676 30000 CAF 0
044459,000127: 4677 24002 INCR Q
044460,000128:
044461,000129: 4700 54001 ISWCALL TS L
044462,000130: 4701 22004 LXCH FBANK
044463,000131: 4702 75012 MASK LOW10
044464,000132: 4703 56002 XCH Q
044465,000133: 4704 52073 DXCH RUPTREG3
044466,000134: 4705 50002 INDEX Q
044467,000135: 4706 02000 TC 10000
044468,000136:
044469,000137: 4707 56073 ISWRETRN XCH RUPTREG4
044470,000138: 4710 56004 XCH FBANK
044471,000139: 4711 56073 XCH RUPTREG4
044472,000140: 4712 00072 TC RUPTREG3
044473,000141:
044474,000142: # 2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
044475,000143: # L TC USPRCADR
044476,000144: # L+1 CADR INTPRETX INTPRETX IS THE INTERPRETIVE CODING
044477,000145: # RETURN IS TO L+2
044478,000146:
044479,000147: 4713 54164 USPRCADR TS LOC # SAVE A
044480,000148: 4714 34744 CA BIT8
044481,000149: 4715 54023 TS EDOP # EXIT INSTRUCTION TO EDOP
044482,000150: 4716 30006 CA BBANK
044483,000151: 4717 54165 TS BANKSET # USER'S BBANK TO BANKSET
044484,000152: 4720 50002 INDEX Q
044485,000153: 4721 30000 CA 0
044486,000154: 4722 54004 TS FBANK # INTERPRETIVE BANK TO FBANK
044487,000155: 4723 75012 MASK LOW10 # YIELDS INTERPRETIVE RELATIVE ADDRESS
044488,000156: 4724 56002 XCH Q # INTERPRETIVE ADDRESS TO Q, FETCHING L+1
044489,000157: 4725 56164 XCH LOC # L+1 TO LOC, RETRIEVING ORIGINAL A
044490,000158: 4726 14643 TCF Q+10000
044491,000159:
Page 1001 |
044493,000161: # THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
044494,000162:
044495,000163: # PSEUDO-FIXED OCTAL PSEUDO
044496,000164: # SUPERBANK SETTING S-REG. VALUE BANK NUMBERS ADDRESSES
044497,000165: # ---------- ------- ------------ ------------ ------------
044498,000166: # SUPERBANK 3 0XX 2000 - 3777 30 - 37 70000 - 107777 (WHERE XX CAN BE ANYTHING AND
044499,000167: # WILL USUALLY BE SEEN AS 11)
044500,000168: # SUPERBANK 4 100 2000 - 3777 40 - 47 110000 - 127777 (AS FAR AS IT CAN BE SEEN,
044501,000169: # ONLY BANKS 40-43 WILL EVER BE
044502,000170: # AND ARE PRESENTLY AVAILABLE)
044503,000171: # SUPERBANK 5 101 2000 - 3777 50 - 57 130000 - 147777 (PRESENTLY NOT AVAILABLE TO
044504,000172: # THE USER)
044505,000173: # SUPERBANK 6 110 2000 - 3777 60 - 67 150000 - 167777 (PRESENTLY NOT AVAILABLE TO
044506,000174: # THE USER)
044507,000175: # *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27. I.E., NO PROGRAM LIVING IN ANY
044508,000176: # SUPERBANK SHOULD USE SUPERSW. ***
044509,000177:
044510,000178: # SUPERSW MAY BE CALLED IN THIS FASHION:
044511,000179: # CAF ABBCON WHERE -- ABBCON BBCON SOMETHIN --
044512,000180: # TCR SUPERSW (THE SUPERBNK BITS ARE IN THE BBCON)
044513,000181: # ... ...
044514,000182: # . .
044515,000183: # . .
044516,000184: # OR IN THIS FASHION:
044517,000185: # CAF SUPERSET WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
044518,000186: # TCR SUPERSW SUPERBANK BIT CONSTANTS:
044519,000187: # ... ... SUPER011 OCTAL 60
044520,000188: # . . SUPER100 OCTAL 100
044521,000189: # . . SUPER101 OCTAL 120
044522,000190: # SUPER110 OCTAL 140
044523,000191:
044524,000192: 4727 00006 SUPERSW EXTEND
044525,000193: 4730 01007 WRITE SUPERBNK # WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
044526,000194: # CHANNEL 07
044527,000195: 4731 00002 TC Q # TC TO INSTRUCTION FOLLOWING
044528,000196: # TC SUPERSW
044529,000197:
End of include-file INTER-BANK_COMMUNICATION.agc. Parent file is MAIN.agc