Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
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.

060524,000002:                                                                                                  ## Copyright:   Public domain.
060525,000003:                                                                                                  ## Filename:    DAP_INTERFACE_SUBROUTINES.agc
060526,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
060527,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
060528,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
060529,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
060530,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
060531,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
060532,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
060533,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
060534,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
060535,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
060536,000014:                                                                                                  ## Reference:   pp. 1401-1404
060537,000015:                                                                                                  ## Assembler:   yaYUL
060538,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
060539,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
060540,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
060541,000019: 

Page 1401

060543,000021: 20,2123                                           BANK     20                                    
060544,000022: 20,2000                                           SETLOC   DAPS3                                 
060545,000023: 20,2000                                           BANK                                           
060546,000024: 
060547,000025: 20,2123  E6,1633                                  EBANK=   CDUXD                                 
060548,000026: 20,2123                                           COUNT*   $$/DAPIF                              
060549,000027: 
060550,000028:                                                                                                  #  MOD 0         DATE    11/15/66        BY GEORGE W. CHERRY
060551,000029:                                                                                                  #  MOD 1                  1/23/67        MODIFICATION BY PETER ADLER
060552,000030: 
060553,000031:                                                                                                  #  FUNCTIONAL DESCRIPTION
060554,000032:                                                                                                  #        HEREIN ARE A COLLECTION OF SUBROUTINES WHICH ALLOW MISSION CONTROL PROGRAMS TO CONTROL THE MODE
060555,000033:                                                                                                  #        AND INTERFACE WITH THE DAP.
060556,000034: 
060557,000035:                                                                                                  #  CALLING SEQUENCES
060558,000036:                                                                                                  #        IN INTERRUPT OR WITH INTERRUPT INHIBITED
060559,000037:                                                                                                  #                TC      IBNKCALL
060560,000038:                                                                                                  #                FCADR   ROUTINE
060561,000039:                                                                                                  #        IN A JOB WITHOUT INTERRUPT INHIBITED
060562,000040:                                                                                                  #                INHINT
060563,000041:                                                                                                  #                TC      IBNKCALL
060564,000042:                                                                                                  #                FCADR   ROUTINE
060565,000043:                                                                                                  #                RELINT
060566,000044: 
060567,000045:                                                                                                  #  OUTPUT
060568,000046:                                                                                                  #        SEE INDIVIDUAL ROUTINES BELOW
060569,000047: 
060570,000048:                                                                                                  #  DEBRIS
060571,000049:                                                                                                  #        A, L, AND SOMETIMES MDUETEMP                    ODE     NOT IN PULSES MODE
060572,000050: 

Page 1402

060574,000052:                                                                                                  #  SUBROUTINE NAMES:
060575,000053:                                                                                                  #        SETMAXDB, SETMINDB, RESTORDB, PFLITEDB
060576,000054:                                                                                                  #  MODIFIED:     30 JANUARY 1968 BY P S WEISSMAN TO CREATE RESTORDB.
060577,000055:                                                                                                  #  MODIFIED:     1 MARCH 1968 BY P S WEISSMAN TO SAVE EBANK AND CREATE PFLITEDB
060578,000056: 
060579,000057:                                                                                                  #  FUNCTIONAL DESCRIPTION:
060580,000058:                                                                                                  #        SETMAXDB - SET DEADBAND TO 5.0 DEGREES
060581,000059:                                                                                                  #        SETMINDB - SET DEADBAND TO 0.3 DEGREE
060582,000060:                                                                                                  #        RESTORDB - SET DEADBAND TO MAX OR MIN ACCORDING TO SETTING OF DBSELECT BIT OF DAPBOOLS
060583,000061:                                                                                                  #        PFLITEDB - SET DEADBAND TO 1.0 DEGREE AND ZERO THE COMMANDED ATTITUDE CHANGE AND COMMANDED RATE
060584,000062: 
060585,000063:                                                                                                  #        ALL ENTRIES SET UP A NOVAC JOB TO DO 1/ACCS SO THAT THE TJETLAW SWITCH CURVES ARE POSITIONED TO
060586,000064:                                                                                                  #        REFLECT THE NEW DEADBAND.  IT SHOULD BE NOTED THAT THE DEADBAND REFERS TO THE ATTITUDE IN THE P-, U-, AND V-AXES.
060587,000065: 
060588,000066:                                                                                                  #  SUBROUTINE CALLED:    NOVAC
060589,000067: 
060590,000068:                                                                                                  #  CALLING SEQUENCE:     SAME AS ABOVE
060591,000069:                                                                                                  #                        OR      TC RESTORDB +1    FROM ALLCOAST
060592,000070: 
060593,000071:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, (ITEMPS IN NOVAC)
060594,000072: 
060595,000073: 20,2123           30111        RESTORDB           CAE      DAPBOOLS                              #  DETERMINE CREW-SELECTED DEADBAND.
060596,000074: 20,2124           74750                           MASK     DBSELECT                              
060597,000075: 20,2125           00006                           EXTEND                                         
060598,000076: 20,2126           12140                           BZF      SETMINDB                              
060599,000077: 
060600,000078: 20,2127           32151        SETMAXDB           CAF      WIDEDB                                #  SET 5 DEGREE DEADBAND.
060601,000079: 20,2130           55346                 +1        TS       DB                                    
060602,000080: 
060603,000081: 20,2131           00006                           EXTEND                                         #  SET UP JOB TO RE-POSITION SWITCH CURVES.
060604,000082: 20,2132           22070                           QXCH     RUPTREG1                              
060605,000083: 20,2133           37714        CALLACCS           CAF      PRIO27                                
060606,000084: 20,2134           05072                           TC       NOVAC                                 
060607,000085: 20,2135  E6,1537                                  EBANK=   AOSQ                                  
060608,000086: 20,2135           02454 40106                     2CADR    1/ACCJOB                              
060609,000087: 
060610,000088: 20,2137           00070                           TC       RUPTREG1                              #  RETURN TO CALLER.
060611,000089: 
060612,000090: 20,2140           32150        SETMINDB           CAF      NARROWDB                              #  SET 0.3 DEGREE DEADBAND.
060613,000091: 20,2141           12130                           TCF      SETMAXDB   +1                         
060614,000092: 
060615,000093: 20,2142           00006        PFLITEDB           EXTEND                                         #  THE RETURN FROM CALLACCS IS TO RUPTREG1.
060616,000094: 20,2143           22070                           QXCH     RUPTREG1                              
060617,000095: 20,2144           02153                           TC       ZATTEROR                              #  ZERO THE ERRORS AND COMMANDED RATES.
060618,000096: 20,2145           32152                           CAF      POWERDB                               #  SET DB TO 1.0 DEG.
060619,000097: 20,2146           55346                           TS       DB                                    
060620,000098: 20,2147           12133                           TCF      CALLACCS                              #  SET UP 1/ACCS AND RETURN TO CALLER.
060621,000099: 20,2150           00155        NARROWDB           OCTAL    00155                                 #  0.3 DEGREE SCALED AT 45.

Page 1403

060623,000101: 20,2151           03434        WIDEDB             OCTAL    03434                                 #  5.0 DEGREES SCALED AT 45.
060624,000102: 20,2152           00554        POWERDB            DEC      .02222                                #  1.0 DEGREE SCALED AT 45.
060625,000103: 
060626,000104: 20,2153           35015        ZATTEROR           CAF      EBANK6                                
060627,000105: 20,2154           56003                           XCH      EBANK                                 
060628,000106: 20,2155           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
060629,000107: 20,2156           30032                           CAE      CDUX                                  
060630,000108: 20,2157           55633                           TS       CDUXD                                 
060631,000109: 20,2160           30033                           CAE      CDUY                                  
060632,000110: 20,2161           55634                           TS       CDUYD                                 
060633,000111: 20,2162           30034                           CAE      CDUZ                                  
060634,000112: 20,2163           55635                           TS       CDUZD                                 
060635,000113: 20,2164           12170                           TCF      STOPRATE   +3                         
060636,000114: 
060637,000115: 20,2165           35015        STOPRATE           CAF      EBANK6                                
060638,000116: 20,2166           56003                           XCH      EBANK                                 
060639,000117: 20,2167           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
060640,000118: 20,2170           34755                 +3        CAF      ZERO                                  
060641,000119: 20,2171           55641                           TS       OMEGAPD                               
060642,000120: 20,2172           55642                           TS       OMEGAQD                               
060643,000121: 20,2173           55643                           TS       OMEGARD                               
060644,000122: 20,2174           55636                           TS       DELCDUX                               
060645,000123: 20,2175           55637                           TS       DELCDUY                               
060646,000124: 20,2176           55640                           TS       DELCDUZ                               
060647,000125: 20,2177           55277                           TS       DELPEROR                              
060648,000126: 20,2200           55300                           TS       DELQEROR                              
060649,000127: 20,2201           55301                           TS       DELREROR                              
060650,000128: 20,2202           22003                           LXCH     EBANK                                 #  RESTORE CALLERS EBANK.
060651,000129: 20,2203           00002                           TC       Q                                     
060652,000130: 
060653,000131:                                                                                                  #  SUBROUTINE NAME:      ALLCOAST
060654,000132:                                                                                                  #  WILL BE CALLED BY FRESH STARTS AND ENGINE OFF ROUTINES.               .
060655,000133: 
060656,000134:                                                                                                  #  CALLING SEQUENCE:     (SAME AS ABOVE)
060657,000135: 
060658,000136:                                                                                                  #  EXIT:                 RETURN TO Q.
060659,000137: 
060660,000138:                                                                                                  #  SUBROUTINES CALLED:   STOPRATE, RESTORDB, NOVAC
060661,000139: 
060662,000140:                                                                                                  #  ZERO:                 (FOR ALL AXES) AOS, ALPHA, AOSTERM, OMEGAD, DELCDU, DELEROR
060663,000141: 
060664,000142:                                                                                                  #  OUTPUT:               DRIFTBIT/DAPBOOLS, DB, JOB TO DO 1/ACCS
060665,000143: 
060666,000144:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, RUPTREG2, (ITEMPS IN NOVAC)
060667,000145: 
060668,000146: 20,2204           00006        ALLCOAST           EXTEND                                         #  SAVE Q FOR RETURN
060669,000147: 20,2205           22071                           QXCH     RUPTREG2                              

Page 1404

060671,000149: 20,2206           02165                           TC       STOPRATE                              #  CLEAR RATE INTERFACE.  RETURN WITH A=0
060672,000150: 20,2207           22003                           LXCH     EBANK                                 #  AND L=EBANK6.  SAVE CALLERS EBANK.
060673,000151: 20,2210           55537                           TS       AOSQ                                  
060674,000152: 20,2211           55540                           TS       AOSQ       +1                         
060675,000153: 20,2212           55541                           TS       AOSR                                  
060676,000154: 20,2213           55542                           TS       AOSR       +1                         
060677,000155: 20,2214           55422                           TS       ALPHAQ                                #  FOR DOWNLIST.
060678,000156: 20,2215           55423                           TS       ALPHAR                                
060679,000157: 20,2216           55545                           TS       AOSQTERM                              
060680,000158: 20,2217           55546                           TS       AOSRTERM                              
060681,000159: 20,2220           22003                           LXCH     EBANK                                 #  RESTORE EBANK (EBANK6 NO LONGER NEEDED)
060682,000160: 
060683,000161: 20,2221           40111                           CS       DAPBOOLS                              #  SET UP DRIFTBIT
060684,000162: 20,2222           74744                           MASK     DRIFTBIT                              
060685,000163: 20,2223           26111                           ADS      DAPBOOLS                              
060686,000164: 20,2224           02124                           TC       RESTORDB   +1                         #  RESTORE DEADBANK TO CREW-SELECTED VALUE.
060687,000165: 
060688,000166: 20,2225           00071                           TC       RUPTREG2                              #  RETURN.
060689,000167: 

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