A/WRITE/A                       Date.   18.12.52 

    Purpose: To write onto magnetic tracks from 
             writing tapes.
             
    Cue: T E U N @ / E Z
          
    Principal lines: [/E] = Z N / :
             
    Magnetic Storage: variable     Electronic Storage: S0 
    
    Stores Altered: /K EK AK :K B2 B2 B3 B4 B5
    
    Effects: Returns to INPUT if none of the checks have
             failed. The effects after reading a writing 
             tape are as follows:

             (1) The sum of the long lines of S4 is
                 compared with [PK] 
          
             (2) If they agree then the contents of S4 
                 is written onto the half-track determined
                 by the destination sequence i.e. [AK]

             (3) A writing check is carried out

             (4) If this is correct the half-track is read
                 back to S4

             (5) The sum of the long lines of S4 is 
                 compared with [PK]

             (6) if they agree INPUT is re-entered and the
                 cue to WRITE is replaced in [VS]

             If any of the checks fail there is a hoot stop
             Failure of different checks may be detected
             as follows:

             (1) If the first comparision of the check sum
                 with [PK] fails A<>-1 and ["/]=$K/:

             (2) If the writing check fails A=-1 and ["/]=$K/:

             (3) If the comparision of the check sum with [PK] 
                 fails after writing and reading down again 
                 A<>-1 and ["/]=YE/P
    
    Library Progs - Bodleian Special Collection 
    MS. Eng. misc. b. 260-C.43.pdf
    p95

    [Routine WRITE/A               ] 
    
    [Col /          E ]                [Col @          A ]  
                                                                                  
    | XE/: | / | ZN/: |   load initial | AA/: | / | R//: |    
    | AKTF | E | H:/C |  patch to skip | G/T/ | E | $E// | const goto 64   
    | J:/H | @ | AK/F |    initial msg | D/TA | @ | I/// | const goto 7
    | AKT/ | A | BE/J | goto load perm | @A/P | A | //// | mag instr to load INITIAL   
    | GETR | : | MK/A |                |      | : |      |    
    | G:TD | S | XK/: |                |      | S |      |    
    | @KTJ | I | :KT/ |                |      | I |      |    
    | VKTA | U | UKTR |                |      | U |      |    
    | X:/C | # | MK/S |  
    | :K/N | D | MKQO |      
    | H:TR | R | /@QT |  
    | VKTJ | J | :KQB |  
    | VK/S | N | /:/P |  
    | O:TC | F | S//: |  
    | @//S | C | MEQO |  
    | O:TN | K | "/QB |  
    | G:TN | T | D:/P |  
    | :/TA | Z | VSTA |  
    | F:QO | L | VET/ |   
    | A:QG | W | NS/P |  
    | /#QC | H | W/C$ |  
    | A:QG | Y | HELO |  
    | HE/T | P | EA/P |  (*) org DS/P
    | PKTJ | Q |      |      
    | MK/A | O |      |  
    | E:TN | B | NE// |  
    | X//H | G | /T/@ |  
    | $K/: | " | $$E/ |  
    | A//: | M | YE/P |  
    | M//V | X | A/@/ |  
    | X//P | V | //UN |  
    | BE/P | $ | @/EZ |  
                                                                                  
    Tape: WRITE A ONE                 
    Destination Sequence: KAK@///#@/EZ
          
    [End]
    
    (*) NOTE by Roberto Sancho: 
        In original listing, instr FE is DS/P instead of EA/P
        DS/P goto to address 0, executes XE/: to load INPUT,
        but address 1 of INPUT is instr /E// wich means
        "exec H as magnetic intruction". If H=0 the result is the system  
         boots again. Conclusion: WRITE A works returning to INPUT
        when done, but it is trick because it depended on H being 
        set to zero. To solve this, a little patch has been set
        extending a bit the original program. The extension loads
        INITIAL whatever the value of H is, patchs it so the ++INITIAL-- 
        message is not shown again, and then goto INITAL to reload
        PERM (wich in turn sets [VS] = cue to WRITE) and INPUT

    
    0  //  XE/:   read Track 3L to Tube S0 (INPUT)
    1  E/  AKTF   Entry 2 on Z warning char: AL=-destination=///# ////
    2  @/  J:/H   if (A>=0) goto XXX   goto if destination=false cue
    3  A/  AKT/   AL=destination=///# ////
    4  :/  GETR   AND .... $$E/  -> discard tube info
    5  S/  G:TD     
    6  I/  @KTJ   
    7  U/  VKTA   
    8  #/  X:/C   D=//T/ ////
    9  D/  :K/N   shift
   10  R/  H:TR   
   11  J/  VKTJ   
   12  N/  VK/S   
   13  F/  O:TC   
   14  C/  @//S   
   15  K/  O:TN   
   16  T/  G:TN   
   17  Z/  :/TA   
   18  L/  F:QO   B7=64     calc cheksum
   19  W/  A:QG   B7=B7-2
   20  H/  /#QC   AL=AL+[256+B7]
   21  Y/  A:QG   B7=B7-2
   22  P/  HE/T   if (B>=0) goto 20
   23  Q/  PKTJ   XOR
   24  O/  MK/A   
   25  B/  E:TN   
   26  G/  X//H   
   27  "/  $K/:   Write S4 to drum at destination address; second pass goto 53 to exit
   28  M/  A//:   check -> if ok goto 31
   29  X/  M//V   
   30  V/  X//P   
   31  $/  BE/P   goto 45
                  
   32  /E  ZN/:   
   33  EE  H:/C   
   34  @E  AK/F   
   35  AE  BE/J   
   36  :E  MK/A   
   37  SE  XK/:   
   38  IE  :KT/   
   39  UE  UKTR   
   40  #E  MK/S   
   41  DE  MKQO   
   42  RE  /@QT   
   43  JE  :KQB   
   44  NE  /:/P   
   45  FE  S//:   read track to S4
   46  CE  MEQO   
   47  KE  "/QB   
   48  TE  D:/P   goto 17
  
   49  ZE  VSTA   Entry: The routine is entered there with Y warning char 
                  set the return link [VS]=J@LV A/@/ -> points to INPUT
   50  LE  VET/   get in AL the cue (//UN @/EZ points back to WRITE) to reenter on next Y
   51  WE  NS/P   return to INPUT to continue processing of input tape, until Z warning char
                  that goes to addr 1

   52  HE  W/C$   
   53  YE  HELO   exit: 
   54  PE  DS/P   goto 0
   55  QE         
   56  OE         
   57  BE  NE//   
   58  GE  /T/@   
   59  "E  $$E/   
   60  ME  YE/P   
   61  XE  A/@/   
   62  VE  //UN   
   63  $E  @/EZ   
                  
