@echo on
cd %2
rem \Utils\Asw\bin\asw %1 -CPU 65816  -L -olist \BldFNX\Listing.txt  -D BuildFNX -o \BldFNX\prog.bld
rem \Utils\Asw\bin\p2hex \BldFNX\prog.bld \relFNX\prog.hex  -F Intel -M 3 -l 32
rem 64tass.exe %1 --long-address -x --intel-hex -o \relFNX\prog.hex --list \BldFNX\Listing.txt 
rem \Utils\Wladx\wla-65816.exe -vo %1 \BldFNX\prog.o

\Utils\Wladx\wla-65816.exe -D BuildFNX  -v -i -o \BldFNX\prog.o %1 
if not "%errorlevel%"=="0" goto Abandon
\Utils\Wladx\wlalink -b \BldFNX\prog.txt \BldFNX\prog.bld
if not "%errorlevel%"=="0" goto Abandon

rem \Emu\Snes9x\snes9x.exe \RelSNS\cart.sfc
\utils\bin2hex.exe 0x00 \BldFNX\prog.bld \RelFNX\Prog.hex

tasklist|find "FoenixIDE.exe"
if %errorlevel%==0 goto Abandon

start "" \Emu\FoenixIDE\bin\Release\FoenixIDE.exe -r -h \RelFNX\Prog.hex
:Abandon
if "%3"=="nopause" exit
pause
