
if "%1%"=="E" goto country_ok
if "%1%"=="A" goto country_ok
if "%1%"=="U" goto country_ok
if "%1%"=="D" goto country_ok

echo Unknown country
goto error

:country_ok

rem -- copy of ma --
erase *.cpe
erase *.obj
erase *.sym
depend *.c >depend.txt
copy makefile.txt+depend.txt makefile.mak
if "%1"=="D" copy makedemo.txt+depend.txt makedemo.mak

rem -- Note that Borland Make needs capital D's for define --
if "%1"=="A" make -DMASTER=1 -DPAL=0
if "%1"=="E" make -DMASTER=1 -DPAL=1
if "%1"=="U" make -DMASTER=1 -DPAL=2
if "%1"=="D" make -DMASTER=1 -DPAL=2 -fmakedemo.mak

if "%1"=="D" goto demchk


if errorlevel 1 goto error
if NOT EXIST crtest.cpe goto error
goto chkok

:demchk
if errorlevel 1 goto error
if NOT EXIST crdemo.cpe goto error

:chkok

rem cpe2x /c%1 crtest.cpe
if "%1"=="A" cpe2x /cA crtest.cpe
if "%1"=="E" cpe2x /cE crtest.cpe
if "%1"=="U" cpe2x /cE crtest.cpe
if "%1"=="D" cpe2x /cE crdemo.cpe

setsp crtest.exe 801fff00
if "%1"=="D" setsp crdemo.exe 801fff00

if "%1"=="A"  move crtest.exe ..\burn\SLUS_013.04
if "%1"=="E"  move crtest.exe ..\burn\SLES_032.85
if "%1"=="U"  move crtest.exe ..\burn\SLES_031.88
if "%1"=="D"  move crdemo.exe ..\burn\CRDEMO.EXE

copy crtest.map ..\burn
copy crtest.sym ..\burn

rem if %1==A  copy sys_a.cnf ..\burn\system.cnf
rem if %1==E  copy sys_e.cnf ..\burn\system.cnf
rem if %1==U  copy sys_u.cnf ..\burn\system.cnf
rem if %1==A  copy cti_a.cti ..\burn\crun.cti
rem if %1==E  copy cti_e.cti ..\burn\crun.cti
rem if %1==U  copy cti_u.cti ..\burn\crun.cti

rem CREATE DAT FILE
if "%1"=="D" goto democd

cd ..\CD
del ..\burn\crtest.dat
datstak /r ..\crtest.dat
if errorlevel 1 goto error
move ..\crtest.dat ..\burn
goto okay

:democd
cd ..\DEMOCD
del ..\burn\crdemo.dat
datstak /r ..\crdemo.dat
if errorlevel 1 goto error
move ..\crdemo.dat ..\burn
goto okay


:error
echo *** There Were Errors ***
goto ending

:okay
echo All Done Okay


:ending
c:
cd \psx\crtest\source
