   
     MANCHESTER UNIVERSITY COMPUTING MACHINE LABORATORY
    
     Programme Sheet B                  Date. 18.May.1955

    
    [Routine TRANS(2)      ] p10-11

    [Col  @    ]                        [     A    ]              
                                                                          
    | / | KNTA |                        | / | IITN | (-)n                                    
 (%)| E | V@/P |___                     | E | :IOA |___            
    | @ | Y@T/ |\                       | @ | :IT# |                                        
    | A | KNTA |! plants instr          | A | IITC | (+)n                                   
    | : | Q@QO |! dealing with %        | : | :IOA |___                                     
    | S | ZNQB |/                       | S | E@// | (%) 4-way switch                       
    | I | W@T/ |\ exit to TRANS(4)      | I | GE// | (x)                                    
    | U | //ZA |!   entry 2             | U | YE// | (-)           
    | # | Z//P |/__                     | # | TE// |_(+)                                    
    | D |      |                        | D | GDO/ |                                        
    | R |      |                        | R | IIOA |___                                     
    | J |      |                        | J | PAO/ |               
    | N |      |                        | N | IIOA |___            
    | F |      |                        | F | $$// | cue to TRANS(3)
    | C |      |                        | C | IE@/ |___            
    | K |      |                        | K | @E// |               
    | T | SE// |                        | T | @J/P |               
    | Z | #E// |\ 2-way switch          | Z | GD#C |               
    | L | NE// |/                       | L | /TQO |               
    | W | @/// |\ cue to TRANS(4)       | W | /NO/ |               
    | H | UE@/ |/   entry 2             | H | @N/J |               
    | Y | #A/J |                        | Y | $A// |               
    | P | /TQO |                        | P | //// |                                    
    | Q | FS#P |___                     | Q | /:@N |                                    
    | O | :I#K | mult code to plant     | O | YA#: |                                    
    | B | II/F |                        | B | PAO/ |                                    
    | G | IIOA | (x)n                   | G | OA/J |                                    
    | " | II#K |                        | " | $$// |\ cue to special                    
    | M | IS/N |                        | M | @E// |/  conversion routine
    | X | :I#A |___                     | X | A/// |\              
    | V | S@// |___                     | V | C/// |! 3-way switch 
    | $ | :IT# |                        | $ | X/// |/              
                                                                                 
    [End]

Note by Roberto Sancho: Indexes are stored in mem with its value doubled (n1=2 -> in 
    mem [MD]=4). Thus the multiplication na=nb x nc -> 2a=2b*2c=4bc -> a=2bc -> we 
    must divide the result by 2. This is the intent of line M@ that contains 
    the shift instr to be planted in generated code after the mult code to 
    correct the result.
    In original code, the correction inst to be blanted is :S/N. 
    Nevertheless, the constant (from PERM) used [:S]=//// ///# = 0.25 is incorrect. 
    It divides the mult result by 4, not by 2. 
    So we fix it changing :S/N to IS/N (in PERM [IS]=//// ///T = 0.5)

Note by Roberto Sancho: integer division of na indexes (called index division) is
    handled in this routine from addr @@ to S@. the programme gets the instr to 
    plant from Y@ and Q@. It should plant these instr in column N (into Intruction
    Matrix, as other operator does). But instead it plants the instruction at address 
    C@ and T@, overwritting the TRANSLATE(2) routine. This seems an undocumented 
    bug/typo/missing correction. To fix and make the divion operator for indexes 
    to work we proceed in a similar way than code generation for other operators:

           addr   original                  fixed code
                  code

	  66  @@  Y@T/  AL=[Y@]=#A/J /TQO
	  67  A@  C@TA  [C@]=AL             KNTA  [KN]=AL
	  68  :@  Q@QO  B7=[Q@]=FS#P
	  69  S@  T@QB  [T@]=B7             ZNQB  [ZN]=B7

