/* this script save the actual Spectrum's screen as IFF */ address command if ~show(ports,ZXAM_REXX) then do requestchoice 'title "ZXAM Script error..." body "I can''t find the emulator''s port!!" gadgets "AARGH!"' exit 0 end /* we use the emulator's filerequester */ cajon="" /* default path for screens */ oldcajon=zxamactloadpath() /* store old path */ oldpattern=zxamactpattern() /* store old pattern */ zxampattern('(#?.iff|#?.pic)') /* new pattern */ nombre=zxamsaverequester('Name to save screen as IFF...',cajon) zxampattern(oldpattern) /* retrieve the pattern */ zxamloadpath(oldcajon) /* retrieve the path */ if nombre='' then do exit /* CANCEL */ end /* open file */ if ~OPEN('fichero',nombre,'Write') then exit 0 oldname=zxamactname() /* old window status */ oldformat=zxamactformat() zxamnameformat(' (SAVING IFF SCREEN)','') /* ID header */ dummy=writech('fichero','FORM') dummy=writech('fichero','000060a8'x) /* total size */ dummy=writech('fichero','ILBM') /* chunk ANNO */ dummy=writech('fichero','ANNO') dummy=writech('fichero','00000033'x) /* size 51 chars */ dummy=writech('fichero','Saved by ZXAM Spectrum Emulator AGA (by Toni Pomar)') dummy=writech('fichero','00'x) /* pad to align */ /* chunk BMHD */ dummy=writech('fichero','BMHD') dummy=writech('fichero','00000014'x) /* size 20 */ dummy=writech('fichero','0100'x) /* width */ dummy=writech('fichero','00c0'x) /* height */ dummy=writech('fichero','0000'x) /* pos x */ dummy=writech('fichero','0000'x) /* pos y */ dummy=writech('fichero','04'x) /* nro bitplanes */ dummy=writech('fichero','00'x) /* masking */ dummy=writech('fichero','00'x) /* compression */ dummy=writech('fichero','00'x) /* Pad1 */ dummy=writech('fichero','0000'x) /* transparent color */ dummy=writech('fichero','2c2c'x) /* aspect 44:44 */ dummy=writech('fichero','0140'x) /* width source page (320) */ dummy=writech('fichero','0100'x) /* heigth source page (256) */ /* chunk CAMG */ dummy=writech('fichero','CAMG') dummy=writech('fichero','00000004'x) /* size 4 */ dummy=writech('fichero','00000000'x) /* 00021000 = PAL:Lo-res */ /* chunk CMAP */ dummy=writech('fichero','CMAP') dummy=writech('fichero','00000030'x) /* size 48 (16 colors*3 bytes) */ /* border color */ /* color 0 to 7 acts as an index to acces to the array */ dummy=writech('fichero',x2c(substr('000000000099990000990099009900009999999900999999',(zxamgetreg(bor)*6)+1,6))) dummy=writech('fichero','000099'x) /* color 1 */ dummy=writech('fichero','990000'x) /* color 2 */ dummy=writech('fichero','990099'x) /* color 3 */ dummy=writech('fichero','009900'x) /* color 4 */ dummy=writech('fichero','009999'x) /* color 5 */ dummy=writech('fichero','999900'x) /* color 6 */ dummy=writech('fichero','999999'x) /* color 7 */ dummy=writech('fichero','000000'x) /* color 8 */ dummy=writech('fichero','0000aa'x) /* color 9 */ dummy=writech('fichero','bb0000'x) /* color 10 */ dummy=writech('fichero','cc00cc'x) /* color 11 */ dummy=writech('fichero','00cc00'x) /* color 12 */ dummy=writech('fichero','00dddd'x) /* color 13 */ dummy=writech('fichero','eeee00'x) /* color 14 */ dummy=writech('fichero','ffffff'x) /* color 15 */ /* chunk BODY */ dummy=writech('fichero','BODY') dummy=writech('fichero','00006000'x) /* size 6144*4 (4 bpls of 256*192) */ /* we use a special emulator's function to extract and convert to bitplanes */ dummy=writech('fichero',zxamgetscr()) dummy=close('fichero') if oldname=='' then zxamclearnameformat() else zxamnameformat(oldname,oldformat) exit