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.

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

Page 372

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

Page 373

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

Page 374

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

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