Source Code

These source-code files were derived from scans of the Colossus 237 (Apollo 8 Command Module) program listing from the private collection of original AGC developer Fred Martin. Scanning was by Ron Burkey. Pre-existing Colossus 249 (Apollo 9 CM) source files were used as a template, and changes between Colossus 249 and Colossus 237 were manually transcribed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional images are 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 237 OF AGC PROGRAM COLOSSUS 
	BY NASA 2021111-031  1:17 AUG. 24, 1968
Note that the date is the date of the printout, not the date of the program revision.

062621,000002:                                                                                                  ## Copyright:   Public domain.
062622,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
062623,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus build 237.
062624,000005:                                                                                                  ##              This is for the Command Module's (CM) Apollo Guidance
062625,000006:                                                                                                  ##              Computer (AGC), for Apollo 8.
062626,000007:                                                                                                  ## Assembler:   yaYUL
062627,000008:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
062628,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
062629,000010:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Colossus237/
062630,000011:                                                                                                  ## Mod history: 2011-04-17 JL   Adapted from corresponding Colossus 249 file.
062631,000012:                                                                                                  ##              2017-01-01 RSB  Proofed comment text using octopus/ProoferComments,
062632,000013:                                                                                                  ##                              and fixed errors found.
062633,000014: 

Page 1472

062635,000016: 22,3505                                           BANK     22                                    
062636,000017: 22,2000                                           SETLOC   RTBCODES                              
062637,000018: 22,2000                                           BANK                                           
062638,000019: 
062639,000020: 22,3505  E5,1713                                  EBANK=   XNB                                   
062640,000021: 22,3505                                           COUNT*   $$/RTB                                
062641,000022: 
062642,000023:                                                                                                  #           LOAD TIME2, TIME1 INTO MPAC:
062643,000024: 
062644,000025: 22,3505           00006        LOADTIME           EXTEND                                         
062645,000026: 22,3506           30025                           DCA      TIME2                                 
062646,000027: 22,3507           16024                           TCF      SLOAD2                                
062647,000028: 
062648,000029:                                                                                                  #           CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
062649,000030:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
062650,000031: 
062651,000032: 22,3510           10154        CDULOGIC           CCS      MPAC                                  
062652,000033: 22,3511           34714                           CAF      ZERO                                  
062653,000034: 22,3512           13515                           TCF      +3                                    
062654,000035: 22,3513           13514                           NOOP                                           
062655,000036: 22,3514           44675                           CS       HALF                                  
062656,000037: 
062657,000038: 22,3515           54155                           TS       MPAC       +1                         
062658,000039: 22,3516           34714                           CAF      ZERO                                  
062659,000040: 22,3517           56154                           XCH      MPAC                                  
062660,000041: 22,3520           00006                           EXTEND                                         
062661,000042: 22,3521           74675                           MP       HALF                                  
062662,000043: 22,3522           20155                           DAS      MPAC                                  
062663,000044: 22,3523           16030                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
062664,000045: 
062665,000046:                                                                                                  #           READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
062666,000047: 
062667,000048: 22,3524           00004        READPIPS           INHINT                                         
062668,000049: 22,3525           30037                           CA       PIPAX                                 
062669,000050: 22,3526           54154                           TS       MPAC                                  
062670,000051: 22,3527           30040                           CA       PIPAY                                 
062671,000052: 22,3530           54157                           TS       MPAC       +3                         
062672,000053: 22,3531           30041                           CA       PIPAZ                                 
062673,000054: 22,3532           00003                           RELINT                                         
062674,000055: 22,3533           54161                           TS       MPAC       +5                         
062675,000056: 
062676,000057: 22,3534           34714                           CAF      ZERO                                  
062677,000058: 22,3535           54155                           TS       MPAC       +1                         
062678,000059: 22,3536           54160                           TS       MPAC       +4                         
062679,000060: 22,3537           54162                           TS       MPAC       +6                         
062680,000061: 
062681,000062: 22,3540           16470        VECMODE            TCF      VMODE                                 
062682,000063:                                                                                                  #           FORCE TP SIGN AGREEMENT IN MPAC:
062683,000064: 
062684,000065: 22,3541           07226        SGNAGREE           TC       TPAGREE                               

Page 1473

062686,000067: 22,3542           16030                           TCF      DANZIG                                
062687,000068: 
062688,000069:                                                                                                  #           CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
062689,000070:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
062690,000071: 
062691,000072: 22,3543           03573        1STO2S             TC       1TO2SUB                               
062692,000073: 22,3544           34714                           CAF      ZERO                                  
062693,000074: 22,3545           54155                           TS       MPAC       +1                         
062694,000075: 22,3546           16027                           TCF      NEWMODE                               
062695,000076: 
062696,000077:                                                                                                  #           DO 1STO2S ON A VECTOR OF ANGLES:
062697,000078: 
062698,000079: 22,3547           03573        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
062699,000080: 
062700,000081: 22,3550           52162                           DXCH     MPAC       +5                         
062701,000082: 22,3551           52155                           DXCH     MPAC                                  
062702,000083: 22,3552           03573                           TC       1TO2SUB                               
062703,000084: 22,3553           54156                           TS       MPAC       +2                         
062704,000085: 
062705,000086: 22,3554           52160                           DXCH     MPAC       +3                         
062706,000087: 22,3555           52155                           DXCH     MPAC                                  
062707,000088: 22,3556           03573                           TC       1TO2SUB                               
062708,000089: 22,3557           54155                           TS       MPAC       +1                         
062709,000090: 
062710,000091: 22,3560           30161                           CA       MPAC       +5                         
062711,000092: 22,3561           54154                           TS       MPAC                                  
062712,000093: 
062713,000094: 22,3562           34712        TPMODE             CAF      ONE                                   #  MODE IS TP.
062714,000095: 22,3563           16027                           TCF      NEWMODE                               
062715,000096: 
062716,000097:                                                                                                  #           V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
062717,000098: 
062718,000099: 22,3564           03573        2V1STO2S           TC       1TO2SUB                               
062719,000100: 22,3565           52160                           DXCH     MPAC       +3                         
062720,000101: 22,3566           52155                           DXCH     MPAC                                  
062721,000102: 22,3567           03573                           TC       1TO2SUB                               
062722,000103: 22,3570           54001                           TS       L                                     
062723,000104: 22,3571           30157                           CA       MPAC       +3                         
062724,000105: 22,3572           16024                           TCF      SLOAD2                                
062725,000106: 
062726,000107:                                                                                                  #           SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
062727,000108: 
062728,000109: 22,3573           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
062729,000110: 22,3574           20001                           DDOUBL                                         
062730,000111: 22,3575           10000                           CCS      A                                     
062731,000112: 22,3576           64712                           AD       ONE                                   
062732,000113: 22,3577           13601                           TCF      +2                                    
062733,000114: 22,3600           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
062734,000115: 
062735,000116: 22,3601           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.

Page 1474

062737,000118: 22,3602           00002                           TC       Q                                     
062738,000119: 
062739,000120: 22,3603           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
062740,000121: 22,3604           34673                           CAF      LIMITS                                
062741,000122: 22,3605           26154                           ADS      MPAC                                  
062742,000123: 22,3606           00002                           TC       Q                                     
062743,000124: 

Page 1475

062745,000126:                                                                                                  #           SUBROUTINE TO INCREMENT CDUS
062746,000127: 22,3607           33622        INCRCDUS           CAF      LOCTHETA                              
062747,000128: 22,3610           54130                           TS       BUF                                   #  PLACE ADRES(THETA) IN BUF.
062748,000129: 22,3611           30154                           CAE      MPAC                                  #  INCREMENT IN 1S COMPL.
062749,000130: 22,3612           03623                           TC       CDUINC                                
062750,000131: 
062751,000132: 22,3613           24130                           INCR     BUF                                   
062752,000133: 22,3614           30157                           CAE      MPAC       +3                         
062753,000134: 22,3615           03623                           TC       CDUINC                                
062754,000135: 
062755,000136: 22,3616           24130                           INCR     BUF                                   
062756,000137: 22,3617           30161                           CAE      MPAC       +5                         
062757,000138: 22,3620           03623                           TC       CDUINC                                
062758,000139: 
062759,000140: 22,3621           13540                           TCF      VECMODE                               
062760,000141: 
062761,000142: 22,3622           01155        LOCTHETA           ADRES    THETAD                                
062762,000143: 
062763,000144:                                                                                                  #           THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
062764,000145:                                                                                                  #  QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
062765,000146:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
062766,000147: 
062767,000148: 22,3623           54142        CDUINC             TS       TEM2                                  #  1S COMPL.QUANT. ARRIVES IN ACC. STORE IT
062768,000149: 22,3624           50130                           INDEX    BUF                                   
062769,000150: 22,3625           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE(IN BUF) INTO 1S
062770,000151: 22,3626           64712                           AD       ONE                                   
062771,000152: 22,3627           13633                           TCF      +4                                    
062772,000153: 22,3630           64712                           AD       ONE                                   
062773,000154: 22,3631           64712                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
062774,000155: 22,3632           40000                           COM                                            
062775,000156: 
062776,000157: 22,3633           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD.(OR BACK)
062777,000158: 22,3634           10000                           CCS      A                                     #  BACK TO 2S COMPL.
062778,000159: 22,3635           64712                           AD       ONE                                   
062779,000160: 22,3636           13640                           TCF      +2                                    
062780,000161: 22,3637           40000                           COM                                            
062781,000162: 22,3640           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
062782,000163: 22,3641           13645                           TCF      +4                                    
062783,000164: 22,3642           50000                           INDEX    A                                     #   SIGN.
062784,000165: 22,3643           34673                           CAF      LIMITS                                #  FIX IT,BY ADDING IN 37777 OR 40000
062785,000166: 22,3644           60142                           AD       TEM2                                  
062786,000167: 
062787,000168: 22,3645           50130                           INDEX    BUF                                   
062788,000169: 22,3646           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
062789,000170: 22,3647           00002                           TC       Q                                     
062790,000171: 

Page 1476

062792,000173:                                                                                                  #           RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
062793,000174: 
062794,000175: 22,3650           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
062795,000176: 22,3651           30046                           CA       X1                                    
062796,000177: 22,3652           04555                           TC       BANKCALL                              
062797,000178: 22,3653           17125                           CADR     IMUPULSE                              
062798,000179: 22,3654           16030                           TCF      DANZIG                                
062799,000180: 

Page 1477

062801,000182:                                                                                                  #  EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
062802,000183:                                                                                                  #  WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
062803,000184:                                                                                                  #  XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
062804,000185: 
062805,000186: 22,3655           02713        XNBEB              ECADR    XNB                                   
062806,000187: 22,3656           02554        XNB1EB             ECADR    XNB1                                  
062807,000188: 
062808,000189: 22,3657  E5,1713                                  EBANK=   XNB                                   
062809,000190: 
062810,000191: 22,3657           33655        TRANSP1            CAF      XNBEB                                 
062811,000192: 22,3660           54003                           TS       EBANK                                 
062812,000193: 22,3661           53716                           DXCH     XNB        +2                         
062813,000194: 22,3662           53722                           DXCH     XNB        +6                         
062814,000195: 22,3663           53716                           DXCH     XNB        +2                         
062815,000196: 
062816,000197: 22,3664           53720                           DXCH     XNB        +4                         
062817,000198: 22,3665           53730                           DXCH     XNB        +12D                       
062818,000199: 22,3666           53720                           DXCH     XNB        +4                         
062819,000200: 
062820,000201: 22,3667           53726                           DXCH     XNB        +10D                       
062821,000202: 22,3670           53732                           DXCH     XNB        +14D                       
062822,000203: 22,3671           53726                           DXCH     XNB        +10D                       
062823,000204: 22,3672           16030                           TCF      DANZIG                                
062824,000205: 
062825,000206: 
062826,000207: 22,3673  E5,1554                                  EBANK=   XNB1                                  
062827,000208: 
062828,000209: 22,3673           33656        TRANSP2            CAF      XNB1EB                                
062829,000210: 22,3674           54003                           TS       EBANK                                 
062830,000211: 22,3675           53557                           DXCH     XNB1       +2                         
062831,000212: 22,3676           53563                           DXCH     XNB1       +6                         
062832,000213: 22,3677           53557                           DXCH     XNB1       +2                         
062833,000214: 
062834,000215: 22,3700           53561                           DXCH     XNB1       +4                         
062835,000216: 22,3701           53571                           DXCH     XNB1       +12D                       
062836,000217: 22,3702           53561                           DXCH     XNB1       +4                         
062837,000218: 
062838,000219: 22,3703           53567                           DXCH     XNB1       +10D                       
062839,000220: 22,3704           53573                           DXCH     XNB1       +14D                       
062840,000221: 22,3705           53567                           DXCH     XNB1       +10D                       
062841,000222: 22,3706           16030                           TCF      DANZIG                                
062842,000223: 

Page 1478

062844,000225:                                                                                                  #           THE SUBROUTINE  SIGNMPAC  SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
062845,000226:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.    ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
062846,000227: 
062847,000228:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
062848,000229: 
062849,000230:                                                                                                  #  1.       LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
062850,000231:                                                                                                  #  ENTRY:          BOVB
062851,000232:                                                                                                  #                         SIGNMPAC
062852,000233: 
062853,000234:                                                                                                  #  2.       GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
062854,000235:                                                                                                  #  ENTRY:          RTB
062855,000236:                                                                                                  #                         SIGNMPAC
062856,000237: 
062857,000238:                                                                                                  #  IN EITHER CASE, RETURN IS TO  THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
062858,000239: 
062859,000240: 22,3707           00006        SIGNMPAC           EXTEND                                         
062860,000241: 22,3710           34672                           DCA      DPOSMAX                               
062861,000242: 22,3711           52155                           DXCH     MPAC                                  
062862,000243: 22,3712           10000                           CCS      A                                     
062863,000244: 22,3713           34714        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
062864,000245: 22,3714           16026                           TCF      SLOAD2     +2                         
062865,000246: 22,3715           13716                           TCF      +1                                    
062866,000247: 22,3716           00006                           EXTEND                                         
062867,000248: 22,3717           44672                           DCS      DPOSMAX                               
062868,000249: 22,3720           16024                           TCF      SLOAD2                                
062869,000250: 
062870,000251:                                                                                                  #      RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
062871,000252:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.   IF NORMUNIT
062872,000253:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
062873,000254:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
062874,000255: 
062875,000256: 22,3721           34712        NORMUNX1           CAF      ONE                                   
062876,000257: 22,3722           13724                           TCF      NORMUNIT   +1                         
062877,000258: 22,3723           34714        NORMUNIT           CAF      ZERO                                  
062878,000259: 22,3724           60120                           AD       FIXLOC                                
062879,000260: 22,3725           54156                           TS       MPAC       +2                         
062880,000261: 22,3726           04555                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
062881,000262: 22,3727           01010                           CADR     VECAGREE                              
062882,000263: 22,3730           10154                           CCS      MPAC                                  
062883,000264: 22,3731           13765                           TCF      NOSHIFT                               
062884,000265: 22,3732           13734                           TCF      +2                                    
062885,000266: 22,3733           13765                           TCF      NOSHIFT                               
062886,000267: 22,3734           10157                           CCS      MPAC       +3                         
062887,000268: 22,3735           13765                           TCF      NOSHIFT                               
062888,000269: 22,3736           13740                           TCF      +2                                    
062889,000270: 22,3737           13765                           TCF      NOSHIFT                               
062890,000271: 22,3740           10161                           CCS      MPAC       +5                         
062891,000272: 22,3741           13765                           TCF      NOSHIFT                               
062892,000273: 22,3742           13744                           TCF      +2                                    
062893,000274: 22,3743           13765                           TCF      NOSHIFT                               

Page 1479

062895,000276: 22,3744           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
062896,000277: 22,3745           00006                           EXTEND                                         
062897,000278: 22,3746           74675                           MP       BIT14                                 
062898,000279: 22,3747           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
062899,000280: 22,3750           30160                           CA       MPAC       +4                         
062900,000281: 22,3751           00006                           EXTEND                                         
062901,000282: 22,3752           74675                           MP       BIT14                                 
062902,000283: 22,3753           20160                           DAS      MPAC       +3                         
062903,000284: 22,3754           30162                           CA       MPAC       +6                         
062904,000285: 22,3755           00006                           EXTEND                                         
062905,000286: 22,3756           74675                           MP       BIT14                                 
062906,000287: 22,3757           20162                           DAS      MPAC       +5                         
062907,000288: 22,3760           34720                           CAF      THIRTEEN                              
062908,000289: 22,3761           50156                           INDEX    MPAC       +2                         
062909,000290: 22,3762           54045                           TS       37D                                   
062910,000291: 22,3763           04574        OFFTUNIT           TC       POSTJUMP                              
062911,000292: 22,3764           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
062912,000293: 
062913,000294: 
062914,000295: 22,3765           34714        NOSHIFT            CAF      ZERO                                  
062915,000296: 22,3766           13761                           TCF      OFFTUNIT   -2                         
062916,000297: 
062917,000298: 
062918,000299:                                                                                                  #   RTB  VECSGNAG   ...FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
062919,000300: 
062920,000301: 22,3767           04555        VECSGNAG           TC       BANKCALL                              
062921,000302: 22,3770           01010                           CADR     VECAGREE                              
062922,000303: 22,3771           06030                           TC       DANZIG                                

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