@echo off 
if not exist \Emu\Fusion\Fusion.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\Asw\bin\asw %BuildFile% -CPU SH7600  -L -olist \Bld32X\ListingSH2.txt  -D Build32X -o \Bld32x\prog.bld

if not "%errorlevel%"=="0" goto Abandon

\Utils\Asw\bin\p2bin \Bld32x\prog.bld \Bld32x\32x.rom

copy /b \Bld32x\gen.rom + \Bld32x\32x.rom \Rel32X\prog.32x
X:\Emu\Fusion\Fusion \Rel32X\prog.32x


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\Fusion\Fusion.exe
:Abandon
if "%3"=="nopause" exit
pause


