
    Alick Glennie Autocode compiler 

    Rewriten by Roberto Sancho Apr/2023 
    using doc on compiler form original author
            
    https://archiveshub.jisc.ac.uk/data/gb133-muc/5-9/muc/9/14

      (a) Photocopy of a 16-page typewritten manual describing 
          Glennies AUTOCODE routine. (Probably a draft for a 
          manual to be entitled The Routine AUTOCODE and its use).   

      (b) Photocopy of 14 pages of Glennies lecture notes on 
          The automatic coding of an electronic computer dated 
          14th December 1952.


    [Col /          E ]                 [Col @          A ]              
                                                            command jump table
    | QIQO | / | Z/$$ |                 | ://A | / | #/// | write
    | /AUP | E |      |                 | :/QO | E | JE// | fractions
    |      | @ | DSQO |                 | /U$/ | @ | A/// | testa
    |      | A | XIQB |                 | RSTR | A | A/// | testb
    | :/QO | : | GIQO |                 | E:TN | : | A/// | control
    | QS/P | S | /N$/ |                 | E:/M | S | A/// | entry
    | RC/V | I | #STR |                 | DS/Q | I | EE// | erase
    |      | U | /NUS |                 | "ATN | U | A/// | loop
    |      | # | #EQO |                 | DS/M | # | A/// | repeat
    | XA/: | D | QS/P |                 | BATC | D | A/// | subroutine
    | GITK | R | @C/V |                 | ://S | R | A/// | adroutine
    | ///S | J |      |                 | :/QO | J | A/// | close
    | //QO | N | @//A |                 | //T/ | N | P@// | start
    | EN$/ | F | S:YO |                 | //US | F |      | 
    | VATR | C | FEO: |                 | EA/P | C |      | 
    | $ATD | K | CE/: |                 |      | K |      | 
    | ///S | T | ///A |                 |      | T |      | 
    | ///: | Z | E/TF |                 | Z@$$ | Z |      | 
    | L/QO | L | Z@/H |                 | E:YG | L |      | 
    | QS/P | W | U:TC |                 | CE/T | W |      | 
    | TC/V | H | E:YO |                 | Y@/P | H |      | 
    |      | Y | E:/M |                 | UE$$ | Y |      | 
    | ///V | P | DSYO |                 |      | P |      | 
    | GITK | Q | QEQO |                 | X@/: | Q |      | 
    | P/TC | O | GS/P |                 | V@/: | O |      | 
    | ///S | B | LC/V |                 | X@/: | B | /N// | const
    | //QO | G | ///E |                 | V@/: | G | //// | 
    | V/QB | " | //O: |                 | X@/: | " | $A// | const
    | M/QO | M | CE/: |                 | $@/P | M | //// |
    | GS/P | X | ://A |                 | $$L$ | X | @E/N | mag instr read dir 34L to col NF
    | //// | V | ://C |                 | $$W$ | V | $$$/ | 
    | /E/P | $ | J:/N |                 | P/// | $ | //## | 
                                                            
    [End]
  
                 process start, write, erase commands
                 calls TRANS.1 to translate commands               

                 process command
                 entry B6=aa/b (func jump addr + param type)

    0  //  QIQO  B7=[FUNC] -> get command number in sentence
    1  E/  /AUP  goto [B7+ /A] command jump table
          
    2  @/  
    3  A/  

                 process commands that generates machine code
                 thus have to be translated

    4  :/  :/QO  B7=*
    5  S/  QS/P  transfer to adroutine
    6  I/  RC/V  cue to TRANS.1 (translate)
    7  U/  
    8  #/  

                 WRITE l command

    9  D/  XA/:  Load directory from track 34 to S6 cols NF
   10  R/  GITK  AL=2*[Label] as parameter on WRITE command
   11  J/  ///S  save into temp [//]=label * 2
   12  N/  //QO  B7=label * 2 -> the addr for cue on directory
   13  F/  EN$/  AL=[B7+EN] -> get the mag instr from cue from dir entry
   14  C/  VATR  AL=AL AND $$$/ xxxx -> clear source col to write from 
   15  K/  $ATD  AL=AL OR  //## //// -> set write to drum bit, and source col #
   16  T/  ///S  save into temp [//]=mag instr to write routine
   17  Z/  ///:  write cols #DRJ to drum -> compiled routine saved into drum

                 init all, start autocode compiler

   18  L/  L/QO  B7=*
   19  W/  QS/P  transfer to adroutine
   20  H/  TC/V  cue to INPUT.1 (init all, start autocode compiler)
   21  Y/  
   22  P/  ///V

                 START [l] command

   23  Q/  GITK  AL=2*[Label] as parameter on START command
   24  O/  P/TC  AL=AL+///V 
   25  B/  ///S  save into temp [//]
   26  G/  //QO  B7=[//] the cue to use on RCS subroutine call
   27  "/  V/QB  [X/]=B7 save cue to be used in RCS 
   28  M/  M/QO  B7=*
   29  X/  GS/P  transfer to subroutine
   30  V/  ////  cue to routine to call
   31  $/  /E/P  goto init all
   32  /E  Z/$$  cn
   33  EE  

                 ERASE l command

   34  @E  DSQO  B7=-1
   35  AE  XIQB  [XI] Clear acc flag = -1=clear acc before use
   36  :E  GIQO  B7=[Label] as parameter on ERASE command
   37  SE  /N$/  AL=[/N + B7] get label addr
   38  IE  #STR  AL=AL AND //// $$$$ -> clear label addr
   39  UE  /NUS  [/N + B7]=AL write label addr

                 non-generating machine code command processing terminated 
                 so proceed to compile next sentence

   40  #E  #EQO  B7=*
   41  DE  QS/P  transfer to adroutine
   42  RE  @C/V  cue to INPUT.1 (read sentence)
   43  JE  

                 FRACTIONS +|-nnnn->a command

   44  NE  @//A  [@/ A/]=0
   45  FE  S:YO  B5=4
   46  CE  FEO:  clear acc
   47  KE  CE/:  read PTR (should be / as skip char or sign: M -, P +)
   48  TE  ///A  [// E/]=AM -> Save char //// ///c, AM=0
   49  ZE  E/TF  AL= - ///c ///
   50  LE  Z@/H  if (A>=0) goto 81 -> skip leading / chars
   51  WE  U:TC  AL=AL+8. if char=P -> -c=-10; if char=M -> -c=-4, so adding 8 leads to AL>0 if char sign was -, AL<0 if sign was +
   52  HE  E:YO  B5=1
   53  YE  E:/M  if (A>=0) skip one instr
   54  PE  DSYO  B5=-1
   55  QE  QEQO  B7=*
   56  OE  GS/P  transfer to subroutine
   57  BE  LC/V  cue to INPUT.8 (input fraction)
   58  GE  ///E  [// E/]=AM              <- save the read fraction
   59  "E  //O:  clear acc
   60  ME  CE/:  read PTR (should be a variable)
   61  XE  ://A  [:/ S/]=AM -> Save char //// ///c, AM=0
   62  VE  ://C  D=//// ///c char read
   63  $E  J:/N  shift -> AL=0, AM=c/// ////
   64  /@  ://A  [:/ S/]=AM=c/// ////, AM=0 -> the variable
   65  E@  :/QO  B7=variable to assign fraction to
   66  @@  /U$/  AL=[B7+/U]=get var address
   67  A@  RSTR  AL=AL AND $$$$ //// -> isolate var addr
   68  :@  E:TN  AL=AL-1
   69  S@  E:/M  if (A>=0) skip one instr (beacuse var addr > 0)
   70  I@  DS/Q  if var addr = 0 dynamic stop here. Assigning value to undef var
                 SYNTAX ERROR: var undef
   71  U@  "ATN  AL=AL-$A//
   72  #@  DS/M  if (A>=0) dynamic stop here, because var defined outside S0 S1
                 SYNTAX ERROR: assing value to var outside S0 S1
   73  D@  BATC  AL=AL + ($A+1+/#))AL+/N//
   74  R@  ://S  [:/]=AL -> save var's address where to store fraction
   75  J@  :/QO  B7=addr
   76  N@  //T/  AL=[//] the value to store into variable
   77  F@  //US  [B7]=AL store the value 
   78  C@  EA/P  goto 44, read next fraction
   79  K@  
   80  T@  
   81  Z@  Z@$$  cn goto 81
   82  L@  E:YG  B5=B5-1 can skip this / char?
   83  W@  CE/T  if (B>=0) goto 46 -> yes, goto read next char
   84  H@  Y@/P  goto 40 non-generating machine code command processing terminated 
   85  Y@  UE$$  cn
   86  P@  
   87  Q@  X@/:  print <cr><lf> x 2
   88  O@  V@/:
   89  B@  X@/:
   90  G@  V@/:
   91  "@  X@/:
   92  M@  $@/P  goto START
   93  X@  $$L$  CR  
   94  V@  $$W$  LF
   95  $@  P///  cn

   96  /A  command jump table
   97  EA  
   98  @A  
   99  AA  
  100  :A  
  101  SA  
  102  IA  
  103  UA  
  104  #A  
  105  DA  
  106  RA  
  107  JA  
  108  NA  
  109  FA  
  110  CA  
  111  KA  
  112  TA  
  113  ZA  
  114  LA  
  115  WA  
  116  HA  
  117  YA  
  118  PA  
  119  QA  
  120  OA  
  121  BA  
  122  GA  
  123  "A  
  124  MA  
  125  XA  
  126  VA  
  127  $A  
