@echo on 
if not exist \Emu\coco3\Vcc.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 6309  -L -olist \BldDGN\Listing.txt  -D BuildDGN -D BuildCCO -D CPU6309 -o \BldDGN\prog.bld

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

\Utils\Asw\bin\p2bin \BldDGN\prog.bld \BldDGN\prog.rom

if not "%errorlevel%"=="0" goto Abandon
cd \Emu\coco3\
Vcc.exe \BldDGN\prog.rom

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
:RomFailX

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