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
	20'35 OCT. 28,1968
Note that the date is the date of the printout, not the date of the program revision.

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

Page 1397

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

Page 1398

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

Page 1399

060108,000135: 10,3666           64753                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
060109,000136: 10,3667           40000                           COM                                            
060110,000137: 
060111,000138: 10,3670           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
060112,000139: 10,3671           10000                           CCS      A                                     #  BACK TO 2S COMPL.
060113,000140: 10,3672           64753                           AD       ONE                                   
060114,000141: 10,3673           13675                           TCF      +2                                    
060115,000142: 10,3674           40000                           COM                                            
060116,000143: 10,3675           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
060117,000144: 10,3676           13702                           TCF      +4                                    
060118,000145: 10,3677           50000                           INDEX    A                                     #  SIGN.
060119,000146: 10,3700           34734                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
060120,000147: 10,3701           60142                           AD       TEM2                                  
060121,000148: 
060122,000149: 10,3702           50130                           INDEX    BUF                                   
060123,000150: 10,3703           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
060124,000151: 10,3704           00002                           TC       Q                                     
060125,000152: 

Page 1400

060127,000154:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL.  ECADR OF COMMANDS ARRIVES IN X1.
060128,000155: 
060129,000156: 10,3705           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
060130,000157: 10,3706           30046                           CA       X1                                    
060131,000158: 10,3707           04616                           TC       BANKCALL                              
060132,000159: 10,3710           17323                           CADR     IMUPULSE                              
060133,000160: 10,3711           16061                           TCF      DANZIG                                
060134,000161: 

Page 1401

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

Page 1402

060184,000211: 10,3747           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
060185,000212: 10,3750           00006                           EXTEND                                         
060186,000213: 10,3751           74736                           MP       BIT14                                 
060187,000214: 10,3752           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
060188,000215: 10,3753           30160                           CA       MPAC       +4                         
060189,000216: 10,3754           00006                           EXTEND                                         
060190,000217: 10,3755           74736                           MP       BIT14                                 
060191,000218: 10,3756           20160                           DAS      MPAC       +3                         
060192,000219: 10,3757           30162                           CA       MPAC       +6                         
060193,000220: 10,3760           00006                           EXTEND                                         
060194,000221: 10,3761           74736                           MP       BIT14                                 
060195,000222: 10,3762           20162                           DAS      MPAC       +5                         
060196,000223: 10,3763           34761                           CAF      THIRTEEN                              
060197,000224: 10,3764           50156                           INDEX    MPAC       +2                         
060198,000225: 10,3765           54045                           TS       37D                                   
060199,000226: 10,3766           04635        OFFTUNIT           TC       POSTJUMP                              
060200,000227: 10,3767           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
060201,000228: 
060202,000229: 10,3770           34755        NOSHIFT            CAF      ZERO                                  
060203,000230: 10,3771           13764                           TCF      OFFTUNIT   -2                         
060204,000231: 
060205,000232:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
060206,000233: 
060207,000234: 10,3772           04616        VECSGNAG           TC       BANKCALL                              
060208,000235: 10,3773           01010                           CADR     VECAGREE                              
060209,000236: 10,3774           06061                           TC       DANZIG                                
060210,000237: 
060211,000238: 

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