Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

77 строки
3.1KB

  1. # E05-S02: run the class descriptor/object fixture in x128 and verify the
  2. # descriptor ABI, object headers, and deterministic CLASS MAP records.
  3. [CmdletBinding()]
  4. param([int]$Port = 6552, [int]$TimeoutSeconds = 90)
  5. $ErrorActionPreference = "Stop"
  6. $project = Split-Path $PSScriptRoot -Parent
  7. Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force
  8. & (Join-Path $PSScriptRoot "build-class-test.ps1")
  9. $out = Join-Path $project "build\class-test"
  10. $disk = Join-Path $out "class-test.d81"
  11. $labels = Join-Path $out "class-test.lbl"
  12. $c1541 = Get-ViceTool "c1541"
  13. $failures = @()
  14. $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port `
  15. -Screenshot (Join-Path $out "class-test-vicii.png")
  16. try {
  17. $mb = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds
  18. Start-Sleep -Milliseconds 500
  19. $screenRam = Read-Nova128Memory $session 0x0400 1000
  20. } finally {
  21. Stop-Nova128X128 $session -SettleSeconds 0
  22. }
  23. if ($mb[2] -ne 0x03) { $failures += "producer $($mb[2]) expected 3" }
  24. if ($mb[3] -ne 0xA5) { $failures += ("status {0:X2} expected A5" -f $mb[3]) }
  25. if ($mb[4] -ne 0 -or $mb[5] -ne 0) { $failures += "code $($mb[4] + 256 * $mb[5]) expected 0" }
  26. for ($i = 0; $i -lt 8; $i++) {
  27. if ($mb[8 + $i] -ne 1) { $failures += "phase $i flag is $($mb[8 + $i]), expected 1" }
  28. }
  29. $rows = for ($r = 0; $r -lt 25; $r++) {
  30. $chars = for ($c = 0; $c -lt 40; $c++) {
  31. $code = $screenRam[$r * 40 + $c]
  32. if ($code -le 0x1F) { [char]($code + 0x40) } elseif ($code -le 0x3F) { [char]$code } else { '?' }
  33. }
  34. (-join $chars).TrimEnd()
  35. }
  36. if (-not ($rows -contains "NOVA128 CLASS TEST OK")) {
  37. $failures += "screen does not contain 'NOVA128 CLASS TEST OK'"
  38. }
  39. function Read-DiskFile([string]$Name, [string]$Dest, [bool]$Seq) {
  40. if (Test-Path -LiteralPath $Dest) { Remove-Item -LiteralPath $Dest -Force }
  41. $spec = if ($Seq) { "$Name,s" } else { $Name }
  42. & $c1541 -attach $disk -read $spec $Dest 2>&1 | Out-Null
  43. if (-not (Test-Path -LiteralPath $Dest)) { throw "could not read $Name from the test disk" }
  44. }
  45. $mapPath = Join-Path $out "CLASSTEST.MAP"
  46. Read-DiskFile "classtest.map" $mapPath $true
  47. $mapLines = ([IO.File]::ReadAllText($mapPath)).TrimEnd("`r", "`n") -split "`r`n|`r|`n"
  48. $destroy = Get-Nova128Label $labels "destroy_b"
  49. $ifdir = Get-Nova128Label $labels "iface_dir"
  50. $expectedMap = @(
  51. "NOVA128 MAP 1",
  52. "ENTRY 1C0D",
  53. "SECTION STUB 1C01 000C",
  54. "SECTION START 1C0D 004A",
  55. ("CLASS EMPTY 0007 0000 00 0000"),
  56. ("CLASS BOX 0023 {0:X4} 01 {1:X4}" -f $destroy, $ifdir))
  57. if (($mapLines -join "`n") -ne ($expectedMap -join "`n")) {
  58. $failures += ("CLASSTEST.MAP differs:`n got: " + ($mapLines -join "`n ") +
  59. "`n want: " + ($expectedMap -join "`n "))
  60. }
  61. if ($failures) {
  62. throw ("class verification failed:`n " + ($failures -join "`n "))
  63. }
  64. Write-Host "screen:"
  65. $rows | Where-Object { $_ } | ForEach-Object { Write-Host " |$_" }
  66. Write-Host ("mailbox: producer 3, PASS, all 8 descriptor/MAP flags set; destroy {0:X4}, ifdir {1:X4}" -f $destroy, $ifdir)
  67. Write-Host "MAP:"
  68. $expectedMap | ForEach-Object { Write-Host " |$_" }

Powered by TurnKey Linux.