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

    
    [Routine DECINPUT(REVISED) ] p59

    [Col  /    ]                        [     E    ]              
                                                                          
    | / | //T$ |                        | / | P@/C | D=10                                   
1)->| E | DSTG |\ set a 2-way           | E | V@/F |\ builds up integral 
2)->| @ | K@TB |/ switch                | @ | V@TA |/ part                                  
    | A | /:TO | B0=////                | A | "@YG | counts num of digits after dec point   
    | : | Z@WO | B3=H$$$                | : | $A/P |___                                     
    | S | /:YO | B5=////                | S | E:QO | (.)                                    
    | I | /:PO | B6=////                | I | "@QB |                                        
    | U | FET: |                        | U | $A/P |___            
    | # | G@TA |\ clear working         | # | T@PO | (-)                                    
    | D | M@TA |! space                 | D | $A/P |___                                     
    | R | V@TA |/                       | R | L@T/ |\ sets cue to                           
    | J | PEO: |                        | J | @/ZA |/ CONVERTER    
    | N | J//: |                        | N | H@/C | D=0.1         
    | F | O@/A |\                       | F | B@YB | B sign flip-flop
    | C | J:/C |! transfers             | C | J//T |               
    | K | O@/N |! a/// to B7            | K | IST/ |               
    | T | O@/A |!                       | T | M@/N |               
    | Z | O@QO |/                       | Z | M@/U |               
    | L | /AUP |___ multiway switch     | L | V@/F |               
    | W | E:PC | 9                      | W | M@/S |               
    | H | E:PC | 8                      | H | V@/A |               
    | Y | E:PC | 7                      | Y | DSYG |               
    | P | E:PC | 6                      | P | U//P |___                                 
    | Q | E:PC | 5                      | Q | V@/J |                                    
    | O | E:PC | 4                      | O | K@QO |                                    
    | B | E:PC | 3                      | B | F@UP |___ 2 way switch                    
    | G | E:PC | 2                      | G | GEQO |\ converto to float                 
    | " | E:PC | 1                      | " | KS/P |/ and plant f.b.a                   
    | M | DSQO |                        | M | #I/U |               
    | X | G@QB |                        | X | RI/U |               
    | V | G@WG | 0                      | V | LS/P |               
    | $ | $A/T |                        | $ |      | spare              
         
     in the case of entry (1) the effect is read the num from tape
            convert to float form and xfer to f.b.a leaving A=0
            
     in the case of entry (2) the effect is read the num from tape
            and leave in A in form AM    +  AL
                                     +-        f
                                     
                                     
            
                                                                        
    [End]

   0  //  //T$  dummy

                Entry 1 -> read float in f.b.a (float binary accumulator)

   1  E/  DSTG  incr B0

                Entry 2 -> read integer

   2  @/  K@TB  [K@]=B0 -> [K@]=0 if entry 2 (read int), =1 if entry 1 (read float)
   3  A/  /:TO  B0=0
   4  :/  Z@WO  B3=-12 -> max number of digits
   5  S/  /:YO  B5=0 -> num of digits after decimal point
   6  I/  /:PO  B6=0 -> ///V when num is negative
   7  U/  FET:  A=0
   8  #/  G@TA  [G@]=AL=0
   9  D/  M@TA  [M@]=AL=0
  10  R/  V@TA  [V@]=AL=0

                read next char from PTR

  11  J/  PEO:  A=0
  12  N/  J//:  read PTR
  13  F/  O@/A  [O@]=//// ///c
  14  C/  J:/C  D=32
  15  K/  O@/N  Shift -> AM=c/// ////
  16  T/  O@/A  [O@]=c/// ////, A=0
  17  Z/  O@QO  B7=[O@]=c///
  18  L/  /AUP  if (B7=1) goto 27 (autocode char 1, teletype E)
                if (B7=28) goto 27 (autocode char '.', teletype M)

  19  W/  E:PC  
  20  H/  E:PC  
  21  Y/  E:PC  
  22  P/  E:PC  
  23  Q/  E:PC  
  24  O/  E:PC  
  25  B/  E:PC  
  26  G/  E:PC  
  27  "/  E:PC  A=A+1 (dep on B6)
  28  M/  DSQO  B7=-1
  29  X/  G@QB  [G@]=B7
  30  V/  G@WG  B3=B3-[G@] -> incr B3
  31  $/  $A/T  if (B>=0) goto xxx
  32  /E  P@/C  D=10
  33  EE  V@/F  AL=AL+[V@]*10
  34  @E  V@TA  [V@]=AL <- current read value
  35  AE  "@YG  B5=B5-["@] -> num of digits after decimal point
  36  :E  $A/P  goto 11

                Handle decimal point

  37  SE  E:QO  B7=1
  38  IE  "@QB  ["@]=1 -> flag for decimal point found
  39  UE  $A/P  goto 11

                Handle minus sign

  40  #E  T@PO  B6=///V
  41  DE  $A/P  goto 11

                Handle <CR> -> process read number

  42  RE  L@T/  AL=$$// Z/E/ -> cue to CONVERTER
  43  JE  @/ZA  Store cue in [B1]
  44  NE  H@/C  D=[H@]=0.1
  45  FE  B@YB  AL=[B@] B sign flip flop

                mult x 0.1 n times, being n the number of digits after dec point held in B5)

  46  CE  J//T  if (B>=0) goto 55 -> end of mult loop
  47  KE  IST/  A=//// ///T
  48  TE  M@/N  Mult x 0.1
  49  ZE  M@/U  [M@]=AL, AL=AM, AM=0
  50  LE  V@/F  Mult x 0.1
  51  WE  M@/S  [M@]=AL
  52  HE  V@/A  [V@]=AM
  53  YE  DSYG  incr B5, B5 = -num of digits after decimal point
  54  PE  U//P  goto 46

  55  QE  V@/J  AM=AM+[V@] -> AM=int part, AL=fact part of number read from PTR
  56  OE  K@QO  B7=[K@], [K@]=0 if entry 2 (read int), =1 if entry 1 (read float)
  57  BE  F@UP  if (B7=0) goto 72
                   (B7=1) goto 58 -> read float

  58  GE  GEQO  B7=*
  59  "E  KS/P  goto 173. call RCS to link cue as subroutine
  60  ME  #I/U  [#I]=f.b.a. mantissa
  61  XE  RI/U  [RI]=f.b.a. exponent
  62  VE  LS/P  closure
  63  $E  
  64  /@  DI/K                        
  65  E@  O@T#                        
  66  @@  U@/N                        
  67  A@  RITA                        
  68  :@  G@T/                        
  69  S@  #ITA                        
  70  I@  LS/P                        
  71  U@  I///                        
  72  #@  ////                        
  73  D@  V@/J  AM=AM+[V@] add int value again because index contains its value x2      
  74  R@  LS/P  closure                            
  75  J@                              
  76  N@                              
  77  F@  KS//                        
  78  C@  BE//                        
  79  K@  USED                        
  80  T@  ///V                        
  81  Z@  H$$$                        
  82  L@  $$//                        
  83  W@  Z/E/                        
  84  H@  GNIW                        
  85  Y@  BNIA                        
  86  P@  R///                        
  87  Q@  ////                        
  88  O@  USED                        
  89  B@  USED                        
  90  G@  USED                        
  91  "@  USED                        
  92  M@  USED                        
  93  X@  USED                        
  94  V@  USED                        
  95  $@  USED                              
  96  /A  R///  
  97  EA  G///  
  98  @A  B///  
  99  AA        
 100  :A  Q///  
 101  SA        
 102  IA        
 103  UA  H///  
 104  #A  W///  
 105  DA        
 106  RA        
 107  JA  UE//  
 108  NA        
 109  FA        
 110  CA        
 111  KA        
 112  TA  X///  
 113  ZA        
 114  LA        
 115  WA  O///  
 116  HA        
 117  YA  P///  
 118  PA  Y///  
 119  QA        
 120  OA        
 121  BA  L///  
 122  GA  R///  
 123  "A        
 124  MA  :E//  
 125  XA        
 126  VA  DE//  
 127  $A  R///  
