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. |
060074,000002: ## Copyright: Public domain.
060075,000003: ## Filename: SERVICE_ROUTINES.agc
060076,000004: ## Purpose: Part of the reconstructed source code for LMY99 Rev 0,
060077,000005: ## otherwise known as Luminary Rev 99, the third release
060078,000006: ## of the Apollo Guidance Computer (AGC) software for Apollo 11.
060079,000007: ## It differs from LMY99 Rev 1 (the flown version) only in the
060080,000008: ## placement of a single label. The corrections shown here have
060081,000009: ## been verified to have the same bank checksums as AGC developer
060082,000010: ## Allan Klumpp's copy of Luminary Rev 99, and so are believed
060083,000011: ## to be accurate. This file is intended to be a faithful
060084,000012: ## recreation, except that the code format has been changed to
060085,000013: ## conform to the requirements of the yaYUL assembler rather than
060086,000014: ## the original YUL assembler.
060087,000015: ##
060088,000016: ## Assembler: yaYUL
060089,000017: ## Contact: Ron Burkey <info@sandroid.org>.
060090,000018: ## Website: www.ibiblio.org/apollo.
060091,000019: ## Pages: 1374-1380
060092,000020: ## Mod history: 2009-05-10 SN (Sergio Navarro). Started adapting
060093,000021: ## from the Luminary131/ file of the same
060094,000022: ## name, using Luminary099 page images.
060095,000023: ## 2016-12-18 RSB Proofed text comments with octopus/ProoferComments
060096,000024: ## and corrected the errors found.
060097,000025: ## 2017-03-16 RSB Comment-text fixes identified in 5-way
060098,000026: ## side-by-side diff of Luminary 69/99/116/131/210.
060099,000027: ## 2017-08-01 MAS Created from LMY99 Rev 1.
060100,000028:
060101,000029: ## This source code has been transcribed or otherwise adapted from
060102,000030: ## digitized images of a hardcopy from the MIT Museum. The digitization
060103,000031: ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
060104,000032: ## the Museum. Many thanks to both. The images (with suitable reduction
060105,000033: ## in storage size and consequent reduction in image quality as well) are
060106,000034: ## available online at www.ibiblio.org/apollo. If for some reason you
060107,000035: ## find that the images are illegible, contact me at info@sandroid.org
060108,000036: ## about getting access to the (much) higher-quality images which Paul
060109,000037: ## actually created.
060110,000038: ##
060111,000039: ## The code has been modified to match LMY99 Revision 0, otherwise
060112,000040: ## known as Luminary Revision 99, the Apollo 11 software release preceeding
060113,000041: ## the listing from which it was transcribed. It has been verified to
060114,000042: ## contain the same bank checksums as AGC developer Allan Klumpp's listing
060115,000043: ## of Luminary Revision 99 (for which we do not have scans).
060116,000044: ##
060117,000045: ## Notations on Allan Klumpp's listing read, in part:
060118,000046: ##
060119,000047: ## ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
060120,000048:
Page 1374 |
060122,000050: 10,3544 BANK 10
060123,000051: 10,2000 SETLOC DISPLAYS
060124,000052: 10,2000 BANK
060125,000053: 10,3544 COUNT* $$/DSPLA
060126,000054:
060127,000055: 10,3544 00004 UPENT2 INHINT
060128,000056: 10,3545 75660 MASK OCT77770
060129,000057: 10,3546 54001 TS L
060130,000058: 10,3547 40100 CS FLAGWRD4
060131,000059: 10,3550 70001 MASK L
060132,000060: 10,3551 26100 ADS FLAGWRD4
060133,000061: 10,3552 00003 JOIN RELINT
060134,000062: 10,3553 16737 TCF Q+1
060135,000063:
060136,000064: 10,3554 00004 DOWNENT2 INHINT
060137,000065: 10,3555 75660 MASK OCT77770
060138,000066: 10,3556 40000 COM
060139,000067: 10,3557 70100 MASK FLAGWRD4
060140,000068: 10,3560 54100 TS FLAGWRD4
060141,000069: 10,3561 13552 TCF JOIN
060142,000070:
060143,000071: 10,3562 4757 OCT7 EQUALS SEVEN
060144,000072:
Page 1375 |
060146,000074: # UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES. USING THEM, WHETHER OR
060147,000075: # NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
060148,000076: # EBANK SETTING. A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
060149,000077: # ASSEMBLER.
060150,000078:
060151,000079: # AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS. ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
060152,000080: # NAME ANY BIT IN ERASABLE MEMORY.
060153,000081:
060154,000082: # CALLING SEQUENCES ARE AS FOLLOWS :-
060155,000083: # TC UPFLAG TC DOWNFLAG
060156,000084: # ADRES NAME OF FLAG ADRES NAME OF FLAG
060157,000085:
060158,000086: # RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
060159,000087: # UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
060160,000088:
060161,000089: 5504 BLOCK 02
060162,000090: 4000 SETLOC FFTAG1
060163,000091: 4000 BANK
060164,000092: 5504 COUNT* $$/FLAG
060165,000093:
060166,000094: 5504 30002 UPFLAG CA Q
060167,000095: 5505 05522 TC DEBIT
060168,000096: 5506 40000 COM # +(15 - BIT)
060169,000097: 5507 00006 EXTEND
060170,000098: 5510 04001 ROR LCHAN # SET BIT
060171,000099: 5511 50061 COMFLAG INDEX ITEMP1
060172,000100: 5512 54074 TS FLAGWRD0
060173,000101: 5513 22063 LXCH ITEMP3
060174,000102: 5514 00003 RELINT
060175,000103: 5515 00001 TC L
060176,000104:
060177,000105: 5516 30002 DOWNFLAG CA Q
060178,000106: 5517 05522 TC DEBIT
060179,000107: 5520 70001 MASK L # RESET BIT
060180,000108: 5521 15511 TCF COMFLAG
060181,000109:
060182,000110: 5522 64753 DEBIT AD ONE # GET DE BITS
060183,000111: 5523 00004 INHINT
060184,000112: 5524 54063 TS ITEMP3
060185,000113: 5525 34762 CA LOW4 # DEC15
060186,000114: 5526 54061 TS ITEMP1
060187,000115: 5527 50063 INDEX ITEMP3
060188,000116: 5530 27777 CA 0 -1 # ADRES
060189,000117: 5531 54001 TS L
060190,000118: 5532 34755 CA ZERO
Page 1376 |
060192,000120: 5533 00006 EXTEND
060193,000121: 5534 10061 DV ITEMP1 # A = FLAGWRD, L = (15 - BIT)
060194,000122: 5535 52062 DXCH ITEMP1
060195,000123: 5536 50061 INDEX ITEMP1
060196,000124: 5537 30074 CA FLAGWRD0
060197,000125: 5540 54001 TS L # CURRENT STATE
060198,000126: 5541 50062 INDEX ITEMP2
060199,000127: 5542 44735 CS BIT15 # -(15 - BIT)
060200,000128: 5543 00002 TC Q
060201,000129:
Page 1377 |
060203,000131: # DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
060204,000132:
060205,000133: # ENTRANCE REQUIREMENTS ...
060206,000134: # CAF DT DELAY JOB FOR DT CENTISECS
060207,000135: # TC BANKCALL
060208,000136: # CADR DELAYJOB
060209,000137:
060210,000138: 06,3764 BANK 06
060211,000139: 00,2000 SETLOC DLAYJOB
060212,000140: 00,2000 BANK
060213,000141:
060214,000142: # THIS MUST REMAIN IN BANK 0 *****************************************
060215,000143:
060216,000144: 00,3735 COUNT* $$/DELAY
060217,000145: 00,3735 00004 DELAYJOB INHINT
060218,000146: 00,3736 54002 TS Q # STORE DELAY DT IN Q FOR DLY -1 IN
060219,000147: 00,3737 34752 CAF DELAYNUM # WAITLIST
060220,000148: 00,3740 54070 DELLOOP TS RUPTREG1
060221,000149: 00,3741 50000 INDEX A
060222,000150: 00,3742 31326 CA DELAYLOC # IS THIS DELAYLOC AVAILABLE
060223,000151: 00,3743 00006 EXTEND
060224,000152: 00,3744 13752 BZF OK2DELAY # YES
060225,000153:
060226,000154: 00,3745 10070 CCS RUPTREG1 # NO, TRY NEXT DELAYLOC
060227,000155: 00,3746 13740 TCF DELLOOP
060228,000156:
060229,000157: 00,3747 52134 DXCH BUF2
060230,000158: 00,3750 05716 TC BAILOUT1 # NO AVAILABLE LOCS.
060231,000159: 00,3751 01104 OCT 1104
060232,000160:
060233,000161: 00,3752 33772 OK2DELAY CA TCSLEEP # SET WAITLIST IMMEDIATE RETURN
060234,000162: 00,3753 54061 TS WAITEXIT
060235,000163:
060236,000164: 00,3754 30004 CA FBANK
060237,000165: 00,3755 60070 AD RUPTREG1 # STORE BBANK FOR TASK CALL
060238,000166: 00,3756 54001 TS L
060239,000167:
060240,000168: 00,3757 33773 CAF WAKECAD # STORE CADR FOR TASK CALL
060241,000169: 00,3760 15211 TCF DLY2 -1 # DLY IS IN WAITLIST ROUTINE
060242,000170:
060243,000171: 00,3761 04645 TCGETCAD TC MAKECADR # GET CALLERS FCADR
060244,000172:
060245,000173: 00,3762 50070 INDEX RUPTREG1
060246,000174: 00,3763 55326 TS DELAYLOC # SAVE DELAY CADRS
060247,000175:
060248,000176: 00,3764 05133 TC JOBSLEEP
060249,000177:
060250,000178: 00,3765 34755 WAKER CAF ZERO
060251,000179: 00,3766 50006 INDEX BBANK
060252,000180: 00,3767 57326 XCH DELAYLOC # MAKE DELAYLOC AVAILABLE
Page 1378 |
060254,000182: 00,3770 05137 TC JOBWAKE
060255,000183:
060256,000184: 00,3771 05261 TC TASKOVER
060257,000185:
060258,000186: 00,3772 03757 TCSLEEP GENADR TCGETCAD -2
060259,000187: 00,3773 03765 WAKECAD GENADR WAKER
060260,000188:
Page 1379 |
060262,000190: # GENTRAN, A BLOCK TRANSFER ROUTINE.
060263,000191: # WRITTEN BY D. EYLES
060264,000192: # MOD 1 BY KERNAN UTILITYM REV 17 11/18/67
060265,000193: # MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
060266,000194:
060267,000195: # THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
060268,000196: # CONSECUTIVE ERASABLE LOCATIONS. IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
060269,000197:
060270,000198: # GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT. THE CALLING SEQUENCE IS:
060271,000199: # I CA N-1 # OF QUANTITIES MINUS ONE.
060272,000200: # I +1 TC GENTRAN IN FIXED-FIXED.
060273,000201: # I +2 ADRES L STARTING ADRES OF DATA TO BE MOVED.
060274,000202: # I +3 ADRES M STARTING ADRES OF DUPLICATION BLOCK.
060275,000203: # I +4 RETURNS HERE.
060276,000204:
060277,000205: # GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
060278,000206: # A, L AND ITEMP1 ARE NOT PRESERVED.
060279,000207:
060280,000208: 5544 BLOCK 02
060281,000209: 4000 SETLOC FFTAG4
060282,000210: 4000 BANK
060283,000211:
060284,000212: 5544 0061 EBANK= ITEMP1
060285,000213:
060286,000214: 5544 COUNT* $$/TRAN
060287,000215:
060288,000216: 5544 00004 GENTRAN INHINT
060289,000217: 5545 54061 TS ITEMP1 # SAVE N-1.
060290,000218: 5546 50002 INDEX Q # C(Q) = ADRES L.
060291,000219: 5547 60000 AD 0 # ADRES (L + N - 1).
060292,000220: 5550 50000 INDEX A
060293,000221: 5551 30000 CA 0 # C(ABOVE).
060294,000222: 5552 54001 TS L # SAVE DATA.
060295,000223: 5553 30061 CA ITEMP1
060296,000224: 5554 50002 INDEX Q
060297,000225: 5555 60001 AD 1 # ADRES (M + N - 1).
060298,000226: 5556 50000 INDEX A
060299,000227: 5557 22000 LXCH 0 # STUFF IT.
060300,000228: 5560 10061 CCS ITEMP1 # LOOP UNTIL N-1 = 0.
060301,000229: 5561 15545 TCF GENTRAN +1
060302,000230: 5562 16741 TCF Q+2 # RETURN TO CALLER.
060303,000231:
Page 1380 |
060305,000233: # B5OFF ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
060306,000234: # MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
060307,000235:
060308,000236: 5563 COUNT* $$/EXTVB
060309,000237:
060310,000238: 5563 44747 B5OFF CS BIT5
060311,000239: 5564 71044 MASK EXTVBACT
060312,000240: 5565 55044 TS EXTVBACT
060313,000241: 5566 05155 TC ENDOFJOB
060314,000242:
060315,000243:
060316,000244:
End of include-file SERVICE_ROUTINES.agc. Parent file is MAIN.agc