Source Code

This source code is very close to the Apollo Guidance Computer software for the Apollo 13 Lunar module. This revision of the Luminary 131 program is from December of 1969, whereas there was a later revision in January of 1970, and still another revision in February, which is the code that flew on the mission. As far as this transcription is concerned, it was originally from a copy made in 1991 of a printout from the collection of AGC developer Don Eyles for collector David Craig. It was subsequently scanned by Gary Neff, reprocessed for online presentation at the now-discontinued History of Recent Science and Technology (HRST) website of MIT's Dibner Institute (the full-quality scans being discarded in the process), and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a high-quality replacement scan for a completely illegible page was later provided by Gary Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many errors to be introduced into the transcription. Accordingly, a second scan of the same physical printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive, and used to correct the transcription errors. All of the scanned materials mentioned, as well as other Luminary 131 related material, are available online. Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017, so the two scans are not identical in that respect. The page-headings in the printout read, in part:
	GAP:  ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091
	17:53 DEC. 19, 1969
Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together.

015482,000002:                                                                                                  ## Copyright:   Public domain.
015483,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
015484,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
015485,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
015486,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
015487,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
015488,000008:                                                                                                  ##              that the code format has been changed to conform to the
015489,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the 
015490,000010:                                                                                                  ##              original YUL assembler.
015491,000011:                                                                                                  ## Reference:   pp. 372-374
015492,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
015493,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
015494,000014:                                                                                                  ## Mod history: 05/11/03 RSB.   Began transcribing.
015495,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
015496,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
015497,000017:                                                                                                  ##                              original harcopy, as opposed to the PDF page
015498,000018:                                                                                                  ##                              numbers in 1701.pdf.
015499,000019:                                                                                                  ##              2017-02-23 RSB  Proofed comment text using octopus/ProoferComments.
015500,000020: 

Page 372

015502,000022: 22,3242  E5,1642                                  EBANK=   XSM                                   
015503,000023: 
015504,000024: 33,2045                                           BANK     33                                    
015505,000025: 04,2000                                           SETLOC   E/PROG                                
015506,000026: 04,2000                                           BANK                                           
015507,000027: 
015508,000028: 04,2562                                           COUNT*   $$/P07                                
015509,000029: 
015510,000030:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
015511,000031: 
015512,000032:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
015513,000033: 
015514,000034:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
015515,000035:                                                                                                  #  IS NOT POSSIBLE.
015516,000036: 
015517,000037:                                                                                                  #  THE CALLING SEQUENCE IS:
015518,000038: 
015519,000039:                                                                                                  #        TC      BANKCALL
015520,000040:                                                                                                  #        CADR    E/BKCALL
015521,000041:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
015522,000042:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
015523,000043:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
015524,000044:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
015525,000045: 
015526,000046:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
015527,000047:                                                                                                  #  OTHER EMEMORY PROGRAMS.
015528,000048: 
015529,000049:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
015530,000050: 
015531,000051: 04,2562           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
015532,000052: 04,2563           53167                           DXCH     EBUF2                                 #  SAVE DP RETURN.
015533,000053: 04,2564           25166                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
015534,000054: 04,2565           30006                           CA       BBANK                                 
015535,000055: 04,2566           75012                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
015536,000056: 04,2567           27167                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
015537,000057: 04,2570           51166                           NDX      EBUF2                                 
015538,000058: 04,2571           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
015539,000059: 04,2572           04622                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
015540,000060:                                                                                                  #  AND RESTORING A + L.
015541,000061: 04,2573           02577                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
015542,000062: 04,2574           02576                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
015543,000063: 04,2575           25166                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
015544,000064: 04,2576           25166                           INCR     EBUF2                                 
015545,000065: 04,2577           53167        E/SWITCH           DXCH     EBUF2                                 
015546,000066: 04,2600           52006                           DTCB                                           
015547,000067: 

Page 373

015549,000069:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
015550,000070: 
015551,000071:                                                                                                  #  THE CALLING SEQUENCE IS...
015552,000072: 
015553,000073:                                                                                                  #        RTB
015554,000074:                                                                                                  #                E/CALL
015555,000075:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
015556,000076:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
015557,000077: 
015558,000078: 04,2601           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
015559,000079: 04,2602           50001                           INDEX    L                                     
015560,000080: 04,2603           30001                           CA       L                                     #  CADR IN A.
015561,000081: 04,2604           24001                           INCR     L                                     
015562,000082: 04,2605           24001                           INCR     L                                     #  RETURN ADRES IN L.
015563,000083: 04,2606           53167                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
015564,000084: 04,2607           06042                           TC       INTPRET                               
015565,000085: 04,2610           77624                           CALL                                           
015566,000086: 04,2611           01166                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
015567,000087: 04,2612           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
015568,000088: 04,2613           23167                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
015569,000089: 04,2614           16044                           TCF      INTPRET    +2                         #  SET LOC AND RETURN TO CALLER.
015570,000090: 

Page 374

015572,000092:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
015573,000093: 
015574,000094:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
015575,000095: 
015576,000096:                                                                                                  #  THE CALLING SEQUENCE IS:
015577,000097: 
015578,000098:                                                                                                  #        INHINT
015579,000099:                                                                                                  #        .
015580,000100:                                                                                                  #        .
015581,000101:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
015582,000102:                                                                                                  #        TC      IBNKCALL
015583,000103:                                                                                                  #        CADR    E/JOBWAK
015584,000104:                                                                                                  #        .                       RETURNS HERE
015585,000105:                                                                                                  #        .
015586,000106:                                                                                                  #        .
015587,000107:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
015588,000108: 
015589,000109: 33,2045                                           BANK     33                                    
015590,000110: 04,2000                                           SETLOC   E/PROG                                
015591,000111: 04,2000                                           BANK                                           
015592,000112: 
015593,000113: 04,2615                                           COUNT*   $$/P07                                
015594,000114: 
015595,000115: 04,2615           05137        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
015596,000116: 04,2616           44741                           CS       BIT11                                 
015597,000117: 04,2617           50064                           NDX      LOCCTR                                
015598,000118: 04,2620           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
015599,000119: 04,2621           00072                           TC       RUPTREG3                              #  RETURN
015600,000120: 

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