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.

043617,000002:                                                                                                  ## Copyright:   Public domain.
043618,000003:                                                                                                  ## Filename:    MYSUBS.agc
043619,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
043620,000005:                                                                                                  ##              It is part of the reconstructed source code for the
043621,000006:                                                                                                  ##              original release of the flight software for the Command
043622,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
043623,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
043624,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
043625,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
043626,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
043627,000012:                                                                                                  ##              reconstruction is correct.
043628,000013:                                                                                                  ## Reference:   pp. 999-1001
043629,000014:                                                                                                  ## Assembler:   yaYUL
043630,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
043631,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
043632,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
043633,000018: 

Page 999

043635,000020: 20,3612                                           BANK     20                                    
043636,000021: 21,2000                                           SETLOC   MYSUBS                                
043637,000022: 21,2000                                           BANK                                           
043638,000023: 
043639,000024: 21,2042  E6,1510                                  EBANK=   KMPAC                                 
043640,000025: 21,2042     5074               SPCOS1             EQUALS   SPCOS                                 
043641,000026: 21,2042     5075               SPSIN1             EQUALS   SPSIN                                 
043642,000027: 21,2042     5074               SPCOS2             EQUALS   SPCOS                                 
043643,000028: 21,2042     5075               SPSIN2             EQUALS   SPSIN                                 
043644,000029: 
043645,000030: 21,2042                                           COUNT    21/DAPMS                              
043646,000031: 
043647,000032:                                                                                                  #  ONE AND ONE HALF PRECISION MULTIPLICATION ROUTINE
043648,000033: 
043649,000034: 21,2042           55512        SMALLMP            TS       KMPTEMP                               #  A(X+Y)
043650,000035: 21,2043           00006                           EXTEND                                         
043651,000036: 21,2044           71511                           MP       KMPAC      +1                         
043652,000037: 21,2045           55511                           TS       KMPAC      +1                         #  AY
043653,000038: 21,2046           35021                           CAF      ZERO                                  
043654,000039: 21,2047           57510                           XCH      KMPAC                                 
043655,000040: 21,2050           00006                           EXTEND                                         
043656,000041: 21,2051           71512                           MP       KMPTEMP                               #  AX
043657,000042: 21,2052           21511                           DAS      KMPAC                                 #  AX+AY
043658,000043: 21,2053           00002                           TC       Q                                     
043659,000044: 
043660,000045:                                                                                                  #  SUBROUTINE FOR DOUBLE PRECISION ADDITIONS OF ANGLES
043661,000046:                                                                                                  #  A AND L CONTAIN A DP(1S) ANGLE SCALED BY 180 DEGS TO BE ADDED TO KMPAC.
043662,000047:                                                                                                  #  RESULT IS PLACED IN KMPAC.  TIMING = 6 MCT (22 MCT ON OVERFLOW)
043663,000048: 
043664,000049: 21,2054           21511        DPADD              DAS      KMPAC                                 
043665,000050: 21,2055           00006                           EXTEND                                         
043666,000051: 21,2056           12073                           BZF      TSK        +1                         #  NO OVERFLOW
043667,000052: 21,2057           11510                           CCS      KMPAC                                 
043668,000053: 21,2060           12074                           TCF      DPADD+                                #  + OVERFLOW
043669,000054: 21,2061           12063                           TCF      +2                                    
043670,000055: 21,2062           12076                           TCF      DPADD-                                #  - OVERFLOW
043671,000056: 21,2063           11511                           CCS      KMPAC      +1                         
043672,000057: 21,2064           12101                           TCF      DPADD2+                               #  UPPER = 0, LOWER +
043673,000058: 21,2065           12067                           TCF      +2                                    
043674,000059: 21,2066           40000                           COM                                            #  UPPER = 0, LOWER -
043675,000060: 21,2067           64777                           AD       POSMAX                                #  LOWER = 0, A = 0
043676,000061: 21,2070           55511                           TS       KMPAC      +1                         #  CAN NOT OVERFLOW
043677,000062: 21,2071           34777                           CA       POSMAX                                #  UPPER WAS = 0
043678,000063: 21,2072           55510        TSK                TS       KMPAC                                 
043679,000064: 21,2073           00002                           TC       Q                                     
043680,000065: 
043681,000066: 21,2074           65001        DPADD+             AD       NEGMAX                                #  KMPAC GREATER THAN 0
043682,000067: 21,2075           12072                           TCF      TSK                                   
043683,000068: 

Page 1000

043685,000070: 21,2076           40000        DPADD-             COM                                            
043686,000071: 21,2077           64777                           AD       POSMAX                                #  KMPAC LESS THAN 0
043687,000072: 21,2100           12072                           TCF      TSK                                   
043688,000073: 
043689,000074: 21,2101           65001        DPADD2+            AD       NEGMAX                                #  CAN NOT OVERFLOW
043690,000075: 21,2102           55511                           TS       KMPAC      +1                         
043691,000076: 21,2103           35001                           CA       NEGMAX                                #  UPPER WAS = 0
043692,000077: 21,2104           12072                           TCF      TSK                                   
043693,000078: 

Page 1001 This page is empty.

043696,000081: 
043697,000082: 

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