Source Code

This source code is very close to the Apollo Guidance Computer software for the Apollo 13 Lunar module. This revision of the Luminary 131 program is from December of 1969, whereas there was a later revision in January of 1970, and still another revision in February, which is the code that flew on the mission. As far as this transcription is concerned, it was originally from a copy made in 1991 of a printout from the collection of AGC developer Don Eyles for collector David Craig. It was subsequently scanned by Gary Neff, reprocessed for online presentation at the now-discontinued History of Recent Science and Technology (HRST) website of MIT's Dibner Institute (the full-quality scans being discarded in the process), and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a high-quality replacement scan for a completely illegible page was later provided by Gary Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many errors to be introduced into the transcription. Accordingly, a second scan of the same physical printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive, and used to correct the transcription errors. All of the scanned materials mentioned, as well as other Luminary 131 related material, are available online. Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017, so the two scans are not identical in that respect. The page-headings in the printout read, in part:
	GAP:  ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091
	17:53 DEC. 19, 1969
Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together.

014024,000002:                                                                                                  ## Copyright:   Public domain.
014025,000003:                                                                                                  ## Filename:    R63.agc
014026,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
014027,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
014028,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
014029,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
014030,000008:                                                                                                  ##              that the code format has been changed to conform to the
014031,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the 
014032,000010:                                                                                                  ##              original YUL assembler.
014033,000011:                                                                                                  ## Reference:   pp. 340-343
014034,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
014035,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
014036,000014:                                                                                                  ## Mod history: 05/06/03 RSB.   Began transcribing.
014037,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
014038,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
014039,000017:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
014040,000018:                                                                                                  ##                              numbers in 1701.pdf.
014041,000019:                                                                                                  ##              2017-01-26 RSB  Back-ported a comment-text fix from Luminary 69.
014042,000020:                                                                                                  ##              2017-02-23 RSB  Proofed comment text using octopus/ProoferComments.
014043,000021:                                                                                                  ##              2017-02-28 RSB  Fixed lingering typos.
014044,000022:                                                                                                  ##              2017-03-07 RSB  Comment-text fixes noted in proofing Luminary 116.
014045,000023: 

Page 340

014047,000025:                                                                                                  #  SUBROUTINE NAME:      V89CALL
014048,000026:                                                                                                  #  MOD NO:       0                       DATE:           9 JAN 1968
014049,000027:                                                                                                  #  MOD BY:       DIGITAL DEVEL GROUP     LOG SECTION:    R63
014050,000028: 
014051,000029:                                                                                                  #  FUNCTIONAL DESCRIPTION:
014052,000030: 
014053,000031:                                                                                                  #  CALLED BY VERB 89 ENTER DURING P00.  PRIO 10 USED.  CALCULATES AND
014054,000032:                                                                                                  #  DISPLAYS FINAL FDAI BALL ANGLES TO POINT LM +X OR +Z AXIS AT CSM.
014055,000033: 
014056,000034:                                                                                                  #  1. KEY IN V 89 E ONLY IF IN PROG 00.  IF NOT IN P00, OPERATOR ERROR AND
014057,000035:                                                                                                  #  EXIT R63, OTHERWISE CONTINUE.
014058,000036: 
014059,000037:                                                                                                  #  2. IF IN P00, DO IMU STATUS CHECK ROUTINE (R02BOTH).  IF IMU ON AND ITS
014060,000038:                                                                                                  #  ORIENTATION KNOWN TO LGC, CONTINUE.
014061,000039: 
014062,000040:                                                                                                  #  3. FLASH DISPLAY V 04 N 06.  R2 INDICATES WHICH SPACECRAFT AXIS IS TO
014063,000041:                                                                                                  #  BE POINTED AT CSM.  INITIAL CHOICE IS PREFERRED (+Z) AXIS (R2=1).
014064,000042:                                                                                                  #  ASTRONAUT CAN CHANGE TO (+X) AXIS (R2 NOT =1) BY V 22 E 2 E.  CONTINUE
014065,000043:                                                                                                  #  AFTER KEYING IN PROCEED.
014066,000044: 
014067,000045:                                                                                                  #  4. BOTH VEHICLE STATE VECTORS UPDATED BY CONIC EQS.
014068,000046: 
014069,000047:                                                                                                  #  5. HALF MAGNITUDE UNIT LOS VECTOR (IN STABLE MEMBER COORDINATES) AND
014070,000048:                                                                                                  #  HALF MAGNITUDE UNIT SPACECRAFT AXIS VECTOR (IN BODY COORDINATES)
014071,000049:                                                                                                  #  PREPARED FOR VECPOINT.
014072,000050: 
014073,000051:                                                                                                  #  6. GIMBAL ANGLES FROM VECPOINT TRANSFORMED INTO FDAI BALL ANGLES BY
014074,000052:                                                                                                  #  BALLANGS.  FLASH DISPLAY V 06 N 18 AND AWAIT RESPONSE.
014075,000053: 
014076,000054:                                                                                                  #  7.    RECYCLE - RETURN TO STEP 4.
014077,000055:                                                                                                  #        TERMINATE - EXIT R63.
014078,000056:                                                                                                  #        PROCEED - RESET 3AXISFLG AND CALL R60LEM FOR ATTITUDE MANEUVER.
014079,000057: 
014080,000058:                                                                                                  #  CALLING SEQUENCE:     V 89 E.
014081,000059: 
014082,000060:                                                                                                  #  SUBROUTINES CALLED:   CHKPOOH, R02BOTH, GOXDSPF, CSMCONIC, LEMCONIC,
014083,000061:                                                                                                  #                        VECPOINT, BALLANGS, R60LEM.
014084,000062: 
014085,000063:                                                                                                  #  NORMAL EXIT MODES:    TC ENDEXT
014086,000064: 
014087,000065:                                                                                                  #  ALARMS:       1. OPERATOR ERROR IF NOT IN P00.
014088,000066:                                                                                                  #                2. PROGRAM ALARM IF IMU IS OFF.
014089,000067:                                                                                                  #                3. PROGRAM ALARM IF IMU ORIENTATION IS UNKNOWN.
014090,000068: 
014091,000069:                                                                                                  #  OUTPUT:       NONE
014092,000070: 
014093,000071:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED:  NONE
014094,000072: 
014095,000073:                                                                                                  #  DEBRIS:       OPTION1, +1, TDEC1, POINTVSM, SCAXIS, CPHI, CTHETA, CPSI,

Page 341

014097,000075:                                                                                                  #                3AXISFLG.
014098,000076: 
014099,000077: 06,3723  E4,1606                                  EBANK=   RONE                                  
014100,000078: 32,2217                                           BANK     32                                    
014101,000079: 26,2000                                           SETLOC   BAWLANGS                              
014102,000080: 26,2000                                           BANK                                           
014103,000081: 
014104,000082: 26,2022                                           COUNT*   $$/R63                                
014105,000083: 26,2022           04616        V89CALL            TC       BANKCALL                              #  IMU STATUS CHECK.  RETURNS IF ORIENTATION
014106,000084: 26,2023           11233                           CADR     R02BOTH                               #  KNOWN.  ALARMS IF NOT.
014107,000085: 26,2024           36250                           CAF      THREE                                 #  ALLOW ASTRONAUT TO SELECT DESIRED
014108,000086: 26,2025           55050                           TS       OPTIONX                               #  TRACKING ATTITUDE AXIS.
014109,000087: 26,2026           34753                           CAF      ONE                                   
014110,000088: 26,2027           55051                           TS       OPTIONX    +1                         
014111,000089: 26,2030           32117                           CAF      VB04N12                               #  V 04 N 12
014112,000090: 26,2031           04616                           TC       BANKCALL                              
014113,000091: 26,2032           20477                           CADR     GOFLASH                               
014114,000092: 26,2033           05472                           TC       ENDEXT                                #  TERMINATE
014115,000093: 26,2034           02036                           TC       +2                                    #  PROCEED
014116,000094: 26,2035           02030                           TC       -5                                    #  DATA IN.  OPTION1+1 = 1 FOR Z AXIS
014117,000095: 26,2036           06042        V89RECL            TC       INTPRET                               #                     = 2 FOR X AXIS
014118,000096: 26,2037           43234                           RTB      DAD                                   
014119,000097: 26,2040           21574                                    LOADTIME                              #  READ PRESENT TIME
014120,000098: 26,2041           14122                                    DP1MIN                                
014121,000099: 26,2042           02205                           STORE    TSTART82                              #  SAVE TIME FOR LEMCONIC CALL
014122,000100: 26,2043           34041                           STCALL   TDEC1                                 #  STORE TIME FOR CSMCONIC CALL
014123,000101: 26,2044           27065                                    CSMCONIC                              #  CSM STATE VECTOR UPDATE
014124,000102: 26,2045           77775                           VLOAD                                          #  CSMCONIC LEFT R VECTOR IN RATT
014125,000103: 26,2046           00001                                    RATT                                  
014126,000104: 26,2047           16207                           STODL    RONE                                  #  SAVE FOR LINE OF SIGHT (LOS) COMPUTATION
014127,000105: 26,2050           02205                                    TSTART82                              
014128,000106: 26,2051           34041                           STCALL   TDEC1                                 #  STORE TIME FOR LEMCONIC CALL
014129,000107: 26,2052           27077                                    LEMCONIC                              #  LEM STATE VECTOR UPDATE
014130,000108: 26,2053           52375                           VLOAD    VSU                                   #  CSM POSITION - LEM POSITION = LOS
014131,000109: 26,2054           02207                                    RONE                                  #  LOS VECTOR LEFT IN MPAC
014132,000110: 26,2055           00001                                    RATT                                  
014133,000111: 26,2056           47121                           MXV      RTB                                   #  (REFSMMAT X LOS).  TRANSFORMS LOS FROM
014134,000112: 26,2057           01734                                    REFSMMAT                              #  REFERENCE COORD TO STAB MEMB COORD.
014135,000113: 26,2060           21727                                    NORMUNIT                              
014136,000114: 26,2061           03773                           STORE    POINTVSM                              #  STORE LOS FOR VECPOINT CALL
014137,000115: 26,2062           77776                           EXIT                                           
014138,000116: 26,2063           41051                           CS       OPTIONX    +1                         #  1 FOR Z AXIS.  2 FOR X AXIS.
014139,000117: 26,2064           64753                           AD       ONE                                   
014140,000118: 26,2065           00006                           EXTEND                                         
014141,000119: 26,2066           12113                           BZF      ALINEZ                                
014142,000120: 26,2067           06042        ALINEX             TC       INTPRET                               #  X AXIS ALIGNMENT
014143,000121: 26,2070           77775                           VLOAD                                          
014144,000122: 26,2071           06522                                    UNITX                                 #  READ (.5, 0, 0)

Page 342

014146,000124: 26,2072           37765        V89CALL1           STCALL   SCAXIS                                #  STORE SELECTED ALIGNMENT AXIS
014147,000125: 26,2073           56040                                    VECPOINT                              #  PUTS DESIRED GIM ANG (OG,IG,MG) IN TMPAC
014148,000126: 26,2074           00322                           STORE    CPHI                                  #  STORE GIMBAL ANGLES FOR BALLANGS CALL.
014149,000127: 26,2075           77776                           EXIT                                           
014150,000128: 26,2076           04616                           TC       BANKCALL                              
014151,000129: 26,2077           54272                           CADR     BALLANGS                              #  PUTS DESIRED BALL ANGLES IN FDAIX,Y,Z
014152,000130: 26,2100           32120                           CAF      VB06N18                               #  V 06 N 18
014153,000131: 26,2101           04616                           TC       BANKCALL                              #  NOUN 18 REFERS TO FDAIX,Y,Z
014154,000132: 26,2102           20477                           CADR     GOFLASH                               
014155,000133: 26,2103           05472                           TC       ENDEXT                                #  TERMINATE
014156,000134: 26,2104           02106                           TC       +2                                    #  PROCEED
014157,000135: 26,2105           02036                           TC       V89RECL                               #  RECYCLE
014158,000136: 26,2106           05516                           TC       DOWNFLAG                              #  RESET 3 AXIS FLAG
014159,000137: 26,2107           00124                           ADRES    3AXISFLG                              #  RESET BIT6 FLAG WORD 5
014160,000138: 26,2110           04616                           TC       BANKCALL                              #  PERFORMS LEM MANEUVER TO ALIGN SELECTED
014161,000139: 26,2111           54123                           CADR     R60LEM                                #  SPACECRAFT AXIS TO CSM.
014162,000140: 26,2112           15472                           TCF      ENDEXT                                #  TERMINATE R63
014163,000141: 
014164,000142: 26,2113           06042        ALINEZ             TC       INTPRET                               #  Z AXIS ALIGNMENT
014165,000143: 26,2114           52175                           VLOAD    GOTO                                  
014166,000144: 26,2115           06516                                    UNITZ                                 #  READ (0, 0, .5)
014167,000145: 26,2116           54072                                    V89CALL1                              
014168,000146: 
014169,000147: 26,2117           01014        VB04N12            VN       412                                   
014170,000148: 26,2120           01422        VB06N18            VN       0618                                  

Page 343

014172,000150: 26,2121           00000 13560  DP1MIN             2DEC     6000       B-28                       
014173,000151: 

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