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

    
    [Routine COMPLEX ADDITION    ] p50

    (e + if) = (a + ib) + (c + id)

    [Col  /    ]                        [     E    ]              
                                                                          
    | / | ME/U |                        | / | GE/J | Af = d                                  
    | E | VE/U |                        | E | EEQO |\ b+d          
    | @ | ME/: |                        | @ | YD/P |/__                                     
    | A | /NP/ |\                       | A | AEQO | normalise b+d                          
    | : | #ITA |! xfer a to f.b.a       | : | CU/P |___                                     
    | S | @NP/ |!                       | S | #IT/ |\                                       
    | I | RITA |/                       | I | :NHA |! record imaginary part                 
    | U | :NP/ |\                       | U | RIT/ |! of result    
    | # | MUTA |! xfers b to HU,VU      | # | INHA |/                                       
    | D | INP/ |!                       | D | XE/: | write up result                        
    | R | VUTA |/                       | R | LS/P |___                                     
    | J | VE/: |                        | J |      |               
    | N | :NY/ |\                       | N |      |               
    | F | OETA |! xfers d to OE,GE      | F |      |               
    | C | INY/ |!                       | C |      |               
    | K | GETA |/                       | K |      |               
    | T | /NY/ |\ Af=c                  | T |      |               
    | Z | @NSJ |/                       | Z |      |               
    | L | L/QO |\ a+c                   | L |      |               
    | W | YD/P |/__                     | W |      |               
    | H | H/QO |\ normalise (a+c)       | H |      |               
    | Y | CU/P |/__                     | Y |      |               
    | P | $E/: |                        | P |      |                                    
    | Q | #IT/ |\                       | Q |      |                                    
    | O | /NHA |! record real part      | O |      |                                    
    | B | RIT/ |! of sum                | B |      |                                    
    | G | @NHA |/                       | G |      |                                    
    | " | MUT/ |\                       | " |      |                                    
    | M | #ITA |! xfers b to f.b.a      | M | USED | real X        
    | X | VUT/ |!                       | X | USED | real z      
    | V | RITA |/                       | V | USED | real y        
    | $ | OET/ |                        | $ | USED | real z        
         

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 OU and GU and we replace them by OE and GE.
    This can be done because this routine does not calls RCS so OE and GE
    will not be overwritten by any called routine
    
                                                                        
    [End]

                Complex addition
                on entry:
                AL=xx@N zzRN   <-- mag instr for read x, write z
                AM=yy@N zz@N   <-- mag instr for read y, read z
		B4=offset in track for z
		B5=offset in track for y
		B6=offset in track for x

   0  //  ME/U  [ME]=AL = xx@N zzRN   <-- mag instr for read x, write z
   1  E/  VE/U  [VE]=AL = yy@N zz@N   <-- mag instr for read y, read z
   2  @/  ME/:  read track for x
   3  A/  /NP/  AL=[/N + 0 + B6] = mantisa for x real part
   4  :/  #ITA  [#I]=AL -> f.b.a.= mantisa for x real part
   5  S/  @NP/  AL=[/N + 2 + B6] = exp for x real part
   6  I/  RITA  [RI]=AL -> f.b.a.= exp for x real part
   7  U/  :NP/  AL=[/N + 4 + B6] = mantisa for x imaginary part
   8  #/  MUTA  [MU]=AL ->         mantisa for x imaginary part
   9  D/  INP/  AL=[/N + 6 + B6] = exp for x imaginary part
  10  R/  VUTA  [VU]=AL ->         exp for x imaginary part
  11  J/  VE/:  read track for y
  12  N/  :NY/  AL=[/N + 4 + B5] = mantisa for y imaginary part
  13  F/  OETA  [OE]=AL ->         mantisa for y imaginary part (in f.b.d)
  14  C/  INY/  AL=[/N + 6 + B5] = exp for y imaginary part
  15  K/  GETA  [GE]=AL ->         exp for y imaginary part
  16  T/  /NY/  AL=[/N + 0 + B5] = mantisa for y real part
  17  Z/  @NSJ  AM=[/N + 2 + B5] = exp for y real part
  18  L/  L/QO  B7=*
  19  W/  YD/P  call float add: fba contains real part of x, AM/AL=real part of y
  20  H/  H/QO  B7=*
  21  Y/  CU/P  call normalise
  22  P/  $E/:  read track for z
  23  Q/  #IT/  AL=[#I] real x+y mantisa
  24  O/  /NHA  [/N + 0 + B4] = AL -> store result in real z mant
  25  B/  RIT/  AL=[#I] real x+y exp
  26  G/  @NHA  [/N + 2 + B4] = AL -> store result in real z exp  
  27  "/  MUT/  AL=[MU]= mantisa for x imaginary part
  28  M/  #ITA  [#I]=AL -> store in fba mantisa
  29  X/  VUT/  AL=[VU]= exp for x imaginary part
  30  V/  RITA  [RI]=AL -> store in fba exp
  31  $/  OET/  AL=[OE] -> mantisa for y imaginary part
  32  /E  GE/J  AM=[GE] -> exp for y imaginary part
  33  EE  EEQO  B7=*
  34  @E  YD/P  call float add
  35  AE  AEQO  B7=*
  36  :E  CU/P  call normalise
  37  SE  #IT/  AL=[#I] imaginary x+y mantisa
  38  IE  :NHA  [:N + 4 + B4] = AL -> store result in imaginary z mant
  39  UE  RIT/  AL=[RI] imaginary x+y exp
  40  #E  INHA  [IN + 6 + B4] = AL -> store result in imaginary z exp
  41  DE  XE/:  save track for z
  42  RE  LS/P  closure
  43  JE        
  44  NE        
  45  FE        
  46  CE        
  47  KE        
  48  TE        
  49  ZE        
  50  LE        
  51  WE        
  52  HE        
  53  YE        
  54  PE        
  55  QE        
  56  OE        
  57  BE        
  58  GE        
  59  "E        
  60  ME  USED  
  61  XE  USED  
  62  VE  USED  
  63  $E  USED  
