Source Code

These source-code files are part of a reconstructed copy of LM131 revision 1, the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 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.

015333,000002:                                                                                                  ## Copyright:   Public domain.
015334,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
015335,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
015336,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
015337,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
015338,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
015339,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
015340,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
015341,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
015342,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
015343,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
015344,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
015345,000014:                                                                                                  ##              resulting binary is.
015346,000015:                                                                                                  ## Reference:   pp. 372-374
015347,000016:                                                                                                  ## Assembler:   yaYUL
015348,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
015349,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
015350,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
015351,000020: 

Page 372

015353,000022: 22,3242  E5,1642                                  EBANK=   XSM                                   
015354,000023: 
015355,000024: 33,2045                                           BANK     33                                    
015356,000025: 04,2000                                           SETLOC   E/PROG                                
015357,000026: 04,2000                                           BANK                                           
015358,000027: 
015359,000028: 04,2562                                           COUNT*   $$/P07                                
015360,000029: 
015361,000030:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
015362,000031: 
015363,000032:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
015364,000033: 
015365,000034:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
015366,000035:                                                                                                  #  IS NOT POSSIBLE.
015367,000036: 
015368,000037:                                                                                                  #  THE CALLING SEQUENCE IS:
015369,000038: 
015370,000039:                                                                                                  #        TC      BANKCALL
015371,000040:                                                                                                  #        CADR    E/BKCALL
015372,000041:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
015373,000042:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
015374,000043:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
015375,000044:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
015376,000045: 
015377,000046:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
015378,000047:                                                                                                  #  OTHER EMEMORY PROGRAMS.
015379,000048: 
015380,000049:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
015381,000050: 
015382,000051: 04,2562           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
015383,000052: 04,2563           53167                           DXCH     EBUF2                                 #  SAVE DP RETURN.
015384,000053: 04,2564           25166                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
015385,000054: 04,2565           30006                           CA       BBANK                                 
015386,000055: 04,2566           75012                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
015387,000056: 04,2567           27167                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
015388,000057: 04,2570           51166                           NDX      EBUF2                                 
015389,000058: 04,2571           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
015390,000059: 04,2572           04622                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
015391,000060:                                                                                                  #  AND RESTORING A + L.
015392,000061: 04,2573           02577                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
015393,000062: 04,2574           02576                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
015394,000063: 04,2575           25166                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
015395,000064: 04,2576           25166                           INCR     EBUF2                                 
015396,000065: 04,2577           53167        E/SWITCH           DXCH     EBUF2                                 
015397,000066: 04,2600           52006                           DTCB                                           
015398,000067: 

Page 373

015400,000069:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
015401,000070: 
015402,000071:                                                                                                  #  THE CALLING SEQUENCE IS...
015403,000072: 
015404,000073:                                                                                                  #        RTB
015405,000074:                                                                                                  #                E/CALL
015406,000075:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
015407,000076:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
015408,000077: 
015409,000078: 04,2601           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
015410,000079: 04,2602           50001                           INDEX    L                                     
015411,000080: 04,2603           30001                           CA       L                                     #  CADR IN A.
015412,000081: 04,2604           24001                           INCR     L                                     
015413,000082: 04,2605           24001                           INCR     L                                     #  RETURN ADRES IN L.
015414,000083: 04,2606           53167                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
015415,000084: 04,2607           06042                           TC       INTPRET                               
015416,000085: 04,2610           77624                           CALL                                           
015417,000086: 04,2611           01166                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
015418,000087: 04,2612           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
015419,000088: 04,2613           23167                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
015420,000089: 04,2614           16044                           TCF      INTPRET    +2                         #  SET LOC AND RETURN TO CALLER.
015421,000090: 

Page 374

015423,000092:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
015424,000093: 
015425,000094:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
015426,000095: 
015427,000096:                                                                                                  #  THE CALLING SEQUENCE IS:
015428,000097: 
015429,000098:                                                                                                  #        INHINT
015430,000099:                                                                                                  #        .
015431,000100:                                                                                                  #        .
015432,000101:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
015433,000102:                                                                                                  #        TC      IBNKCALL
015434,000103:                                                                                                  #        CADR    E/JOBWAK
015435,000104:                                                                                                  #        .                       RETURNS HERE
015436,000105:                                                                                                  #        .
015437,000106:                                                                                                  #        .
015438,000107:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
015439,000108: 
015440,000109: 33,2045                                           BANK     33                                    
015441,000110: 04,2000                                           SETLOC   E/PROG                                
015442,000111: 04,2000                                           BANK                                           
015443,000112: 
015444,000113: 04,2615                                           COUNT*   $$/P07                                
015445,000114: 
015446,000115: 04,2615           05137        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
015447,000116: 04,2616           44741                           CS       BIT11                                 
015448,000117: 04,2617           50064                           NDX      LOCCTR                                
015449,000118: 04,2620           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
015450,000119: 04,2621           00072                           TC       RUPTREG3                              #  RETURN
015451,000120: 

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