@echo off 

if not exist \Emu\Fuse\fuse.exe goto EmulatorFail

set BuildFile=%1
set BuildPath=%2
if exist \utils\SelectedBuildFile.bat call \utils\SelectedBuildFile.bat 

cd %BuildPath%
if not %BuildPath:~0,1%==%CD:~0,1% goto InvalidPath

\Utils\Vasm\vasmZ80_OldStyle_win32.exe %BuildFile% -chklabels -nocase -Dvasm=1  -L z:\BldZX\Listing.txt -DBuildZXS=1 -DBuildZXS_TAP=1 -Fbin -o "z:\BldZX\program.bin"
if not "%errorlevel%"=="0" goto Abandon
cd \
start "" \Utils\BuildScripts\ZX_goTAP48.bat 


goto Abandon


:InvalidPath
echo Error: ASM file must be on same drive as devtools 
echo File: %BuildPath%\%BuildFile% 
echo Devtools Drive: %CD:~0,1% 
goto Abandon


:EmulatorFail
echo Error: Can't find \Emu\Fuse\fuse.exe
:Abandon
if "%3"=="nopause" exit
pause

