diff --git a/Source/Images/Build.cmd b/Source/Images/Build.cmd index 4d38b33c..017dbc26 100644 --- a/Source/Images/Build.cmd +++ b/Source/Images/Build.cmd @@ -5,11 +5,23 @@ echo : echo : Cleaning... echo : call Clean.cmd + echo : echo : Building Floppy Disk Images... echo : -call BuildFD.cmd +call BuildFD.cmd cpm22 +call BuildFD.cmd zsdos +call BuildFD.cmd nzcom +call BuildFD.cmd cpm3 +call BuildFD.cmd zpm3 +call BuildFD.cmd ws4 + echo : echo : Building Hard Disk Images... echo : -call BuildHD.cmd +call BuildHD.cmd cpm22 +call BuildHD.cmd zsdos +call BuildHD.cmd nzcom +call BuildHD.cmd cpm3 +call BuildHD.cmd zpm3 +call BuildHD.cmd ws4 diff --git a/Source/Images/BuildFD.ps1 b/Source/Images/BuildFD.ps1 index ac5a4268..b48612ed 100644 --- a/Source/Images/BuildFD.ps1 +++ b/Source/Images/BuildFD.ps1 @@ -1,33 +1,48 @@ +Param([Parameter(Mandatory)]$Disk) + $ErrorAction = 'Stop' +if (-not (Test-Path("d_${Disk}/"))) +{ + "Source directory d_${Disk} for disk ${Disk} not found!" + return +} + $CpmToolsPath = '../../Tools/cpmtools' $env:PATH = $CpmToolsPath + ';' + $env:PATH -$Blank = ([byte[]](0xE5) * 1440KB) +"Generating Floppy Disk ${Disk}..." + +$Blank = ([string]([char]0xE5)) * 1440KB +Set-Content -Value $Blank -NoNewLine -Path "fd_${Disk}.img" -"Creating work file..." -if (!(Test-Path('Blank.tmp'))) {Set-Content -Value $Blank -Encoding byte -Path 'Blank.tmp'} +for ($Usr=0; $Usr -lt 16; $Usr++) +{ + if (Test-Path ("d_${Disk}/u${Usr}/*")) + { + $Cmd = "cpmcp -f wbw_fd144 fd_${Disk}.img d_${Disk}/u${Usr}/*.* ${Usr}:" + $Cmd + Invoke-Expression $Cmd + } +} -"Creating floppy disk images..." -foreach ($Dsk in @("cpm3","cpm22","nzcom","ws4","zpm3","zsdos")) +if (Test-Path("d_${Disk}.txt")) { - "Generating Floppy Disk ${Dsk}..." - copy "Blank.tmp" "fd_${Dsk}.img" - for ($Usr=0; $Usr -lt 16; $Usr++) + foreach($Line in Get-Content "d_${Disk}.txt") { - if (Test-Path ("d_${Dsk}/u${Usr}/*")) + $Spec = $Line.Trim() + if (($Spec.Length -gt 0) -and ($Spec.Substring(0,1) -ne "#")) { - $Cmd = "cpmcp -f wbw_fd144 fd_${Dsk}.img d_${Dsk}/u${Usr}/*.* ${Usr}:" + $Cmd = "cpmcp -f wbw_fd144 fd_${Disk}.img ${Spec}" $Cmd Invoke-Expression $Cmd } } } -"Moving images into output directory..." -&$env:COMSPEC /c move fd_*.img ..\..\Binary\ +"Moving image fd_${Disk}.img into output directory..." -Remove-Item *.tmp +&$env:COMSPEC /c move fd_${Disk}.img ..\..\Binary\ return \ No newline at end of file diff --git a/Source/Images/BuildHD.ps1 b/Source/Images/BuildHD.ps1 index a45b98f3..2f3d5c28 100644 --- a/Source/Images/BuildHD.ps1 +++ b/Source/Images/BuildHD.ps1 @@ -1,33 +1,48 @@ +Param([Parameter(Mandatory)]$Disk) + $ErrorAction = 'Stop' +if (-not (Test-Path("d_${Disk}/"))) +{ + "Source directory d_${Disk} for disk ${Disk} not found!" + return +} + $CpmToolsPath = '../../Tools/cpmtools' $env:PATH = $CpmToolsPath + ';' + $env:PATH -$Blank = ([byte[]](0xE5) * (128KB * 65)) +"Generating Hard Disk ${Disk}..." + +$Blank = ([string]([char]0xE5)) * (128KB * 65) +Set-Content -Value $Blank -NoNewLine -Path "hd_${Disk}.img" -"Creating work file..." -if (!(Test-Path('Blank.tmp'))) {Set-Content -Value $Blank -Encoding byte -Path 'Blank.tmp'} +for ($Usr=0; $Usr -lt 16; $Usr++) +{ + if (Test-Path ("d_${Disk}/u${Usr}/*")) + { + $Cmd = "cpmcp -f wbw_hd0 hd_${Disk}.img d_${Disk}/u${Usr}/*.* ${Usr}:" + $Cmd + Invoke-Expression $Cmd + } +} -"Creating hard disk images..." -foreach ($Dsk in @("cpm3","cpm22","nzcom","ws4","zpm3","zsdos")) +if (Test-Path("d_${Disk}.txt")) { - "Generating Hard Disk ${Dsk}..." - copy "Blank.tmp" "hd_${Dsk}.img" - for ($Usr=0; $Usr -lt 16; $Usr++) + foreach($Line in Get-Content "d_${Disk}.txt") { - if (Test-Path ("d_${Dsk}/u${Usr}/*")) + $Spec = $Line.Trim() + if (($Spec.Length -gt 0) -and ($Spec.Substring(0,1) -ne "#")) { - $Cmd = "cpmcp -f wbw_hd0 hd_${Dsk}.img d_${Dsk}/u${Usr}/*.* ${Usr}:" + $Cmd = "cpmcp -f wbw_hd0 hd_${Disk}.img ${Spec}" $Cmd Invoke-Expression $Cmd } } } -"Moving images into output directory..." -&$env:COMSPEC /c move hd_*.img ..\..\Binary\ +"Moving image hd_${Disk}.img into output directory..." -Remove-Item *.tmp +&$env:COMSPEC /c move hd_${Disk}.img ..\..\Binary\ return \ No newline at end of file diff --git a/Source/Images/ReadMe.txt b/Source/Images/ReadMe.txt index 2c68f5eb..0ba5b130 100644 --- a/Source/Images/ReadMe.txt +++ b/Source/Images/ReadMe.txt @@ -57,8 +57,8 @@ command prompt. Build.cmd in turn invokes separate scripts to create the floppy and hard disk images. As distributed, you will see that there are several d_ directories -populated with files. If you look at the BuildFD.ps1 and BuildHD.ps1 -scripts, you will find that the names of each of these directories is +populated with files. If you look at the Build.cmd +script, you will find that the names of each of these directories is listed. If you want to add a new d_ directory to be converted into a disk image, you will need to add the name of your new directory to this list. Note that each d_ directory may be turned into a floppy @@ -76,10 +76,10 @@ hard disk. Note that cpmtools is used to generate the images and is included in the distribution under the Tools directory. The scripts are intended to be run from a command prompt. Open a -command prompt and navigate to the Images directory. To build the -floppy disk images, use the command "BuildFD". To build the hard disk -images, use the command "BuildHD". You can use the command "Build" -to build both the floppy and hard disk images in one run. +command prompt and navigate to the Images directory. Use the command +"Build" to build both the floppy and hard disk images in one run. +You can build a single disk image by running either BuildFD.cmd or +BuildHD.cmd with a single parameter specifying the disk name. After completion of the script, the resultant image files are placed in the Binary directory with names such as fd_xxx.img and hd_xxx.img.