@ECHO OFF

IF EXIST kvadro_sk.bin GOTO MAKE_SK
CALL make.cmd
@ECHO OFF

:MAKE_SK
SET ERRFILE=kvadro_loader_sk.err
bin\asw.exe kvadro.loader.sk.a8080 -L -OLIST kvadro_sk_loader.lst -E %ERRFILE%
IF ERRORLEVEL 1 GOTO ERROR

SET OUTFILE=release\kvadro_sk.ptp
bin\p2bin.exe kvadro.p %OUTFILE% -l 0 -r $-$ -k
bin\checksum -add -s 0x32 -l 0x0E -c 0x40 %OUTFILE%
bin\checksum -add -s 0x43 -l 0x019B -c 0x01DE %OUTFILE%
bin\checksum -add -s 0x35CE -l 0x484A -c 0x7E18 %OUTFILE%


IF EXIST kvadro_en.bin GOTO MAKE_EN
CALL make.cmd
@ECHO OFF

:MAKE_EN
SET ERRFILE=kvadro_loader_en.err
bin\asw.exe kvadro.loader.en.a8080 -L -OLIST kvadro_en_loader.lst -E %ERRFILE%
IF ERRORLEVEL 1 GOTO ERROR

SET OUTFILE=release\kvadro_en.ptp
bin\p2bin.exe kvadro.p %OUTFILE% -l 0 -r $-$ -k
bin\checksum -add -s 0x32 -l 0x0E -c 0x40 %OUTFILE%
bin\checksum -add -s 0x43 -l 0x019B -c 0x01DE %OUTFILE%
bin\checksum -add -s 0x3326 -l 0x4750 -c 0x7A76 %OUTFILE%

GOTO EOF

:ERROR

MORE %ERRFILE%

:EOF

ECHO ON
