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.

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

Page 371

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

Page 372

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

Page 373

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

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