diff --git a/Source/Images/Build.cmd b/Source/Images/Build.cmd index d603f8e0..5b9576df 100644 --- a/Source/Images/Build.cmd +++ b/Source/Images/Build.cmd @@ -52,9 +52,9 @@ call BuildDisk.cmd msxroms1 hd wbw_hd512 || exit /b call BuildDisk.cmd msxroms2 hd wbw_hd512 || exit /b call BuildDisk.cmd infocom hd wbw_hd512 || exit /b -echo. -echo Building Combo Disk (512 directory entry format) Image... -copy /b ..\..\Binary\hd512_cpm22.img + ..\..\Binary\hd512_zsdos.img + ..\..\Binary\hd512_nzcom.img + ..\..\Binary\hd512_cpm3.img + ..\..\Binary\hd512_zpm3.img + ..\..\Binary\hd512_ws4.img ..\..\Binary\hd512_combo.img || exit /b +:: echo. +:: echo Building Combo Disk (512 directory entry format) Image... +:: copy /b ..\..\Binary\hd512_cpm22.img + ..\..\Binary\hd512_zsdos.img + ..\..\Binary\hd512_nzcom.img + ..\..\Binary\hd512_cpm3.img + ..\..\Binary\hd512_zpm3.img + ..\..\Binary\hd512_ws4.img ..\..\Binary\hd512_combo.img || exit /b echo. echo Building Hard Disk Images (1024 directory entry format)... @@ -85,7 +85,8 @@ if exist ..\BPBIOS\bp*.rel call BuildDisk.cmd bp hd wbw_hd1k ..\zsdos\zsys_wbw.s copy hd1k_prefix.dat ..\..\Binary\ || exit /b -echo. -echo Building Combo Disk (1024 directory entry format) Image... -copy /b hd1k_prefix.dat + ..\..\Binary\hd1k_cpm22.img + ..\..\Binary\hd1k_zsdos.img + ..\..\Binary\hd1k_nzcom.img + ..\..\Binary\hd1k_cpm3.img + ..\..\Binary\hd1k_zpm3.img + ..\..\Binary\hd1k_ws4.img ..\..\Binary\hd1k_combo.img || exit /b +:: echo. +:: echo Building Combo Disk (1024 directory entry format) Image... +:: copy /b hd1k_prefix.dat + ..\..\Binary\hd1k_cpm22.img + ..\..\Binary\hd1k_zsdos.img + ..\..\Binary\hd1k_nzcom.img + ..\..\Binary\hd1k_cpm3.img + ..\..\Binary\hd1k_zpm3.img + ..\..\Binary\hd1k_ws4.img ..\..\Binary\hd1k_combo.img || exit /b +call BuildImg.cmd || exit /b diff --git a/Source/Images/BuildImg.cmd b/Source/Images/BuildImg.cmd new file mode 100644 index 00000000..7931c5b9 --- /dev/null +++ b/Source/Images/BuildImg.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +for %%f in (*.def) do ( + PowerShell -ExecutionPolicy Unrestricted .\BuildImg.ps1 %%~nf || exit /b +) diff --git a/Source/Images/BuildImg.ps1 b/Source/Images/BuildImg.ps1 new file mode 100644 index 00000000..062ab03b --- /dev/null +++ b/Source/Images/BuildImg.ps1 @@ -0,0 +1,66 @@ +param([string]$Image) + +# If a PowerShell exception occurs, just stop the script immediately. +$ErrorAction = 'Stop' + +$DefFile = $Image + ".def" + +$ImgFile = "..\..\Binary\hd1k_" + $Image + ".img" + + + + +$SliceList = @() + +ForEach ($Line in Get-Content $DefFile) +{ + $Line = $Line.Trim() + + if (($Line.Length -eq 0) -or ($Line[0] -eq "#")) + { + continue + } + + $SliceList += $Line +} + +function CreateImageFile { + param ( + [string]$Format = "" # hd1k or hd512 + ) + + $ImgFile = "..\..\Binary\" + $Format + "_" + $Image + ".img" + + $FileList = "" + + "Generating $ImgFile using $DefFile..." + + ForEach ($Slice in $SliceList) + { + $File = "..\..\Binary\" + $Format + "_" + $Slice + ".img" + + if (!(Test-Path $File)) + { + "Slice input file """ + $File + """ not found!!!" + exit 1 + } + + if ($FileList.Length -gt 0) + { + $FileList += "+" + } + + $FileList += $File + } + + if ($Format -eq "hd1k") + { + $FileList = "hd1k_prefix.dat+" + $FileList + } + cmd.exe /c copy /b $FileList $ImgFile +} + +CreateImageFile "hd512" +CreateImageFile "hd1k" + +exit 0 diff --git a/Source/Images/Makefile b/Source/Images/Makefile index 09ef606e..abfe97d7 100644 --- a/Source/Images/Makefile +++ b/Source/Images/Makefile @@ -31,8 +31,16 @@ HD512PREFIX = HD1KPREFIX = hd1k_prefix.dat OBJECTS = $(FDIMGS) -OBJECTS += $(HD512IMGS) $(HD512XIMGS) hd512_combo.img $(HD512PREFIX) -OBJECTS += $(HD1KIMGS) $(HD1KXIMGS) hd1k_combo.img $(HD1KPREFIX) +OBJECTS += $(HD512IMGS) $(HD512XIMGS) $(HD512PREFIX) +OBJECTS += $(HD1KIMGS) $(HD1KXIMGS) $(HD1KPREFIX) + +# OBJECTS = + +TEMP = $(wildcard *.def) +TEMP := $(addprefix hd512_,$(TEMP)) $(addprefix hd1k_,$(TEMP)) +TEMP := $(TEMP:.def=.img) +OBJECTS += $(TEMP) + OTHERS = blank144 blankhd512 blankhd1k *.cat @@ -47,11 +55,41 @@ include $(TOOLS)/Makefile.inc DIFFPATH = $(DIFFTO)/Binary -hd512_combo.img: $(HD512PREFIX) $(HD512IMGS) - cat $^ > $@ - -hd1k_combo.img: $(HD1KPREFIX) $(HD1KIMGS) - cat $^ > $@ +# hd512_%.img: %.def $(HD512IMGS) $(HD512XIMGS) + +hd512_%.img: %.def + @echo "Making hd512 $^"; \ + file_list=""; \ + while read line; do \ + line=$$(echo "$${line}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$$//') ; \ + if [ -z "$${line}" ]; then \ + continue; + fi; \ + if [ "`expr substr "$$line" 1 1`" = "#" ]; then \ + continue; \ + fi; \ + file_list="$${file_list} hd512_$${line}.img"; \ + done < $^ ; \ + echo "$${file_list}"; \ + cat $${file_list} > $@ + +# hd1k_%.img: %.def $(HD1KIMGS) $(HD1KXIMGS) + +hd1k_%.img: %.def + @echo "Making hd1k $^"; \ + file_list=""; \ + while read line; do \ + line=$$(echo "$${line}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$$//') ; \ + if [ -z "$${line}" ]; then \ + continue; + fi; \ + if [ "`expr substr "$$line" 1 1`" = "#" ]; then \ + continue; \ + fi; \ + file_list="$${file_list} hd1k_$${line}.img"; \ + done < $^ ; \ + echo "$${file_list}"; \ + cat $(HD1KPREFIX) $${file_list} > $@ # # this somewhat impenetrable and fragile code is used to build each of the images diff --git a/Source/Images/all.def.example b/Source/Images/all.def.example new file mode 100644 index 00000000..2caed21b --- /dev/null +++ b/Source/Images/all.def.example @@ -0,0 +1,25 @@ +# This image definition shows how to generate +# an disk image containing all of the available +# slices. + +aztecc +bascomp +blank +cobol +cowgol +cpm22 +cpm3 +fortran +games +hitechc +infocom +msxroms1 +msxroms2 +nzcom +qpm +tpascal +ws4 +z3plus +z80asm +zpm3 +zsdos diff --git a/Source/Images/combo.def b/Source/Images/combo.def new file mode 100644 index 00000000..2dc41f15 --- /dev/null +++ b/Source/Images/combo.def @@ -0,0 +1,8 @@ +# This is the ubiquituous Combo image for RomWBW + +cpm22 +zsdos +nzcom +cpm3 +zpm3 +ws4