Source Code

These source-code files are part of a reconstructed copy of Luminary 98, a development version of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

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 memo 85, using asterisks indicating changed lines in the listing as a guide. While no listing of this version is known to exist, nor are the memory-bank checksums available, the reconstruction is believed to be correct because it was an an intermediate step in reconstructing Luminary 97 whose reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152G. 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 98 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.

058521,000002:                                                                                                  ## Copyright:   Public domain.
058522,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
058523,000004:                                                                                                  ## Purpose:     A section of Luminary revision 98.
058524,000005:                                                                                                  ##              It is part of the reconstructed source code for the a
058525,000006:                                                                                                  ##              development version of the flight software for the Lunar 
058526,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
058527,000008:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
058528,000009:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
058529,000010:                                                                                                  ##              the listing and Luminary Memo #85, which lists changes between
058530,000011:                                                                                                  ##              Luminary 98 and 99.
058531,000012:                                                                                                  ## Reference:   pp. 1397-1402
058532,000013:                                                                                                  ## Assembler:   yaYUL
058533,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058534,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058535,000016:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
058536,000017: 

Page 1397

058538,000019: 22,3773                                           BANK     22                                    
058539,000020: 10,2000                                           SETLOC   RTBCODES                              
058540,000021: 10,2000                                           BANK                                           
058541,000022: 
058542,000023: 10,3573  E5,1664                                  EBANK=   XNB                                   
058543,000024: 10,3573                                           COUNT*   $$/RTB                                
058544,000025: 
058545,000026:                                                                                                  #  LOAD TIME2, TIME1 INTO MPAC:
058546,000027: 
058547,000028: 10,3573           00006        LOADTIME           EXTEND                                         
058548,000029: 10,3574           30025                           DCA      TIME2                                 
058549,000030: 10,3575           16055                           TCF      SLOAD2                                
058550,000031: 
058551,000032:                                                                                                  #  CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
058552,000033:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
058553,000034: 
058554,000035: 10,3576           10154        CDULOGIC           CCS      MPAC                                  
058555,000036: 10,3577           34755                           CAF      ZERO                                  
058556,000037: 10,3600           13603                           TCF      +3                                    
058557,000038: 10,3601           13602                           NOOP                                           
058558,000039: 10,3602           44736                           CS       HALF                                  
058559,000040: 
058560,000041: 10,3603           54155                           TS       MPAC       +1                         
058561,000042: 10,3604           34755                           CAF      ZERO                                  
058562,000043: 10,3605           56154                           XCH      MPAC                                  
058563,000044: 10,3606           00006                           EXTEND                                         
058564,000045: 10,3607           74736                           MP       HALF                                  
058565,000046: 10,3610           20155                           DAS      MPAC                                  
058566,000047: 10,3611           16061                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
058567,000048: 
058568,000049:                                                                                                  #  FORCE TP SIGN AGREEMENT IN MPAC:
058569,000050: 
058570,000051: 10,3612           07257        SGNAGREE           TC       TPAGREE                               
058571,000052: 10,3613           16061                           TCF      DANZIG                                
058572,000053: 
058573,000054:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
058574,000055:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
058575,000056: 
058576,000057: 10,3614           03644        1STO2S             TC       1TO2SUB                               
058577,000058: 10,3615           34755                           CAF      ZERO                                  
058578,000059: 10,3616           54155                           TS       MPAC       +1                         
058579,000060: 10,3617           16060                           TCF      NEWMODE                               
058580,000061: 
058581,000062:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
058582,000063: 
058583,000064: 10,3620           03644        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
058584,000065: 
058585,000066: 10,3621           52162                           DXCH     MPAC       +5                         
058586,000067: 10,3622           52155                           DXCH     MPAC                                  
058587,000068: 10,3623           03644                           TC       1TO2SUB                               

Page 1398

058589,000070: 10,3624           54156                           TS       MPAC       +2                         
058590,000071: 
058591,000072: 10,3625           52160                           DXCH     MPAC       +3                         
058592,000073: 10,3626           52155                           DXCH     MPAC                                  
058593,000074: 10,3627           03644                           TC       1TO2SUB                               
058594,000075: 10,3630           54155                           TS       MPAC       +1                         
058595,000076: 
058596,000077: 10,3631           30161                           CA       MPAC       +5                         
058597,000078: 10,3632           54154                           TS       MPAC                                  
058598,000079: 
058599,000080: 10,3633           34753        TPMODE             CAF      ONE                                   #  MODE IS TP.
058600,000081: 10,3634           16060                           TCF      NEWMODE                               
058601,000082: 
058602,000083:                                                                                                  #  V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
058603,000084: 
058604,000085: 10,3635           03644        2V1STO2S           TC       1TO2SUB                               
058605,000086: 10,3636           52160                           DXCH     MPAC       +3                         
058606,000087: 10,3637           52155                           DXCH     MPAC                                  
058607,000088: 10,3640           03644                           TC       1TO2SUB                               
058608,000089: 10,3641           54001                           TS       L                                     
058609,000090: 10,3642           30157                           CA       MPAC       +3                         
058610,000091: 10,3643           16055                           TCF      SLOAD2                                
058611,000092: 
058612,000093:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
058613,000094: 
058614,000095: 10,3644           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
058615,000096: 10,3645           20001                           DDOUBL                                         
058616,000097: 10,3646           10000                           CCS      A                                     
058617,000098: 10,3647           64753                           AD       ONE                                   
058618,000099: 10,3650           13652                           TCF      +2                                    
058619,000100: 10,3651           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
058620,000101: 
058621,000102: 10,3652           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.
058622,000103: 10,3653           00002                           TC       Q                                     
058623,000104: 
058624,000105: 10,3654           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
058625,000106: 10,3655           34734                           CAF      LIMITS                                
058626,000107: 10,3656           26154                           ADS      MPAC                                  
058627,000108: 10,3657           00002                           TC       Q                                     
058628,000109: 
058629,000110:                                                                                                  #  THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
058630,000111:                                                                                                  #  QUANTITY FOUND IN TEM2.  THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
058631,000112:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY.  MAY BE CALLED BY BANKCALL/SWCALL.
058632,000113: 
058633,000114: 10,3660           54142        CDUINC             TS       TEM2                                  #  1S COMPL.QUANT. ARRIVES IN ACC.  STORE IT
058634,000115: 10,3661           50130                           INDEX    BUF                                   
058635,000116: 10,3662           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
058636,000117: 10,3663           64753                           AD       ONE                                   
058637,000118: 10,3664           13670                           TCF      +4                                    
058638,000119: 10,3665           64753                           AD       ONE                                   

Page 1399

058640,000121: 10,3666           64753                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
058641,000122: 10,3667           40000                           COM                                            
058642,000123: 
058643,000124: 10,3670           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
058644,000125: 10,3671           10000                           CCS      A                                     #  BACK TO 2S COMPL.
058645,000126: 10,3672           64753                           AD       ONE                                   
058646,000127: 10,3673           13675                           TCF      +2                                    
058647,000128: 10,3674           40000                           COM                                            
058648,000129: 10,3675           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
058649,000130: 10,3676           13702                           TCF      +4                                    
058650,000131: 10,3677           50000                           INDEX    A                                     #  SIGN.
058651,000132: 10,3700           34734                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
058652,000133: 10,3701           60142                           AD       TEM2                                  
058653,000134: 
058654,000135: 10,3702           50130                           INDEX    BUF                                   
058655,000136: 10,3703           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
058656,000137: 10,3704           00002                           TC       Q                                     
058657,000138: 

Page 1400

058659,000140:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL.  ECADR OF COMMANDS ARRIVES IN X1.
058660,000141: 
058661,000142: 10,3705           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
058662,000143: 10,3706           30046                           CA       X1                                    
058663,000144: 10,3707           04616                           TC       BANKCALL                              
058664,000145: 10,3710           17323                           CADR     IMUPULSE                              
058665,000146: 10,3711           16061                           TCF      DANZIG                                
058666,000147: 

Page 1401

058668,000149:                                                                                                  #  THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
058669,000150:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.  ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
058670,000151: 
058671,000152:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
058672,000153:                                                                                                  #        1.      LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
058673,000154:                                                                                                  #                ENTRY:          BOVB
058674,000155:                                                                                                  #                                        SIGNMPAC
058675,000156:                                                                                                  #        2.      GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
058676,000157:                                                                                                  #                ENTRY:          RTB
058677,000158:                                                                                                  #                                        SIGNMPAC
058678,000159:                                                                                                  #  IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
058679,000160: 
058680,000161: 10,3712           00006        SIGNMPAC           EXTEND                                         
058681,000162: 10,3713           34733                           DCA      DPOSMAX                               
058682,000163: 10,3714           52155                           DXCH     MPAC                                  
058683,000164: 10,3715           10000                           CCS      A                                     
058684,000165: 10,3716           34755        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
058685,000166: 10,3717           16057                           TCF      SLOAD2     +2                         
058686,000167: 10,3720           13721                           TCF      +1                                    
058687,000168: 10,3721           00006                           EXTEND                                         
058688,000169: 10,3722           44733                           DCS      DPOSMAX                               
058689,000170: 10,3723           16055                           TCF      SLOAD2                                
058690,000171: 
058691,000172:                                                                                                  #  RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
058692,000173:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.  IF NORMUNIT
058693,000174:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
058694,000175:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
058695,000176: 
058696,000177: 10,3724           34753        NORMUNX1           CAF      ONE                                   
058697,000178: 10,3725           13727                           TCF      NORMUNIT   +1                         
058698,000179: 10,3726           34755        NORMUNIT           CAF      ZERO                                  
058699,000180: 10,3727           60120                           AD       FIXLOC                                
058700,000181: 10,3730           54156                           TS       MPAC       +2                         
058701,000182: 10,3731           04616                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
058702,000183: 10,3732           01010                           CADR     VECAGREE                              
058703,000184: 10,3733           10154                           CCS      MPAC                                  
058704,000185: 10,3734           13770                           TCF      NOSHIFT                               
058705,000186: 10,3735           13737                           TCF      +2                                    
058706,000187: 10,3736           13770                           TCF      NOSHIFT                               
058707,000188: 10,3737           10157                           CCS      MPAC       +3                         
058708,000189: 10,3740           13770                           TCF      NOSHIFT                               
058709,000190: 10,3741           13743                           TCF      +2                                    
058710,000191: 10,3742           13770                           TCF      NOSHIFT                               
058711,000192: 10,3743           10161                           CCS      MPAC       +5                         
058712,000193: 10,3744           13770                           TCF      NOSHIFT                               
058713,000194: 10,3745           13747                           TCF      +2                                    
058714,000195: 10,3746           13770                           TCF      NOSHIFT                               

Page 1402

058716,000197: 10,3747           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
058717,000198: 10,3750           00006                           EXTEND                                         
058718,000199: 10,3751           74736                           MP       BIT14                                 
058719,000200: 10,3752           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
058720,000201: 10,3753           30160                           CA       MPAC       +4                         
058721,000202: 10,3754           00006                           EXTEND                                         
058722,000203: 10,3755           74736                           MP       BIT14                                 
058723,000204: 10,3756           20160                           DAS      MPAC       +3                         
058724,000205: 10,3757           30162                           CA       MPAC       +6                         
058725,000206: 10,3760           00006                           EXTEND                                         
058726,000207: 10,3761           74736                           MP       BIT14                                 
058727,000208: 10,3762           20162                           DAS      MPAC       +5                         
058728,000209: 10,3763           34761                           CAF      THIRTEEN                              
058729,000210: 10,3764           50156                           INDEX    MPAC       +2                         
058730,000211: 10,3765           54045                           TS       37D                                   
058731,000212: 10,3766           04635        OFFTUNIT           TC       POSTJUMP                              
058732,000213: 10,3767           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
058733,000214: 
058734,000215: 10,3770           34755        NOSHIFT            CAF      ZERO                                  
058735,000216: 10,3771           13764                           TCF      OFFTUNIT   -2                         
058736,000217: 
058737,000218:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
058738,000219: 
058739,000220: 10,3772           04616        VECSGNAG           TC       BANKCALL                              
058740,000221: 10,3773           01010                           CADR     VECAGREE                              
058741,000222: 10,3774           06061                           TC       DANZIG                                
058742,000223: 
058743,000224: 

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