Source Code

These source-code files are part of a reconstructed copy of Comanche 051, the original release of the Apollo 11 Command Module (CM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Comanche 055 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes related to the R-2 lunar potential model, using hints from program comments and change-indicating asterisks in the Comanche 055 listing as a guide. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021153D. Note that page numbers in the reconstructed code match those on the Comanche 055 printout, although the added code would likely have changed page numbers for a real Comanche 051 listing.

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.

045120,000002:                                                                                                  ## Copyright:   Public domain.
045121,000003:                                                                                                  ## Filename:    RCS-CSM_DAP_EXECUTIVE_PROGRAMS.agc
045122,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
045123,000005:                                                                                                  ##              It is part of the reconstructed source code for the
045124,000006:                                                                                                  ##              original release of the flight software for the Command
045125,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
045126,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
045127,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
045128,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
045129,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
045130,000012:                                                                                                  ##              reconstruction is correct.
045131,000013:                                                                                                  ## Reference:   pp. 1037-1038
045132,000014:                                                                                                  ## Assembler:   yaYUL
045133,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
045134,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
045135,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
045136,000018: 

Page 1037

045138,000020:                                                                                                  #  CALCULATION OF  AMGB, AMBG  ONCE EVERY SECOND
045139,000021: 
045140,000022:                                                                                                  #        AMGB =  1       SIN(PSI)                0
045141,000023:                                                                                                  #                0       COS(PSI)COS(PHI)        SIN(PHI)
045142,000024:                                                                                                  #                0       -COS(PSI)SIN(PHI)       COS(PHI)
045143,000025: 
045144,000026:                                                                                                  #        AMBG =  1       -TAN(PSI)COS(PHI)       TAN(PSI)SIN(PHI)
045145,000027:                                                                                                  #                0       COS(PHI)/COS(PSI)       -SIN(PHI)/COS(PSI)
045146,000028:                                                                                                  #                0       SIN(PHI)                COS(PHI)
045147,000029: 
045148,000030:                                                                                                  #  WHERE PHI AND PSI ARE CDU ANGLES
045149,000031: 
045150,000032: 20,3612                                           BANK     20                                    
045151,000033: 22,2000                                           SETLOC   DAPS8                                 
045152,000034: 22,2000                                           BANK                                           
045153,000035: 
045154,000036: 22,3447                                           COUNT*   $$/DAPEX                              
045155,000037: 22,3447  E6,1510                                  EBANK=   KMPAC                                 
045156,000038: 22,3447           30102        AMBGUPDT           CA       FLAGWRD6                              #  CHECK FOR RCS AUTOPILOT
045157,000039: 22,3450           00006                           EXTEND                                         
045158,000040: 22,3451           65217                           BZMF     ENDOFJOB                              #  BIT15 = 0, BIT14 = 1
045159,000041: 22,3452           75002                           MASK     BIT14                                 #  IF NOT RCS, EXIT
045160,000042: 22,3453           00006                           EXTEND                                         
045161,000043: 22,3454           15217                           BZF      ENDOFJOB                              #  TO PROTECT TVC DAP ON SWITCHOVER
045162,000044: 
045163,000045: 22,3455           30034                           CA       CDUZ                                  
045164,000046: 22,3456           05075                           TC       SPSIN2                                
045165,000047: 22,3457           55640                           TS       AMGB1                                 #  CALCULATE AMGB
045166,000048: 22,3460           30034                           CA       CDUZ                                  
045167,000049: 22,3461           05074                           TC       SPCOS2                                
045168,000050: 22,3462           55645                           TS       CAPSI                                 #  MUST CHECK FOR GIMBAL LOCK
045169,000051: 22,3463           33507                           CAF      QUADANGL                              #  = 7.25  DEGREES JET QUAD ANGULAR OFFSET
045170,000052: 22,3464           00006                           EXTEND                                         
045171,000053: 22,3465           20032                           MSU      CDUX                                  
045172,000054: 22,3466           40000                           COM                                            #  CDUX - 7.25 DEG
045173,000055: 22,3467           05074                           TC       SPCOS1                                
045174,000056: 22,3470           55644                           TS       AMGB8                                 
045175,000057: 22,3471           00006                           EXTEND                                         
045176,000058: 22,3472           71645                           MP       CAPSI                                 
045177,000059: 22,3473           55641                           TS       AMGB4                                 
045178,000060: 22,3474           33507                           CAF      QUADANGL                              
045179,000061: 22,3475           00006                           EXTEND                                         
045180,000062: 22,3476           20032                           MSU      CDUX                                  
045181,000063: 22,3477           40000                           COM                                            #  CDUX - 7.25 DEG
045182,000064: 22,3500           05075                           TC       SPSIN1                                
045183,000065: 22,3501           55642                           TS       AMGB5                                 
045184,000066: 22,3502           00006                           EXTEND                                         
045185,000067: 22,3503           71645                           MP       CAPSI                                 
045186,000068: 22,3504           40000                           COM                                            

Page 1038

045188,000070: 22,3505           55643                           TS       AMGB7                                 
045189,000071: 22,3506           15217                           TCF      ENDOFJOB                              
045190,000072: 22,3507           01224        QUADANGL           DEC      660        B-14                       #  = 7.25 DEGREES
045191,000073: 

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