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

    
    [Routine TRANS(4)      ]  p14,p14b

    [Col  /    ]                        [     E    ]              
                                                                          
1)->| / | OIQO |\ examine opcode        | / | /UT/ |\ for and plant
    | E | E:QG |! jump if >= 1          | E | "@TC |!    (/N+4a)#U 
    | @ | C@/T |/                       | @ | YNTA |/    (@N+4a)#U                           
2)->| A | ZIQO |\ examine z switch      | A | B@T/ |\ plant #IO/                             
    | : | VA/T |/                       | : | WNTA |/       RI/J                             
    | S | //T$ |                        | S | Q@QO |\ plant WA#:                             
    | I | //T$ |                        | I | LNQB |/                                        
    | U | USQO |___                     | U | O@QO |\ plant ZA#:    
    | # | AIQG |                        | # | QNQB |/                                        
    | D | "A/T |                        | D | HA/P |___                                     
    | R | LITK |\                    Vna| R | LITK | plants                                 
    | J | EUTA |!                       | J | Y@TC |   (GD+2a)/C   
    | N | /UTB |! form and plant        | N | HNTA |   /T$O        
    | F | /UT/ |!  :IT/                 | F | W@T/ |   @J#P        
    | C | BATC |!  (GD+2a)TA            | C | PNTA |   @I/:        
    | K | LNTA |/                       | K | HA/P |___to deal with z=Vna
    | T | QAT/ |\ deal with exit        | T | OITK |\  double code num describing
    | Z | //ZA |! to possible           | Z | /UTA |/  operation in order to
    | L | P//P |/_printing section      | L | /UQO |               
    | W | TIQO |\ examine v,n count     | W | V@Q/ |   select appropriate cue for
    | H | HAUP |/_(which cannot be zero)| H | GCTA |   list staring in /A,@?
  Va| Y | LI/C |                        | Y | K@T/ |\               
    | P | TST: |                        | P | CNTA |/\ plant  //O:                        
    | Q | $:/N |                        | Q | Z@T/ |\/        G@/J                        
    | O | V@TC |\ form reading instr    | O | TNTA |/         /TQO                       
    | B | LK/S |/                       | B | S:/P |___       FS#P                      
    | G | G:TC |\ do writing instr      | G | MAT/ |                                    
    | " | TKTA |/                       | " | //ZA |                                    
    | M | S:/N |                        | M | P//P |___            
    | X | X@TR |                        | X | E:QG |               
    | V | /U/S |                        | V | $A/T |               
    | $ | EUTA |                        | $ | R@/: |               

                                                                                 
    [End]

                Examine opcode 
 
   0  //  OIQO  B7=[OI] = num for main op (see VARS.TXT) 0=simple transfer, <0 arth op, >0 -> function call
   1  E/  E:QG  decr B7
   2  @/  
          original code: 
          $A/T  if (B>=0) goto 48 -> goto if opcode>=1 (function call)

          fixed code:
          C@/T  if (B>=0) goto 108 -> goto if opcode>=1 (func call) to check type of func call

                Enter from TRANSLATE(2)
                Plant instr to Store result in z

   3  A/  ZIQO  B7=[ZI] = z switch
   4  :/  VA/T  if (B>=0) goto 58 -> goto if no z (e.g an autocode j)

                Store result in z

   5  S/  //T$  dummy
   6  I/  //T$  dummy
   7  U/  USQO  B7=[US]=///T
   8  #/  AIQG  B7=B7-[AI], [AI] = n/v switch for x -> reverse switch -> now B7=//// for va/vna, B7=///T for na/a 
   9  D/  "A/T  if (B>=0) goto 19

                store in z as na index or a constant for index

  10  R/  LITK  AL=[LI]*2 -> AL=int part of z -> index n to store constant to
  11  J/  EUTA  [EU]=AL
  12  N/  /UTB  [/U]=0
  13  F/  /UT/  AL=[/U, EU]=//// (2n)//
  14  C/  BATC  AL=AL+:IO/ GDOA
  15  K/  LNTA  [LN,WN]=AL -> plant instr  :IO/ (GD+2n)//

                deal with posible exit to printing section 

  16  T/  QAT/  AL=[QA]=WE// #E@/ -> cue to TRANSLATE(5)
  17  Z/  //ZA  Store cue in [B1]
  18  L/  P//P  goto 177

                store z as va variable or a float constant for variable

  19  W/  TIQO  B7=[TI] = v/n count for z (here cannot be zero)
  20  H/  HAUP  if (B7=1) goto 21
                if (B7=2) goto 42
 
                store in var va  

  21  Y/  LI/C  D=[LI] = integral part of z = var number
  22  P/  TST:  A=0
  23  Q/  $:/N  shift D -> AL=///n ////
  24  O/  V@TC  AL=AL+//// /:@N -> cue to data track
  25  B/  LK/S  [LK,WK]=cue to read data track 
  26  G/  G:TC  AL=AL+//// //#/
  27  "/  TKTA  [TK,ZK]=cue to write data track, A=0
  28  M/  S:/N  AL=D*4 -> AL= num of var a * 4 (4 short lines per var) 
  29  X/  X@TR  AL=AL AND $A//
  30  V/  /U/S  [/U]=AL -> pos inside data track
  31  $/  EUTA  [EU]=AL, A=0 -> pos inside data track again
  32  /E  /UT/  AL=[/U,EU]= (4a)/// (4a)///
  33  EE  "@TC  AL=AL + /N#U @N#U
  34  @E  YNTA  [YN, PN]=AL, A=0 -> plant (/N + 4a)#U (@N + 4a)#U
  35  AE  B@T/  AL=#IO/ RI/J
  36  :E  WNTA  [WN, HN]=AL      -> plant #IO/ RI/J
  37  SE  Q@QO  B7=[Q@] = WA#:
  38  IE  LNQB  [LN]=B7          -> plant WA#:
  39  UE  O@QO  B7=[O@] = ZA#:
  40  #E  QNQB  [QN]=B7          -> plant ZA#:
  41  DE  HA/P  goto 16

                store in var vna  

  42  RE  LITK  AL=2*[LI] = integral part of z = var index number
  43  JE  Y@TC  AL=AL+:R#C /T$O
  44  NE  HNTA  [HN]=AL -> plant instr
  45  FE  W@T/  AL=AL+@J#P AI#:
  46  CE  PNTA  [PN]=AL -> plant instr
  47  KE  HA/P  goto 16

                Entry when [IO] >= 1 -> a function call with one x param

  48  TE  OITK  AL=[OI]*2 -> main op * 2. op=1->sqrt, =2->cos, 3->exp ...
  49  ZE  /UTA  [/U]=AL -> save it
  50  LE  /UQO  B7=[/U] ->  to be loaded in B7
  51  WE  V@Q/  AL=[/A + B7 -2] get cue of function from table of built in functions
  52  HE  GCTA  [GC]=AL -> plant cue of func to be called
  53  YE  K@T/  AL=[K@]=E/O: G@/J
  54  PE  CNTA  [CN]=AL -> plant instr
  55  QE  Z@T/  AL=[Z@]=/TQO FS#P
  56  OE  TNTA  [TN]=AL -> plant instr 
  57  BE  S:/P  goto 5
 
  58  GE  MAT/  AL=[MA]=I@// #E@/ cue to TRANSLATE(5) entry 1 (handle j autocode jump)
  59  "E  //ZA  Store cue in [B1]
  60  ME  P//P  goto 177. Call RCS adroutine

  61  XE  E:QG  This code is replaced by code 
  62  VE  $A/T  fixed in NA to WA. See TRANS.4B.txt file
  63  $E  R@/:  
  64  /@  PITK  
  65  E@  PITA  
  66  @@  PIQO  
  67  A@  /#Q/  
  68  :@  GCTA  
  69  S@  K@T/  
  70  I@  CNTA  
  71  U@  Z@T/  
  72  #@  TNTA  
  73  D@  S:/P  
  74  R@  $E/#  
  75  J@  ME// end of replaced code 
  76  N@        
  77  F@        
  78  C@        
  79  K@  //O:  
  80  T@  G@/J  
  81  Z@  /TQO  
  82  L@  FS#P  
  83  W@  @J#P  
  84  H@  AI#:  
  85  Y@  GD#C  
  86  P@  /T$O  
  87  Q@  WA#:  
  88  O@  ZA#:  
  89  B@  #IO/  
  90  G@  RI/J  
  91  "@  /N#U  
  92  M@  @N#U  
  93  X@  $A//  
  94  V@  ////  
  95  $@  /:@N  
  96  /A  $$//  
  97  EA  P/@/  
  98  @A  $$//  
  99  AA  Q/@/  
 100  :A  $$//  
 101  SA  O/@/  
 102  IA  $$//  
 103  UA  B/@/  
 104  #A  $$//  
 105  DA  G/@/  
 106  RA  $$//
 107  JA  $///  

          Fix to check type of function call (see note on TRANS.4B.txt)

 108  NA  /:QO  B7=0 
 109  FA  PIQG  B7=B7-[PI]  -> [PI]=integral part j = the m value = the func number called
 110  CA  $A/T  if (B>=0) goto 48 -> if m=0 -> goto process built-in function call R C E L A M
 111  KA  LAT/  AL=[LA]=$$// IE@/, cue to TRANSLATE(3) 
 112  TA  //ZA  Store cue in [B1]
 113  ZA  P//P  goto 177, call ad-routine
 114  LA  $$//  cue to TRANS(3)
 115  WA  IE@/  entry handle Fm( )

 116  HA  K///  
 117  YA  H///  
 118  PA  DE//  
 119  QA  WE//  
 120  OA  #E@/  
 121  BA  :IO/  
 122  GA  GDOA  
 123  "A  L///  
 124  MA  $$//  
 125  XA  #R@/  
 126  VA  BE//  
 127  $A  KE//  
