Source Code

These source-code files were from the printout at the MIT Museum, with many thanks to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing it to us. The printout was digitally photographed by Paul Fjeld. A team of volunteers transcribed the source code manually from these images or, where appropriate, modified already-transcribed but similar source Luminary 131 (Apollo 13) source code to agree with the images from the printout. Note that the page images presented online are of reduced quality, and that higher-quality 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 001 OF AGC PROGRAM LMY99 BY NASA 2021112-061
	16:27 JULY 14,1969
Note that the date is the date of the printout, not the date of the program revision.

059998,000002:                                                                                                  ## Copyright:   Public domain.
059999,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
060000,000004:                                                                                                  ## Purpose:     Part of the source code for Luminary 1A build 099.
060001,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
060002,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 11.
060003,000007:                                                                                                  ## Assembler:   yaYUL
060004,000008:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
060005,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo.
060006,000010:                                                                                                  ## Pages:       1397-1401
060007,000011:                                                                                                  ## Mod history: 2009-05-10 SN   (Sergio Navarro).  Started adapting
060008,000012:                                                                                                  ##                              from the Luminary131/ file of the same
060009,000013:                                                                                                  ##                              name, using Luminary099 page images.
060010,000014:                                                                                                  ##              2016-12-18 RSB  Proofed text comments with octopus/ProoferComments
060011,000015:                                                                                                  ##                              and corrected the errors found.
060012,000016:                                                                                                  ##
060013,000017:                                                                                                  ## This source code has been transcribed or otherwise adapted from
060014,000018:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
060015,000019:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
060016,000020:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
060017,000021:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
060018,000022:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
060019,000023:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
060020,000024:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
060021,000025:                                                                                                  ## actually created.
060022,000026:                                                                                                  ##
060023,000027:                                                                                                  ## Notations on the hardcopy document read, in part:
060024,000028:                                                                                                  ##
060025,000029:                                                                                                  ##      Assemble revision 001 of AGC program LMY99 by NASA 2021112-61
060026,000030:                                                                                                  ##      16:27 JULY 14, 1969 
060027,000031: 

Page 1397

060029,000033: 22,3773                                           BANK     22                                    
060030,000034: 10,2000                                           SETLOC   RTBCODES                              
060031,000035: 10,2000                                           BANK                                           
060032,000036: 
060033,000037: 10,3573  E5,1664                                  EBANK=   XNB                                   
060034,000038: 10,3573                                           COUNT*   $$/RTB                                
060035,000039: 
060036,000040:                                                                                                  #  LOAD TIME2, TIME1 INTO MPAC:
060037,000041: 
060038,000042: 10,3573           00006        LOADTIME           EXTEND                                         
060039,000043: 10,3574           30025                           DCA      TIME2                                 
060040,000044: 10,3575           16055                           TCF      SLOAD2                                
060041,000045: 
060042,000046:                                                                                                  #  CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
060043,000047:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
060044,000048: 
060045,000049: 10,3576           10154        CDULOGIC           CCS      MPAC                                  
060046,000050: 10,3577           34755                           CAF      ZERO                                  
060047,000051: 10,3600           13603                           TCF      +3                                    
060048,000052: 10,3601           13602                           NOOP                                           
060049,000053: 10,3602           44736                           CS       HALF                                  
060050,000054: 
060051,000055: 10,3603           54155                           TS       MPAC       +1                         
060052,000056: 10,3604           34755                           CAF      ZERO                                  
060053,000057: 10,3605           56154                           XCH      MPAC                                  
060054,000058: 10,3606           00006                           EXTEND                                         
060055,000059: 10,3607           74736                           MP       HALF                                  
060056,000060: 10,3610           20155                           DAS      MPAC                                  
060057,000061: 10,3611           16061                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
060058,000062: 
060059,000063:                                                                                                  #  FORCE TP SIGN AGREEMENT IN MPAC:
060060,000064: 
060061,000065: 10,3612           07257        SGNAGREE           TC       TPAGREE                               
060062,000066: 10,3613           16061                           TCF      DANZIG                                
060063,000067: 
060064,000068:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
060065,000069:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
060066,000070: 
060067,000071: 10,3614           03644        1STO2S             TC       1TO2SUB                               
060068,000072: 10,3615           34755                           CAF      ZERO                                  
060069,000073: 10,3616           54155                           TS       MPAC       +1                         
060070,000074: 10,3617           16060                           TCF      NEWMODE                               
060071,000075: 
060072,000076:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
060073,000077: 
060074,000078: 10,3620           03644        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
060075,000079: 
060076,000080: 10,3621           52162                           DXCH     MPAC       +5                         
060077,000081: 10,3622           52155                           DXCH     MPAC                                  
060078,000082: 10,3623           03644                           TC       1TO2SUB                               

Page 1398

060080,000084: 10,3624           54156                           TS       MPAC       +2                         
060081,000085: 
060082,000086: 10,3625           52160                           DXCH     MPAC       +3                         
060083,000087: 10,3626           52155                           DXCH     MPAC                                  
060084,000088: 10,3627           03644                           TC       1TO2SUB                               
060085,000089: 10,3630           54155                           TS       MPAC       +1                         
060086,000090: 
060087,000091: 10,3631           30161                           CA       MPAC       +5                         
060088,000092: 10,3632           54154                           TS       MPAC                                  
060089,000093: 
060090,000094: 10,3633           34753        TPMODE             CAF      ONE                                   #  MODE IS TP.
060091,000095: 10,3634           16060                           TCF      NEWMODE                               
060092,000096: 
060093,000097:                                                                                                  #  V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
060094,000098: 
060095,000099: 10,3635           03644        2V1STO2S           TC       1TO2SUB                               
060096,000100: 10,3636           52160                           DXCH     MPAC       +3                         
060097,000101: 10,3637           52155                           DXCH     MPAC                                  
060098,000102: 10,3640           03644                           TC       1TO2SUB                               
060099,000103: 10,3641           54001                           TS       L                                     
060100,000104: 10,3642           30157                           CA       MPAC       +3                         
060101,000105: 10,3643           16055                           TCF      SLOAD2                                
060102,000106: 
060103,000107:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
060104,000108: 
060105,000109: 10,3644           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
060106,000110: 10,3645           20001                           DDOUBL                                         
060107,000111: 10,3646           10000                           CCS      A                                     
060108,000112: 10,3647           64753                           AD       ONE                                   
060109,000113: 10,3650           13652                           TCF      +2                                    
060110,000114: 10,3651           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
060111,000115: 
060112,000116: 10,3652           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.
060113,000117: 10,3653           00002                           TC       Q                                     
060114,000118: 
060115,000119: 10,3654           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
060116,000120: 10,3655           34734                           CAF      LIMITS                                
060117,000121: 10,3656           26154                           ADS      MPAC                                  
060118,000122: 10,3657           00002                           TC       Q                                     
060119,000123: 
060120,000124:                                                                                                  #  THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
060121,000125:                                                                                                  #  QUANTITY FOUND IN TEM2.  THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
060122,000126:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY.  MAY BE CALLED BY BANKCALL/SWCALL.
060123,000127: 
060124,000128: 10,3660           54142        CDUINC             TS       TEM2                                  #  1S COMPL.QUANT. ARRIVES IN ACC.  STORE IT
060125,000129: 10,3661           50130                           INDEX    BUF                                   
060126,000130: 10,3662           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
060127,000131: 10,3663           64753                           AD       ONE                                   
060128,000132: 10,3664           13670                           TCF      +4                                    
060129,000133: 10,3665           64753                           AD       ONE                                   

Page 1399

060131,000135: 10,3666           64753                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
060132,000136: 10,3667           40000                           COM                                            
060133,000137: 
060134,000138: 10,3670           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
060135,000139: 10,3671           10000                           CCS      A                                     #  BACK TO 2S COMPL.
060136,000140: 10,3672           64753                           AD       ONE                                   
060137,000141: 10,3673           13675                           TCF      +2                                    
060138,000142: 10,3674           40000                           COM                                            
060139,000143: 10,3675           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
060140,000144: 10,3676           13702                           TCF      +4                                    
060141,000145: 10,3677           50000                           INDEX    A                                     #  SIGN.
060142,000146: 10,3700           34734                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
060143,000147: 10,3701           60142                           AD       TEM2                                  
060144,000148: 
060145,000149: 10,3702           50130                           INDEX    BUF                                   
060146,000150: 10,3703           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
060147,000151: 10,3704           00002                           TC       Q                                     
060148,000152: 

Page 1400

060150,000154:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL.  ECADR OF COMMANDS ARRIVES IN X1.
060151,000155: 
060152,000156: 10,3705           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
060153,000157: 10,3706           30046                           CA       X1                                    
060154,000158: 10,3707           04616                           TC       BANKCALL                              
060155,000159: 10,3710           17323                           CADR     IMUPULSE                              
060156,000160: 10,3711           16061                           TCF      DANZIG                                
060157,000161: 

Page 1401

060159,000163:                                                                                                  #  THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
060160,000164:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.  ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
060161,000165: 
060162,000166:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
060163,000167:                                                                                                  #        1.      LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
060164,000168:                                                                                                  #                ENTRY:          BOVB
060165,000169:                                                                                                  #                                        SIGNMPAC
060166,000170:                                                                                                  #        2.      GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
060167,000171:                                                                                                  #                ENTRY:          RTB
060168,000172:                                                                                                  #                                        SIGNMPAC
060169,000173:                                                                                                  #  IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
060170,000174: 
060171,000175: 10,3712           00006        SIGNMPAC           EXTEND                                         
060172,000176: 10,3713           34733                           DCA      DPOSMAX                               
060173,000177: 10,3714           52155                           DXCH     MPAC                                  
060174,000178: 10,3715           10000                           CCS      A                                     
060175,000179: 10,3716           34755        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
060176,000180: 10,3717           16057                           TCF      SLOAD2     +2                         
060177,000181: 10,3720           13721                           TCF      +1                                    
060178,000182: 10,3721           00006                           EXTEND                                         
060179,000183: 10,3722           44733                           DCS      DPOSMAX                               
060180,000184: 10,3723           16055                           TCF      SLOAD2                                
060181,000185: 
060182,000186:                                                                                                  #  RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
060183,000187:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.  IF NORMUNIT
060184,000188:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
060185,000189:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
060186,000190: 
060187,000191: 10,3724           34753        NORMUNX1           CAF      ONE                                   
060188,000192: 10,3725           13727                           TCF      NORMUNIT   +1                         
060189,000193: 10,3726           34755        NORMUNIT           CAF      ZERO                                  
060190,000194: 10,3727           60120                           AD       FIXLOC                                
060191,000195: 10,3730           54156                           TS       MPAC       +2                         
060192,000196: 10,3731           04616                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
060193,000197: 10,3732           01010                           CADR     VECAGREE                              
060194,000198: 10,3733           10154                           CCS      MPAC                                  
060195,000199: 10,3734           13770                           TCF      NOSHIFT                               
060196,000200: 10,3735           13737                           TCF      +2                                    
060197,000201: 10,3736           13770                           TCF      NOSHIFT                               
060198,000202: 10,3737           10157                           CCS      MPAC       +3                         
060199,000203: 10,3740           13770                           TCF      NOSHIFT                               
060200,000204: 10,3741           13743                           TCF      +2                                    
060201,000205: 10,3742           13770                           TCF      NOSHIFT                               
060202,000206: 10,3743           10161                           CCS      MPAC       +5                         
060203,000207: 10,3744           13770                           TCF      NOSHIFT                               
060204,000208: 10,3745           13747                           TCF      +2                                    
060205,000209: 10,3746           13770                           TCF      NOSHIFT                               

Page 1402

060207,000211: 10,3747           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
060208,000212: 10,3750           00006                           EXTEND                                         
060209,000213: 10,3751           74736                           MP       BIT14                                 
060210,000214: 10,3752           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
060211,000215: 10,3753           30160                           CA       MPAC       +4                         
060212,000216: 10,3754           00006                           EXTEND                                         
060213,000217: 10,3755           74736                           MP       BIT14                                 
060214,000218: 10,3756           20160                           DAS      MPAC       +3                         
060215,000219: 10,3757           30162                           CA       MPAC       +6                         
060216,000220: 10,3760           00006                           EXTEND                                         
060217,000221: 10,3761           74736                           MP       BIT14                                 
060218,000222: 10,3762           20162                           DAS      MPAC       +5                         
060219,000223: 10,3763           34761                           CAF      THIRTEEN                              
060220,000224: 10,3764           50156                           INDEX    MPAC       +2                         
060221,000225: 10,3765           54045                           TS       37D                                   
060222,000226: 10,3766           04635        OFFTUNIT           TC       POSTJUMP                              
060223,000227: 10,3767           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
060224,000228: 
060225,000229: 10,3770           34755        NOSHIFT            CAF      ZERO                                  
060226,000230: 10,3771           13764                           TCF      OFFTUNIT   -2                         
060227,000231: 
060228,000232:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
060229,000233: 
060230,000234: 10,3772           04616        VECSGNAG           TC       BANKCALL                              
060231,000235: 10,3773           01010                           CADR     VECAGREE                              
060232,000236: 10,3774           06061                           TC       DANZIG                                
060233,000237: 
060234,000238: 

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