   
     MANCHESTER UNIVERSITY COMPUTING MACHINE LABORATORY
    
     Programme Sheet B                  

    
    [Routine ALTPRT  ] 

    [Col  @    ]                        [     A    ]              
                                                                          
    | / | ZZ$$ | dummy                  | / | //T: | A=0  print <0> <space>     
    | E | ///Z | Mod H                  | E | $A/: | Print zero                          
    | @ | ///C |\                       | @ | VA/: | Print space                         
    | A | TST: |! examine               | A | LS/P | closure                             
    | : | B:/N |! digits 8,9 of         | : | XA/: | Letter shift  print <#> <space>       
    | S | V@TR |! H                     | S | //T: | A=0
    | I | Y@TC |!                       | I | MA/J | AM=.... ...#                
    | U | //TA |!                       | U | $A/: | Print #                     
    | # | E/YO |/                       | # | VA/: | Print space                  
    | D | $$YT | B6=5,8,10 or 12        | D | LS/P | closure                     
    | R | B@T/ | AL=cue to DECOUT       | R |      |                                       
    | J | //ZA |                     +->| J | Y@QG |\ exp is >= 0                                                        
    | N | RAT: | A=0                 !  | N | VA/T |/ print <#> if exp >80 (i.e. > 2^40)   
    | F | #I/K | D=[#I]=fba mant     !  | F | H@QG |                                       
    | C | RIQO | B7=[RI]=fba exp     !  | C | E:/O |                                       
    | K | N@/T | if (B>=0) ----------+  | K | W@QG |                                       
    | T | XA/P | goto -------------+    | T | /:UN |                                       
    | Z |      |                   !    | Z | A@/P | -> link to DECOUT w/o CRLF            
    | L |      |                   !    | L |      |                                            
    | W | QV$$ | -41               +--->| W | H@QG | exp if <0                                  
    | H | OV$$ | -40                    | H | E:/O |                                            
    | Y | T@// | 80                     | Y | W@QG |                                            
    | P | M@// | table base             | P | E:/O |                                            
    | Q |      |                        | Q | $A/P | print <0> if exp < -80 (i.e. < 2^-40)      
    | O |      |                        | O | /:UN |                                            
    | B | U@// | \ cue to decoutput     | B | @I/A |                                            
    | G | W/E@ | / (do not print CR LF) | G | @IT# |                                            
    | " | :/// | 5  \                   | " | A@/P | -> link to DECOUT w/o CRLF                 
    | M | U/// | 8  ! decimals          | M |      |
    | X | D/// | 10 !                   | X | LAY# | c.n. + letter shift + # char
    | V | J/// | 12 /                   | V | AAZ/ |
    | $ | A/// |                        | $ | $@T/ |
                                                                                 
    [End]

                Entry to print float value 

   0  //  :E/:  Printer set Figure Shift        H=..... ...ab ..... .c... bits 8,9,16
   1  E/  ///Z  [//]=H -> get hand switches
   2  @/  ///C  D=[//]
   3  A/  TST:  A=0
   4  :/  B:/N  Shift D
   5  S/  VETR  AL=AL AND 11010 /// 11000 /// -> AL=.... ab000 ///   from H=..... ...ab ..... ..... bits 8,9
   6  I/  YETC  AL=AL+T@// ME//                          
   7  U/  //TA  [//. E/]=AL
   8  #/  E/YO  B5=[E/]
   9  D/  $$YT  B6=[B5-1] -> = 5,8,10 or 12 decimals
  10  R/  U:/D  Shift D
  11  J/  //TA  [//. E/]=AL
  12  N/  //QO  B7=[//]
  13  F/  QET/  AL=$E// W/E@ -> cue to DECOUTPUT (print CR LF +|- nnn.mmm) 
  14  C/  ZE/T  if (B>=0) goto 37 -> print in float form
  15  K/  //ZA  Store cue in [B1]
  16  T/  #I/K  D=[#I, DI]=f.b.a (floating point accumulator)
  17  Z/  RIQO  B7=[RI]=f.b.a exponent
  18  L/  M//T  if (B>=0) goto 29
  19  W/  HEQG  B7=B7-[HE] =B7+40
  20  H/  E:/O  if (B>=0) goto 22
  21  Y/  WEQG  
  22  P/  E:/O  if (B>=0) goto 24
  23  Q/  E:/Q  
  24  O/  /:UN  shift    
  25  B/  @I/A  [@I]=AM
  26  G/  @IT#  AL=[@I] signed
  27  "/  A//P  
  28  M/  M///  
  29  X/  YEQG  B7=B7-80 -> exp=exp-80
  30  V/  LE/T  if (B>=0) goto xxx -> value > 2^40
  31  $/  HEQG  B7=B7+40
  32  /E  E:/O  if (B>=0) goto xxx -> value > 2^20
  33  EE  WEQG  B7=B7+41
  34  @E  /:UN  
  35  AE  A//P  goto 177. Call RCS (print CR LF +|- nnn.mmm)
  36  :E  REH/  const figure shift

                print in float form   

  37  SE  @/ZA  Store cue in [B1]
  38  IE  #IT#  AL=[#I, DI]=f.b.a (floating point accumulator)
  39  UE  UEQO  B7=*
  40  #E  KS/P  goto 173 call RCS. call DECOUTPUT (print CR LF +|- nnn.mmm) as subroutine
  41  DE  BET/  AL=U@// W/E@ -> cue to DECOUTPUT (print +|- nnn.mmm) 
  42  RE  RI/K  D=[RI, JI]=f.b.a exponent

  43  JE  //ZA  Store cue at [B1] stack
  44  NE  IS/N  mult by 0.5
  45  FE  A//P  goto 177. Call RCS

                Entry to print integer value in [:I, SI] 
                (it is div by 2 before being printed)

  46  CE  QET/  AL=[QE]=$E// W/E@ cue to DECOUTPUT
  47  KE  :I/K  D=[:I, SI]=the int value to print
  48  TE  :E/:  Printer set Figure Shift
  49  ZE  :E/P  goto 43
  50  LE  N///  
  51  WE  QV$$  
  52  HE  OV$$  
  53  YE  T@//  
  54  PE  ME//  
  55  QE  $E//  
  56  OE  W/E@  
  57  BE  U@//  
  58  GE  W/E@  
  59  "E  :///  
  60  ME  U///  
  61  XE  D///  
  62  VE  J///  
  63  $E  A///  
