Source Code

These source-code files are part of a reconstructed copy of Comanche 72/3 (AKA Manche72 revision 3), the final, flown mission release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

The starting point was the source code of Comanche 72 (itself previously reconstructed). Comanche 72 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 72 and 72/3. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments.

Since no contemporary listings of Comanche 72/3 are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

017751,000002:                                                                                                  ## Copyright:   Public domain.
017752,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
017753,000004:                                                                                                  ## Purpose:     A section of Manche72 revision 3.
017754,000005:                                                                                                  ##              It is part of the reconstructed source code for the final, flown
017755,000006:                                                                                                  ##              release of the software for the Command Module's (CM) Apollo
017756,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 13. No original listings
017757,000008:                                                                                                  ##              of this program are available; instead, this file was recreated
017758,000009:                                                                                                  ##              from a reconstructed copy of Comanche 072. It has been adapted
017759,000010:                                                                                                  ##              such that the resulting bugger words exactly match those
017760,000011:                                                                                                  ##              specified for Manche72 revision 3 in NASA drawing 2021153G,
017761,000012:                                                                                                  ##              which gives relatively high confidence that the reconstruction
017762,000013:                                                                                                  ##              is correct.
017763,000014:                                                                                                  ## Assembler:   yaYUL
017764,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017765,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
017766,000017:                                                                                                  ## Mod history: 2024-05-19 MAS  Created from Comanche 072.
017767,000018: 
017768,000019: 22,3151  E5,1671                                  EBANK=   XSM                                   
017769,000020: 
017770,000021: 33,2000                                           BANK     33                                    
017771,000022: 13,2000                                           SETLOC   E/PROG1                               
017772,000023: 13,2000                                           BANK                                           
017773,000024: 
017774,000025: 13,2036                                           COUNT*   $$/P07                                
017775,000026: 
017776,000027:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
017777,000028: 
017778,000029:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
017779,000030: 
017780,000031:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
017781,000032:                                                                                                  #  IS NOT POSSIBLE.
017782,000033: 
017783,000034:                                                                                                  #  THE CALLING SEQUENCE IS:
017784,000035: 
017785,000036:                                                                                                  #        TC      BANKCALL
017786,000037:                                                                                                  #        CADR    E/BKCALL
017787,000038:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
017788,000039:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
017789,000040:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
017790,000041:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
017791,000042: 
017792,000043:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
017793,000044:                                                                                                  #  OTHER EMEMORY PROGRAMS.
017794,000045: 
017795,000046:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
017796,000047: 
017797,000048: 13,2036           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
017798,000049: 13,2037           52364                           DXCH     EBUF2                                 #  SAVE DP RETURN.
017799,000050: 13,2040           24363                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
017800,000051: 13,2041           30006                           CA       BBANK                                 
017801,000052: 13,2042           75070                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
017802,000053: 13,2043           26364                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
017803,000054: 13,2044           50363                           NDX      EBUF2                                 
017804,000055: 13,2045           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
017805,000056: 13,2046           04702                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
017806,000057:                                                                                                  #  AND RESTORING A + L.
017807,000058: 13,2047           02053                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
017808,000059: 13,2050           02052                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
017809,000060: 13,2051           24363                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
017810,000061: 13,2052           24363                           INCR     EBUF2                                 
017811,000062: 13,2053           52364        E/SWITCH           DXCH     EBUF2                                 
017812,000063: 13,2054           52006                           DTCB                                           
017813,000064: 
017814,000065:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
017815,000066: 
017816,000067:                                                                                                  #  THE CALLING SEQUENCE IS...
017817,000068: 
017818,000069:                                                                                                  #        RTB
017819,000070:                                                                                                  #                E/CALL
017820,000071:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
017821,000072:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
017822,000073: 
017823,000074: 13,2055           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
017824,000075: 13,2056           50001                           INDEX    L                                     
017825,000076: 13,2057           30001                           CA       L                                     #  CADR IN A.
017826,000077: 13,2060           24001                           INCR     L                                     
017827,000078: 13,2061           24001                           INCR     L                                     #  RETURN ADRES IN L.
017828,000079: 13,2062           52364                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
017829,000080: 13,2063           06006                           TC       INTPRET                               
017830,000081: 13,2064           77624                           CALL                                           
017831,000082: 13,2065           00363                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
017832,000083: 13,2066           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
017833,000084: 13,2067           22364                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
017834,000085: 13,2070           16010                           TCF      INTPRET    +2                         #  SET LOC AND RETURB TO CALLER
017835,000086: 
017836,000087:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
017837,000088: 
017838,000089:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
017839,000090: 
017840,000091:                                                                                                  #  THE CALLING SEQUENCE IS:
017841,000092: 
017842,000093:                                                                                                  #        INHINT
017843,000094:                                                                                                  #          .
017844,000095:                                                                                                  #          .
017845,000096:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
017846,000097:                                                                                                  #        TC      IBNKCALL
017847,000098:                                                                                                  #        CADR    E/JOBWAK
017848,000099:                                                                                                  #          .                     RETURNS HERE
017849,000100:                                                                                                  #          .
017850,000101:                                                                                                  #          .
017851,000102:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
017852,000103: 
017853,000104: 33,2000                                           BANK     33                                    
017854,000105: 04,2000                                           SETLOC   E/PROG                                
017855,000106: 04,2000                                           BANK                                           
017856,000107: 
017857,000108: 04,2606                                           COUNT*   $$/P07                                
017858,000109: 
017859,000110: 04,2606           05215        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
017860,000111: 04,2607           45021                           CS       BIT11                                 
017861,000112: 04,2610           50064                           NDX      LOCCTR                                
017862,000113: 04,2611           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
017863,000114: 04,2612           00072                           TC       RUPTREG3                              #  RETURN
017864,000115: 
017865,000116: 
017866,000117:                                                                                                  #  THESE PROGRAMS ARE PROVIDED TO ALLOW OVERLAY OF BANKS 30 THRU 33 OF THE 205 VERSIONS OF SYSTEM TESTS AND
017867,000118:                                                                                                  #  PRELAUNCH ALIGN.  THE INTENT IS TO ALLOW THE STG AND HYBRID LABS TO RUN ALL THE TESTS WITH COLOSSUS.
017868,000119: 
017869,000120: 
017870,000121: 33,2000                                           BANK     33                                    
017871,000122: 33,2000                                           SETLOC   TESTLEAD                              
017872,000123: 33,2000                                           BANK                                           
017873,000124: 
017874,000125: 33,2000                                           COUNT    33/COMST                              
017875,000126: 
017876,000127: 33,2000  E5,1425                                  EBANK=   QPLACE                                
017877,000128: 
017878,000129: 33,2000           03436        COMPVER            TC       GCOMPVER                              #  MUST BE 33,2000.
017879,000130: 
017880,000131: 33,2001           03131        GTSCPSS1           TC       GTSCPSS                               #  MUST BE AT 33,2001
017881,000132: 
017882,000133: 33,2002           05370        REDO               TC       NEWMODEX                              #  DISPLAY MM 07.
017883,000134: 33,2003           00007                           MM       07         B-14                       #  FALL INTO IMUTEST
017884,000135: 

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