<# .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 -Define FIXED_SEED=12345 # extra cl65 -D define(s) #> [CmdletBinding()] param( [string]$Target, [switch]$NoBuild, [string[]]$Define, [ValidateSet('pal', 'ntsc')][string]$Video ) . (Join-Path $PSScriptRoot 'lib.ps1') try { $project = Get-ProjectConfig $t = if ($Target) { Get-ProjectTargets $project $Target } else { @($project.resolved.targets)[0] } if ($Define) { $t.build.defines = @($t.build.defines) + $Define } 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 }