Source Code

These source-code files are part of a reconstructed copy of Luminary 97, the second release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software. It was created to fix two incorrect ephemeris constants in Luminary 96, as described by anomaly report LNY-59.

The reconstruction began with source code of Luminary 99 revision 1 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes described in original Luminary memos 83 and 85, using asterisks indicating changed lines in the listing as a guide. 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 97 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.

015252,000002:                                                                                                  ## Copyright:   Public domain.
015253,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
015254,000004:                                                                                                  ## Purpose:     A section of Luminary revision 97.
015255,000005:                                                                                                  ##              It is part of the reconstructed source code for the
015256,000006:                                                                                                  ##              second release of the flight software for the Lunar 
015257,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
015258,000008:                                                                                                  ##              It was created to fix two incorrect ephemeris constants in
015259,000009:                                                                                                  ##              Luminary 96, as described by anomaly report LNY-59.
015260,000010:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
015261,000011:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
015262,000012:                                                                                                  ##              the listing and Luminary Memos #83 and #85, which list 
015263,000013:                                                                                                  ##              changes between Luminary 97 and 98, and 98 and 99. The
015264,000014:                                                                                                  ##              code has been adapted such that the resulting bugger words
015265,000015:                                                                                                  ##              exactly match those specified for Luminary 97 in NASA drawing
015266,000016:                                                                                                  ##              2021152D, which gives relatively high confidence that the
015267,000017:                                                                                                  ##              reconstruction is correct.
015268,000018:                                                                                                  ## Reference:   pp. 370-372
015269,000019:                                                                                                  ## Assembler:   yaYUL
015270,000020:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
015271,000021:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
015272,000022:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
015273,000023: 

Page 370

015275,000025: 22,3242  E5,1642                                  EBANK=   XSM                                   
015276,000026: 
015277,000027: 33,2045                                           BANK     33                                    
015278,000028: 04,2000                                           SETLOC   E/PROG                                
015279,000029: 04,2000                                           BANK                                           
015280,000030: 
015281,000031: 04,2576                                           COUNT*   $$/P07                                
015282,000032: 
015283,000033:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
015284,000034: 
015285,000035:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
015286,000036: 
015287,000037:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
015288,000038:                                                                                                  #  IS NOT POSSIBLE.
015289,000039: 
015290,000040:                                                                                                  #  THE CALLING SEQUENCE IS:
015291,000041: 
015292,000042:                                                                                                  #        TC      BANKCALL
015293,000043:                                                                                                  #        CADR    E/BKCALL
015294,000044:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
015295,000045:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
015296,000046:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
015297,000047:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
015298,000048: 
015299,000049:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
015300,000050:                                                                                                  #  OTHER EMEMORY PROGRAMS.
015301,000051: 
015302,000052:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
015303,000053: 
015304,000054: 04,2576           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
015305,000055: 04,2577           53170                           DXCH     EBUF2                                 #  SAVE DP RETURN.
015306,000056: 04,2600           25167                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
015307,000057: 04,2601           30006                           CA       BBANK                                 
015308,000058: 04,2602           75012                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
015309,000059: 04,2603           27170                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
015310,000060: 04,2604           51167                           NDX      EBUF2                                 
015311,000061: 04,2605           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
015312,000062: 04,2606           04622                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
015313,000063:                                                                                                  #  AND RESTORING A + L.
015314,000064: 04,2607           02613                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
015315,000065: 04,2610           02612                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
015316,000066: 04,2611           25167                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
015317,000067: 04,2612           25167                           INCR     EBUF2                                 
015318,000068: 04,2613           53170        E/SWITCH           DXCH     EBUF2                                 
015319,000069: 04,2614           52006                           DTCB                                           
015320,000070: 

Page 371

015322,000072:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
015323,000073: 
015324,000074:                                                                                                  #  THE CALLING SEQUENCE IS...
015325,000075: 
015326,000076:                                                                                                  #        RTB
015327,000077:                                                                                                  #                E/CALL
015328,000078:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
015329,000079:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
015330,000080: 
015331,000081: 04,2615           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
015332,000082: 04,2616           50001                           INDEX    L                                     
015333,000083: 04,2617           30001                           CA       L                                     #  CADR IN A.
015334,000084: 04,2620           24001                           INCR     L                                     
015335,000085: 04,2621           24001                           INCR     L                                     #  RETURN ADRES IN L.
015336,000086: 04,2622           53170                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
015337,000087: 04,2623           06037                           TC       INTPRET                               
015338,000088: 04,2624           77624                           CALL                                           
015339,000089: 04,2625           01167                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
015340,000090: 04,2626           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
015341,000091: 04,2627           23170                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
015342,000092: 04,2630           16041                           TCF      INTPRET    +2                         #  SET LOC AND RETURN TO CALLER.
015343,000093: 

Page 372

015345,000095:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
015346,000096: 
015347,000097:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
015348,000098: 
015349,000099:                                                                                                  #  THE CALLING SEQUENCE IS:
015350,000100: 
015351,000101:                                                                                                  #        INHINT
015352,000102:                                                                                                  #          .
015353,000103:                                                                                                  #          .
015354,000104:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
015355,000105:                                                                                                  #        TC      IBNKCALL
015356,000106:                                                                                                  #        CADR    E/JOBWAK
015357,000107:                                                                                                  #          .                     RETURNS HERE
015358,000108:                                                                                                  #          .
015359,000109:                                                                                                  #          .
015360,000110:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
015361,000111: 
015362,000112: 33,2045                                           BANK     33                                    
015363,000113: 04,2000                                           SETLOC   E/PROG                                
015364,000114: 04,2000                                           BANK                                           
015365,000115: 
015366,000116: 04,2631                                           COUNT*   $$/P07                                
015367,000117: 
015368,000118: 04,2631           05137        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
015369,000119: 04,2632           44741                           CS       BIT11                                 
015370,000120: 04,2633           50064                           NDX      LOCCTR                                
015371,000121: 04,2634           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
015372,000122: 04,2635           00072                           TC       RUPTREG3                              #  RETURN
015373,000123: 

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