Source Code

These source-code files are part of a reconstructed copy of Luminary 96, the original release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 96 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

015170,000002:                                                                                                  ## Copyright:   Public domain.
015171,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
015172,000004:                                                                                                  ## Purpose:     A section of Luminary revision 96.
015173,000005:                                                                                                  ##              It is part of the reconstructed source code for the
015174,000006:                                                                                                  ##              original release of the flight software for the Lunar 
015175,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
015176,000008:                                                                                                  ##              The code has been recreated from a previously reconstructed
015177,000009:                                                                                                  ##              copy of Luminary 97 by undoing changes described in anomaly
015178,000010:                                                                                                  ##              report LNY-59. The code has been adapted such that the
015179,000011:                                                                                                  ##              resulting bugger words exactly match those specified for
015180,000012:                                                                                                  ##              Luminary 96 in NASA drawing 2021152D, which gives relatively
015181,000013:                                                                                                  ##              high confidence that the reconstruction is correct.
015182,000014:                                                                                                  ## Reference:   pp. 370-372
015183,000015:                                                                                                  ## Assembler:   yaYUL
015184,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
015185,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
015186,000018:                                                                                                  ## Mod history: 2019-08-04 MAS  Created from Luminary 97.
015187,000019: 

Page 370

015189,000021: 22,3242  E5,1642                                  EBANK=   XSM                                   
015190,000022: 
015191,000023: 33,2045                                           BANK     33                                    
015192,000024: 04,2000                                           SETLOC   E/PROG                                
015193,000025: 04,2000                                           BANK                                           
015194,000026: 
015195,000027: 04,2576                                           COUNT*   $$/P07                                
015196,000028: 
015197,000029:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
015198,000030: 
015199,000031:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
015200,000032: 
015201,000033:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
015202,000034:                                                                                                  #  IS NOT POSSIBLE.
015203,000035: 
015204,000036:                                                                                                  #  THE CALLING SEQUENCE IS:
015205,000037: 
015206,000038:                                                                                                  #        TC      BANKCALL
015207,000039:                                                                                                  #        CADR    E/BKCALL
015208,000040:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
015209,000041:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
015210,000042:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
015211,000043:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
015212,000044: 
015213,000045:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
015214,000046:                                                                                                  #  OTHER EMEMORY PROGRAMS.
015215,000047: 
015216,000048:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
015217,000049: 
015218,000050: 04,2576           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
015219,000051: 04,2577           53170                           DXCH     EBUF2                                 #  SAVE DP RETURN.
015220,000052: 04,2600           25167                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
015221,000053: 04,2601           30006                           CA       BBANK                                 
015222,000054: 04,2602           75012                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
015223,000055: 04,2603           27170                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
015224,000056: 04,2604           51167                           NDX      EBUF2                                 
015225,000057: 04,2605           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
015226,000058: 04,2606           04622                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
015227,000059:                                                                                                  #  AND RESTORING A + L.
015228,000060: 04,2607           02613                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
015229,000061: 04,2610           02612                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
015230,000062: 04,2611           25167                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
015231,000063: 04,2612           25167                           INCR     EBUF2                                 
015232,000064: 04,2613           53170        E/SWITCH           DXCH     EBUF2                                 
015233,000065: 04,2614           52006                           DTCB                                           
015234,000066: 

Page 371

015236,000068:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
015237,000069: 
015238,000070:                                                                                                  #  THE CALLING SEQUENCE IS...
015239,000071: 
015240,000072:                                                                                                  #        RTB
015241,000073:                                                                                                  #                E/CALL
015242,000074:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
015243,000075:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
015244,000076: 
015245,000077: 04,2615           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
015246,000078: 04,2616           50001                           INDEX    L                                     
015247,000079: 04,2617           30001                           CA       L                                     #  CADR IN A.
015248,000080: 04,2620           24001                           INCR     L                                     
015249,000081: 04,2621           24001                           INCR     L                                     #  RETURN ADRES IN L.
015250,000082: 04,2622           53170                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
015251,000083: 04,2623           06037                           TC       INTPRET                               
015252,000084: 04,2624           77624                           CALL                                           
015253,000085: 04,2625           01167                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
015254,000086: 04,2626           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
015255,000087: 04,2627           23170                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
015256,000088: 04,2630           16041                           TCF      INTPRET    +2                         #  SET LOC AND RETURN TO CALLER.
015257,000089: 

Page 372

015259,000091:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
015260,000092: 
015261,000093:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
015262,000094: 
015263,000095:                                                                                                  #  THE CALLING SEQUENCE IS:
015264,000096: 
015265,000097:                                                                                                  #        INHINT
015266,000098:                                                                                                  #          .
015267,000099:                                                                                                  #          .
015268,000100:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
015269,000101:                                                                                                  #        TC      IBNKCALL
015270,000102:                                                                                                  #        CADR    E/JOBWAK
015271,000103:                                                                                                  #          .                     RETURNS HERE
015272,000104:                                                                                                  #          .
015273,000105:                                                                                                  #          .
015274,000106:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
015275,000107: 
015276,000108: 33,2045                                           BANK     33                                    
015277,000109: 04,2000                                           SETLOC   E/PROG                                
015278,000110: 04,2000                                           BANK                                           
015279,000111: 
015280,000112: 04,2631                                           COUNT*   $$/P07                                
015281,000113: 
015282,000114: 04,2631           05137        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
015283,000115: 04,2632           44741                           CS       BIT11                                 
015284,000116: 04,2633           50064                           NDX      LOCCTR                                
015285,000117: 04,2634           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
015286,000118: 04,2635           00072                           TC       RUPTREG3                              #  RETURN
015287,000119: 

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