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.

015901,000002:                                                                                                  ## Copyright:   Public domain.
015902,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
015903,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
015904,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the third release
015905,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
015906,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
015907,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
015908,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
015909,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
015910,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
015911,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
015912,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
015913,000014:                                                                                                  ##              the original YUL assembler.
015914,000015:                                                                                                  ##
015915,000016:                                                                                                  ## Assembler:   yaYUL
015916,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
015917,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
015918,000019:                                                                                                  ## Pages:       370-372
015919,000020:                                                                                                  ## Mod history: 2009-05-17 RSB  Adapted from the corresponding 
015920,000021:                                                                                                  ##                              Luminary131 file, using page 
015921,000022:                                                                                                  ##                              images from Luminary 1A.
015922,000023:                                                                                                  ##              2016-12-14 RSB  Proofed text comments with octopus/ProoferComments
015923,000024:                                                                                                  ##                              and corrected the errors found.
015924,000025:                                                                                                  ##              2017-03-07 RSB  Comment-text fixes noted in proofing Luminary 116.
015925,000026:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
015926,000027: 
015927,000028:                                                                                                  ## This source code has been transcribed or otherwise adapted from
015928,000029:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
015929,000030:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
015930,000031:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
015931,000032:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
015932,000033:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
015933,000034:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
015934,000035:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
015935,000036:                                                                                                  ## actually created.
015936,000037:                                                                                                  ##
015937,000038:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
015938,000039:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
015939,000040:                                                                                                  ## the listing from which it was transcribed. It has been verified to
015940,000041:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
015941,000042:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
015942,000043:                                                                                                  ##
015943,000044:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
015944,000045:                                                                                                  ##
015945,000046:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
015946,000047: 

Page 370

015948,000049: 22,3242  E5,1642                                  EBANK=   XSM                                   
015949,000050: 
015950,000051: 33,2045                                           BANK     33                                    
015951,000052: 04,2000                                           SETLOC   E/PROG                                
015952,000053: 04,2000                                           BANK                                           
015953,000054: 
015954,000055: 04,2576                                           COUNT*   $$/P07                                
015955,000056: 
015956,000057:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
015957,000058: 
015958,000059:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
015959,000060: 
015960,000061:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
015961,000062:                                                                                                  #  IS NOT POSSIBLE.
015962,000063: 
015963,000064:                                                                                                  #  THE CALLING SEQUENCE IS:
015964,000065: 
015965,000066:                                                                                                  #        TC      BANKCALL
015966,000067:                                                                                                  #        CADR    E/BKCALL
015967,000068:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
015968,000069:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
015969,000070:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
015970,000071:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
015971,000072: 
015972,000073:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
015973,000074:                                                                                                  #  OTHER EMEMORY PROGRAMS.
015974,000075: 
015975,000076:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
015976,000077: 
015977,000078: 04,2576           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
015978,000079: 04,2577           53170                           DXCH     EBUF2                                 #  SAVE DP RETURN.
015979,000080: 04,2600           25167                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
015980,000081: 04,2601           30006                           CA       BBANK                                 
015981,000082: 04,2602           75012                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
015982,000083: 04,2603           27170                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
015983,000084: 04,2604           51167                           NDX      EBUF2                                 
015984,000085: 04,2605           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
015985,000086: 04,2606           04622                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
015986,000087:                                                                                                  #  AND RESTORING A + L.
015987,000088: 04,2607           02613                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
015988,000089: 04,2610           02612                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
015989,000090: 04,2611           25167                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
015990,000091: 04,2612           25167                           INCR     EBUF2                                 
015991,000092: 04,2613           53170        E/SWITCH           DXCH     EBUF2                                 
015992,000093: 04,2614           52006                           DTCB                                           
015993,000094: 

Page 371

015995,000096:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
015996,000097: 
015997,000098:                                                                                                  #  THE CALLING SEQUENCE IS...
015998,000099: 
015999,000100:                                                                                                  #        RTB
016000,000101:                                                                                                  #                E/CALL
016001,000102:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
016002,000103:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
016003,000104: 
016004,000105: 04,2615           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
016005,000106: 04,2616           50001                           INDEX    L                                     
016006,000107: 04,2617           30001                           CA       L                                     #  CADR IN A.
016007,000108: 04,2620           24001                           INCR     L                                     
016008,000109: 04,2621           24001                           INCR     L                                     #  RETURN ADRES IN L.
016009,000110: 04,2622           53170                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
016010,000111: 04,2623           06037                           TC       INTPRET                               
016011,000112: 04,2624           77624                           CALL                                           
016012,000113: 04,2625           01167                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
016013,000114: 04,2626           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
016014,000115: 04,2627           23170                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
016015,000116: 04,2630           16041                           TCF      INTPRET    +2                         #  SET LOC AND RETURN TO CALLER.
016016,000117: 

Page 372

016018,000119:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
016019,000120: 
016020,000121:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
016021,000122: 
016022,000123:                                                                                                  #  THE CALLING SEQUENCE IS:
016023,000124: 
016024,000125:                                                                                                  #        INHINT
016025,000126:                                                                                                  #          .
016026,000127:                                                                                                  #          .
016027,000128:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
016028,000129:                                                                                                  #        TC      IBNKCALL
016029,000130:                                                                                                  #        CADR    E/JOBWAK
016030,000131:                                                                                                  #          .                     RETURNS HERE
016031,000132:                                                                                                  #          .
016032,000133:                                                                                                  #          .
016033,000134:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
016034,000135: 
016035,000136: 33,2045                                           BANK     33                                    
016036,000137: 04,2000                                           SETLOC   E/PROG                                
016037,000138: 04,2000                                           BANK                                           
016038,000139: 
016039,000140: 04,2631                                           COUNT*   $$/P07                                
016040,000141: 
016041,000142: 04,2631           05137        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
016042,000143: 04,2632           44741                           CS       BIT11                                 
016043,000144: 04,2633           50064                           NDX      LOCCTR                                
016044,000145: 04,2634           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
016045,000146: 04,2635           00072                           TC       RUPTREG3                              #  RETURN
016046,000147: 

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