Source Code
These source-code files derive from a printout of Luminary 116 (the Apollo 12
Lunar Module guidance computer program), from the personal library of
original AGC developer Don Eyles, digitally photographed at archive.org,
financially sponsored by Ron Burkey, and transcribed to source code by a
team of volunteers. This colorized, syntax-highlighted form was created
by assembling that transcribed source code. Note that the full page images
are available on the
Virtual AGC project page at archive.org, while reduced-size images
are presented at the VirtualAGC project website. Report or fix any
transcription errors at
the Virtual AGC project code repository. Notations on the program listing read, in part: GAP: ASSEMBLE REVISION 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071 19:09 AUG. 11,1969Note that the date is the date of the printout, not the date of the program revision. |
042742,000002: ## Copyright: Public domain.
042743,000003: ## Filename: INTER-BANK_COMMUNICATION.agc
042744,000004: ## Purpose: A section of Luminary revision 116.
042745,000005: ## It is part of the source code for the Lunar Module's (LM)
042746,000006: ## Apollo Guidance Computer (AGC) for Apollo 12.
042747,000007: ## This file is intended to be a faithful transcription, except
042748,000008: ## that the code format has been changed to conform to the
042749,000009: ## requirements of the yaYUL assembler rather than the
042750,000010: ## original YUL assembler.
042751,000011: ## Reference: pp. 990-993
042752,000012: ## Assembler: yaYUL
042753,000013: ## Contact: Ron Burkey <info@sandroid.org>.
042754,000014: ## Website: www.ibiblio.org/apollo/index.html
042755,000015: ## Mod history: 2017-01-22 MAS Created from Luminary 99.
042756,000016: ## 2017-01-30 RRB Updated for Luminary 116.
042757,000017: ## 2017-03-13 RSB Proofed comment text via 3-way diff vs
042758,000018: ## Luminary 99 and 131.
042759,000019: ## 2017-03-17 RSB Comment-text fixes identified in diff'ing
042760,000020: ## Luminary 99 vs Comanche 55.
042761,000021: ## 2021-05-30 ABS ISWCALLL -> ISWCALL
042762,000022:
Page 990 |
042764,000024: # THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
042765,000025: # CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
042766,000026:
042767,000027: 4616 BLOCK 02
042768,000028: 4616 COUNT* $$/BANK
042769,000029: 4616 52134 BANKCALL DXCH BUF2 # SAVE INCOMING A,L.
042770,000030: 4617 50002 INDEX Q # PICK UP CADR.
042771,000031: 4620 30000 CA 0
042772,000032: 4621 24002 INCR Q # SO WE RETURN TO THE LOC. AFTER THE CADR.
042773,000033:
042774,000034: # SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
042775,000035:
042776,000036: 4622 54001 SWCALL TS L
042777,000037: 4623 22004 LXCH FBANK # SWITCH BANKS, SAVING RETURN.
042778,000038: 4624 75012 MASK LOW10 # GET SUB-ADDRESS OF CADR.
042779,000039: 4625 56002 XCH Q # A,L NOW CONTAINS DP RETURN.
042780,000040: 4626 52134 DXCH BUF2 # RESTORING INPUTS IF THIS IS A BANKCALL.
042781,000041: 4627 50002 INDEX Q
042782,000042: 4630 02000 TC 10000 # SETTING Q TO SWRETURN.
042783,000043:
042784,000044: 4631 56134 SWRETURN XCH BUF2 +1 # COMES HERE TO RETURN TO CALLER. C(A,L)
042785,000045: 4632 56004 XCH FBANK # ARE PRESERVED FOR RETURN.
042786,000046: 4633 56134 XCH BUF2 +1
042787,000047: 4634 00133 TC BUF2
042788,000048:
042789,000049: # THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
042790,000050: # FOLLOWING THE TC POSTJUMP INSTRUCTION.
042791,000051:
042792,000052: 4635 56002 POSTJUMP XCH Q # SAVE INCOMING C(A).
042793,000053: 4636 50000 INDEX A # GET CADR.
042794,000054: 4637 30000 CA 0
042795,000055:
042796,000056: # BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
042797,000057:
042798,000058: 4640 54004 BANKJUMP TS FBANK
042799,000059: 4641 75012 MASK LOW10
042800,000060: 4642 56002 XCH Q # RESTORING INPUT C(A) IF THIS WAS A
042801,000061: 4643 50002 Q+10000 INDEX Q # POSTJUMP.
042802,000062: 4644 12000 PRIO12 TCF 10000 # PRIO12 = TCF 10000 = 12000
042803,000063:
Page 991 |
042805,000065: # THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
042806,000066:
042807,000067: 4645 35012 MAKECADR CAF LOW10
042808,000068: 4646 70133 MASK BUF2
042809,000069: 4647 60134 AD BUF2 +1
042810,000070: 4650 00002 TC Q
042811,000071:
042812,000072: 4651 54135 SUPDACAL TS MPTEMP
042813,000073: 4652 56004 XCH FBANK # SET FBANK FOR DATA.
042814,000074: 4653 00006 EXTEND
042815,000075: 4654 04007 ROR SUPERBNK # SAVE FBANK IN BITS 15-11, AND
042816,000076: 4655 56135 XCH MPTEMP # S UPERBANK IN BITS 7-5.
042817,000077: 4656 75012 MASK LOW10
042818,000078: 4657 56001 XCH L # SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
042819,000079: 4660 00004 INHINT # BECAUSE RUPT DOES NOT SAVE SUPERBANK.
042820,000080: 4661 00006 EXTEND
042821,000081: 4662 01007 WRITE SUPERBNK # SET SUPERBANK FOR DATA.
042822,000082: 4663 50001 INDEX L
042823,000083: 4664 32000 CA 10000 # PINBALL (FIX MEM DISP) PREVENTS DCA HERE
042824,000084: 4665 56135 XCH MPTEMP # SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
042825,000085: 4666 00006 EXTEND
042826,000086: 4667 01007 WRITE SUPERBNK # RESTORE SUPERBANK.
042827,000087: 4670 00003 RELINT
042828,000088: 4671 54004 TS FBANK # RESTORE FBANK.
042829,000089: 4672 30135 CA MPTEMP # RECOVER FIRST WORD OF DATA.
042830,000090: 4673 00002 RETURN # 24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
042831,000091:
Page 992 |
042833,000093: # THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
042834,000094:
042835,000095: 4674 52073 IBNKCALL DXCH RUPTREG3 # USES RUPTREG3,4 FOR DP RETURN ADDRESS.
042836,000096: 4675 50002 INDEX Q
042837,000097: 4676 30000 CAF 0
042838,000098: 4677 24002 INCR Q
042839,000099:
042840,000100: 4700 54001 ISWCALL TS L
042841,000101: 4701 22004 LXCH FBANK
042842,000102: 4702 75012 MASK LOW10
042843,000103: 4703 56002 XCH Q
042844,000104: 4704 52073 DXCH RUPTREG3
042845,000105: 4705 50002 INDEX Q
042846,000106: 4706 02000 TC 10000
042847,000107:
042848,000108: 4707 56073 ISWRETRN XCH RUPTREG4
042849,000109: 4710 56004 XCH FBANK
042850,000110: 4711 56073 XCH RUPTREG4
042851,000111: 4712 00072 TC RUPTREG3
042852,000112:
042853,000113: # 2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
042854,000114:
042855,000115: # L TC USPRCADR
042856,000116: # L+1 CADR INTPRETX INTPRETX IS THE INTERPRETIVE CODING
042857,000117: # RETURN IS TO L+2
042858,000118:
042859,000119: 4713 54164 USPRCADR TS LOC # SAVE A
042860,000120: 4714 34744 CA BIT8
042861,000121: 4715 54023 TS EDOP # EXIT INSTRUCTION TO EDOP
042862,000122: 4716 30006 CA BBANK
042863,000123: 4717 54165 TS BANKSET # USER'S BBANK TO BANKSET
042864,000124: 4720 50002 INDEX Q
042865,000125: 4721 30000 CA 0
042866,000126: 4722 54004 TS FBANK # INTERPRETIVE BANK TO FBANK
042867,000127: 4723 75012 MASK LOW10 # YIELDS INTERPRETIVE RELATIVE ADDRESS
042868,000128: 4724 56002 XCH Q # INTERPRETIVE ADDRESS TO Q, FETCHING L+1
042869,000129: 4725 56164 XCH LOC # L+1 TO LOC, RETRIEVING ORIGINAL A
042870,000130: 4726 14643 TCF Q+10000
042871,000131:
Page 993 |
042873,000133: # THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
042874,000134:
042875,000135: # PSEUDO-FIXED OCTAL PSEUDO
042876,000136: # SUPERBANK SETTING S-REG. VALUE BANK NUMBERS ADDRESSES
042877,000137: # ---------- ------- ------------ ------------ ------------
042878,000138: # SUPERBANK 3 0XX 2000 - 3777 30 - 37 70000 - 107777 (WHERE XX CAN BE ANYTHING AND
042879,000139: # WILL USUALLY BE SEEN AS 11)
042880,000140: # SUPERBANK 4 100 2000 - 3777 40 - 47 110000 - 127777 (AS FAR AS IT CAN BE SEEN,
042881,000141: # ONLY BANKS 40-43 WILL EVER BE
042882,000142: # AND ARE PRESENTLY AVAILABLE)
042883,000143: # SUPERBANK 5 101 2000 - 3777 50 - 57 130000 - 147777 (PRESENTLY NOT AVAILABLE TO
042884,000144: # THE USER)
042885,000145: # SUPERBANK 6 110 2000 - 3777 60 - 67 150000 - 167777 (PRESENTLY NOT AVAILABLE TO
042886,000146: # THE USER)
042887,000147: # *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27. I.E., NO PROGRAM LIVING IN ANY
042888,000148: # SUPERBANK SHOULD USE SUPERSW. ***
042889,000149:
042890,000150: # SUPERSW MAY BE CALLED IN THIS FASHION:
042891,000151: # CAF ABBCON WHERE -- ABBCON BBCON SOMETHIN --
042892,000152: # TCR SUPERSW (THE SUPERBNK BITS ARE IN THE BBCON)
042893,000153: # ... ...
042894,000154: # . .
042895,000155: # . .
042896,000156: # OR IN THIS FASHION:
042897,000157: # CAF SUPERSET WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
042898,000158: # TCR SUPERSW SUPERBANK BIT CONSTANTS:
042899,000159: # ... ... SUPER011 OCTAL 60
042900,000160: # . . SUPER100 OCTAL 100
042901,000161: # . . SUPER101 OCTAL 120
042902,000162: # SUPER110 OCTAL 140
042903,000163:
042904,000164: 4727 00006 SUPERSW EXTEND
042905,000165: 4730 01007 WRITE SUPERBNK # WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
042906,000166: # CHANNEL 07
042907,000167: 4731 00002 TC Q # TC TO INSTRUCTION FOLLOWING
042908,000168: # TC SUPERSW
042909,000169:
End of include-file INTER-BANK_COMMUNICATION.agc. Parent file is MAIN.agc