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.

013889,000002:                                                                                                  ## Copyright:   Public domain.
013890,000003:                                                                                                  ## Filename:    R63.agc
013891,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
013892,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
013893,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
013894,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
013895,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
013896,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
013897,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
013898,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
013899,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
013900,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
013901,000014:                                                                                                  ##              resulting binary is.
013902,000015:                                                                                                  ## Reference:   pp. 340-343
013903,000016:                                                                                                  ## Assembler:   yaYUL
013904,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
013905,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
013906,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
013907,000020: 

Page 340

013909,000022:                                                                                                  #  SUBROUTINE NAME:      V89CALL
013910,000023:                                                                                                  #  MOD NO:       0                       DATE:           9 JAN 1968
013911,000024:                                                                                                  #  MOD BY:       DIGITAL DEVEL GROUP     LOG SECTION:    R63
013912,000025: 
013913,000026:                                                                                                  #  FUNCTIONAL DESCRIPTION:
013914,000027: 
013915,000028:                                                                                                  #  CALLED BY VERB 89 ENTER DURING P00.  PRIO 10 USED.  CALCULATES AND
013916,000029:                                                                                                  #  DISPLAYS FINAL FDAI BALL ANGLES TO POINT LM +X OR +Z AXIS AT CSM.
013917,000030: 
013918,000031:                                                                                                  #  1. KEY IN V 89 E ONLY IF IN PROG 00.  IF NOT IN P00, OPERATOR ERROR AND
013919,000032:                                                                                                  #  EXIT R63, OTHERWISE CONTINUE.
013920,000033: 
013921,000034:                                                                                                  #  2. IF IN P00, DO IMU STATUS CHECK ROUTINE (R02BOTH).  IF IMU ON AND ITS
013922,000035:                                                                                                  #  ORIENTATION KNOWN TO LGC, CONTINUE.
013923,000036: 
013924,000037:                                                                                                  #  3. FLASH DISPLAY V 04 N 06.  R2 INDICATES WHICH SPACECRAFT AXIS IS TO
013925,000038:                                                                                                  #  BE POINTED AT CSM.  INITIAL CHOICE IS PREFERRED (+Z) AXIS (R2=1).
013926,000039:                                                                                                  #  ASTRONAUT CAN CHANGE TO (+X) AXIS (R2 NOT =1) BY V 22 E 2 E.  CONTINUE
013927,000040:                                                                                                  #  AFTER KEYING IN PROCEED.
013928,000041: 
013929,000042:                                                                                                  #  4. BOTH VEHICLE STATE VECTORS UPDATED BY CONIC EQS.
013930,000043: 
013931,000044:                                                                                                  #  5. HALF MAGNITUDE UNIT LOS VECTOR (IN STABLE MEMBER COORDINATES) AND
013932,000045:                                                                                                  #  HALF MAGNITUDE UNIT SPACECRAFT AXIS VECTOR (IN BODY COORDINATES)
013933,000046:                                                                                                  #  PREPARED FOR VECPOINT.
013934,000047: 
013935,000048:                                                                                                  #  6. GIMBAL ANGLES FROM VECPOINT TRANSFORMED INTO FDAI BALL ANGLES BY
013936,000049:                                                                                                  #  BALLANGS.  FLASH DISPLAY V 06 N 18 AND AWAIT RESPONSE.
013937,000050: 
013938,000051:                                                                                                  #  7.    RECYCLE - RETURN TO STEP 4.
013939,000052:                                                                                                  #        TERMINATE - EXIT R63.
013940,000053:                                                                                                  #        PROCEED - RESET 3AXISFLG AND CALL R60LEM FOR ATTITUDE MANEUVER.
013941,000054: 
013942,000055:                                                                                                  #  CALLING SEQUENCE:     V 89 E.
013943,000056: 
013944,000057:                                                                                                  #  SUBROUTINES CALLED:   CHKPOOH, R02BOTH, GOXDSPF, CSMCONIC, LEMCONIC,
013945,000058:                                                                                                  #                        VECPOINT, BALLANGS, R60LEM.
013946,000059: 
013947,000060:                                                                                                  #  NORMAL EXIT MODES:    TC ENDEXT
013948,000061: 
013949,000062:                                                                                                  #  ALARMS:       1. OPERATOR ERROR IF NOT IN P00.
013950,000063:                                                                                                  #                2. PROGRAM ALARM IF IMU IS OFF.
013951,000064:                                                                                                  #                3. PROGRAM ALARM IF IMU ORIENTATION IS UNKNOWN.
013952,000065: 
013953,000066:                                                                                                  #  OUTPUT:       NONE
013954,000067: 
013955,000068:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED:  NONE
013956,000069: 
013957,000070:                                                                                                  #  DEBRIS:       OPTION1, +1, TDEC1, POINTVSM, SCAXIS, CPHI, CTHETA, CPSI,

Page 341

013959,000072:                                                                                                  #                3AXISFLG.
013960,000073: 
013961,000074: 06,3723  E4,1606                                  EBANK=   RONE                                  
013962,000075: 32,2217                                           BANK     32                                    
013963,000076: 26,2000                                           SETLOC   BAWLANGS                              
013964,000077: 26,2000                                           BANK                                           
013965,000078: 
013966,000079: 26,2022                                           COUNT*   $$/R63                                
013967,000080: 26,2022           04616        V89CALL            TC       BANKCALL                              #  IMU STATUS CHECK.  RETURNS IF ORIENTATION
013968,000081: 26,2023           11233                           CADR     R02BOTH                               #  KNOWN.  ALARMS IF NOT.
013969,000082: 26,2024           36250                           CAF      THREE                                 #  ALLOW ASTRONAUT TO SELECT DESIRED
013970,000083: 26,2025           55050                           TS       OPTIONX                               #  TRACKING ATTITUDE AXIS.
013971,000084: 26,2026           34753                           CAF      ONE                                   
013972,000085: 26,2027           55051                           TS       OPTIONX    +1                         
013973,000086: 26,2030           32117                           CAF      VB04N12                               #  V 04 N 12
013974,000087: 26,2031           04616                           TC       BANKCALL                              
013975,000088: 26,2032           20477                           CADR     GOFLASH                               
013976,000089: 26,2033           05472                           TC       ENDEXT                                #  TERMINATE
013977,000090: 26,2034           02036                           TC       +2                                    #  PROCEED
013978,000091: 26,2035           02030                           TC       -5                                    #  DATA IN.  OPTION1+1 = 1 FOR Z AXIS
013979,000092: 26,2036           06042        V89RECL            TC       INTPRET                               #                     = 2 FOR X AXIS
013980,000093: 26,2037           43234                           RTB      DAD                                   
013981,000094: 26,2040           21574                                    LOADTIME                              #  READ PRESENT TIME
013982,000095: 26,2041           14122                                    DP1MIN                                
013983,000096: 26,2042           02205                           STORE    TSTART82                              #  SAVE TIME FOR LEMCONIC CALL
013984,000097: 26,2043           34041                           STCALL   TDEC1                                 #  STORE TIME FOR CSMCONIC CALL
013985,000098: 26,2044           27065                                    CSMCONIC                              #  CSM STATE VECTOR UPDATE
013986,000099: 26,2045           77775                           VLOAD                                          #  CSMCONIC LEFT R VECTOR IN RATT
013987,000100: 26,2046           00001                                    RATT                                  
013988,000101: 26,2047           16207                           STODL    RONE                                  #  SAVE FOR LINE OF SIGHT (LOS) COMPUTATION
013989,000102: 26,2050           02205                                    TSTART82                              
013990,000103: 26,2051           34041                           STCALL   TDEC1                                 #  STORE TIME FOR LEMCONIC CALL
013991,000104: 26,2052           27077                                    LEMCONIC                              #  LEM STATE VECTOR UPDATE
013992,000105: 26,2053           52375                           VLOAD    VSU                                   #  CSM POSITION - LEM POSITION = LOS
013993,000106: 26,2054           02207                                    RONE                                  #  LOS VECTOR LEFT IN MPAC
013994,000107: 26,2055           00001                                    RATT                                  
013995,000108: 26,2056           47121                           MXV      RTB                                   #  (REFSMMAT X LOS).  TRANSFORMS LOS FROM
013996,000109: 26,2057           01734                                    REFSMMAT                              #  REFERENCE COORD TO STAB MEMB COORD.
013997,000110: 26,2060           21727                                    NORMUNIT                              
013998,000111: 26,2061           03773                           STORE    POINTVSM                              #  STORE LOS FOR VECPOINT CALL
013999,000112: 26,2062           77776                           EXIT                                           
014000,000113: 26,2063           41051                           CS       OPTIONX    +1                         #  1 FOR Z AXIS.  2 FOR X AXIS.
014001,000114: 26,2064           64753                           AD       ONE                                   
014002,000115: 26,2065           00006                           EXTEND                                         
014003,000116: 26,2066           12113                           BZF      ALINEZ                                
014004,000117: 26,2067           06042        ALINEX             TC       INTPRET                               #  X AXIS ALIGNMENT
014005,000118: 26,2070           77775                           VLOAD                                          
014006,000119: 26,2071           06522                                    UNITX                                 #  READ (.5, 0, 0)

Page 342

014008,000121: 26,2072           37765        V89CALL1           STCALL   SCAXIS                                #  STORE SELECTED ALIGNMENT AXIS
014009,000122: 26,2073           56040                                    VECPOINT                              #  PUTS DESIRED GIM ANG (OG,IG,MG) IN TMPAC
014010,000123: 26,2074           00322                           STORE    CPHI                                  #  STORE GIMBAL ANGLES FOR BALLANGS CALL.
014011,000124: 26,2075           77776                           EXIT                                           
014012,000125: 26,2076           04616                           TC       BANKCALL                              
014013,000126: 26,2077           54272                           CADR     BALLANGS                              #  PUTS DESIRED BALL ANGLES IN FDAIX,Y,Z
014014,000127: 26,2100           32120                           CAF      VB06N18                               #  V 06 N 18
014015,000128: 26,2101           04616                           TC       BANKCALL                              #  NOUN 18 REFERS TO FDAIX,Y,Z
014016,000129: 26,2102           20477                           CADR     GOFLASH                               
014017,000130: 26,2103           05472                           TC       ENDEXT                                #  TERMINATE
014018,000131: 26,2104           02106                           TC       +2                                    #  PROCEED
014019,000132: 26,2105           02036                           TC       V89RECL                               #  RECYCLE
014020,000133: 26,2106           05516                           TC       DOWNFLAG                              #  RESET 3 AXIS FLAG
014021,000134: 26,2107           00124                           ADRES    3AXISFLG                              #  RESET BIT6 FLAG WORD 5
014022,000135: 26,2110           04616                           TC       BANKCALL                              #  PERFORMS LEM MANEUVER TO ALIGN SELECTED
014023,000136: 26,2111           54123                           CADR     R60LEM                                #  SPACECRAFT AXIS TO CSM.
014024,000137: 26,2112           15472                           TCF      ENDEXT                                #  TERMINATE R63
014025,000138: 
014026,000139: 26,2113           06042        ALINEZ             TC       INTPRET                               #  Z AXIS ALIGNMENT
014027,000140: 26,2114           52175                           VLOAD    GOTO                                  
014028,000141: 26,2115           06516                                    UNITZ                                 #  READ (0, 0, .5)
014029,000142: 26,2116           54072                                    V89CALL1                              
014030,000143: 
014031,000144: 26,2117           01014        VB04N12            VN       412                                   
014032,000145: 26,2120           01422        VB06N18            VN       0618                                  

Page 343

014034,000147: 26,2121           00000 13560  DP1MIN             2DEC     6000       B-28                       
014035,000148: 

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