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.

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

Page 1472

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

Page 1473

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

Page 1474

062726,000118: 22,3602           00002                           TC       Q                                     
062727,000119: 
062728,000120: 22,3603           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
062729,000121: 22,3604           34673                           CAF      LIMITS                                
062730,000122: 22,3605           26154                           ADS      MPAC                                  
062731,000123: 22,3606           00002                           TC       Q                                     
062732,000124: 

Page 1475

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

Page 1476

062781,000173:                                                                                                  #           RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
062782,000174: 
062783,000175: 22,3650           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
062784,000176: 22,3651           30046                           CA       X1                                    
062785,000177: 22,3652           04555                           TC       BANKCALL                              
062786,000178: 22,3653           17125                           CADR     IMUPULSE                              
062787,000179: 22,3654           16030                           TCF      DANZIG                                
062788,000180: 

Page 1477

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

Page 1478

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

Page 1479

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

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