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