Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

48 lignes
3.0KB

  1. # pc-run.ps1 - link given object files with the ORIGINAL Power C linker (copy of POWERc.d81),
  2. # optionally run the program and type keys at it. The original disk image is never written.
  3. # pc-run.ps1 -Obj a.o,b.o -Name prog -Dir outdir [-Keys 'text\n'] [-Data file1,file2]
  4. param([string[]]$Obj, [string]$Name = "prog", [string]$Dir, [string]$Keys = "", [string[]]$Data = @(), [string[]]$LibObj = @(),
  5. [int]$Delay = 900, [int]$Tail = 8, [int]$Settle = 15, [string]$Shot = "run.png")
  6. $ErrorActionPreference = "Continue"
  7. $vice = "C:\Program Files\GTK3VICE-3.10-win64\bin"
  8. $x64 = Join-Path $vice "x64sc.exe"; $c1541 = Join-Path $vice "c1541.exe"
  9. $Obj = @($Obj | % { $_ -split "," } | % { (Resolve-Path $_).Path })
  10. $LibObj = @($LibObj | ? { $_ } | % { $_ -split "," } | % { (Resolve-Path $_).Path })
  11. $Data = @($Data | ? { $_ } | % { $_ -split "," } | % { (Resolve-Path $_).Path })
  12. New-Item -ItemType Directory -Force -Path $Dir | Out-Null
  13. $Dir = (Resolve-Path $Dir).Path
  14. $here = $PSScriptRoot
  15. $base = (Resolve-Path (Join-Path $here "..\..\POWERc.d81")).Path
  16. $wd = Join-Path $here "..\work"; New-Item -ItemType Directory -Force -Path $wd | Out-Null; $wd = (Resolve-Path $wd).Path
  17. Set-Location $wd
  18. $img = "r.d81"; Copy-Item $base $img -Force
  19. $names = @()
  20. foreach ($o in $Obj) {
  21. $n = [IO.Path]::GetFileNameWithoutExtension($o); $names += $n
  22. $null = & $c1541 $img -delete "$n.o" 2>$null
  23. $null = & $c1541 $img -write $o "$n.o,s" 2>$null
  24. }
  25. foreach ($l in $LibObj) { $ln = [IO.Path]::GetFileName($l); $null = & $c1541 $img -delete $ln 2>$null; $null = & $c1541 $img -write $l "$ln,s" 2>$null }
  26. foreach ($d in $Data) { $null = & $c1541 $img -write $d ([IO.Path]::GetFileName($d) + ",s") 2>$null }
  27. function Quote-Arg([string]$a) {
  28. if ($a -ne "" -and $a -notmatch '[\s"]') { return $a }
  29. $e = $a -replace '(\\*)"', '$1$1\"'; $e = $e -replace '(\\+)$', '$1$1'; return '"' + $e + '"'
  30. }
  31. $kb = "link -s\n"
  32. foreach ($n in $names) { $kb += "$n.o\n" }
  33. $kb += "^\n\n$Name\n" + ("\n" * $Tail)
  34. $haveKeys = $Keys -ne ""
  35. if ($haveKeys) {
  36. $kb += "bye\n" + ("\n" * 6) + 'load"' + $Name + '",8,1' + "\n" + ("\n" * 10) + "run\n" + $Keys
  37. }
  38. $shotp = Join-Path $Dir $Shot; if (Test-Path $shotp) { Remove-Item $shotp -Force }
  39. $cycles = [long](($kb.Length * $Delay / 1000.0 + $Settle) * 13000000); if ($cycles -gt 2000000000) { $cycles = 2000000000 }
  40. $argv = @("-8", $img, "-autostart", "${img}:shell", "-autostart-warp", "-warp", "-sounddev", "dummy",
  41. "-keybuf-delay", "$Delay", "-keybuf", $kb, "-limitcycles", "$cycles", "-exitscreenshot", $shotp)
  42. $psi = New-Object System.Diagnostics.ProcessStartInfo
  43. $psi.WorkingDirectory = $wd; $psi.FileName = $x64; $psi.Arguments = ($argv | % { Quote-Arg $_ }) -join ' '; $psi.UseShellExecute = $false
  44. $p = [Diagnostics.Process]::Start($psi); $p.WaitForExit(); Start-Sleep -Milliseconds 900
  45. $prg = Join-Path $Dir "$Name.prg"; if (Test-Path $prg) { Remove-Item $prg -Force }
  46. & $c1541 $img -read $Name $prg 2>$null | Out-Null
  47. if (Test-Path $prg) { Write-Host ("linked {0}: {1} bytes" -f $Name, (Get-Item $prg).Length) } else { Write-Host "LINK FAILED" }

Powered by TurnKey Linux.