|
- # E05-S04: run the member fixture and check field offsets, two-object
- # independence, the concrete-call ABI, and word results.
- [CmdletBinding()]
- param([int]$Port = 6556, [int]$TimeoutSeconds = 180)
-
- $ErrorActionPreference = "Stop"
- $project = Split-Path $PSScriptRoot -Parent
- Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force
- & (Join-Path $PSScriptRoot "build-member-test.ps1")
-
- $out = Join-Path $project "build\member-test"
- $disk = Join-Path $out "member-test.d81"
- $failures = @()
-
- $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port `
- -Screenshot (Join-Path $out "member-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 4; $i++) {
- if ($mb[8 + $i] -ne 1) { $failures += "flag $i is $($mb[8 + $i]), expected 1" }
- }
- if ($mb[12] -ne 0x78) { $failures += ('result low is {0:X2}, expected 78' -f $mb[12]) }
- if ($mb[13] -ne 0x56) { $failures += ('result high is {0:X2}, expected 56' -f $mb[13]) }
-
- $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 "MEMBER OK")) {
- $failures += "screen does not contain 'MEMBER OK'"
- }
-
- if ($failures) { throw ("member verification failed:`n " + ($failures -join "`n ")) }
- Write-Host "screen:"
- $rows | Where-Object { $_ } | ForEach-Object { Write-Host " |$_" }
- Write-Host "mailbox: producer 3, PASS, code 0, all 4 member/call flags set"
- Write-Host "verified field offsets, two-object independence, concrete-call ABI with argument discard, and word results"
|