Source Code

These source-code files derive from a printout of Luminary 116 (the Apollo 12 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Ron Burkey, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071
	19:09 AUG. 11,1969
Note that the date is the date of the printout, not the date of the program revision.

015546,000002:                                                                                                  ## Copyright:   Public domain.
015547,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
015548,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
015549,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM) 
015550,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
015551,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
015552,000008:                                                                                                  ##              that the code format has been changed to conform to the
015553,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
015554,000010:                                                                                                  ##              original YUL assembler.
015555,000011:                                                                                                  ## Reference:   pp. 371-373
015556,000012:                                                                                                  ## Assembler:   yaYUL
015557,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
015558,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
015559,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
015560,000016:                                                                                                  ##              2017-03-07 RSB  Transcribed, and then proofed comment-text using
015561,000017:                                                                                                  ##                              3-way diff vs Luminary 99 and Luminary 131.
015562,000018:                                                                                                  ##                              (Admittedly, the former is more for detecting errors
015563,000019:                                                                                                  ##                              in Luminary 99 than the other way around.)
015564,000020: 

Page 371

015566,000022: 22,3242  E5,1642                                  EBANK=   XSM                                   
015567,000023: 
015568,000024: 33,2045                                           BANK     33                                    
015569,000025: 04,2000                                           SETLOC   E/PROG                                
015570,000026: 04,2000                                           BANK                                           
015571,000027: 
015572,000028: 04,2560                                           COUNT*   $$/P07                                
015573,000029: 
015574,000030:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
015575,000031: 
015576,000032:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
015577,000033: 
015578,000034:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
015579,000035:                                                                                                  #  IS NOT POSSIBLE.
015580,000036: 
015581,000037:                                                                                                  #  THE CALLING SEQUENCE IS:
015582,000038: 
015583,000039:                                                                                                  #        TC      BANKCALL
015584,000040:                                                                                                  #        CADR    E/BKCALL
015585,000041:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
015586,000042:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
015587,000043:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
015588,000044:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
015589,000045: 
015590,000046:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
015591,000047:                                                                                                  #  OTHER EMEMORY PROGRAMS.
015592,000048: 
015593,000049:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
015594,000050: 
015595,000051: 04,2560           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
015596,000052: 04,2561           53167                           DXCH     EBUF2                                 #  SAVE DP RETURN.
015597,000053: 04,2562           25166                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
015598,000054: 04,2563           30006                           CA       BBANK                                 
015599,000055: 04,2564           75012                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
015600,000056: 04,2565           27167                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
015601,000057: 04,2566           51166                           NDX      EBUF2                                 
015602,000058: 04,2567           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
015603,000059: 04,2570           04622                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
015604,000060:                                                                                                  #  AND RESTORING A + L.
015605,000061: 04,2571           02575                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
015606,000062: 04,2572           02574                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
015607,000063: 04,2573           25166                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
015608,000064: 04,2574           25166                           INCR     EBUF2                                 
015609,000065: 04,2575           53167        E/SWITCH           DXCH     EBUF2                                 
015610,000066: 04,2576           52006                           DTCB                                           
015611,000067: 

Page 372

015613,000069:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
015614,000070: 
015615,000071:                                                                                                  #  THE CALLING SEQUENCE IS...
015616,000072: 
015617,000073:                                                                                                  #        RTB
015618,000074:                                                                                                  #                E/CALL
015619,000075:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
015620,000076:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
015621,000077: 
015622,000078: 04,2577           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
015623,000079: 04,2600           50001                           INDEX    L                                     
015624,000080: 04,2601           30001                           CA       L                                     #  CADR IN A.
015625,000081: 04,2602           24001                           INCR     L                                     
015626,000082: 04,2603           24001                           INCR     L                                     #  RETURN ADRES IN L.
015627,000083: 04,2604           53167                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
015628,000084: 04,2605           06042                           TC       INTPRET                               
015629,000085: 04,2606           77624                           CALL                                           
015630,000086: 04,2607           01166                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
015631,000087: 04,2610           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
015632,000088: 04,2611           23167                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
015633,000089: 04,2612           16044                           TCF      INTPRET    +2                         #  SET LOC AND RETURN TO CALLER.
015634,000090: 

Page 373

015636,000092:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
015637,000093: 
015638,000094:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
015639,000095: 
015640,000096:                                                                                                  #  THE CALLING SEQUENCE IS:
015641,000097: 
015642,000098:                                                                                                  #        INHINT
015643,000099:                                                                                                  #          .
015644,000100:                                                                                                  #          .
015645,000101:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
015646,000102:                                                                                                  #        TC      IBNKCALL
015647,000103:                                                                                                  #        CADR    E/JOBWAK
015648,000104:                                                                                                  #          .                     RETURNS HERE
015649,000105:                                                                                                  #          .
015650,000106:                                                                                                  #          .
015651,000107:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
015652,000108: 
015653,000109: 33,2045                                           BANK     33                                    
015654,000110: 04,2000                                           SETLOC   E/PROG                                
015655,000111: 04,2000                                           BANK                                           
015656,000112: 
015657,000113: 04,2613                                           COUNT*   $$/P07                                
015658,000114: 
015659,000115: 04,2613           05137        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
015660,000116: 04,2614           44741                           CS       BIT11                                 
015661,000117: 04,2615           50064                           NDX      LOCCTR                                
015662,000118: 04,2616           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
015663,000119: 04,2617           00072                           TC       RUPTREG3                              #  RETURN
015664,000120: 

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