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.

018033,000002:                                                                                                  ## Copyright:   Public domain.
018034,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
018035,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
018036,000005:                                                                                                  ##              It is part of the reconstructed source code for the
018037,000006:                                                                                                  ##              original release of the flight software for the Command
018038,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
018039,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
018040,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
018041,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
018042,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
018043,000012:                                                                                                  ##              reconstruction is correct.
018044,000013:                                                                                                  ## Reference:   pp. 420-422
018045,000014:                                                                                                  ## Assembler:   yaYUL
018046,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
018047,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
018048,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
018049,000018: 

Page 420

018051,000020: 22,3151  E5,1671                                  EBANK=   XSM                                   
018052,000021: 
018053,000022: 33,2000                                           BANK     33                                    
018054,000023: 13,2000                                           SETLOC   E/PROG1                               
018055,000024: 13,2000                                           BANK                                           
018056,000025: 
018057,000026: 13,2036                                           COUNT*   $$/P07                                
018058,000027: 
018059,000028:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
018060,000029: 
018061,000030:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
018062,000031: 
018063,000032:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
018064,000033:                                                                                                  #  IS NOT POSSIBLE.
018065,000034: 
018066,000035:                                                                                                  #  THE CALLING SEQUENCE IS:
018067,000036: 
018068,000037:                                                                                                  #        TC      BANKCALL
018069,000038:                                                                                                  #        CADR    E/BKCALL
018070,000039:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
018071,000040:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
018072,000041:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
018073,000042:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
018074,000043: 
018075,000044:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
018076,000045:                                                                                                  #  OTHER EMEMORY PROGRAMS.
018077,000046: 
018078,000047:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
018079,000048: 
018080,000049: 13,2036           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
018081,000050: 13,2037           52365                           DXCH     EBUF2                                 #  SAVE DP RETURN.
018082,000051: 13,2040           24364                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
018083,000052: 13,2041           30006                           CA       BBANK                                 
018084,000053: 13,2042           75054                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
018085,000054: 13,2043           26365                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
018086,000055: 13,2044           50364                           NDX      EBUF2                                 
018087,000056: 13,2045           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
018088,000057: 13,2046           04666                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
018089,000058:                                                                                                  #  AND RESTORING A + L.
018090,000059: 13,2047           02053                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
018091,000060: 13,2050           02052                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
018092,000061: 13,2051           24364                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
018093,000062: 13,2052           24364                           INCR     EBUF2                                 
018094,000063: 13,2053           52365        E/SWITCH           DXCH     EBUF2                                 
018095,000064: 13,2054           52006                           DTCB                                           
018096,000065: 

Page 421

018098,000067:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
018099,000068: 
018100,000069:                                                                                                  #  THE CALLING SEQUENCE IS...
018101,000070: 
018102,000071:                                                                                                  #        RTB
018103,000072:                                                                                                  #                E/CALL
018104,000073:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
018105,000074:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
018106,000075: 
018107,000076: 13,2055           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
018108,000077: 13,2056           50001                           INDEX    L                                     
018109,000078: 13,2057           30001                           CA       L                                     #  CADR IN A.
018110,000079: 13,2060           24001                           INCR     L                                     
018111,000080: 13,2061           24001                           INCR     L                                     #  RETURN ADRES IN L.
018112,000081: 13,2062           52365                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
018113,000082: 13,2063           06006                           TC       INTPRET                               
018114,000083: 13,2064           77624                           CALL                                           
018115,000084: 13,2065           00364                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
018116,000085: 13,2066           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
018117,000086: 13,2067           22365                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
018118,000087: 13,2070           16010                           TCF      INTPRET    +2                         #  SET LOC AND RETURB TO CALLER
018119,000088: 

Page 422

018121,000090:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
018122,000091: 
018123,000092:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
018124,000093: 
018125,000094:                                                                                                  #  THE CALLING SEQUENCE IS:
018126,000095: 
018127,000096:                                                                                                  #        INHINT
018128,000097:                                                                                                  #          .
018129,000098:                                                                                                  #          .
018130,000099:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
018131,000100:                                                                                                  #        TC      IBNKCALL
018132,000101:                                                                                                  #        CADR    E/JOBWAK
018133,000102:                                                                                                  #          .                     RETURNS HERE
018134,000103:                                                                                                  #          .
018135,000104:                                                                                                  #          .
018136,000105:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
018137,000106: 
018138,000107: 33,2000                                           BANK     33                                    
018139,000108: 04,2000                                           SETLOC   E/PROG                                
018140,000109: 04,2000                                           BANK                                           
018141,000110: 
018142,000111: 04,2606                                           COUNT*   $$/P07                                
018143,000112: 
018144,000113: 04,2606           05201        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
018145,000114: 04,2607           45005                           CS       BIT11                                 
018146,000115: 04,2610           50064                           NDX      LOCCTR                                
018147,000116: 04,2611           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
018148,000117: 04,2612           00072                           TC       RUPTREG3                              #  RETURN
018149,000118: 
018150,000119: 
018151,000120:                                                                                                  #  THESE PROGRAMS ARE PROVIDED TO ALLOW OVERLAY OF BANKS 30 THRU 33 OF THE 205 VERSIONS OF SYSTEM TESTS AND
018152,000121:                                                                                                  #  PRELAUNCH ALIGN.  THE INTENT IS TO ALLOW THE STG AND HYBRID LABS TO RUN ALL THE TESTS WITH COLOSSUS.
018153,000122: 
018154,000123: 
018155,000124: 33,2000                                           BANK     33                                    
018156,000125: 33,2000                                           SETLOC   TESTLEAD                              
018157,000126: 33,2000                                           BANK                                           
018158,000127: 
018159,000128: 33,2000                                           COUNT    33/COMST                              
018160,000129: 
018161,000130: 33,2000  E5,1425                                  EBANK=   QPLACE                                
018162,000131: 
018163,000132: 33,2000           03436        COMPVER            TC       GCOMPVER                              #  MUST BE 33,2000.
018164,000133: 
018165,000134: 33,2001           03131        GTSCPSS1           TC       GTSCPSS                               #  MUST BE AT 33,2001
018166,000135: 
018167,000136: 33,2002           05354        REDO               TC       NEWMODEX                              #  DISPLAY MM 07.
018168,000137: 33,2003           00007                           MM       07         B-14                       #  FALL INTO IMUTEST
018169,000138: 

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