/*
  $VER: SaveSCREEN$.zxam 1.0 (23.5.96)
  Written by Edmund Vermeulen (edmundv@grafix.xs4all.nl).

  ARexx script for ZXAM (the ZX Spectrum emulator by Antonio J. Pomar
  Rosselló) to save the Spectrum's screen to a file for viewing with
  ZX DataType.
*/
	
/* Test if the emulator is present. */
if ~show('p',ZXAM_REXX) then do
   address command
   requestchoice 'TITLE "ZXAM Script error..."',
      'BODY "I can''t find the emulator''s port!!"',
      'GADGETS "OK"'
   exit
   end

/* Save requester. */
oldpath=zxamactsavepath()
oldpattern=zxamactpattern()
zxampattern('#?')
name=zxamsaverequester('Save ZX SCREEN$ as...')
zxamsavepath(oldpath)
zxampattern(oldpattern)
if name='' then  /* cancel */
   exit
if right(name,3)~='.zx' then
   name=name'.zx'

/* Write the SCREEN$. */
if open('outfile',name,'w') then do
   call writech('outfile',zxamgetmem(16384,6912))
   call close('outfile')
   end
