   
     MANCHESTER UNIVERSITY COMPUTING MACHINE LABORATORY
    
     Programme Sheet B                  Date. 2.Jun.1955

    
    [Routine COMPLEX DIVISION ] p54-p55

                                       ac+bd       bc-ad
    (e + if) = (a + ib) / (c + id)  = -------  +  ------- i
                                      c^2+d^2     c^2+d^2
      

    [Col  /    ]                        [     E    ]              
                                                                          
    | / | MA/U |                        | / | /EQO |                                         
    | E | VA/U |                        | E | YD/P |               
    | @ | MA/: |                        | @ | GE/J |
    | A | /NP/ |                        | A | AEQO |
    | : | MUTA |                        | : | FS/P |
    | S | @NP/ |                        | S | IST/ |                                       
    | I | VUTA |                        | I | #I/K |                                        
    | U | :NP/ |                        | U | :I/D |               
    | # | OATA |                        | # | :I/A |                                        
    | D | INP/ |                        | D | HA/F |                                        
    | R | GATA |                        | R | HA/A |                                        
    | J | VA/: |                        | J | RIT# |               
    | N | /NY/ |                        | N | IITC |               
    | F | HATA |                        | F | IITA |               
    | C | @NY/ |                        | C | RIT# |               
    | K | PATA |                        | K | PATC |               
    | T | :NY/ |                        | T | PATA |               
    | Z | :ITA |                        | Z | $$$$ | was BE/P
    | L | INY/ |                        | L | HE/: | xfer COMPLEX DIV FIX to cols N F 
    | W | IITA |                        | W | A//P | goto /N
    | H | IST/ |                        | H | HE/N | mag instr for COMPLEX DIV FIX
    | Y | HA/K |                        | Y | //// |               
    | P | HA/F |                        | P | //// |                                    
    | Q | #I/A |                        | Q | //// |                                    
    | O | PATK |                        | O | //// |                                    
    | B | RITA |                        | B | K@// | 
    | G | IST/ |                        | G | $$// | \ cue to DIVISION/F
    | " | :I/K |                        | " | Y/// | / entry on RECIPROCAL/F                                  
    | M | :I/F |                        | M | MA/U | <- Entry for MULT              
    | X | @I/U |                        | X | VA/U |               
    | V | II/J |                        | V | MA/: |               
    | $ | II/J |                        | $ | /NP/ |               
                                                                                 
    [End]

Note by Roberto Sancho: line OU (into NORMALISE) is used by autocode
    to settle routine called by "BD/P" instr, used in generated prog 
    to link to next track of generated code.
    So we remove use of HU, PU, OU and GU and we replace them by HA, PA, OA and GA.
    This can be done because this routine only calls RCS to load DIVISION/F 
    that loads in cols / E. As data are save in column A, they are not 
    overwritten. 

    Division code then jumps to complex multiply to finish calculation.
    Before doing this, the division fix routine is loaded from track 52L
    to column N F, and branch to it. On this routine, data is copies from 
    MA, VA, HA, PA, OA and GA to MF, VF, HF, PF, OF and GF to save its values.
    Complex Multiply is loaded on cols @ A (thus overwritting the data, 
    but no worries at is has been saved to column F). Then, data is
    transfered back to address MA, VA, H/, P/, O/ and G/ where complex multiply
    expects them. To terminate, control is transfered to multiply 
    using BE/P instruction    


   0  //  MA/U  [MA]=AL = xx@N zzRN   <-- mag instr for read x, write z   
   1  E/  VA/U  [VA]=AL = yy@N zz@N   <-- mag instr for read y, read z 
   2  @/  MA/:  read track for x 
   3  A/  /NP/  AL=[/N + 0 + B6] = mantisa for x real part (a)
   4  :/  MUTA  [MU]=AL ->         mantisa for x real part 
   5  S/  @NP/  AL=[/N + 2 + B6] = exp for x real part 
   6  I/  VUTA  [VU]=AL ->         exp for x real part 
   7  U/  :NP/  AL=[/N + 4 + B6] = mantisa for x imaginary part (b)
   8  #/  OATA  [OA]=AL ->         mantisa for x imaginary part 
   9  D/  INP/  AL=[/N + 6 + B6] = exp for x imaginary part 
  10  R/  GATA  [GA]=AL ->         exp for x imaginary part
  11  J/  VA/:  read track for y
  12  N/  /NY/  AL=[/N + 0 + B5] = mantisa for y real part (c)
  13  F/  HATA  [HA]=AL ->         mantisa for y real part 
  14  C/  @NY/  AL=[/N + 2 + B5] = exp for y real part 
  15  K/  PATA  [PA]=AL ->         exp for y real part 
  16  T/  :NY/  AL=[/N + 4 + B5] = mantisa for y imaginary part (d)
  17  Z/  :ITA  [:I]=AL -> f.b.d = mantisa for y imaginary part
  18  L/  INY/  AL=[/N + 6 + B5] = exp for y imaginary part
  19  W/  IITA  [II]=AL -> f.b.d = exp for y imaginary part
  20  H/  IST/  AL=[IS]=//// ///T
  21  Y/  HA/K  D=[HA]= mantisa for y real part (c)
  22  P/  HA/F  A=A+D*[HA] -> AL=c^2
  23  Q/  #I/A  [#I]=AM -> fba mantisa = c*c
  24  O/  PATK  AL=2*[PA] -> 2 * exp for y real part 
  25  B/  RITA  [RI]=AL ->now fba = c*c
  26  G/  IST/  AL=[IS]=//// ///T
  27  "/  :I/K  D=[:I]= mantisa for y imaginary part (d)
  28  M/  :I/F  A=A+D*[:I] -> AL=d^2
  29  X/  @I/U  [@I]=AL = d*d, AM=0
  30  V/  II/J  AM=AM+[II] = exp for y imaginary part
  31  $/  II/J  AM=AM+[II] = exp for y imaginary part -> AL/AM=d*d
  32  /E  /EQO  B7=*
  33  EE  YD/P  call add -> now fba = c*c + d*d                  
  34  @E  GE/J  AM=[GE]=cue for DIVISION/F, entry on RECIPROCAL/F
  35  AE  AEQO  B7=*
  36  :E  FS/P  goto 171. call RCS link cue as subroutine -> fba = 1/(c*c+d*d)
  37  SE  IST/  AL=[IS]=//// ///T
  38  IE  #I/K  D=[#I] = fba mantisa = xxx
  39  UE  :I/D  AL=-D*[:I] -> AL=fbd mantissa = xxx
  40  #E  :I/A  [:I]=AM
  41  DE  HA/F  A=A+D*[HA] -> AL=c^2
  42  RE  HA/A  [HA]=AM
  43  JE  RIT#  AL=[RI]
  44  NE  IITC  
  45  FE  IITA  
  46  CE  RIT#  
  47  KE  PATC  
  48  TE  PATA  
  49  ZE  BE/P  goto 80
  50  LE  ////  
  51  WE  ////  
  52  HE  ////  
  53  YE  ////  
  54  PE  ////  
  55  QE  ////  
  56  OE  ////  
  57  BE  K@// c.n. 
  58  GE  $$// cue to 
  59  "E  Y/// DIVISION/F, entry to RECIPROCAL

                Entry for complex mult

  60  ME  MA/U  
  61  XE  VA/U  
  62  VE  MA/:  
  63  $E  /NP/  
