/* Update v1.2. 19-09-96. Gerard Sweeney. Based on original AREXX
script supplied with ZXAM 2.0b */
/* Note, this does not need to be run through DOpus... Any Directory
Manager can do it, just use RX ZXAMRUN.dopus [snapshotname]
and it should work OK..... */
parse arg file2load /* gets the arguments as one long text */
parse var file2load nombre "|" YN /* Splits into 2 seperate args */
ADDLIB('rexxarplib.library',0,-30,0)
/* check filename. Step 1 if no name, step 2 if wrong name */
call check_yn
call check_filename
call check_zxam
call load_zxam
call load_snap
exit
/* PROCEDURES FOLLOW............*/
Check_YN:
if yn='' then do
yn='Y'
end
return
Check_filename:
if nombre='' then do
prompt_str='You don''t appear to have entered a snapshot name.\Do you want to pick one yourself?'
call snap_prob
end
if ~open(tempsnap,nombre,"r") then do
prompt_str='Sorry Spec-Chum. I couldn''t find that file.\Do you want to pick one yourself?'
call snap_prob
end
return
Check_ZXAM:
locfile='s:zxamlocation' /* S:zxamlocation - points to emulator */
if ~open(zxamlocfile,locfile,"r") then do
prompt_str='The emulator location file (S:ZXAMLOCATION) could not be found\Do you want to show me where your emulator is?'
call zxam_loc_prob
end
open(zxamlocfile,locfile,"r")
zxam_location=readln(zxamlocfile)
if ~exists(zxam_location) then do
prompt_str='Sorry Spec-Chum.... I couldn''t find the emulator based on the\settings of S:ZXAMLOCATION......\\Do you want to show me where your emulator is?'
call zxam_loc_prob
end
return
load_snap:
/* Load the snapshot.. The zxamact labels allow the Reload function */
bloque=zxampploadfile(nombre) /* load the whole file */
formato=zxamparseloaded(bloque) /* checks the format and loads the file */
if formato~='' then do
zxamnameformat(zxamfilepart(nombre),formato)
pth=zxampathpart(nombre)
temp_path=zxamloadpath(pth)
path=zxamactloadpath()
path=pth
name=zxamactname()
zxamenablereload()
end
if upper(YN)='N' then do
exit
end
else do
zxamrun()
end
return
zxam_loc_prob:
prompt_yes='Yes please'
prompt_no='No thanks'
call prompt_proc
prompt_str='Try editing the file S:ZXAMLOCATION to reflect the\full name (path included) of your emulator\(e.g. DH1:UTILS/EMULATORS/SPECCY/ZXAMSPECTRUM_AGA)'
if prompt_temp='' then do
call prompt_exit
end
req_str='Please select the emulator you wish to use'
call req_proc
if req_temp='' then do
call prompt_exit
end
zxam_location=req_temp
call open(templocfile,locfile,"w")
writeln(templocfile,zxam_location)
call close(templocfile)
return
load_zxam:
running=1
loading=0
/* Uses the internal loaders of the emulator...
If emulator port not found, loads program from disk using zxam_location */
address command
if ~show(ports,ZXAM_REXX) then do
ADDRESS COMMAND zxam_location
loading=1
end
/* Loops until ZXAM port is active, otherwise the prog cannot load the snap */