Source Code

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

The starting point was the source code of Comanche 44 (itself previously accurately reconstructed). Comanche 44 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 44 and 45. The now-reconstructed Comanche 45 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:
There is also a detailed commentary about the reconstruction process.

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.

043656,000002:                                                                                                  ## Copyright:   Public domain.
043657,000003:                                                                                                  ## Filename:    MYSUBS.agc
043658,000004:                                                                                                  ## Purpose:     A section of Comanche revision 045.
043659,000005:                                                                                                  ##              It is part of the reconstructed source code for the
043660,000006:                                                                                                  ##              second release of the flight software for the Command
043661,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
043662,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
043663,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
043664,000010:                                                                                                  ##              exactly match those specified for Comanche 45 in NASA drawing
043665,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
043666,000012:                                                                                                  ##              reconstruction is correct.
043667,000013:                                                                                                  ## Assembler:   yaYUL
043668,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
043669,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
043670,000016:                                                                                                  ## Mod history: 2020-12-06 MAS  Created from Comanche 44.
043671,000017: 

Page 999

043673,000019: 20,3612                                           BANK     20                                    
043674,000020: 21,2000                                           SETLOC   MYSUBS                                
043675,000021: 21,2000                                           BANK                                           
043676,000022: 
043677,000023: 21,2042  E6,1510                                  EBANK=   KMPAC                                 
043678,000024: 21,2042     5074               SPCOS1             EQUALS   SPCOS                                 
043679,000025: 21,2042     5075               SPSIN1             EQUALS   SPSIN                                 
043680,000026: 21,2042     5074               SPCOS2             EQUALS   SPCOS                                 
043681,000027: 21,2042     5075               SPSIN2             EQUALS   SPSIN                                 
043682,000028: 
043683,000029: 21,2042                                           COUNT    21/DAPMS                              
043684,000030: 
043685,000031:                                                                                                  #  ONE AND ONE HALF PRECISION MULTIPLICATION ROUTINE
043686,000032: 
043687,000033: 21,2042           55512        SMALLMP            TS       KMPTEMP                               #  A(X+Y)
043688,000034: 21,2043           00006                           EXTEND                                         
043689,000035: 21,2044           71511                           MP       KMPAC      +1                         
043690,000036: 21,2045           55511                           TS       KMPAC      +1                         #  AY
043691,000037: 21,2046           35021                           CAF      ZERO                                  
043692,000038: 21,2047           57510                           XCH      KMPAC                                 
043693,000039: 21,2050           00006                           EXTEND                                         
043694,000040: 21,2051           71512                           MP       KMPTEMP                               #  AX
043695,000041: 21,2052           21511                           DAS      KMPAC                                 #  AX+AY
043696,000042: 21,2053           00002                           TC       Q                                     
043697,000043: 
043698,000044:                                                                                                  #  SUBROUTINE FOR DOUBLE PRECISION ADDITIONS OF ANGLES
043699,000045:                                                                                                  #  A AND L CONTAIN A DP(1S) ANGLE SCALED BY 180 DEGS TO BE ADDED TO KMPAC.
043700,000046:                                                                                                  #  RESULT IS PLACED IN KMPAC.  TIMING = 6 MCT (22 MCT ON OVERFLOW)
043701,000047: 
043702,000048: 21,2054           21511        DPADD              DAS      KMPAC                                 
043703,000049: 21,2055           00006                           EXTEND                                         
043704,000050: 21,2056           12073                           BZF      TSK        +1                         #  NO OVERFLOW
043705,000051: 21,2057           11510                           CCS      KMPAC                                 
043706,000052: 21,2060           12074                           TCF      DPADD+                                #  + OVERFLOW
043707,000053: 21,2061           12063                           TCF      +2                                    
043708,000054: 21,2062           12076                           TCF      DPADD-                                #  - OVERFLOW
043709,000055: 21,2063           11511                           CCS      KMPAC      +1                         
043710,000056: 21,2064           12101                           TCF      DPADD2+                               #  UPPER = 0, LOWER +
043711,000057: 21,2065           12067                           TCF      +2                                    
043712,000058: 21,2066           40000                           COM                                            #  UPPER = 0, LOWER -
043713,000059: 21,2067           64777                           AD       POSMAX                                #  LOWER = 0, A = 0
043714,000060: 21,2070           55511                           TS       KMPAC      +1                         #  CAN NOT OVERFLOW
043715,000061: 21,2071           34777                           CA       POSMAX                                #  UPPER WAS = 0
043716,000062: 21,2072           55510        TSK                TS       KMPAC                                 
043717,000063: 21,2073           00002                           TC       Q                                     
043718,000064: 
043719,000065: 21,2074           65001        DPADD+             AD       NEGMAX                                #  KMPAC GREATER THAN 0
043720,000066: 21,2075           12072                           TCF      TSK                                   
043721,000067: 

Page 1000

043723,000069: 21,2076           40000        DPADD-             COM                                            
043724,000070: 21,2077           64777                           AD       POSMAX                                #  KMPAC LESS THAN 0
043725,000071: 21,2100           12072                           TCF      TSK                                   
043726,000072: 
043727,000073: 21,2101           65001        DPADD2+            AD       NEGMAX                                #  CAN NOT OVERFLOW
043728,000074: 21,2102           55511                           TS       KMPAC      +1                         
043729,000075: 21,2103           35001                           CA       NEGMAX                                #  UPPER WAS = 0
043730,000076: 21,2104           12072                           TCF      TSK                                   
043731,000077: 

Page 1001 This page is empty.

043734,000080: 
043735,000081: 

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