@echo --------------------------------------------------------------------------
@echo 	Keith's Z80 Dev Toolkit - Please see the Readme for instructions!
@echo --------------------------------------------------------------------------
@echo 			Start MSX Disk V1.0
@echo. 			
@echo This tool loads your program on the MSX - by default using the Sony_HB-F1XDJ 
@echo Due to licensing you must supply the correct rom files in the systemroms folder
@echo. 			
@echo The data is loaded into C000 and copied to 8000 so your program will
@echo 	    run the same on ROM or Disk, and allow self modified code
@echo --------------------------------------------------------------------------

@echo off
if exist Emu\openmsx\share\systemroms\machines\Sony\*.rom goto Start
echo System Roms not found
echo need Sony_HB-F1XDJ roms in Emu\openmsx\share\systemroms\machines\Sony\
echo If you have other roms, please change this batch file
pause
exit
:Start
@echo on
set DiskFile=RelMSX\Disk

set infile=boot.bin
set outfile=boot.dat
call :AddOneB

copy ResALL\MusicTest9000.bin BldMSX\
set infile=MusicTest9000.bin
set outfile=music.bin
call :AddOneB



utils\BFI -b=ResMSX\MsxBootDisk.bin -t=4 -f=RelMSX\disk%Lang%.dsk \RelMSX\Disk%Lang%
cd Emu\openmsx\
openmsx.exe -machine Sony_HB-F1XDJ  -diska ..\..\RelMSX\disk%Lang%.dsk -ext video9000


:AddOne
set OutFile=%infile:~0,8%

:AddOneB
utils\MsxHeader.exe BldMSX\%infile% BldMSX\%OutFile% 900A
copy BldMSX\%OutFile% "%DiskFile%"
goto :eof


:AddOneZ
set OutFile=%infile:~0,8%

:AddOneZB
utils\lz48.exe -i BldMSX\%infile% -o BldMSX\%infile%.z
utils\MsxHeader.exe BldMSX\%infile%.z BldMSX\%OutFile% 900A
copy BldMSX\%OutFile% "%DiskFile%"
goto :eof