Source Code

These source-code files are part of a reconstructed copy of Luminary 178, the final release of the Apollo 14 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Zerlina 56, Luminary 210, and Luminary 131, previously transcribed from digitized copies of those programs. The code was created by combining the three, using Zerlina 56 as a base, since it was based off of Luminary 183. The differences between the three were carefully merged using the Luminary memos as a guide, with all changes made after Luminary 178 being backed out. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 178 listing would be different.

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.

059429,000002:                                                                                                  ## Copyright:   Public domain.
059430,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
059431,000004:                                                                                                  ## Purpose:     A section of Luminary revision 178.
059432,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
059433,000006:                                                                                                  ##              release of the flight software for the Lunar Module's
059434,000007:                                                                                                  ##              (LM) Apollo Guidance Computer (AGC) for Apollo 14. The
059435,000008:                                                                                                  ##              code has been recreated from copies of Zerlina 56, Luminary
059436,000009:                                                                                                  ##              210, and Luminary 131, as well as many Luminary memos.
059437,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
059438,000011:                                                                                                  ##              exactly match those specified for Luminary 178 in NASA
059439,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
059440,000013:                                                                                                  ##              that the reconstruction is correct.
059441,000014:                                                                                                  ## Reference:   pp. 1385-1390
059442,000015:                                                                                                  ## Assembler:   yaYUL
059443,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
059444,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
059445,000018:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Zerlina 56.
059446,000019: 

Page 1385

059448,000021: 22,3772                                           BANK     22                                    
059449,000022: 10,2000                                           SETLOC   RTBCODES                              
059450,000023: 10,2000                                           BANK                                           
059451,000024: 
059452,000025: 10,3574  E5,1664                                  EBANK=   XNB                                   
059453,000026: 10,3574                                           COUNT*   $$/RTB                                
059454,000027: 
059455,000028:                                                                                                  #           LOAD TIME2, TIME1 INTO MPAC:
059456,000029: 
059457,000030: 10,3574           00006        LOADTIME           EXTEND                                         
059458,000031: 10,3575           30025                           DCA      TIME2                                 
059459,000032: 10,3576           16060                           TCF      SLOAD2                                
059460,000033: 
059461,000034:                                                                                                  #           CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
059462,000035:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
059463,000036: 
059464,000037: 10,3577           10154        CDULOGIC           CCS      MPAC                                  
059465,000038: 10,3600           34755                           CAF      ZERO                                  
059466,000039: 10,3601           13604                           TCF      +3                                    
059467,000040: 10,3602           13603                           NOOP                                           
059468,000041: 10,3603           44736                           CS       HALF                                  
059469,000042: 
059470,000043: 10,3604           54155                           TS       MPAC       +1                         
059471,000044: 10,3605           34755                           CAF      ZERO                                  
059472,000045: 10,3606           56154                           XCH      MPAC                                  
059473,000046: 10,3607           00006                           EXTEND                                         
059474,000047: 10,3610           74736                           MP       HALF                                  
059475,000048: 10,3611           20155                           DAS      MPAC                                  
059476,000049: 10,3612           16064                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
059477,000050: 
059478,000051:                                                                                                  #           FORCE TP SIGN AGREEMENT IN MPAC:
059479,000052: 
059480,000053: 10,3613           07262        SGNAGREE           TC       TPAGREE                               
059481,000054: 10,3614           16064                           TCF      DANZIG                                
059482,000055: 
059483,000056:                                                                                                  #           CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
059484,000057:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
059485,000058: 
059486,000059: 10,3615           03645        1STO2S             TC       1TO2SUB                               
059487,000060: 10,3616           34755                           CAF      ZERO                                  
059488,000061: 10,3617           54155                           TS       MPAC       +1                         
059489,000062: 10,3620           16063                           TCF      NEWMODE                               
059490,000063: 
059491,000064:                                                                                                  #           DO 1STO2S ON A VECTOR OF ANGLES:
059492,000065: 
059493,000066: 10,3621           03645        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
059494,000067: 
059495,000068: 10,3622           52162                           DXCH     MPAC       +5                         
059496,000069: 10,3623           52155                           DXCH     MPAC                                  
059497,000070: 10,3624           03645                           TC       1TO2SUB                               

Page 1386

059499,000072: 10,3625           54156                           TS       MPAC       +2                         
059500,000073: 
059501,000074: 10,3626           52160                           DXCH     MPAC       +3                         
059502,000075: 10,3627           52155                           DXCH     MPAC                                  
059503,000076: 10,3630           03645                           TC       1TO2SUB                               
059504,000077: 10,3631           54155                           TS       MPAC       +1                         
059505,000078: 
059506,000079: 10,3632           30161                           CA       MPAC       +5                         
059507,000080: 10,3633           54154                           TS       MPAC                                  
059508,000081: 
059509,000082: 10,3634           34753        TPMODE             CAF      ONE                                   #  MODE IS TP.
059510,000083: 10,3635           16063                           TCF      NEWMODE                               
059511,000084: 
059512,000085:                                                                                                  #           V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
059513,000086: 
059514,000087: 10,3636           03645        2V1STO2S           TC       1TO2SUB                               
059515,000088: 10,3637           52160                           DXCH     MPAC       +3                         
059516,000089: 10,3640           52155                           DXCH     MPAC                                  
059517,000090: 10,3641           03645                           TC       1TO2SUB                               
059518,000091: 10,3642           54001                           TS       L                                     
059519,000092: 10,3643           30157                           CA       MPAC       +3                         
059520,000093: 10,3644           16060                           TCF      SLOAD2                                
059521,000094: 
059522,000095:                                                                                                  #           SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
059523,000096: 
059524,000097: 10,3645           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
059525,000098: 10,3646           20001                           DDOUBL                                         
059526,000099: 10,3647           10000                           CCS      A                                     
059527,000100: 10,3650           64753                           AD       ONE                                   
059528,000101: 10,3651           13653                           TCF      +2                                    
059529,000102: 10,3652           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
059530,000103: 
059531,000104: 10,3653           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.
059532,000105: 10,3654           00002                           TC       Q                                     
059533,000106: 
059534,000107: 10,3655           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
059535,000108: 10,3656           34734                           CAF      LIMITS                                
059536,000109: 10,3657           26154                           ADS      MPAC                                  
059537,000110: 10,3660           00002                           TC       Q                                     
059538,000111: 
059539,000112:                                                                                                  #           THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
059540,000113:                                                                                                  #  QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
059541,000114:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
059542,000115: 
059543,000116: 10,3661           54142        CDUINC             TS       TEM2                                  #  1S COMPL.QUANT. ARRIVES IN ACC. STORE IT
059544,000117: 10,3662           50130                           INDEX    BUF                                   
059545,000118: 10,3663           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
059546,000119: 10,3664           64753                           AD       ONE                                   
059547,000120: 10,3665           13671                           TCF      +4                                    
059548,000121: 10,3666           64753                           AD       ONE                                   

Page 1387

059550,000123: 10,3667           64753                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
059551,000124: 10,3670           40000                           COM                                            
059552,000125: 
059553,000126: 10,3671           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD.(OR BACK)
059554,000127: 10,3672           10000                           CCS      A                                     #  BACK TO 2S COMPL.
059555,000128: 10,3673           64753                           AD       ONE                                   
059556,000129: 10,3674           13676                           TCF      +2                                    
059557,000130: 10,3675           40000                           COM                                            
059558,000131: 10,3676           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
059559,000132: 10,3677           13703                           TCF      +4                                    
059560,000133: 10,3700           50000                           INDEX    A                                     #   SIGN.
059561,000134: 10,3701           34734                           CAF      LIMITS                                #  FIX IT,BY ADDING IN 37777 OR 40000
059562,000135: 10,3702           60142                           AD       TEM2                                  
059563,000136: 
059564,000137: 10,3703           50130                           INDEX    BUF                                   
059565,000138: 10,3704           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
059566,000139: 10,3705           00002                           TC       Q                                     
059567,000140: 

Page 1388

059569,000142:                                                                                                  #           RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
059570,000143: 
059571,000144: 10,3706           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
059572,000145: 10,3707           30046                           CA       X1                                    
059573,000146: 10,3710           04616                           TC       BANKCALL                              
059574,000147: 10,3711           17307                           CADR     IMUPULSE                              
059575,000148: 10,3712           16064                           TCF      DANZIG                                
059576,000149: 

Page 1389

059578,000151:                                                                                                  #           THE SUBROUTINE  SIGNMPAC  SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
059579,000152:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.    ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
059580,000153: 
059581,000154:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
059582,000155: 
059583,000156:                                                                                                  #  1.       LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
059584,000157:                                                                                                  #  ENTRY:          BOVB
059585,000158:                                                                                                  #                         SIGNMPAC
059586,000159: 
059587,000160:                                                                                                  #  2.       GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
059588,000161:                                                                                                  #  ENTRY:          RTB
059589,000162:                                                                                                  #                         SIGNMPAC
059590,000163: 
059591,000164:                                                                                                  #  IN EITHER CASE, RETURN IS TO  THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
059592,000165: 
059593,000166: 10,3713           00006        SIGNMPAC           EXTEND                                         
059594,000167: 10,3714           34733                           DCA      DPOSMAX                               
059595,000168: 10,3715           52155                           DXCH     MPAC                                  
059596,000169: 10,3716           10000                           CCS      A                                     
059597,000170: 10,3717           34755        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
059598,000171: 10,3720           16062                           TCF      SLOAD2     +2                         
059599,000172: 10,3721           13722                           TCF      +1                                    
059600,000173: 10,3722           00006                           EXTEND                                         
059601,000174: 10,3723           44733                           DCS      DPOSMAX                               
059602,000175: 10,3724           16060                           TCF      SLOAD2                                
059603,000176: 
059604,000177:                                                                                                  #      RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
059605,000178:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.   IF NORMUNIT
059606,000179:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
059607,000180:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
059608,000181: 
059609,000182: 10,3725           34753        NORMUNX1           CAF      ONE                                   
059610,000183: 10,3726           13730                           TCF      NORMUNIT   +1                         
059611,000184: 10,3727           34755        NORMUNIT           CAF      ZERO                                  
059612,000185: 10,3730           60120                           AD       FIXLOC                                
059613,000186: 10,3731           54156                           TS       MPAC       +2                         
059614,000187: 10,3732           04616                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
059615,000188: 10,3733           01010                           CADR     VECAGREE                              
059616,000189: 10,3734           10154                           CCS      MPAC                                  
059617,000190: 10,3735           13771                           TCF      NOSHIFT                               
059618,000191: 10,3736           13740                           TCF      +2                                    
059619,000192: 10,3737           13771                           TCF      NOSHIFT                               
059620,000193: 10,3740           10157                           CCS      MPAC       +3                         
059621,000194: 10,3741           13771                           TCF      NOSHIFT                               
059622,000195: 10,3742           13744                           TCF      +2                                    
059623,000196: 10,3743           13771                           TCF      NOSHIFT                               
059624,000197: 10,3744           10161                           CCS      MPAC       +5                         
059625,000198: 10,3745           13771                           TCF      NOSHIFT                               
059626,000199: 10,3746           13750                           TCF      +2                                    
059627,000200: 10,3747           13771                           TCF      NOSHIFT                               

Page 1390

059629,000202: 10,3750           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
059630,000203: 10,3751           00006                           EXTEND                                         
059631,000204: 10,3752           74736                           MP       BIT14                                 
059632,000205: 10,3753           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
059633,000206: 10,3754           30160                           CA       MPAC       +4                         
059634,000207: 10,3755           00006                           EXTEND                                         
059635,000208: 10,3756           74736                           MP       BIT14                                 
059636,000209: 10,3757           20160                           DAS      MPAC       +3                         
059637,000210: 10,3760           30162                           CA       MPAC       +6                         
059638,000211: 10,3761           00006                           EXTEND                                         
059639,000212: 10,3762           74736                           MP       BIT14                                 
059640,000213: 10,3763           20162                           DAS      MPAC       +5                         
059641,000214: 10,3764           34761                           CAF      THIRTEEN                              
059642,000215: 10,3765           50156                           INDEX    MPAC       +2                         
059643,000216: 10,3766           54045                           TS       37D                                   
059644,000217: 10,3767           04635        OFFTUNIT           TC       POSTJUMP                              
059645,000218: 10,3770           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
059646,000219: 
059647,000220: 
059648,000221: 10,3771           34755        NOSHIFT            CAF      ZERO                                  
059649,000222: 10,3772           13765                           TCF      OFFTUNIT   -2                         
059650,000223: 
059651,000224: 
059652,000225:                                                                                                  #   RTB  VECSGNAG   ...FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
059653,000226: 
059654,000227: 10,3773           04616        VECSGNAG           TC       BANKCALL                              
059655,000228: 10,3774           01010                           CADR     VECAGREE                              
059656,000229: 10,3775           06064                           TC       DANZIG                                

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