|
- # E06-S06: run the interface lifetime fixture in x128 and check its mailbox.
- [CmdletBinding()]
- param([int]$Port = 6561, [int]$TimeoutSeconds = 180)
-
- $ErrorActionPreference = "Stop"
- $project = Split-Path $PSScriptRoot -Parent
- Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force
- & (Join-Path $PSScriptRoot "build-lifetime-test.ps1")
-
- $out = Join-Path $project "build\lifetime-test"
- $disk = Join-Path $out "lifetime-test.d81"
- $failures = @()
-
- $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port `
- -Screenshot (Join-Path $out "lifetime-test-vicii.png")
- try {
- $mb = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds
- Start-Sleep -Milliseconds 500
- $screenRam = Read-Nova128Memory $session 0x0400 1000
- } finally {
- Stop-Nova128X128 $session -SettleSeconds 0
- }
-
- if ($mb[2] -ne 0x03) { $failures += "producer $($mb[2]) expected 3" }
- if ($mb[3] -ne 0xA5) { $failures += ("status {0:X2} expected A5" -f $mb[3]) }
- if ($mb[4] -ne 0 -or $mb[5] -ne 0) { $failures += "code $($mb[4] + 256 * $mb[5]) expected 0" }
- for ($i = 0; $i -lt 5; $i++) {
- if ($mb[8 + $i] -ne 1) { $failures += "phase $i flag is $($mb[8 + $i]), expected 1" }
- }
-
- $rows = for ($r = 0; $r -lt 25; $r++) {
- $chars = for ($c = 0; $c -lt 40; $c++) {
- $code = $screenRam[$r * 40 + $c]
- if ($code -le 0x1F) { [char]($code + 0x40) } elseif ($code -le 0x3F) { [char]$code } else { '?' }
- }
- (-join $chars).TrimEnd()
- }
- if (-not ($rows -contains "LIFETIME OK")) {
- $failures += "screen does not contain 'LIFETIME OK'"
- }
-
- if ($failures) {
- throw ("interface lifetime verification failed (code {0}, addr {1:X4}):`n " -f ($mb[4] + 256 * $mb[5]), ($mb[6] + 256 * $mb[7]) +
- ($failures -join "`n ") + "`n mailbox: " + ($mb -join ' ') + "`n screen:`n " + (($rows | Where-Object { $_ }) -join "`n "))
- }
- Write-Host "screen:"
- $rows | Where-Object { $_ } | ForEach-Object { Write-Host " |$_" }
- Write-Host "mailbox: producer 3, PASS, code 0, all 5 lifetime flags set"
- Write-Host "verified delete through one and two interface values, null delete, alias detection, and the null call fault"
|