setlocal

set _name=LawOfTheWest

bin\acme -f plain -o src\T64Loader_V3.bin src\T64Loader_V3.asm
pause

del %_name%-MD*.*
bin\t64fix -c data\%_name%.t64 game\*
copy /b src\t64loader_V3.bin + data\%_name%.t64 data\%_name%.bin
bin\cartconv -i data\%_name%.bin -o %_name%-MD.crt -t md -p
bin\cartconv -i %_name%-MD.crt -o %_name%-MD.bin -p -r

for %%I in (%_name%-MD.bin) do set size=%%~zI

if %size% gtr 262144 (
    set zusatz=27C040
) else if %size% gtr 131072 (
    set zusatz=27C020
) else (
    set zusatz=27C010
)

ren %_name%-MD.bin %_name%-MD-%zusatz%.bin

pause

endlocal
