forked from MirrorRepos/RomWBW
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.6 KiB
69 lines
1.6 KiB
#Param([Parameter(Mandatory)]$Disk, $SysFile="")
|
|
Param($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
|
|
$Blank = ([byte[]](0xE5) * $Size)
|
|
[System.IO.File]::WriteAllBytes($ImgFile, $Blank)
|
|
|
|
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
|
|
|
|
$Cmd = "mkfs.cpm -f $Fmt -b $SysFile $ImgFile"
|
|
$Cmd
|
|
Invoke-Expression $Cmd
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|
|
"Moving image $ImgFile into output directory..."
|
|
|
|
#&$env:COMSPEC /c move $ImgFile ..\..\Binary\
|
|
Move-Item $ImgFile -Destination "..\..\Binary\" -Force
|
|
|
|
return
|