@echo off
cd %2


if not exist \Emu\kegs32091\dos33mst.dsk goto EmulatorFail
if not exist \Emu\kegs32091\rom.01 goto EmulatorFail

cd %2
\Utils\Wladx\wla-65816.exe -i -D BuildAP2 -v -o \BldAP2\prog.o %1 
if not "%errorlevel%"=="0" goto Abandon
\Utils\Wladx\wlalink -i -b \BldAP2\prog.txt \BldAP2\Prog.
if not "%errorlevel%"=="0" goto Abandon
@echo off


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

copy \ResAp2\blank.dsk \BldAP2\Test.dsk

cd \BldAP2

\Utils\a2in b.0C00 TEST.DSK PROG prog

copy \BldAP2\Test.dsk \Emu\kegs32091


echo *** type: BRUN PROG ***

cd \Emu\kegs32091\
copy config.kegs.bak config.kegs

kegs32.exe>nul

exit

:EmulatorFail
echo Error: Please provide files "dos33mst.dsk" and "rom.01" in "\Emu\kegs32091\"
echo For licensing reasons I cannot provide these.
pause
exit 
:Abandon
if "%3"=="nopause" exit
pause
rem \Utils\a2tools.exe in b.0C00 TEST.DSK PROG prog