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.

46 line
1.9KB

  1. <#
  2. .SYNOPSIS
  3. Build a target and start it in VICE for interactive testing.
  4. .DESCRIPTION
  5. Starts the emulator listed for the target in project.json with the target's display and
  6. video options, attaches the disk image when there is one, and autostarts the program.
  7. VICE uses your normal VICE settings here (unlike tools/smoke.ps1).
  8. .EXAMPLE
  9. pwsh -File tools/run.ps1
  10. pwsh -File tools/run.ps1 -Target c128-80
  11. pwsh -File tools/run.ps1 -Target c64 -Define FIXED_SEED=12345 # extra cl65 -D define(s)
  12. #>
  13. [CmdletBinding()]
  14. param(
  15. [string]$Target,
  16. [switch]$NoBuild,
  17. [string[]]$Define,
  18. [ValidateSet('pal', 'ntsc')][string]$Video
  19. )
  20. . (Join-Path $PSScriptRoot 'lib.ps1')
  21. try {
  22. $project = Get-ProjectConfig
  23. $t = if ($Target) { Get-ProjectTargets $project $Target } else { @($project.resolved.targets)[0] }
  24. if ($Define) { $t.build.defines = @($t.build.defines) + $Define }
  25. if (-not $NoBuild) { Invoke-TargetBuild $project $t @{} }
  26. 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." }
  27. $emu = Get-ToolPath $project $t.emulator.binary
  28. if ($Video) { $t.video = $Video }
  29. $vargs = @(Get-VideoArgs $t) + @($t.emulator.args)
  30. if ($t.emulator.autostart -ne 'disk' -and $t.disk) { $vargs += @('-8', (Get-RepoPath $t.disk.image)) }
  31. $vargs += @('-autostart', (Get-AutostartFile $t))
  32. $quoted = $vargs | ForEach-Object { if ($_ -match '\s') { '"' + $_ + '"' } else { $_ } }
  33. Write-Host "[$($t.id)] starting $($t.emulator.binary) $($quoted -join ' ')"
  34. Start-Process -FilePath $emu -ArgumentList $quoted | Out-Null
  35. Write-Host "Expected: $($t.expectedBehavior)"
  36. } catch [MissingToolException] {
  37. Write-Host $_.Exception.Message -ForegroundColor Yellow
  38. exit 2
  39. } catch {
  40. Write-Host "RUN FAILED: $($_.Exception.Message)" -ForegroundColor Red
  41. exit 1
  42. }

Powered by TurnKey Linux.