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.

89 line
3.5KB

  1. # E06-S03: run the interface table fixture in x128 and check its mailbox and
  2. # the TABLE records in IFTTEST.MAP.
  3. [CmdletBinding()]
  4. param([int]$Port = 6559, [int]$TimeoutSeconds = 180)
  5. $ErrorActionPreference = "Stop"
  6. $project = Split-Path $PSScriptRoot -Parent
  7. Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force
  8. & (Join-Path $PSScriptRoot "build-iftable-test.ps1")
  9. $out = Join-Path $project "build\iftable-test"
  10. $disk = Join-Path $out "iftable-test.d81"
  11. $labels = Join-Path $out "iftable-test.lbl"
  12. $c1541 = Get-ViceTool "c1541"
  13. $failures = @()
  14. $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port `
  15. -Screenshot (Join-Path $out "iftable-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 IFTABLE TEST OK")) {
  37. $failures += "screen does not contain 'NOVA128 IFTABLE 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. $prev = $ErrorActionPreference
  43. $ErrorActionPreference = "Continue"
  44. & $c1541 -attach $disk -read $spec $Dest 2>&1 | Out-Null
  45. $ErrorActionPreference = $prev
  46. return (Test-Path -LiteralPath $Dest)
  47. }
  48. $mapPath = Join-Path $out "IFTTEST.MAP"
  49. if (Read-DiskFile "ifttest.map" $mapPath $true) {
  50. $mapLines = ([IO.File]::ReadAllText($mapPath)).TrimEnd("`r", "`n") -split "`r`n|`r|`n"
  51. } else {
  52. $failures += ("no IFTTEST.MAP (check at {0:X2}{1:X2})" -f $mb[7], $mb[6])
  53. $mapLines = @()
  54. }
  55. $alphaA = Get-Nova128Label $labels "m_alpha_a"
  56. $betaA = Get-Nova128Label $labels "m_beta_a"
  57. $alphaB = Get-Nova128Label $labels "m_alpha_b"
  58. $betaB = Get-Nova128Label $labels "m_beta_b"
  59. $expectedMap = @(
  60. "NOVA128 MAP 1",
  61. "ENTRY 1C0D",
  62. "SECTION STUB 1C01 000C",
  63. "SECTION START 1C0D 004A",
  64. ("TABLE A IFOO B000 02 {0:X4} {1:X4}" -f $alphaA, $betaA),
  65. ("TABLE A IBAR B004 01 {0:X4}" -f $alphaA),
  66. ("TABLE B IFOO B006 02 {0:X4} {1:X4}" -f $alphaB, $betaB))
  67. if ($mapLines -and ($mapLines -join "`n") -ne ($expectedMap -join "`n")) {
  68. $failures += ("IFTTEST.MAP differs:`n got: " + ($mapLines -join "`n ") +
  69. "`n want: " + ($expectedMap -join "`n "))
  70. }
  71. $detail = "last check {0:X4} value {1:X2}" -f ($mb[6] + 256 * $mb[7]), $mb[4]
  72. if ($failures) {
  73. throw ("interface table verification failed ($detail):`n " + ($failures -join "`n ") +
  74. "`n screen:`n " + (($rows | Where-Object { $_ }) -join "`n "))
  75. }
  76. Write-Host "screen:"
  77. $rows | Where-Object { $_ } | ForEach-Object { Write-Host " |$_" }
  78. Write-Host "mailbox: producer 3, PASS, all 8 table flags set"
  79. Write-Host "MAP:"
  80. $expectedMap | ForEach-Object { Write-Host " |$_" }

Powered by TurnKey Linux.