! ILAP RAM Generator
! Provisional release   JGH   Feb 83

%include "nmos.inc"
%external %string (255) %fn %spec ItoS (%integer I, P)

{#########################################################################}
{#                                                                       #}
{#      This program is part of the ILAP library, and was written in     #}
{#   The Department of Computer Science at the University of Edinburgh   #}
{#       (James Clerk Maxwell Building, Kings Buildings, Edinburgh)      #}
{#                                                                       #}
{#   This software is available free to other educational establisments  #}
{#   but the University of Edinburgh, retains all commercial rights.     #}
{#   It is a condition of having this software is that the sources are   #}
{#   not passed on to any other site, and that Edinburgh University is   #}
{#   given credit in any re-implementations of any of the algorithms     #}
{#   used, or articles published which refer to the software.            #}
{#                                                                       #}
{#   There is no formal support for this software, but any bugs should   #}
{#   be reported to Gordon Hughes or David Rees at the above address,    #}
{#   and these are likely to be fixed in a future release.               #}
{#                                                                       #}
{#########################################################################}

%external %routine RAM %alias "ILAP_RAM" (%integer X, Y)
   %integer I
   %string (31) row, array

   disaster ("Ram X or Y number is less than or equal to zero") %if X<=0 %or Y<=0

   row = "Ram row ".ITOS (X,0)
   array = "Ram array ".ITOS (X,0)." x ".ITOS (Y,0)

   %if symbol exists("Ram cell")#TRUE %start
%include "RAM.TED"
   %finish
   %if symbol exists(row)#TRUE %start
       symbol (row)
          draw ("Ram cell", i*SX("Ram cell")-2*i, 0) %for I = 0, 1, X-1
       end symbol
   %finish
   %if symbol exists(array)#TRUE %start
       symbol (array)
          %for I = 0, 1, Y-1 %cycle
               %if I&1=0 %start
                   draw (row, 0, i*SY(row)-4*i)
               %finish %else %start
                   draw my (row, 0, (i+1)*SY(row)-(4*i))
               %finish
          %repeat
       end symbol
   %finish
%end

%end %of %file
