!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!  Utility/test macro for ICE-PIC PICFUNC primitive
!
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
startmacro/setup/nover/quiet/nmq=1k/timeout=100/np=32 &
	u:device[pic1cc] n:port[1] u:mode[e321]

  res pw 420
  res ph 100
  res px 160
  res py 50
  calc iw -514  ! pw-10
  calc ih ph-30

  picd reset ^device "^mode"

  pic create emuxram sp 2*64M 2.048e6*16

  res switches "/port=modulei^port"
  if /archive gt 0
    concat switches "/PS=1M" switches
  endif
  if /jjj gt 0
    pic create emuxram sp 2*64M 13e6
    res switches "/port=module2/flags=iom=cxd|intclk|verbose"
  endif

  xpipe on

  picfunc/id=11/wb=1^switches/afn=16 E1MUX ^device emuxram _e1_

  loop 16 nn
    calc ix nn-1 2 mod pw * px +
    calc iy nn-1 2 / fix ph * py +
    xrtraster/s=d/xl=ix/xt=iy/xw=iw/xh=ih/xcshr/nospecs/lpss=64/lpb=-8&
        /id=100+nn/xn="Plot-^nn  E1-^nn" &
         _e1_^nn(cl=512*64*16) ,-1,1,ma,512,4
    if /archive gt 0 noop _e1_^nn e1_^nn
  endloop

  xpipe off

  picd reset ^device 
  erase emuxram

endmacro

