Source Code

These source-code files are part of a reconstructed copy of Comanche 45/2 (AKA Manche45 revision 2), the final, flown mission release of the Apollo 10 Command Module (CM) Apollo Guidance Computer (AGC) software. Comanche 45/2 was preceded by Comanche 44 and Comanche 45. The reconstruction is believed to be exactly accurate, but in the absence of an actual Apollo-era listing of Comanche 45/2, some explanation of the reconstruction process is needed to insure confidence in that accuracy.

The starting point was the source code of Comanche 45 (itself previously accurately reconstructed). Comanche 45 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 45 and 45/2. The now-reconstructed Comanche 45/2 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 tend to match those in the Comanche 55, the most-similar revision of Comanche for which we have access to an actual non-reconstructed hardcopy; the source code would likely have different page numbers in a contemporary Comanche 45 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 44. Here's a guide to the Apollo documentation referenced in those annotations:
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.

045094,000002:                                                                                                  ## Copyright:   Public domain.
045095,000003:                                                                                                  ## Filename:    RCS-CSM_DAP_EXECUTIVE_PROGRAMS.agc
045096,000004:                                                                                                  ## Purpose:     A section of Manche45 revision 2.
045097,000005:                                                                                                  ##              It is part of the reconstructed source code for the
045098,000006:                                                                                                  ##              final, flown release of the flight software for the Command
045099,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
045100,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
045101,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
045102,000010:                                                                                                  ##              exactly match those specified for Manche 45/2 in NASA drawing
045103,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
045104,000012:                                                                                                  ##              reconstruction is correct.
045105,000013:                                                                                                  ## Assembler:   yaYUL
045106,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
045107,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
045108,000016:                                                                                                  ## Mod history: 2020-12-24 MAS  Created from Comanche 45.
045109,000017: 

Page 1037

045111,000019:                                                                                                  #  CALCULATION OF  AMGB, AMBG  ONCE EVERY SECOND
045112,000020: 
045113,000021:                                                                                                  #        AMGB =  1       SIN(PSI)                0
045114,000022:                                                                                                  #                0       COS(PSI)COS(PHI)        SIN(PHI)
045115,000023:                                                                                                  #                0       -COS(PSI)SIN(PHI)       COS(PHI)
045116,000024: 
045117,000025:                                                                                                  #        AMBG =  1       -TAN(PSI)COS(PHI)       TAN(PSI)SIN(PHI)
045118,000026:                                                                                                  #                0       COS(PHI)/COS(PSI)       -SIN(PHI)/COS(PSI)
045119,000027:                                                                                                  #                0       SIN(PHI)                COS(PHI)
045120,000028: 
045121,000029:                                                                                                  #  WHERE PHI AND PSI ARE CDU ANGLES
045122,000030: 
045123,000031: 20,3612                                           BANK     20                                    
045124,000032: 22,2000                                           SETLOC   DAPS8                                 
045125,000033: 22,2000                                           BANK                                           
045126,000034: 
045127,000035: 22,3447                                           COUNT*   $$/DAPEX                              
045128,000036: 22,3447  E6,1510                                  EBANK=   KMPAC                                 
045129,000037: 22,3447           30102        AMBGUPDT           CA       FLAGWRD6                              #  CHECK FOR RCS AUTOPILOT
045130,000038: 22,3450           00006                           EXTEND                                         
045131,000039: 22,3451           65217                           BZMF     ENDOFJOB                              #  BIT15 = 0, BIT14 = 1
045132,000040: 22,3452           75002                           MASK     BIT14                                 #  IF NOT RCS, EXIT
045133,000041: 22,3453           00006                           EXTEND                                         
045134,000042: 22,3454           15217                           BZF      ENDOFJOB                              #  TO PROTECT TVC DAP ON SWITCHOVER
045135,000043: 
045136,000044: 22,3455           30034                           CA       CDUZ                                  
045137,000045: 22,3456           05075                           TC       SPSIN2                                
045138,000046: 22,3457           55640                           TS       AMGB1                                 #  CALCULATE AMGB
045139,000047: 22,3460           30034                           CA       CDUZ                                  
045140,000048: 22,3461           05074                           TC       SPCOS2                                
045141,000049: 22,3462           55645                           TS       CAPSI                                 #  MUST CHECK FOR GIMBAL LOCK
045142,000050: 22,3463           33507                           CAF      QUADANGL                              #  = 7.25  DEGREES JET QUAD ANGULAR OFFSET
045143,000051: 22,3464           00006                           EXTEND                                         
045144,000052: 22,3465           20032                           MSU      CDUX                                  
045145,000053: 22,3466           40000                           COM                                            #  CDUX - 7.25 DEG
045146,000054: 22,3467           05074                           TC       SPCOS1                                
045147,000055: 22,3470           55644                           TS       AMGB8                                 
045148,000056: 22,3471           00006                           EXTEND                                         
045149,000057: 22,3472           71645                           MP       CAPSI                                 
045150,000058: 22,3473           55641                           TS       AMGB4                                 
045151,000059: 22,3474           33507                           CAF      QUADANGL                              
045152,000060: 22,3475           00006                           EXTEND                                         
045153,000061: 22,3476           20032                           MSU      CDUX                                  
045154,000062: 22,3477           40000                           COM                                            #  CDUX - 7.25 DEG
045155,000063: 22,3500           05075                           TC       SPSIN1                                
045156,000064: 22,3501           55642                           TS       AMGB5                                 
045157,000065: 22,3502           00006                           EXTEND                                         
045158,000066: 22,3503           71645                           MP       CAPSI                                 
045159,000067: 22,3504           40000                           COM                                            

Page 1038

045161,000069: 22,3505           55643                           TS       AMGB7                                 
045162,000070: 22,3506           15217                           TCF      ENDOFJOB                              
045163,000071: 22,3507           01224        QUADANGL           DEC      660        B-14                       #  = 7.25 DEGREES
045164,000072: 

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