Source Code

These source-code files are part of a reconstructed copy of Luminary 97, the second release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software. It was created to fix two incorrect ephemeris constants in Luminary 96, as described by anomaly report LNY-59.

The reconstruction began with source code of Luminary 99 revision 1 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes described in original Luminary memos 83 and 85, using asterisks indicating changed lines in the listing as a guide. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 97 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

058978,000002:                                                                                                  ## Copyright:   Public domain.
058979,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
058980,000004:                                                                                                  ## Purpose:     A section of Luminary revision 97.
058981,000005:                                                                                                  ##              It is part of the reconstructed source code for the
058982,000006:                                                                                                  ##              second release of the flight software for the Lunar 
058983,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
058984,000008:                                                                                                  ##              It was created to fix two incorrect ephemeris constants in
058985,000009:                                                                                                  ##              Luminary 96, as described by anomaly report LNY-59.
058986,000010:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
058987,000011:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
058988,000012:                                                                                                  ##              the listing and Luminary Memos #83 and #85, which list 
058989,000013:                                                                                                  ##              changes between Luminary 97 and 98, and 98 and 99. The
058990,000014:                                                                                                  ##              code has been adapted such that the resulting bugger words
058991,000015:                                                                                                  ##              exactly match those specified for Luminary 97 in NASA drawing
058992,000016:                                                                                                  ##              2021152D, which gives relatively high confidence that the
058993,000017:                                                                                                  ##              reconstruction is correct.
058994,000018:                                                                                                  ## Reference:   pp. 1397-1402
058995,000019:                                                                                                  ## Assembler:   yaYUL
058996,000020:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058997,000021:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058998,000022:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
058999,000023: 

Page 1397

059001,000025: 22,3773                                           BANK     22                                    
059002,000026: 10,2000                                           SETLOC   RTBCODES                              
059003,000027: 10,2000                                           BANK                                           
059004,000028: 
059005,000029: 10,3573  E5,1664                                  EBANK=   XNB                                   
059006,000030: 10,3573                                           COUNT*   $$/RTB                                
059007,000031: 
059008,000032:                                                                                                  #  LOAD TIME2, TIME1 INTO MPAC:
059009,000033: 
059010,000034: 10,3573           00006        LOADTIME           EXTEND                                         
059011,000035: 10,3574           30025                           DCA      TIME2                                 
059012,000036: 10,3575           16055                           TCF      SLOAD2                                
059013,000037: 
059014,000038:                                                                                                  #  CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
059015,000039:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
059016,000040: 
059017,000041: 10,3576           10154        CDULOGIC           CCS      MPAC                                  
059018,000042: 10,3577           34755                           CAF      ZERO                                  
059019,000043: 10,3600           13603                           TCF      +3                                    
059020,000044: 10,3601           13602                           NOOP                                           
059021,000045: 10,3602           44736                           CS       HALF                                  
059022,000046: 
059023,000047: 10,3603           54155                           TS       MPAC       +1                         
059024,000048: 10,3604           34755                           CAF      ZERO                                  
059025,000049: 10,3605           56154                           XCH      MPAC                                  
059026,000050: 10,3606           00006                           EXTEND                                         
059027,000051: 10,3607           74736                           MP       HALF                                  
059028,000052: 10,3610           20155                           DAS      MPAC                                  
059029,000053: 10,3611           16061                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
059030,000054: 
059031,000055:                                                                                                  #  FORCE TP SIGN AGREEMENT IN MPAC:
059032,000056: 
059033,000057: 10,3612           07257        SGNAGREE           TC       TPAGREE                               
059034,000058: 10,3613           16061                           TCF      DANZIG                                
059035,000059: 
059036,000060:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
059037,000061:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
059038,000062: 
059039,000063: 10,3614           03644        1STO2S             TC       1TO2SUB                               
059040,000064: 10,3615           34755                           CAF      ZERO                                  
059041,000065: 10,3616           54155                           TS       MPAC       +1                         
059042,000066: 10,3617           16060                           TCF      NEWMODE                               
059043,000067: 
059044,000068:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
059045,000069: 
059046,000070: 10,3620           03644        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
059047,000071: 
059048,000072: 10,3621           52162                           DXCH     MPAC       +5                         
059049,000073: 10,3622           52155                           DXCH     MPAC                                  
059050,000074: 10,3623           03644                           TC       1TO2SUB                               

Page 1398

059052,000076: 10,3624           54156                           TS       MPAC       +2                         
059053,000077: 
059054,000078: 10,3625           52160                           DXCH     MPAC       +3                         
059055,000079: 10,3626           52155                           DXCH     MPAC                                  
059056,000080: 10,3627           03644                           TC       1TO2SUB                               
059057,000081: 10,3630           54155                           TS       MPAC       +1                         
059058,000082: 
059059,000083: 10,3631           30161                           CA       MPAC       +5                         
059060,000084: 10,3632           54154                           TS       MPAC                                  
059061,000085: 
059062,000086: 10,3633           34753        TPMODE             CAF      ONE                                   #  MODE IS TP.
059063,000087: 10,3634           16060                           TCF      NEWMODE                               
059064,000088: 
059065,000089:                                                                                                  #  V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
059066,000090: 
059067,000091: 10,3635           03644        2V1STO2S           TC       1TO2SUB                               
059068,000092: 10,3636           52160                           DXCH     MPAC       +3                         
059069,000093: 10,3637           52155                           DXCH     MPAC                                  
059070,000094: 10,3640           03644                           TC       1TO2SUB                               
059071,000095: 10,3641           54001                           TS       L                                     
059072,000096: 10,3642           30157                           CA       MPAC       +3                         
059073,000097: 10,3643           16055                           TCF      SLOAD2                                
059074,000098: 
059075,000099:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
059076,000100: 
059077,000101: 10,3644           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
059078,000102: 10,3645           20001                           DDOUBL                                         
059079,000103: 10,3646           10000                           CCS      A                                     
059080,000104: 10,3647           64753                           AD       ONE                                   
059081,000105: 10,3650           13652                           TCF      +2                                    
059082,000106: 10,3651           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
059083,000107: 
059084,000108: 10,3652           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.
059085,000109: 10,3653           00002                           TC       Q                                     
059086,000110: 
059087,000111: 10,3654           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
059088,000112: 10,3655           34734                           CAF      LIMITS                                
059089,000113: 10,3656           26154                           ADS      MPAC                                  
059090,000114: 10,3657           00002                           TC       Q                                     
059091,000115: 
059092,000116:                                                                                                  #  THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
059093,000117:                                                                                                  #  QUANTITY FOUND IN TEM2.  THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
059094,000118:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY.  MAY BE CALLED BY BANKCALL/SWCALL.
059095,000119: 
059096,000120: 10,3660           54142        CDUINC             TS       TEM2                                  #  1S COMPL.QUANT. ARRIVES IN ACC.  STORE IT
059097,000121: 10,3661           50130                           INDEX    BUF                                   
059098,000122: 10,3662           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
059099,000123: 10,3663           64753                           AD       ONE                                   
059100,000124: 10,3664           13670                           TCF      +4                                    
059101,000125: 10,3665           64753                           AD       ONE                                   

Page 1399

059103,000127: 10,3666           64753                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
059104,000128: 10,3667           40000                           COM                                            
059105,000129: 
059106,000130: 10,3670           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
059107,000131: 10,3671           10000                           CCS      A                                     #  BACK TO 2S COMPL.
059108,000132: 10,3672           64753                           AD       ONE                                   
059109,000133: 10,3673           13675                           TCF      +2                                    
059110,000134: 10,3674           40000                           COM                                            
059111,000135: 10,3675           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
059112,000136: 10,3676           13702                           TCF      +4                                    
059113,000137: 10,3677           50000                           INDEX    A                                     #  SIGN.
059114,000138: 10,3700           34734                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
059115,000139: 10,3701           60142                           AD       TEM2                                  
059116,000140: 
059117,000141: 10,3702           50130                           INDEX    BUF                                   
059118,000142: 10,3703           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
059119,000143: 10,3704           00002                           TC       Q                                     
059120,000144: 

Page 1400

059122,000146:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL.  ECADR OF COMMANDS ARRIVES IN X1.
059123,000147: 
059124,000148: 10,3705           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
059125,000149: 10,3706           30046                           CA       X1                                    
059126,000150: 10,3707           04616                           TC       BANKCALL                              
059127,000151: 10,3710           17323                           CADR     IMUPULSE                              
059128,000152: 10,3711           16061                           TCF      DANZIG                                
059129,000153: 

Page 1401

059131,000155:                                                                                                  #  THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
059132,000156:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.  ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
059133,000157: 
059134,000158:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
059135,000159:                                                                                                  #        1.      LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
059136,000160:                                                                                                  #                ENTRY:          BOVB
059137,000161:                                                                                                  #                                        SIGNMPAC
059138,000162:                                                                                                  #        2.      GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
059139,000163:                                                                                                  #                ENTRY:          RTB
059140,000164:                                                                                                  #                                        SIGNMPAC
059141,000165:                                                                                                  #  IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
059142,000166: 
059143,000167: 10,3712           00006        SIGNMPAC           EXTEND                                         
059144,000168: 10,3713           34733                           DCA      DPOSMAX                               
059145,000169: 10,3714           52155                           DXCH     MPAC                                  
059146,000170: 10,3715           10000                           CCS      A                                     
059147,000171: 10,3716           34755        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
059148,000172: 10,3717           16057                           TCF      SLOAD2     +2                         
059149,000173: 10,3720           13721                           TCF      +1                                    
059150,000174: 10,3721           00006                           EXTEND                                         
059151,000175: 10,3722           44733                           DCS      DPOSMAX                               
059152,000176: 10,3723           16055                           TCF      SLOAD2                                
059153,000177: 
059154,000178:                                                                                                  #  RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
059155,000179:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.  IF NORMUNIT
059156,000180:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
059157,000181:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
059158,000182: 
059159,000183: 10,3724           34753        NORMUNX1           CAF      ONE                                   
059160,000184: 10,3725           13727                           TCF      NORMUNIT   +1                         
059161,000185: 10,3726           34755        NORMUNIT           CAF      ZERO                                  
059162,000186: 10,3727           60120                           AD       FIXLOC                                
059163,000187: 10,3730           54156                           TS       MPAC       +2                         
059164,000188: 10,3731           04616                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
059165,000189: 10,3732           01010                           CADR     VECAGREE                              
059166,000190: 10,3733           10154                           CCS      MPAC                                  
059167,000191: 10,3734           13770                           TCF      NOSHIFT                               
059168,000192: 10,3735           13737                           TCF      +2                                    
059169,000193: 10,3736           13770                           TCF      NOSHIFT                               
059170,000194: 10,3737           10157                           CCS      MPAC       +3                         
059171,000195: 10,3740           13770                           TCF      NOSHIFT                               
059172,000196: 10,3741           13743                           TCF      +2                                    
059173,000197: 10,3742           13770                           TCF      NOSHIFT                               
059174,000198: 10,3743           10161                           CCS      MPAC       +5                         
059175,000199: 10,3744           13770                           TCF      NOSHIFT                               
059176,000200: 10,3745           13747                           TCF      +2                                    
059177,000201: 10,3746           13770                           TCF      NOSHIFT                               

Page 1402

059179,000203: 10,3747           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
059180,000204: 10,3750           00006                           EXTEND                                         
059181,000205: 10,3751           74736                           MP       BIT14                                 
059182,000206: 10,3752           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
059183,000207: 10,3753           30160                           CA       MPAC       +4                         
059184,000208: 10,3754           00006                           EXTEND                                         
059185,000209: 10,3755           74736                           MP       BIT14                                 
059186,000210: 10,3756           20160                           DAS      MPAC       +3                         
059187,000211: 10,3757           30162                           CA       MPAC       +6                         
059188,000212: 10,3760           00006                           EXTEND                                         
059189,000213: 10,3761           74736                           MP       BIT14                                 
059190,000214: 10,3762           20162                           DAS      MPAC       +5                         
059191,000215: 10,3763           34761                           CAF      THIRTEEN                              
059192,000216: 10,3764           50156                           INDEX    MPAC       +2                         
059193,000217: 10,3765           54045                           TS       37D                                   
059194,000218: 10,3766           04635        OFFTUNIT           TC       POSTJUMP                              
059195,000219: 10,3767           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
059196,000220: 
059197,000221: 10,3770           34755        NOSHIFT            CAF      ZERO                                  
059198,000222: 10,3771           13764                           TCF      OFFTUNIT   -2                         
059199,000223: 
059200,000224:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
059201,000225: 
059202,000226: 10,3772           04616        VECSGNAG           TC       BANKCALL                              
059203,000227: 10,3773           01010                           CADR     VECAGREE                              
059204,000228: 10,3774           06061                           TC       DANZIG                                
059205,000229: 
059206,000230: 

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