<# .SYNOPSIS Build a target and start it in VICE for interactive testing. .DESCRIPTION Starts the emulator listed for the target in project.json with the target's display and video options, attaches the disk image when there is one, and autostarts the program. VICE uses your normal VICE settings here (unlike tools/smoke.ps1). .EXAMPLE pwsh -File tools/run.ps1 pwsh -File tools/run.ps1 -Target c128-80 pwsh -File tools/run.ps1 -Target c64 -TimingBar pwsh -File tools/run.ps1 -Target c64 -PathTest .PARAMETER TimingBar Build with the assembler symbol TIMING_BAR into a separate program (-timing.prg) whose border colour shows the CPU's work in each frame (see src/main.s). The normal build is not touched. .PARAMETER PathTest Build with the assembler symbol PATH_TEST into -pathtest.prg: worn paths appear after 8 steps into a cell and fade below 4, with fast decay (see src/paths.inc), so they can be watched in minutes. #> [CmdletBinding()] param( [string]$Target, [switch]$NoBuild, [ValidateSet('pal', 'ntsc')][string]$Video, [switch]$TimingBar, [switch]$PathTest ) . (Join-Path $PSScriptRoot 'lib.ps1') try { $project = Get-ProjectConfig $t = if ($Target) { Get-ProjectTargets $project $Target } else { @($project.resolved.targets)[0] } if ($TimingBar) { Set-TargetVariant $t 'TIMING_BAR' 'timing' } if ($PathTest) { Set-TargetVariant $t 'PATH_TEST' 'pathtest' } if (-not $NoBuild) { Invoke-TargetBuild $project $t @{} } if ($t.build.kind -eq 'none' -and -not $t.disk) { throw "Target $($t.id) is built on the Commodore; follow docs/toolchain.md to load it." } $emu = Get-ToolPath $project $t.emulator.binary if ($Video) { $t.video = $Video } $vargs = @(Get-VideoArgs $t) + @($t.emulator.args) if ($t.emulator.autostart -ne 'disk' -and $t.disk) { $vargs += @('-8', (Get-RepoPath $t.disk.image)) } $vargs += @('-autostart', (Get-AutostartFile $t)) $quoted = $vargs | ForEach-Object { if ($_ -match '\s') { '"' + $_ + '"' } else { $_ } } Write-Host "[$($t.id)] starting $($t.emulator.binary) $($quoted -join ' ')" Start-Process -FilePath $emu -ArgumentList $quoted | Out-Null Write-Host "Expected: $($t.expectedBehavior)" } catch [MissingToolException] { Write-Host $_.Exception.Message -ForegroundColor Yellow exit 2 } catch { Write-Host "RUN FAILED: $($_.Exception.Message)" -ForegroundColor Red exit 1 }