Disk images created as part of the build process can now be made bootable without requiring the user to run SYSCOPY. Some of the disk images are now bootable.
61 lines
1.3 KiB
PowerShell
61 lines
1.3 KiB
PowerShell
Param([Parameter(Mandatory)]$Disk, $SysFile="")
|
|
|
|
$ErrorAction = 'Stop'
|
|
|
|
$ImgFile = "fd_${Disk}.img"
|
|
$Fmt = "wbw_fd144"
|
|
$Size = 1440KB
|
|
|
|
$CpmToolsPath = '../../Tools/cpmtools'
|
|
|
|
$env:PATH = $CpmToolsPath + ';' + $env:PATH
|
|
|
|
if (-not (Test-Path("d_${Disk}/")))
|
|
{
|
|
"Source directory d_${Disk} for disk ${Disk} not found!"
|
|
return
|
|
}
|
|
|
|
"Generating Floppy Disk ${Disk}..."
|
|
|
|
$Blank = ([string]([char]0xE5)) * $Size
|
|
Set-Content -Value $Blank -NoNewLine -Path $ImgFile
|
|
|
|
for ($Usr=0; $Usr -lt 16; $Usr++)
|
|
{
|
|
if (Test-Path ("d_${Disk}/u${Usr}/*"))
|
|
{
|
|
$Cmd = "cpmcp -f $Fmt $ImgFile d_${Disk}/u${Usr}/*.* ${Usr}:"
|
|
$Cmd
|
|
Invoke-Expression $Cmd
|
|
}
|
|
}
|
|
|
|
if (Test-Path("d_${Disk}.txt"))
|
|
{
|
|
foreach($Line in Get-Content "d_${Disk}.txt")
|
|
{
|
|
$Spec = $Line.Trim()
|
|
if (($Spec.Length -gt 0) -and ($Spec.Substring(0,1) -ne "#"))
|
|
{
|
|
$Cmd = "cpmcp -f $Fmt $ImgFile ${Spec}"
|
|
$Cmd
|
|
Invoke-Expression $Cmd
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($SysFile.Length -gt 0)
|
|
{
|
|
"Adding System Image $SysFile..."
|
|
$Sys = Get-Content -Path "$SysFile.sys" -Raw
|
|
$Img = Get-Content -Path $ImgFile -Raw
|
|
$NewImg = $Sys + $Img.SubString($Sys.Length, $Img.Length - $Sys.Length)
|
|
Set-Content -NoNewLine -Path $ImgFile $NewImg
|
|
}
|
|
|
|
"Moving image $ImgFile into output directory..."
|
|
|
|
&$env:COMSPEC /c move $ImgFile ..\..\Binary\
|
|
|
|
return |