@echo off
rem --- '2_compile.cmd' v2.6 by KdL (2020.01.09)

set TIMEOUT=1
set PROJECT=emsx_top
if "%1"=="" color 87&title COMPILE for 1chipMSX and Zemmix Neo
if not exist %PROJECT%.qpf goto err_msg
if exist C:\Altera\11.0sp1\quartus\bin\quartus.exe (
    start C:\Altera\11.0sp1\quartus\bin\quartus.exe %PROJECT%.qpf
    goto init
)
if not exist "%QUARTUS_ROOTDIR%\common\devinfo\cyclone" goto err_quartus
explorer %PROJECT%.qpf

:init
goto quit

:err_quartus
if "%1"=="" color f0
echo.&echo Quartus II was not found or unsupported device!
goto timer

:err_msg
if "%1"=="" color f0
echo.&echo '%PROJECT%.qpf' not found!

:timer
if "%1"=="" waitfor /T %TIMEOUT% pause >nul 2>nul

:quit
