A/DECOUT/D                        Date. 18.9.52

    Purpose: To print out the contents of successive 
             long lines (signed) as integers of fractions 
             
    Cues: (1) / / O $ Q E E Z   Successive long lines in integral form
          (2) S / O $ Q E E Z   Successive long lines in fractional form
             
    Principal lines: [/E] = S : / Q
                     [/A] = B @ H O
                     
    Magnetic Storage: variable      Electronic Storage: S0 S1
    
    Stores Altered:  /C  EC
    
    Effects: Initially [/C] = number of successive long lines
                       [EC] = address of first line
                       
             Entry by cue (1): the contents of the lines are 
             printed out as integers, preceeded by correct sign,
             comencing with the line specified by [EC].
             Printing commences with the first non-zero digit,
             all preceeding zeros being omitted.
             
             Entry by cue (2): the contents of the lines are 
             printed out as signrf decimal fractions, preceeded by 
             correct sign, comencing with the line specified by [EC].
             Printing is to six decimal places, the last figure
             being rounded off.
             
             If the contents of the line are zero, in either case,
             only '+0' is printed
             
             layout: printing commences and ends with a CR and LF.
             The number of store lines printed out per line of printing
             is determined by [$A].
             if [$A]=n then n+1 long lines are printed on each line.
             By default this value is set to 2 (three values printed) 
             

    Note by Roberto Sancho: DECOUT D prints fractional numbers as
    signed values, in range -0.5 .. +0.5
                  
    Library Progs - Bodleian Special Collection 
    MS. Eng. misc. b. 260-C.43.pdf
    p22
    
    [Routine DECOUT/D       ] 

    [Col /          E ]                 [Col @          A ]              
                                                                          
    | $EZ/ | / | S:/Q |                 | "//J | / | B@HO |                                         
    | VSTA | E | SE/J |                 | A//: | E | E:LO |               
    | //T/ | @ | A//: |                 | S:HO | @ | G@/C |                                        
    | J:TI | A | V@TF |                 | G@/C | A | V@T/ |                                        
    | //TA | : | A:/M |                 | @@T: | : | /:WO |                                        
    | E:/Q | S | S/T: |                 | V@/N | S | GATN |                                        
    | VSTA | I | ///P |                 | M@/A | I | BAWG |                                        
    | "EPB | U | A//: |                 | V@TA | U | K@/H |               
    | MEYB | # | DSPG |                 | V:/C | # | GATI |                                        
    | XEHB | D | DSPG |                 | M@/N | D | V@TA |                                        
    | VEWB | R | E:QG |                 | UE/I | R | $:WG |                                        
    | $ELB | J | N//O |                 | A//: | J | X@WB |               
    | D//: | N | J//: |                 | E:HG | N | M@/J |               
    | /CQO | F | R//: |                 | :@/T | F | /:WO |               
    | E:QG | C | J//: |                 | G@/C | C | X@WG |               
    | /:PO | K | "EPO |                 | :AT: | K | @:@O |               
    | ECT/ | T | MEYO |                 | V@/N | T | A//: |               
    | RSTR | Z | XEHO |                 | ISTI | Z | /:LO |               
    | O/TI | L | VEWO |                 | M@/A | L | AAT: |               
    | O/TA | W | $ELO |                 | W/T: | W | V@/N |               
    | J//: | H | NS/P |                 | V:/C | H | E:HG |               
    | R//: | Y | E:YG |                 | M@/N | Y | LA/T |               
    | J//: | P | E:/O |                 | Q//I | P | "//J |                                    
    | $AYO | Q | W@/P |                 | A//: | Q | A//: |                                    
    | //P/ | O | ///: |                 | R@/P | O | R@/P |                                    
    | V@TA | B | ///: |                 | J/// | B | ///$ |                                    
    | V@T# | G | P@/P |                 | R/// | G | //GF |                                    
    | SE/M | " |      |                 | //// | " | U:X@ |                                    
    | V@TF | M |      |                 |      | M |      |               
    | V@TA | X |      |                 |      | X |      |               
    | G//J | V |      |                 |      | V |      |               
    | A//: | $ |      |                 |      | $ | @/// |               
                                                                          
    Tape: DECOUT D ONE                  Tape: DECOUT D TWO
    Destination Sequence: KAK@///#QEEZ  Destination Sequence: KAK@//E#QEEZ
    
    [End]

     0  //  $EZ/  const
     1  E/  VSTA  Entry print integer: Save return link in [VS]
     2  @/  //T/  A=$EZ/ VSTA
     3  A/  J:TI  A=A+/E// //// -> A=$@Z/ VSTA
     4  :/  //TA  [//]=$@Z/ -> print integer mode
     5  S/  E:/Q  goto 7
     6  I/  VSTA  Entry print fract
     7  U/  "EPB  ["E]=B6  save indexes
     8  #/  MEYB  [ME]=B5
     9  D/  XEHB  [XE]=B4
    10  R/  VEWB  [VE]=B3
    11  J/  $ELB  [$E]=B2
    12  N/  D//:  Printer set figure shift 
    13  F/  /CQO  B7=[/C]= number of successive long lines to print
    14  C/  E:QG  decr B7
    15  K/  /:PO  B6=0 -> index on addr for data to print
    16  T/  ECT/  AL=[EC]=address of first line to print 
    17  Z/  RSTR  AND $$$$ ////
    18  L/  O/TI  
    19  W/  O/TA  [O/]=addr P/ V@TA -> set addr of first line to print as base addr 

    20  H/  J//:  Print new line with values: Print <cr>
    21  Y/  R//:  Print <lf>
    22  P/  J//:  Print <cr>
    23  Q/  $AYO  B5=2 -> num of values to print on same line

    24  O/  //P/  get value to print: AL=[addr of first line + B6]
    25  B/  V@TA  [V@, $@]=value to print
    26  G/  V@T#  A=[V@, $@] -> AL=value to print
    27  "/  SE/M  if (A>=0) goto 33 -> goto 33 if value to print is positive
    28  M/  V@TF  
    29  X/  V@TA   
    30  V/  G//J  
    31  $/  A//:  
                  
    32  /E  S:/Q  
    33  EE  SE/J  AM=AM+[.... ...P] (AL keeps value to print)
    34  @E  A//:  Print char AM -> print P -> print '+' because figure shift set
    35  AE  V@TF  A=-[V@, $@] -> AL=-value to print
    36  :E  A:/M  if (A>=0) goto XXX -> goto XXX if value to print is zero
    37  SE  S/T:  A=0
    38  IE  ///P  goto 96
    39  UE  A//:  
    40  #E  DSPG  incr B6
    41  DE  DSPG  incr B6 -> addr of next addr to print
    42  RE  E:QG  decr B7 -> decr num of sucessive long lines to print
    43  JE  N//O  if (B>=0) goto 53 -> continue printing 
    44  NE  J//:  Print <cr>
    45  FE  R//:  Print <lf>
    46  CE  J//:  Print <cr>
    47  KE  "EPO  restore indexes
    48  TE  MEYO  
    49  ZE  XEHO  
    50  LE  VEWO  
    51  WE  $ELO  
    52  HE  NS/P  goto RCS to obey return link

    53  YE  E:YG  decr B5 -> B5=num of values remaining to be printed on same line
    54  PE  E:/O  if (B>=0) goto 56
    55  QE  W@/P  goto 20 -> print <cr><lf>, then print new value
    56  OE  ///:  print space
    57  BE  ///:  print space
    58  GE  P@/P  goto 24 -> print a new value
    59  "E        save B6
    60  ME        save B5
    61  XE        save B4
    62  VE        save B3
    63  $E        save B2
                  
    64  /@  "//J  
    65  E@  A//:  
    66  @@  S:HO  
    67  A@  G@/C  
    68  :@  @@T:  
    69  S@  V@/N  
    70  I@  M@/A  
    71  U@  V@TA  
    72  #@  V:/C  
    73  D@  M@/N  
    74  R@  UE/I  
    75  J@  A//:  
    76  N@  E:HG  
    77  F@  :@/T  
    78  C@  G@/C  
    79  K@  :AT:  goto const
    80  T@  V@/N  
    81  Z@  ISTI  
    82  L@  M@/A  
    83  W@  W/T:  
    84  H@  V:/C  
    85  Y@  M@/N  
    86  P@  Q//I  
    87  Q@  A//:  
    88  O@  R@/P  
    89  B@  J///  const 11
    90  G@  R///  const ...
    91  "@  ////  ... 10
    92  M@        
    93  X@        var
    94  V@        value to ...
    95  $@        ... print
                  
    96  /A  B@HO  print positive int: B4=11 -> chars remaining to print 
    97  EA  E:LO  B2=1 -> flag removing leading zeroes=1
    98  @A  G@/C  D=10
    99  AA  V@T/  A=[V@, $@] -> AL=value to print
   100  :A  /:WO  extract digit: B3=0
   101  SA  GATN  lbl1: A=A-100.000.000.000
   102  IA  BAWG  B3=B3-(-32768 ///E = char 4 =10000 in binary)
   103  UA  K@/H  if (AM>=0) goto lbl1
   104  #A  GATI  A=A+100.000.000.000 restore to value before being negative
   105  DA  V@TA  save back as value to print, A=0
   106  RA  $:WG  B3=B3-(32768) count digit in char 4
   107  JA  X@WB  [X@=B3]
   108  NA  M@/J  AM=AM+[M@, X@] -> Most significat char of AM=digit extracted for value to print
   109  FA  /:WO  B3=0
   110  CA  X@WG  B3=B3-[X@]
   111  KA  @:@O  if (B>=0) take digit extracted is zero: if B2=1 goto 114; if B2=0 goto 112}
   112  TA  A//:  Print digit
   113  ZA  /:LO  B2=0  -> flag removing leading zeroes=0
   114  LA  AAT:  A=0
   115  WA  V@/N  A=value to print*10
   116  HA  E:HG  decr B4 (B4=chars remaining to print )
   117  YA  LA/T  if (B>=0) goto 100
   118  PA  "//J  AM=.... ...F (code for printing '.')
   119  QA  A//:  Print '.'
   120  OA  R@/P  goto 40
   121  BA  ///$  
   122  GA  //GF  const 100.000.000.000
   123  "A  U:X@  
   124  MA        
   125  XA        
   126  VA        
   127  $A  @///  const 2
                  
