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.

55 line
2.4KB

  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 -TimingBar
  12. pwsh -File tools/run.ps1 -Target c64 -PathTest
  13. .PARAMETER TimingBar
  14. Build with the assembler symbol TIMING_BAR into a separate program (<name>-timing.prg) whose border colour
  15. shows the CPU's work in each frame (see src/main.s). The normal build is not touched.
  16. .PARAMETER PathTest
  17. Build with the assembler symbol PATH_TEST into <name>-pathtest.prg: worn paths appear after 8 steps
  18. into a cell and fade below 4, with fast decay (see src/paths.inc), so they can be watched in minutes.
  19. #>
  20. [CmdletBinding()]
  21. param(
  22. [string]$Target,
  23. [switch]$NoBuild,
  24. [ValidateSet('pal', 'ntsc')][string]$Video,
  25. [switch]$TimingBar,
  26. [switch]$PathTest
  27. )
  28. . (Join-Path $PSScriptRoot 'lib.ps1')
  29. try {
  30. $project = Get-ProjectConfig
  31. $t = if ($Target) { Get-ProjectTargets $project $Target } else { @($project.resolved.targets)[0] }
  32. if ($TimingBar) { Set-TargetVariant $t 'TIMING_BAR' 'timing' }
  33. if ($PathTest) { Set-TargetVariant $t 'PATH_TEST' 'pathtest' }
  34. if (-not $NoBuild) { Invoke-TargetBuild $project $t @{} }
  35. 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." }
  36. $emu = Get-ToolPath $project $t.emulator.binary
  37. if ($Video) { $t.video = $Video }
  38. $vargs = @(Get-VideoArgs $t) + @($t.emulator.args)
  39. if ($t.emulator.autostart -ne 'disk' -and $t.disk) { $vargs += @('-8', (Get-RepoPath $t.disk.image)) }
  40. $vargs += @('-autostart', (Get-AutostartFile $t))
  41. $quoted = $vargs | ForEach-Object { if ($_ -match '\s') { '"' + $_ + '"' } else { $_ } }
  42. Write-Host "[$($t.id)] starting $($t.emulator.binary) $($quoted -join ' ')"
  43. Start-Process -FilePath $emu -ArgumentList $quoted | Out-Null
  44. Write-Host "Expected: $($t.expectedBehavior)"
  45. } catch [MissingToolException] {
  46. Write-Host $_.Exception.Message -ForegroundColor Yellow
  47. exit 2
  48. } catch {
  49. Write-Host "RUN FAILED: $($_.Exception.Message)" -ForegroundColor Red
  50. exit 1
  51. }

Powered by TurnKey Linux.