Source Code

These source-code files are part of a reconstructed copy of Comanche 51, the initial release (though not the final mission release) of the Apollo 11 Command Module (CM) Apollo Guidance Computer (AGC) software. The flown, final release was Comanche 55. The reconstruction is believed to be exactly accurate, but in the absence of an actual Apollo-era listing of Comanche 51, some explanation of the reconstruction process is needed to insure confidence in that accuracy.

The starting point was the source code of Comanche 55, whose original source code is available. Comanche 55 source code was then modified by undoing changes known to have been made between revisions 51 and 55. The most-significant steps involved reverting changes related to the R-2 lunar potential model, the details of which were known from the previous, separate, independent reconstruction of the Apollo 10 Lunar Module software Luminary 69/2. The now-reconstructed Comanche 51 source code was verified by assembling it and checking that the assembled code had the expected known-correct memory-bank checksums. Note that page numbers in the reconstructed code match those on the Comanche 55 or Luminary 69 printouts, although the source code would likely have different page numbers in a contemporary Comanche 51 listing.

Annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change relative to Comanche 55. Here's a guide to some of the Apollo documentation relevant to those annotations:
Among documentation not actually referenced in the annotations, there is a short writeup about the reconstruction process in our software repository that may be helpful in understanding it from a different perspective. There's also a handy table that lists what the number of memory-words should be for each routine in Comanche 51, which could make a nice double-check; however, we've not performed that double-check ourselves.

Comments expected to have been present in 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.

045158,000002:                                                                                                  ## Copyright:   Public domain.
045159,000003:                                                                                                  ## Filename:    RCS-CSM_DAP_EXECUTIVE_PROGRAMS.agc
045160,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
045161,000005:                                                                                                  ##              It is part of the reconstructed source code for the
045162,000006:                                                                                                  ##              original release of the flight software for the Command
045163,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
045164,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
045165,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
045166,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
045167,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
045168,000012:                                                                                                  ##              reconstruction is correct.
045169,000013:                                                                                                  ## Reference:   pp. 1037-1038
045170,000014:                                                                                                  ## Assembler:   yaYUL
045171,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
045172,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
045173,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
045174,000018: 

Page 1037

045176,000020:                                                                                                  #  CALCULATION OF  AMGB, AMBG  ONCE EVERY SECOND
045177,000021: 
045178,000022:                                                                                                  #        AMGB =  1       SIN(PSI)                0
045179,000023:                                                                                                  #                0       COS(PSI)COS(PHI)        SIN(PHI)
045180,000024:                                                                                                  #                0       -COS(PSI)SIN(PHI)       COS(PHI)
045181,000025: 
045182,000026:                                                                                                  #        AMBG =  1       -TAN(PSI)COS(PHI)       TAN(PSI)SIN(PHI)
045183,000027:                                                                                                  #                0       COS(PHI)/COS(PSI)       -SIN(PHI)/COS(PSI)
045184,000028:                                                                                                  #                0       SIN(PHI)                COS(PHI)
045185,000029: 
045186,000030:                                                                                                  #  WHERE PHI AND PSI ARE CDU ANGLES
045187,000031: 
045188,000032: 20,3612                                           BANK     20                                    
045189,000033: 22,2000                                           SETLOC   DAPS8                                 
045190,000034: 22,2000                                           BANK                                           
045191,000035: 
045192,000036: 22,3447                                           COUNT*   $$/DAPEX                              
045193,000037: 22,3447  E6,1510                                  EBANK=   KMPAC                                 
045194,000038: 22,3447           30102        AMBGUPDT           CA       FLAGWRD6                              #  CHECK FOR RCS AUTOPILOT
045195,000039: 22,3450           00006                           EXTEND                                         
045196,000040: 22,3451           65217                           BZMF     ENDOFJOB                              #  BIT15 = 0, BIT14 = 1
045197,000041: 22,3452           75002                           MASK     BIT14                                 #  IF NOT RCS, EXIT
045198,000042: 22,3453           00006                           EXTEND                                         
045199,000043: 22,3454           15217                           BZF      ENDOFJOB                              #  TO PROTECT TVC DAP ON SWITCHOVER
045200,000044: 
045201,000045: 22,3455           30034                           CA       CDUZ                                  
045202,000046: 22,3456           05075                           TC       SPSIN2                                
045203,000047: 22,3457           55640                           TS       AMGB1                                 #  CALCULATE AMGB
045204,000048: 22,3460           30034                           CA       CDUZ                                  
045205,000049: 22,3461           05074                           TC       SPCOS2                                
045206,000050: 22,3462           55645                           TS       CAPSI                                 #  MUST CHECK FOR GIMBAL LOCK
045207,000051: 22,3463           33507                           CAF      QUADANGL                              #  = 7.25  DEGREES JET QUAD ANGULAR OFFSET
045208,000052: 22,3464           00006                           EXTEND                                         
045209,000053: 22,3465           20032                           MSU      CDUX                                  
045210,000054: 22,3466           40000                           COM                                            #  CDUX - 7.25 DEG
045211,000055: 22,3467           05074                           TC       SPCOS1                                
045212,000056: 22,3470           55644                           TS       AMGB8                                 
045213,000057: 22,3471           00006                           EXTEND                                         
045214,000058: 22,3472           71645                           MP       CAPSI                                 
045215,000059: 22,3473           55641                           TS       AMGB4                                 
045216,000060: 22,3474           33507                           CAF      QUADANGL                              
045217,000061: 22,3475           00006                           EXTEND                                         
045218,000062: 22,3476           20032                           MSU      CDUX                                  
045219,000063: 22,3477           40000                           COM                                            #  CDUX - 7.25 DEG
045220,000064: 22,3500           05075                           TC       SPSIN1                                
045221,000065: 22,3501           55642                           TS       AMGB5                                 
045222,000066: 22,3502           00006                           EXTEND                                         
045223,000067: 22,3503           71645                           MP       CAPSI                                 
045224,000068: 22,3504           40000                           COM                                            

Page 1038

045226,000070: 22,3505           55643                           TS       AMGB7                                 
045227,000071: 22,3506           15217                           TCF      ENDOFJOB                              
045228,000072: 22,3507           01224        QUADANGL           DEC      660        B-14                       #  = 7.25 DEGREES
045229,000073: 

End of include-file RCS-CSM_DAP_EXECUTIVE_PROGRAMS.agc.  Parent file is MAIN.agc