Source Code

These source-code files were obtained by digitally photographing an Artemis 72 (Apollo 15-17 Command Module) program listing from a private collection and then modifying pre-existing Comanche 55 (Apollo 11) source files to incorporate changes. Photography was by Ron Burkey, and transcription was performed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional images may be available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 072 OF AGC PROGRAM ARTEMIS 
	BY NASA 2021114-011 11:40 FEB. 26, 1971
Note that the date is the date of the printout, not the date of the program revision.

064525,000002:                                                                                                  ## Copyright:   Public domain.
064526,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
064527,000004:                                                                                                  ## Purpose:     Part of the source code for Artemis (i.e., Colossus 3),
064528,000005:                                                                                                  ##              build 072.  This is for the Command Module's (CM)
064529,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for
064530,000007:                                                                                                  ##              Apollo 15-17.
064531,000008:                                                                                                  ## Assembler:   yaYUL
064532,000009:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
064533,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
064534,000011:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Artemis072/
064535,000012:                                                                                                  ## Mod history: 2009-08-17 JL   Adapted from corresponding Comanche 055 file.
064536,000013:                                                                                                  ##              2009-09-29 JL   Fixed file name in header section.
064537,000014:                                                                                                  ##              2010-02-20 RSB  Un-##'d this header.
064538,000015:                                                                                                  ##              2017-02-08 RSB  Proofed comment text by diff'ing vs Comanche 55
064539,000016:                                                                                                  ##                              and/or octopus/ProoferComments as most-appropriate.
064540,000017: 

Page 1501

064542,000019: 
064543,000020: 24,2000                                           SETLOC   RTBCODE1                              
064544,000021: 24,2000                                           BANK                                           
064545,000022: 
064546,000023: 24,3751  E5,1713                                  EBANK=   XNB                                   
064547,000024: 24,3751                                           COUNT*   $$/RTB                                
064548,000025: 
064549,000026:                                                                                                  #  LOAD TIME2, TIME1 INTO MPAC:
064550,000027: 
064551,000028: 24,3751           00006        LOADTIME           EXTEND                                         
064552,000029: 24,3752           30025                           DCA      TIME2                                 
064553,000030: 24,3753           16024                           TCF      SLOAD2                                
064554,000031: 
064555,000032:                                                                                                  #  CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
064556,000033:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
064557,000034: 
064558,000035: 24,3754           10154        CDULOGIC           CCS      MPAC                                  
064559,000036: 24,3755           34772                           CAF      ZERO                                  
064560,000037: 24,3756           13761                           TCF      +3                                    
064561,000038: 24,3757           13760                           NOOP                                           
064562,000039: 24,3760           44753                           CS       HALF                                  
064563,000040: 
064564,000041: 24,3761           54155                           TS       MPAC       +1                         
064565,000042: 24,3762           34772                           CAF      ZERO                                  
064566,000043: 24,3763           56154                           XCH      MPAC                                  
064567,000044: 24,3764           00006                           EXTEND                                         
064568,000045: 24,3765           74753                           MP       HALF                                  
064569,000046: 24,3766           20155                           DAS      MPAC                                  
064570,000047: 24,3767           16030                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
064571,000048: 
064572,000049: 22,2000                                           SETLOC   RTBCODES                              
064573,000050: 22,2000                                           BANK                                           
064574,000051: 
064575,000052: 22,3621                                           COUNT*   $$/RTB                                
064576,000053: 
064577,000054:                                                                                                  #  READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
064578,000055: 
064579,000056: 22,3621           00004        READPIPS           INHINT                                         
064580,000057: 22,3622           30037                           CA       PIPAX                                 
064581,000058: 22,3623           54154                           TS       MPAC                                  
064582,000059: 22,3624           30040                           CA       PIPAY                                 
064583,000060: 22,3625           54157                           TS       MPAC       +3                         
064584,000061: 22,3626           30041                           CA       PIPAZ                                 
064585,000062: 22,3627           00003                           RELINT                                         
064586,000063: 22,3630           54161                           TS       MPAC       +5                         
064587,000064: 
064588,000065: 22,3631           34772                           CAF      ZERO                                  
064589,000066: 22,3632           54155                           TS       MPAC       +1                         
064590,000067: 22,3633           54160                           TS       MPAC       +4                         
064591,000068: 22,3634           54162                           TS       MPAC       +6                         
064592,000069: 22,3635           16470        VECMODE            TCF      VMODE                                 
064593,000070: 

Page 1502

064595,000072: 
064596,000073:                                                                                                  #  FORCE TP SIGN AGREEMENT IN MPAC:
064597,000074: 
064598,000075: 22,3636           07226        SGNAGREE           TC       TPAGREE                               
064599,000076: 22,3637           16030                           TCF      DANZIG                                
064600,000077: 
064601,000078:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
064602,000079:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
064603,000080: 
064604,000081: 22,3640           03661        1STO2S             TC       1TO2SUB                               
064605,000082: 22,3641           34772                           CAF      ZERO                                  
064606,000083: 22,3642           54155                           TS       MPAC       +1                         
064607,000084: 22,3643           16027                           TCF      NEWMODE                               
064608,000085: 
064609,000086:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
064610,000087: 
064611,000088: 22,3644           03661        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
064612,000089: 
064613,000090: 22,3645           52162                           DXCH     MPAC       +5                         
064614,000091: 22,3646           52155                           DXCH     MPAC                                  
064615,000092: 22,3647           03661                           TC       1TO2SUB                               
064616,000093: 22,3650           54156                           TS       MPAC       +2                         
064617,000094: 
064618,000095: 22,3651           52160                           DXCH     MPAC       +3                         
064619,000096: 22,3652           52155                           DXCH     MPAC                                  
064620,000097: 22,3653           03661                           TC       1TO2SUB                               
064621,000098: 22,3654           54155                           TS       MPAC       +1                         
064622,000099: 
064623,000100: 22,3655           30161                           CA       MPAC       +5                         
064624,000101: 22,3656           54154                           TS       MPAC                                  
064625,000102: 
064626,000103: 22,3657           34770        TPMODE             CAF      ONE                                   #  MODE IS TP.
064627,000104: 22,3660           16027                           TCF      NEWMODE                               
064628,000105: 
064629,000106:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
064630,000107: 
064631,000108: 22,3661           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
064632,000109: 22,3662           20001                           DDOUBL                                         
064633,000110: 22,3663           10000                           CCS      A                                     
064634,000111: 22,3664           64770                           AD       ONE                                   
064635,000112: 22,3665           13667                           TCF      +2                                    
064636,000113: 22,3666           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
064637,000114: 
064638,000115: 22,3667           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.
064639,000116: 22,3670           00002                           TC       Q                                     
064640,000117: 
064641,000118: 22,3671           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
064642,000119: 22,3672           34751                           CAF      LIMITS                                
064643,000120: 22,3673           26154                           ADS      MPAC                                  
064644,000121: 22,3674           00002                           TC       Q                                     
064645,000122: 

Page 1503

064647,000124: 
064648,000125:                                                                                                  #  THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
064649,000126:                                                                                                  #  QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
064650,000127:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
064651,000128: 
064652,000129: 22,3675           54142        CDUINC             TS       TEM2                                  #  1S COMPL.QUANT. ARRIVES IN ACC. STORE IT
064653,000130: 22,3676           50130                           INDEX    BUF                                   
064654,000131: 22,3677           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
064655,000132: 22,3700           64770                           AD       ONE                                   
064656,000133: 22,3701           13705                           TCF      +4                                    
064657,000134: 22,3702           64770                           AD       ONE                                   
064658,000135: 22,3703           64770                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
064659,000136: 22,3704           40000                           COM                                            
064660,000137: 
064661,000138: 22,3705           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
064662,000139: 22,3706           10000                           CCS      A                                     #  BACK TO 2S COMPL.
064663,000140: 22,3707           64770                           AD       ONE                                   
064664,000141: 22,3710           13712                           TCF      +2                                    
064665,000142: 22,3711           40000                           COM                                            
064666,000143: 22,3712           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
064667,000144: 22,3713           13717                           TCF      +4                                    
064668,000145: 22,3714           50000                           INDEX    A                                     #  SIGN.
064669,000146: 22,3715           34751                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
064670,000147: 22,3716           60142                           AD       TEM2                                  
064671,000148: 
064672,000149: 22,3717           50130                           INDEX    BUF                                   
064673,000150: 22,3720           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
064674,000151: 22,3721           00002                           TC       Q                                     
064675,000152: 

Page 1504

064677,000154: 
064678,000155:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
064679,000156: 
064680,000157: 22,3722           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
064681,000158: 22,3723           30046                           CA       X1                                    
064682,000159: 22,3724           04636                           TC       BANKCALL                              
064683,000160: 22,3725           17244                           CADR     IMUPULSE                              
064684,000161: 22,3726           16030                           TCF      DANZIG                                
064685,000162: 

Page 1505

064687,000164: 
064688,000165:                                                                                                  #  EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
064689,000166:                                                                                                  #  WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
064690,000167:                                                                                                  #  XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
064691,000168: 
064692,000169: 22,3727           02713        XNBEB              ECADR    XNB                                   
064693,000170: 22,3730           02554        XNB1EB             ECADR    XNB1                                  
064694,000171: 
064695,000172: 22,3731  E5,1713                                  EBANK=   XNB                                   
064696,000173: 
064697,000174: 22,3731           33727        TRANSP1            CAF      XNBEB                                 
064698,000175: 22,3732           54003                           TS       EBANK                                 
064699,000176: 22,3733           53716                           DXCH     XNB        +2                         
064700,000177: 22,3734           53722                           DXCH     XNB        +6                         
064701,000178: 22,3735           53716                           DXCH     XNB        +2                         
064702,000179: 
064703,000180: 22,3736           53720                           DXCH     XNB        +4                         
064704,000181: 22,3737           53730                           DXCH     XNB        +12D                       
064705,000182: 22,3740           53720                           DXCH     XNB        +4                         
064706,000183: 
064707,000184: 22,3741           53726                           DXCH     XNB        +10D                       
064708,000185: 22,3742           53732                           DXCH     XNB        +14D                       
064709,000186: 22,3743           53726                           DXCH     XNB        +10D                       
064710,000187: 22,3744           16030                           TCF      DANZIG                                
064711,000188: 
064712,000189: 22,3745  E5,1554                                  EBANK=   XNB1                                  
064713,000190: 
064714,000191: 22,3745           33730        TRANSP2            CAF      XNB1EB                                
064715,000192: 22,3746           54003                           TS       EBANK                                 
064716,000193: 22,3747           53557                           DXCH     XNB1       +2                         
064717,000194: 22,3750           53563                           DXCH     XNB1       +6                         
064718,000195: 22,3751           53557                           DXCH     XNB1       +2                         
064719,000196: 
064720,000197: 22,3752           53561                           DXCH     XNB1       +4                         
064721,000198: 22,3753           53571                           DXCH     XNB1       +12D                       
064722,000199: 22,3754           53561                           DXCH     XNB1       +4                         
064723,000200: 
064724,000201: 22,3755           53567                           DXCH     XNB1       +10D                       
064725,000202: 22,3756           53573                           DXCH     XNB1       +14D                       
064726,000203: 22,3757           53567                           DXCH     XNB1       +10D                       
064727,000204: 22,3760           16030                           TCF      DANZIG                                
064728,000205: 

Page 1506

064730,000207: 
064731,000208:                                                                                                  #  THE SUBROUTINE  SIGNMPAC  SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
064732,000209:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED. ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
064733,000210: 
064734,000211:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
064735,000212: 
064736,000213:                                                                                                  #        1.      LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
064737,000214:                                                                                                  #        ENTRY:          BOVB
064738,000215:                                                                                                  #                                SIGNMPAC
064739,000216:                                                                                                  #        2.      GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
064740,000217:                                                                                                  #        ENTRY:          RTB
064741,000218:                                                                                                  #                                SIGNMPAC
064742,000219: 
064743,000220:                                                                                                  #  IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
064744,000221: 
064745,000222: 22,3761           00006        SIGNMPAC           EXTEND                                         
064746,000223: 22,3762           34750                           DCA      DPOSMAX                               
064747,000224: 22,3763           52155                           DXCH     MPAC                                  
064748,000225: 22,3764           10000                           CCS      A                                     
064749,000226: 22,3765           34772        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
064750,000227: 22,3766           16026                           TCF      SLOAD2     +2                         
064751,000228: 22,3767           13770                           TCF      +1                                    
064752,000229: 22,3770           00006                           EXTEND                                         
064753,000230: 22,3771           44750                           DCS      DPOSMAX                               
064754,000231: 22,3772           16024                           TCF      SLOAD2                                
064755,000232: 
064756,000233: 

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