No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

59 líneas
2.4KB

  1. <#
  2. .SYNOPSIS
  3. Put the current source on a transfer disk image for the Commodore (on-Commodore workflow).
  4. .DESCRIPTION
  5. The Git repository stays on this Windows host. This script prepares the disk image you
  6. attach in VICE (File > Attach disk image > drive 8) or copy to a real disk/SD card:
  7. - BASIC projects: tokenizes src/main.bas with petcat and writes the PRG to the image.
  8. - Other projects: copies the files listed in project.json (resolved.onCommodore.files).
  9. Then, on the Commodore: LOAD"<name>",8 and RUN (or load it into your native tool).
  10. .EXAMPLE
  11. pwsh -File tools/to-commodore.ps1
  12. #>
  13. [CmdletBinding()]
  14. param()
  15. . (Join-Path $PSScriptRoot 'lib.ps1')
  16. try {
  17. $project = Get-ProjectConfig
  18. $oc = $project.resolved.onCommodore
  19. if (-not $oc) { throw 'This project does not use the on-Commodore workflow.' }
  20. $c1541 = Get-ToolPath $project 'c1541'
  21. $image = Get-RepoPath $oc.image
  22. $stage = Split-Path $image -Parent
  23. New-Item -ItemType Directory -Force -Path $stage | Out-Null
  24. $files = @()
  25. if ($oc.kind -eq 'basic') {
  26. $petcat = Get-ToolPath $project 'petcat'
  27. $prg = Join-Path $stage "$($oc.programName).prg"
  28. Invoke-Tool $petcat @("-w$($oc.dialect)", '-f', '-o', $prg, '--', (Get-RepoPath $oc.source))
  29. $files += @{ path = $prg; dest = $oc.programName }
  30. }
  31. foreach ($f in @($oc.files)) {
  32. if (-not $f) { continue }
  33. $src = Get-RepoPath $f.source
  34. if ($f.convert -eq 'ascii-to-petscii') {
  35. $conv = Join-Path $stage ($f.name + '.petscii')
  36. [IO.File]::WriteAllBytes($conv, (ConvertTo-Petscii ([IO.File]::ReadAllBytes($src)) $f.lineEndings))
  37. $src = $conv
  38. }
  39. $files += @{ path = $src; dest = $(if ($f.type -eq 'seq') { "$($f.name),s" } else { $f.name }) }
  40. }
  41. if (Test-Path -LiteralPath $image) { Remove-Item -LiteralPath $image }
  42. $toolArgs = @('-format', $oc.diskName, $oc.diskFormat, $image)
  43. foreach ($f in $files) { $toolArgs += @('-write', $f.path, $f.dest) }
  44. $toolArgs += '-list'
  45. Invoke-Tool $c1541 $toolArgs
  46. Write-Host ""
  47. Write-Host "Transfer disk ready: $($oc.image)"
  48. Write-Host "On the Commodore (or VICE with the image on drive 8): $($oc.loadCommand)"
  49. } catch [MissingToolException] {
  50. Write-Host $_.Exception.Message -ForegroundColor Yellow
  51. exit 2
  52. } catch {
  53. Write-Host "FAILED: $($_.Exception.Message)" -ForegroundColor Red
  54. exit 1
  55. }

Powered by TurnKey Linux.