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.

060055,000002:                                                                                                  ## Copyright:   Public domain.
060056,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
060057,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
060058,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the second release
060059,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
060060,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
060061,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
060062,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
060063,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
060064,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
060065,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
060066,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
060067,000014:                                                                                                  ##              the original YUL assembler.
060068,000015:                                                                                                  ##
060069,000016:                                                                                                  ## Assembler:   yaYUL
060070,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
060071,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
060072,000019:                                                                                                  ## Pages:       1374-1380
060073,000020:                                                                                                  ## Mod history: 2009-05-10 SN   (Sergio Navarro).  Started adapting
060074,000021:                                                                                                  ##                              from the Luminary131/ file of the same
060075,000022:                                                                                                  ##                              name, using Luminary099 page images.
060076,000023:                                                                                                  ##              2016-12-18 RSB  Proofed text comments with octopus/ProoferComments
060077,000024:                                                                                                  ##                              and corrected the errors found.
060078,000025:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 5-way
060079,000026:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
060080,000027:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
060081,000028: 
060082,000029:                                                                                                  ## This source code has been transcribed or otherwise adapted from
060083,000030:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
060084,000031:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
060085,000032:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
060086,000033:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
060087,000034:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
060088,000035:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
060089,000036:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
060090,000037:                                                                                                  ## actually created.
060091,000038:                                                                                                  ##
060092,000039:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
060093,000040:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
060094,000041:                                                                                                  ## the listing from which it was transcribed. It has been verified to
060095,000042:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
060096,000043:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
060097,000044:                                                                                                  ##
060098,000045:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
060099,000046:                                                                                                  ##
060100,000047:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
060101,000048: 

Page 1374

060103,000050: 10,3544                                           BANK     10                                    
060104,000051: 10,2000                                           SETLOC   DISPLAYS                              
060105,000052: 10,2000                                           BANK                                           
060106,000053: 10,3544                                           COUNT*   $$/DSPLA                              
060107,000054: 
060108,000055: 10,3544           00004        UPENT2             INHINT                                         
060109,000056: 10,3545           75660                           MASK     OCT77770                              
060110,000057: 10,3546           54001                           TS       L                                     
060111,000058: 10,3547           40100                           CS       FLAGWRD4                              
060112,000059: 10,3550           70001                           MASK     L                                     
060113,000060: 10,3551           26100                           ADS      FLAGWRD4                              
060114,000061: 10,3552           00003        JOIN               RELINT                                         
060115,000062: 10,3553           16737                           TCF      Q+1                                   
060116,000063: 
060117,000064: 10,3554           00004        DOWNENT2           INHINT                                         
060118,000065: 10,3555           75660                           MASK     OCT77770                              
060119,000066: 10,3556           40000                           COM                                            
060120,000067: 10,3557           70100                           MASK     FLAGWRD4                              
060121,000068: 10,3560           54100                           TS       FLAGWRD4                              
060122,000069: 10,3561           13552                           TCF      JOIN                                  
060123,000070: 
060124,000071: 10,3562     4757               OCT7               EQUALS   SEVEN                                 
060125,000072: 

Page 1375

060127,000074:                                                                                                  #  UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.  USING THEM, WHETHER OR
060128,000075:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
060129,000076:                                                                                                  #  EBANK SETTING.  A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
060130,000077:                                                                                                  #  ASSEMBLER.
060131,000078: 
060132,000079:                                                                                                  #  AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.  ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
060133,000080:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
060134,000081: 
060135,000082:                                                                                                  #  CALLING SEQUENCES ARE AS FOLLOWS :-
060136,000083:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
060137,000084:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
060138,000085: 
060139,000086:                                                                                                  #  RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
060140,000087:                                                                                                  #  UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
060141,000088: 
060142,000089:    5504                                           BLOCK    02                                    
060143,000090:    4000                                           SETLOC   FFTAG1                                
060144,000091:    4000                                           BANK                                           
060145,000092:    5504                                           COUNT*   $$/FLAG                               
060146,000093: 
060147,000094:    5504           30002        UPFLAG             CA       Q                                     
060148,000095:    5505           05522                           TC       DEBIT                                 
060149,000096:    5506           40000                           COM                                            #  +(15 - BIT)
060150,000097:    5507           00006                           EXTEND                                         
060151,000098:    5510           04001                           ROR      LCHAN                                 #  SET BIT
060152,000099:    5511           50061        COMFLAG            INDEX    ITEMP1                                
060153,000100:    5512           54074                           TS       FLAGWRD0                              
060154,000101:    5513           22063                           LXCH     ITEMP3                                
060155,000102:    5514           00003                           RELINT                                         
060156,000103:    5515           00001                           TC       L                                     
060157,000104: 
060158,000105:    5516           30002        DOWNFLAG           CA       Q                                     
060159,000106:    5517           05522                           TC       DEBIT                                 
060160,000107:    5520           70001                           MASK     L                                     #  RESET BIT
060161,000108:    5521           15511                           TCF      COMFLAG                               
060162,000109: 
060163,000110:    5522           64753        DEBIT              AD       ONE                                   #  GET DE BITS
060164,000111:    5523           00004                           INHINT                                         
060165,000112:    5524           54063                           TS       ITEMP3                                
060166,000113:    5525           34762                           CA       LOW4                                  #  DEC15
060167,000114:    5526           54061                           TS       ITEMP1                                
060168,000115:    5527           50063                           INDEX    ITEMP3                                
060169,000116:    5530           27777                           CA       0          -1                         #  ADRES
060170,000117:    5531           54001                           TS       L                                     
060171,000118:    5532           34755                           CA       ZERO                                  

Page 1376

060173,000120:    5533           00006                           EXTEND                                         
060174,000121:    5534           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
060175,000122:    5535           52062                           DXCH     ITEMP1                                
060176,000123:    5536           50061                           INDEX    ITEMP1                                
060177,000124:    5537           30074                           CA       FLAGWRD0                              
060178,000125:    5540           54001                           TS       L                                     #  CURRENT STATE
060179,000126:    5541           50062                           INDEX    ITEMP2                                
060180,000127:    5542           44735                           CS       BIT15                                 #  -(15 - BIT)
060181,000128:    5543           00002                           TC       Q                                     
060182,000129: 

Page 1377

060184,000131:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
060185,000132: 
060186,000133:                                                                                                  #  ENTRANCE REQUIREMENTS ...
060187,000134:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
060188,000135:                                                                                                  #                TC      BANKCALL
060189,000136:                                                                                                  #                CADR    DELAYJOB
060190,000137: 
060191,000138: 06,3764                                           BANK     06                                    
060192,000139: 00,2000                                           SETLOC   DLAYJOB                               
060193,000140: 00,2000                                           BANK                                           
060194,000141: 
060195,000142:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
060196,000143: 
060197,000144: 00,3735                                           COUNT*   $$/DELAY                              
060198,000145: 00,3735           00004        DELAYJOB           INHINT                                         
060199,000146: 00,3736           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
060200,000147: 00,3737           34752                           CAF      DELAYNUM                              #  WAITLIST
060201,000148: 00,3740           54070        DELLOOP            TS       RUPTREG1                              
060202,000149: 00,3741           50000                           INDEX    A                                     
060203,000150: 00,3742           31326                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
060204,000151: 00,3743           00006                           EXTEND                                         
060205,000152: 00,3744           13752                           BZF      OK2DELAY                              #  YES
060206,000153: 
060207,000154: 00,3745           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
060208,000155: 00,3746           13740                           TCF      DELLOOP                               
060209,000156: 
060210,000157: 00,3747           52134                           DXCH     BUF2                                  
060211,000158: 00,3750           05716                           TC       BAILOUT1                              #  NO AVAILABLE LOCS.
060212,000159: 00,3751           01104                           OCT      1104                                  
060213,000160: 
060214,000161: 00,3752           33772        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
060215,000162: 00,3753           54061                           TS       WAITEXIT                              
060216,000163: 
060217,000164: 00,3754           30004                           CA       FBANK                                 
060218,000165: 00,3755           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
060219,000166: 00,3756           54001                           TS       L                                     
060220,000167: 
060221,000168: 00,3757           33773                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
060222,000169: 00,3760           15211                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
060223,000170: 
060224,000171: 00,3761           04645        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
060225,000172: 
060226,000173: 00,3762           50070                           INDEX    RUPTREG1                              
060227,000174: 00,3763           55326                           TS       DELAYLOC                              #  SAVE DELAY CADRS
060228,000175: 
060229,000176: 00,3764           05133                           TC       JOBSLEEP                              
060230,000177: 
060231,000178: 00,3765           34755        WAKER              CAF      ZERO                                  
060232,000179: 00,3766           50006                           INDEX    BBANK                                 
060233,000180: 00,3767           57326                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE

Page 1378

060235,000182: 00,3770           05137                           TC       JOBWAKE                               
060236,000183: 
060237,000184: 00,3771           05261                           TC       TASKOVER                              
060238,000185: 
060239,000186: 00,3772           03757        TCSLEEP            GENADR   TCGETCAD   -2                         
060240,000187: 00,3773           03765        WAKECAD            GENADR   WAKER                                 
060241,000188: 

Page 1379

060243,000190:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
060244,000191:                                                                                                  #  WRITTEN BY D. EYLES
060245,000192:                                                                                                  #  MOD 1 BY KERNAN                               UTILITYM REV 17 11/18/67
060246,000193:                                                                                                  #  MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
060247,000194: 
060248,000195:                                                                                                  #  THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
060249,000196:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
060250,000197: 
060251,000198:                                                                                                  #  GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
060252,000199:                                                                                                  #        I       CA      N-1             # OF QUANTITIES MINUS ONE.
060253,000200:                                                                                                  #        I +1    TC      GENTRAN         IN FIXED-FIXED.
060254,000201:                                                                                                  #        I +2    ADRES   L               STARTING ADRES OF DATA TO BE MOVED.
060255,000202:                                                                                                  #        I +3    ADRES   M               STARTING ADRES OF DUPLICATION BLOCK.
060256,000203:                                                                                                  #        I +4                            RETURNS HERE.
060257,000204: 
060258,000205:                                                                                                  #  GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
060259,000206:                                                                                                  #  A, L AND ITEMP1 ARE NOT PRESERVED.
060260,000207: 
060261,000208:    5544                                           BLOCK    02                                    
060262,000209:    4000                                           SETLOC   FFTAG4                                
060263,000210:    4000                                           BANK                                           
060264,000211: 
060265,000212:    5544     0061                                  EBANK=   ITEMP1                                
060266,000213: 
060267,000214:    5544                                           COUNT*   $$/TRAN                               
060268,000215: 
060269,000216:    5544           00004        GENTRAN            INHINT                                         
060270,000217:    5545           54061                           TS       ITEMP1                                #  SAVE N-1.
060271,000218:    5546           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
060272,000219:    5547           60000                           AD       0                                     #  ADRES (L + N - 1).
060273,000220:    5550           50000                           INDEX    A                                     
060274,000221:    5551           30000                           CA       0                                     #  C(ABOVE).
060275,000222:    5552           54001                           TS       L                                     #  SAVE DATA.
060276,000223:    5553           30061                           CA       ITEMP1                                
060277,000224:    5554           50002                           INDEX    Q                                     
060278,000225:    5555           60001                           AD       1                                     #  ADRES (M + N - 1).
060279,000226:    5556           50000                           INDEX    A                                     
060280,000227:    5557           22000                           LXCH     0                                     #  STUFF IT.
060281,000228:    5560           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
060282,000229:    5561           15545                           TCF      GENTRAN    +1                         
060283,000230:    5562           16741                           TCF      Q+2                                   #  RETURN TO CALLER.
060284,000231: 

Page 1380

060286,000233:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
060287,000234:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
060288,000235: 
060289,000236:    5563                                           COUNT*   $$/EXTVB                              
060290,000237: 
060291,000238:    5563           44747        B5OFF              CS       BIT5                                  
060292,000239:    5564           71044                           MASK     EXTVBACT                              
060293,000240:    5565           55044                           TS       EXTVBACT                              
060294,000241:    5566           05155                           TC       ENDOFJOB                              
060295,000242: 
060296,000243: 
060297,000244: 

End of include-file SERVICE_ROUTINES.agc.  Parent file is MAIN.agc