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.

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

Page 1397

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

Page 1398

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

Page 1399

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

Page 1400

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

Page 1401

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

Page 1402

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

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