選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

68 行
2.8KB

  1. # E04-S05: run the print/fault runtime test in x128, then check the screen
  2. # text and the mailbox failure fields.
  3. [CmdletBinding()]
  4. param([int]$Port = 6546, [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-print-test.ps1")
  9. $out = Join-Path $project "build\print-test"
  10. $disk = Join-Path $out "print-test.d81"
  11. $expected = @(
  12. "NOVA128 PRINT TEST",
  13. "TEXT OK",
  14. "BYTE 0 7 255",
  15. "WORD 0 12345 65535",
  16. "INT -1 -32768 32767",
  17. "BOOL FALSE TRUE",
  18. "CHAR A",
  19. "RUNTIME FAULT R001",
  20. "RUNTIME FAULT R002",
  21. "RUNTIME FAULT R003",
  22. "RUNTIME FAULT R004",
  23. "RUNTIME FAULT R005")
  24. $failures = @()
  25. $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port `
  26. -Screenshot (Join-Path $out "print-test-vicii.png")
  27. try {
  28. $null = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds
  29. Start-Sleep -Seconds 2 # all five fault lines are printed
  30. $mb = Read-Nova128Memory $session 0x1BF0 16
  31. $screenRam = Read-Nova128Memory $session 0x0400 1000
  32. } finally {
  33. Stop-Nova128X128 $session -SettleSeconds 0
  34. }
  35. # ------------------------------------------------------------- mailbox
  36. if ($mb[2] -ne 0x03) { $failures += ("producer $($mb[2]) expected 3 (generated program)") }
  37. if ($mb[3] -ne 0xFA) { $failures += ("status ${0:X2} expected FA (failure)" -f $mb[3]) }
  38. if ($mb[4] -ne 5 -or $mb[5] -ne 0) { $failures += ("code {0} expected 5 (heap)" -f ($mb[4] + 256 * $mb[5])) }
  39. $addr = $mb[6] + 256 * $mb[7]
  40. if ($addr -ne 0x1234) { $failures += ("address ${0:X4} expected 1234" -f $addr) }
  41. if ($mb[8] -ne 1) { $failures += "CR/RCR changed across the print and fault calls" }
  42. # -------------------------------------------------------------- screen
  43. $rows = for ($r = 0; $r -lt 25; $r++) {
  44. $chars = for ($c = 0; $c -lt 40; $c++) {
  45. $code = $screenRam[$r * 40 + $c]
  46. if ($code -le 0x1F) { [char]($code + 0x40) } elseif ($code -le 0x3F) { [char]$code } else { '?' }
  47. }
  48. (-join $chars).TrimEnd()
  49. }
  50. for ($r = 0; $r -lt $expected.Count; $r++) {
  51. if ($rows[$r] -cne $expected[$r]) {
  52. $failures += "screen row ${r}: '$($rows[$r])' expected '$($expected[$r])'"
  53. }
  54. }
  55. $wide = @($rows[0..($expected.Count - 1)] | Where-Object { $_.Length -gt 39 })
  56. if ($wide) { $failures += "screen rows longer than 39: $($wide -join ' | ')" }
  57. if ($failures) { throw ("print runtime verification failed:`n " + ($failures -join "`n ")) }
  58. Write-Host "screen:"
  59. $rows[0..($expected.Count - 1)] | ForEach-Object { Write-Host " |$_" }
  60. Write-Host ("mailbox: producer 3, status FA, code 5, address {0:X4}, mapping preserved" -f $addr)
  61. Write-Host "verified print formatting, fault reporting, and mapping stability"

Powered by TurnKey Linux.