home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Emulation / ZXAMSpectrum / ZXAM_Rexx / English / SaveScreen.zxam < prev    next >
Text File  |  1995-07-31  |  4KB  |  119 lines

  1. /* this script save the actual Spectrum's screen as IFF */
  2.     
  3.     address command
  4.     
  5.     if ~show(ports,ZXAM_REXX) then do
  6.         requestchoice 'title "ZXAM Script error..." body "I can''t find the emulator''s port!!" gadgets "AARGH!"'
  7.         exit 0
  8.         end
  9.  
  10.     /* store the initial status of the emulator */
  11.     running=zxamactrun()    /* 1=running */
  12.     zxamstop()              /* stop the emulation */
  13.  
  14. /* we use the emulator's filerequester */
  15.     
  16.     cajon=""  /* default path for screens */
  17.     
  18.     oldcajon=zxamactloadpath()    /* store old path */
  19.     oldpattern=zxamactpattern()    /* store old pattern */
  20.     zxampattern('(#?.iff|#?.pic)')  /* new pattern */
  21.     
  22.     nombre=zxamsaverequester('Name to save screen as IFF...',cajon)
  23.     
  24.     zxampattern(oldpattern)        /* retrieve the pattern */
  25.     zxamloadpath(oldcajon)        /* retrieve the path */    
  26.     
  27.     if nombre='' then do
  28.         exit    /* CANCEL */
  29.         end
  30.     
  31. /* open file */
  32.  
  33.     if ~OPEN('fichero',nombre,'Write') then exit 0
  34.     
  35.     oldname=zxamactname()        /* old window status */
  36.     oldformat=zxamactformat()
  37.     
  38.     zxamnameformat('    (SAVING IFF SCREEN)','')
  39.     
  40. /* ID header */
  41.     dummy=writech('fichero','FORM')
  42.     dummy=writech('fichero','000060a8'x)    /* total size */
  43.     dummy=writech('fichero','ILBM')
  44.  
  45. /* chunk ANNO */
  46.     dummy=writech('fichero','ANNO')
  47.     dummy=writech('fichero','00000033'x)    /* size 51 chars */
  48.     dummy=writech('fichero','Saved by ZXAM Spectrum Emulator AGA (by Toni Pomar)')
  49.     dummy=writech('fichero','00'x)        /* pad to align */
  50.  
  51. /* chunk BMHD */
  52.     dummy=writech('fichero','BMHD')
  53.     dummy=writech('fichero','00000014'x)    /* size 20 */
  54.     dummy=writech('fichero','0100'x)    /* width */
  55.     dummy=writech('fichero','00c0'x)    /* height */
  56.     dummy=writech('fichero','0000'x)    /* pos x */
  57.     dummy=writech('fichero','0000'x)    /* pos y */
  58.     dummy=writech('fichero','04'x)        /* nro bitplanes */
  59.     dummy=writech('fichero','00'x)        /* masking */
  60.     dummy=writech('fichero','00'x)        /* compression */
  61.     dummy=writech('fichero','00'x)        /* Pad1 */
  62.     dummy=writech('fichero','0000'x)    /* transparent color */
  63.     dummy=writech('fichero','2c2c'x)    /* aspect 44:44 */
  64.     dummy=writech('fichero','0140'x)    /* width source page (320) */
  65.     dummy=writech('fichero','0100'x)    /* heigth source page (256) */
  66.  
  67. /* chunk CAMG */
  68.     dummy=writech('fichero','CAMG')
  69.     dummy=writech('fichero','00000004'x)    /* size 4 */
  70.     dummy=writech('fichero','00000000'x)    /* 00021000 = PAL:Lo-res */
  71.  
  72. /* chunk CMAP */
  73.  
  74.     dummy=writech('fichero','CMAP')
  75.     dummy=writech('fichero','00000030'x)    /* size 48 (16 colors*3 bytes) */
  76.     
  77.     /* border color */
  78.     /* color 0 to 7 acts as an index to acces to the array */
  79.  
  80.         dummy=writech('fichero',x2c(substr('000000000099990000aa00aa00aa0000bbbbcccc00dddddd',(zxamgetreg(bor)*6)+1,6)))
  81.  
  82.     dummy=writech('fichero','000099'x)    /* color 1 */
  83.     dummy=writech('fichero','990000'x)    /* color 2 */
  84.     dummy=writech('fichero','aa00aa'x)    /* color 3 */
  85.     dummy=writech('fichero','00aa00'x)    /* color 4 */
  86.     dummy=writech('fichero','00bbbb'x)    /* color 5 */
  87.     dummy=writech('fichero','cccc00'x)    /* color 6 */
  88.     dummy=writech('fichero','dddddd'x)    /* color 7 */
  89.     dummy=writech('fichero','000000'x)    /* color 8 */
  90.     dummy=writech('fichero','0000aa'x)    /* color 9 */
  91.     dummy=writech('fichero','bb0000'x)    /* color 10 */
  92.     dummy=writech('fichero','cc00cc'x)    /* color 11 */
  93.     dummy=writech('fichero','00cc00'x)    /* color 12 */
  94.     dummy=writech('fichero','00dddd'x)    /* color 13 */
  95.     dummy=writech('fichero','eeee00'x)    /* color 14 */
  96.     dummy=writech('fichero','ffffff'x)    /* color 15 */
  97.     
  98.  
  99. /* chunk BODY */
  100.  
  101.     dummy=writech('fichero','BODY')
  102.     dummy=writech('fichero','00006000'x)    /* size 6144*4 (4 bpls of 256*192) */
  103.  
  104. /* we use a special emulator's function to extract and convert to bitplanes */
  105.  
  106.     dummy=writech('fichero',zxamgetscr())
  107.  
  108.     dummy=close('fichero')
  109.     
  110.     if oldname=='' then
  111.         zxamclearnameformat()
  112.     else
  113.         zxamnameformat(oldname,oldformat)
  114.     
  115.     /* restore the status */
  116.     if running=1 then zxamrun()
  117.  
  118.     exit
  119.