@echo Bas2Bin is running...
@rem Use this script only to create BIN files for an emulator
@rem You should not process these BIN files with Bin2wav.
@rem open console,
@rem change to directory and start batch with "bas2wav FILENAM"
@rem FileToOpen needed: http://www.horstmuc.de/win/wfile.zip

@echo off
if not exist GetFName.cmd (
	%~d0
	cd %~dp0
)
if not exist GetFName.cmd if exist ..\GetFName.cmd cd ..
call SHARPSET
set fnamex=.BAS
set fnamedp=%BASDIR%\
set fnamen=%1
set fnamef=%fnamedp%%fnamen%%fnamex%

Rem Note: Filenames with 1-7 characters are recommended!
if not exist %fnamef% call GetFName %fnamedp% "*%fnamex%;*.PRG;*.ASC;*.SPP;*.SHA;*.shp" "%1"
if not exist %fnamef% (
             echo Error: File %fnamef% does not exist! - Ctrl+C
             goto end
)

bas2img --pc=%SHARPC% %fnamef% %fnamedp%%fnamen%.bin --endmark %BAS2OPT%
if errorlevel 1 goto end
echo.
echo Inside the emulator choose "View", your PC and "Dump Memory" [Load Binary File]
pause
if not "%HEDITOR%"=="" start "%fnamen%" %HEDITOR% %fnamedp%%fnamen%.bin
goto :EOF
:end
pause