Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97. A bug (which had been around since at least Apollo 10, Luminary 69) was discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute revision into Rev 1, which is what actually flew rather than the Rev 0 presented here. A hardcopy of Rev 0 is known to exist — it belonged to AGC developer Allan Klumpp for many years — but unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus the code you see here had been reconstructed (we believe accurately) rather than transcribed. The first step of the reconstruction of the Rev 0 source code was the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection. The process of reverting the active portion of the source code (i.e., other than program comments) from Rev 1 to Rev 0 was very minor, consisting only of moving the position of the STARTSB1 label in FRESH START AND RESTART. Allan had previously given us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read, in part:

	GAP:  ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051

A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here.

061600,000002:                                                                                                  ## Copyright:   Public domain.
061601,000003:                                                                                                  ## Filename:    DAP_INTERFACE_SUBROUTINES.agc
061602,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
061603,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the third release
061604,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
061605,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
061606,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
061607,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
061608,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
061609,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
061610,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
061611,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
061612,000014:                                                                                                  ##              the original YUL assembler.
061613,000015:                                                                                                  ##
061614,000016:                                                                                                  ## Assembler:   yaYUL
061615,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
061616,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
061617,000019:                                                                                                  ## Pages:       1406-1409
061618,000020:                                                                                                  ## Mod history: 2009-05-10 SN   (Sergio Navarro).  Started adapting
061619,000021:                                                                                                  ##                              from the Luminary131/ file of the same
061620,000022:                                                                                                  ##                              name, using Luminary099 page images.
061621,000023:                                                                                                  ##              2011-01-06 JL   Fixed pseudo-label indentation.
061622,000024:                                                                                                  ##              2016-12-18 RSB  Proofed text comments with octopus/ProoferComments
061623,000025:                                                                                                  ##                              and corrected the errors found.
061624,000026:                                                                                                  ##              2017-03-10 RSB  Comment-text fixes noted in proofing Luminary 116.
061625,000027:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
061626,000028: 
061627,000029:                                                                                                  ## This source code has been transcribed or otherwise adapted from
061628,000030:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
061629,000031:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
061630,000032:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
061631,000033:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
061632,000034:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
061633,000035:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
061634,000036:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
061635,000037:                                                                                                  ## actually created.
061636,000038:                                                                                                  ##
061637,000039:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
061638,000040:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
061639,000041:                                                                                                  ## the listing from which it was transcribed. It has been verified to
061640,000042:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
061641,000043:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
061642,000044:                                                                                                  ##
061643,000045:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
061644,000046:                                                                                                  ##
061645,000047:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
061646,000048: 

Page 1406

061648,000050: 20,2123                                           BANK     20                                    
061649,000051: 20,2000                                           SETLOC   DAPS3                                 
061650,000052: 20,2000                                           BANK                                           
061651,000053: 
061652,000054: 20,2123  E6,1635                                  EBANK=   CDUXD                                 
061653,000055: 20,2123                                           COUNT*   $$/DAPIF                              
061654,000056: 
061655,000057:                                                                                                  #  MOD 0         DATE    11/15/66        BY GEORGE W. CHERRY
061656,000058:                                                                                                  #  MOD 1                  1/23/67        MODIFICATION BY PETER ADLER
061657,000059: 
061658,000060:                                                                                                  #  FUNCTIONAL DESCRIPTION
061659,000061:                                                                                                  #        HEREIN ARE A COLLECTION OF SUBROUTINES WHICH ALLOW MISSION CONTROL PROGRAMS TO CONTROL THE MODE
061660,000062:                                                                                                  #        AND INTERFACE WITH THE DAP.
061661,000063: 
061662,000064:                                                                                                  #  CALLING SEQUENCES
061663,000065:                                                                                                  #        IN INTERRUPT OR WITH INTERRUPT INHIBITED
061664,000066:                                                                                                  #                TC      IBNKCALL
061665,000067:                                                                                                  #                FCADR   ROUTINE
061666,000068:                                                                                                  #        IN A JOB WITHOUT INTERRUPT INHIBITED
061667,000069:                                                                                                  #                INHINT
061668,000070:                                                                                                  #                TC      IBNKCALL
061669,000071:                                                                                                  #                FCADR   ROUTINE
061670,000072:                                                                                                  #                RELINT
061671,000073: 
061672,000074:                                                                                                  #  OUTPUT
061673,000075:                                                                                                  #        SEE INDIVIDUAL ROUTINES BELOW
061674,000076: 
061675,000077:                                                                                                  #  DEBRIS
061676,000078:                                                                                                  #        A, L, AND SOMETIMES MDUETEMP                    ODE     NOT IN PULSES MODE
061677,000079: 

Page 1407

061679,000081:                                                                                                  #  SUBROUTINE NAMES:
061680,000082:                                                                                                  #        SETMAXDB, SETMINDB, RESTORDB, PFLITEDB
061681,000083:                                                                                                  #  MODIFIED:     30 JANUARY 1968 BY P S WEISSMAN TO CREATE RESTORDB.
061682,000084:                                                                                                  #  MODIFIED:     1 MARCH 1968 BY P S WEISSMAN TO SAVE EBANK AND CREATE PFLITEDB
061683,000085: 
061684,000086:                                                                                                  #  FUNCTIONAL DESCRIPTION:
061685,000087:                                                                                                  #        SETMAXDB - SET DEADBAND TO 5.0 DEGREES
061686,000088:                                                                                                  #        SETMINDB - SET DEADBAND TO 0.3 DEGREE
061687,000089:                                                                                                  #        RESTORDB - SET DEADBAND TO MAX OR MIN ACCORDING TO SETTING OF DBSELECT BIT OF DAPBOOLS
061688,000090:                                                                                                  #        PFLITEDB - SET DEADBAND TO 1.0 DEGREE AND ZERO THE COMMANDED ATTITUDE CHANGE AND COMMANDED RATE
061689,000091: 
061690,000092:                                                                                                  #        ALL ENTRIES SET UP A NOVAC JOB TO DO 1/ACCS SO THAT THE TJETLAW SWITCH CURVES ARE POSITIONED TO
061691,000093:                                                                                                  #        REFLECT THE NEW DEADBAND.  IT SHOULD BE NOTED THAT THE DEADBAND REFERS TO THE ATTITUDE IN THE P-, U-, AND V-AXES.
061692,000094: 
061693,000095:                                                                                                  #  SUBROUTINE CALLED:    NOVAC
061694,000096: 
061695,000097:                                                                                                  #  CALLING SEQUENCE:     SAME AS ABOVE
061696,000098:                                                                                                  #                        OR      TC RESTORDB +1    FROM ALLCOAST
061697,000099: 
061698,000100:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, (ITEMPS IN NOVAC)
061699,000101: 
061700,000102: 20,2123           30111        RESTORDB           CAE      DAPBOOLS                              #  DETERMINE CREW-SELECTED DEADBAND.
061701,000103: 20,2124           74750                           MASK     DBSELECT                              
061702,000104: 20,2125           00006                           EXTEND                                         
061703,000105: 20,2126           12140                           BZF      SETMINDB                              
061704,000106: 
061705,000107: 20,2127           32151        SETMAXDB           CAF      WIDEDB                                #  SET 5 DEGREE DEADBAND.
061706,000108: 20,2130           55346                 +1        TS       DB                                    
061707,000109: 
061708,000110: 20,2131           00006                           EXTEND                                         #  SET UP JOB TO RE-POSITION SWITCH CURVES.
061709,000111: 20,2132           22070                           QXCH     RUPTREG1                              
061710,000112: 20,2133           37715        CALLACCS           CAF      PRIO27                                
061711,000113: 20,2134           05072                           TC       NOVAC                                 
061712,000114: 20,2135  E6,1537                                  EBANK=   AOSQ                                  
061713,000115: 20,2135           02454 40106                     2CADR    1/ACCJOB                              
061714,000116: 
061715,000117: 20,2137           00070                           TC       RUPTREG1                              #  RETURN TO CALLER.
061716,000118: 
061717,000119: 20,2140           32150        SETMINDB           CAF      NARROWDB                              #  SET 0.3 DEGREE DEADBAND.
061718,000120: 20,2141           12130                           TCF      SETMAXDB   +1                         
061719,000121: 
061720,000122: 20,2142           00006        PFLITEDB           EXTEND                                         #  THE RETURN FROM CALLACCS IS TO RUPTREG1.
061721,000123: 20,2143           22070                           QXCH     RUPTREG1                              
061722,000124: 20,2144           02153                           TC       ZATTEROR                              #  ZERO THE ERRORS AND COMMANDED RATES.
061723,000125: 20,2145           32152                           CAF      POWERDB                               #  SET DB TO 1.0 DEG.
061724,000126: 20,2146           55346                           TS       DB                                    
061725,000127: 20,2147           12133                           TCF      CALLACCS                              #  SET UP 1/ACCS AND RETURN TO CALLER.
061726,000128: 20,2150           00155        NARROWDB           OCTAL    00155                                 #  0.3 DEGREE SCALED AT 45.

Page 1408

061728,000130: 20,2151           03434        WIDEDB             OCTAL    03434                                 #  5.0 DEGREES SCALED AT 45.
061729,000131: 20,2152           00554        POWERDB            DEC      .02222                                #  1.0 DEGREE SCALED AT 45.
061730,000132: 
061731,000133: 20,2153           35015        ZATTEROR           CAF      EBANK6                                
061732,000134: 20,2154           56003                           XCH      EBANK                                 
061733,000135: 20,2155           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
061734,000136: 20,2156           30032                           CAE      CDUX                                  
061735,000137: 20,2157           55635                           TS       CDUXD                                 
061736,000138: 20,2160           30033                           CAE      CDUY                                  
061737,000139: 20,2161           55636                           TS       CDUYD                                 
061738,000140: 20,2162           30034                           CAE      CDUZ                                  
061739,000141: 20,2163           55637                           TS       CDUZD                                 
061740,000142: 20,2164           12170                           TCF      STOPRATE   +3                         
061741,000143: 
061742,000144: 20,2165           35015        STOPRATE           CAF      EBANK6                                
061743,000145: 20,2166           56003                           XCH      EBANK                                 
061744,000146: 20,2167           54001                           TS       L                                     #  SAVE CALLERS EBANK IN L.
061745,000147: 20,2170           34755                 +3        CAF      ZERO                                  
061746,000148: 20,2171           55643                           TS       OMEGAPD                               
061747,000149: 20,2172           55644                           TS       OMEGAQD                               
061748,000150: 20,2173           55645                           TS       OMEGARD                               
061749,000151: 20,2174           55640                           TS       DELCDUX                               
061750,000152: 20,2175           55641                           TS       DELCDUY                               
061751,000153: 20,2176           55642                           TS       DELCDUZ                               
061752,000154: 20,2177           55277                           TS       DELPEROR                              
061753,000155: 20,2200           55300                           TS       DELQEROR                              
061754,000156: 20,2201           55301                           TS       DELREROR                              
061755,000157: 20,2202           22003                           LXCH     EBANK                                 #  RESTORE CALLERS EBANK.
061756,000158: 20,2203           00002                           TC       Q                                     
061757,000159: 
061758,000160:                                                                                                  #  SUBROUTINE NAME:      ALLCOAST
061759,000161:                                                                                                  #  WILL BE CALLED BY FRESH STARTS AND ENGINE OFF ROUTINES.               .
061760,000162: 
061761,000163:                                                                                                  #  CALLING SEQUENCE:     (SAME AS ABOVE)
061762,000164: 
061763,000165:                                                                                                  #  EXIT:                 RETURN TO Q.
061764,000166: 
061765,000167:                                                                                                  #  SUBROUTINES CALLED:   STOPRATE, RESTORDB, NOVAC
061766,000168: 
061767,000169:                                                                                                  #  ZERO:                 (FOR ALL AXES) AOS, ALPHA, AOSTERM, OMEGAD, DELCDU, DELEROR
061768,000170: 
061769,000171:                                                                                                  #  OUTPUT:               DRIFTBIT/DAPBOOLS, DB, JOB TO DO 1/ACCS
061770,000172: 
061771,000173:                                                                                                  #  DEBRIS:               A, L, Q, RUPTREG1, RUPTREG2, (ITEMPS IN NOVAC)
061772,000174: 
061773,000175: 20,2204           00006        ALLCOAST           EXTEND                                         #  SAVE Q FOR RETURN
061774,000176: 20,2205           22071                           QXCH     RUPTREG2                              

Page 1409

061776,000178: 20,2206           02165                           TC       STOPRATE                              #  CLEAR RATE INTERFACE.  RETURN WITH A=0
061777,000179: 20,2207           22003                           LXCH     EBANK                                 #  AND L=EBANK6.  SAVE CALLERS EBANK.
061778,000180: 20,2210           55537                           TS       AOSQ                                  
061779,000181: 20,2211           55540                           TS       AOSQ       +1                         
061780,000182: 20,2212           55541                           TS       AOSR                                  
061781,000183: 20,2213           55542                           TS       AOSR       +1                         
061782,000184: 20,2214           55424                           TS       ALPHAQ                                #  FOR DOWNLIST.
061783,000185: 20,2215           55425                           TS       ALPHAR                                
061784,000186: 20,2216           55545                           TS       AOSQTERM                              
061785,000187: 20,2217           55546                           TS       AOSRTERM                              
061786,000188: 20,2220           22003                           LXCH     EBANK                                 #  RESTORE EBANK (EBANK6 NO LONGER NEEDED)
061787,000189: 
061788,000190: 20,2221           40111                           CS       DAPBOOLS                              #  SET UP DRIFTBIT
061789,000191: 20,2222           74744                           MASK     DRIFTBIT                              
061790,000192: 20,2223           26111                           ADS      DAPBOOLS                              
061791,000193: 20,2224           02124                           TC       RESTORDB   +1                         #  RESTORE DEADBANK TO CREW-SELECTED VALUE.
061792,000194: 
061793,000195: 20,2225           00071                           TC       RUPTREG2                              #  RETURN.
061794,000196: 

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