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.

018027,000002:                                                                                                  ## Copyright:   Public domain.
018028,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
018029,000004:                                                                                                  ## Purpose:     A section of Manche45 revision 2.
018030,000005:                                                                                                  ##              It is part of the reconstructed source code for the
018031,000006:                                                                                                  ##              final, flown release of the flight software for the Command
018032,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
018033,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
018034,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
018035,000010:                                                                                                  ##              exactly match those specified for Manche 45/2 in NASA drawing
018036,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
018037,000012:                                                                                                  ##              reconstruction is correct.
018038,000013:                                                                                                  ## Assembler:   yaYUL
018039,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
018040,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
018041,000016:                                                                                                  ## Mod history: 2020-12-24 MAS  Created from Comanche 45.
018042,000017: 

Page 420

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

Page 421

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

Page 422

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

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