# E07-S02: prepare a disposable development disk and autostart the Nova128 # compiler in x128. # # The session is strictly sequential: this launcher refuses to start while an # editor session owns the same image, waits for x128 to exit and for the image # to flush, and rebuilds the disposable image from its clean source. [CmdletBinding()] param( [string]$CompilerPrg = "", [string]$DiskImage = "", [int]$LimitCycles = 0, [string]$Screenshot = "", [string]$Keys = "", [int]$KeyDelay = 3000, [switch]$Warp, [switch]$SkipPrepare ) $ErrorActionPreference = "Stop" $project = Split-Path $PSScriptRoot -Parent $build = Join-Path $project "build" Import-Module (Join-Path $PSScriptRoot "lib\Nova128Launcher.psm1") -Force if ($CompilerPrg -eq "") { $CompilerPrg = Join-Path $build "n128c.prg" } if ($DiskImage -eq "") { $DiskImage = Join-Path $build "newlang-dev.d81" } $CompilerPrg = [IO.Path]::GetFullPath($CompilerPrg) $DiskImage = [IO.Path]::GetFullPath($DiskImage) if (-not (Test-Path -LiteralPath $CompilerPrg -PathType Leaf)) { throw "compiler program not found: $CompilerPrg (build N128C.PRG first)" } $null = Get-Nova128ViceTool "x128" if (-not $SkipPrepare) { & (Join-Path $PSScriptRoot "prepare-disk.ps1") -OutputImage $DiskImage ` -CompilerPrg $CompilerPrg -RequireCompiler | Out-Host } $session = $null try { $session = Enter-Nova128ImageSession -Image $DiskImage -Kind "compiler" $null = Invoke-Nova128Emulator -Emulator "x128" -Program $CompilerPrg ` -DiskImage $DiskImage -Screenshot $Screenshot -LimitCycles $LimitCycles ` -Keys $Keys -KeyDelay $KeyDelay -Warp:$Warp } finally { if ($session) { Exit-Nova128ImageSession -Session $session } } Write-Host "compiler session closed and the image is flushed" Write-Host "close this session before editing or inspecting the disk again"