# E05-S02: run the class descriptor/object fixture in x128 and verify the # descriptor ABI, object headers, and deterministic CLASS MAP records. [CmdletBinding()] param([int]$Port = 6552, [int]$TimeoutSeconds = 90) $ErrorActionPreference = "Stop" $project = Split-Path $PSScriptRoot -Parent Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force & (Join-Path $PSScriptRoot "build-class-test.ps1") $out = Join-Path $project "build\class-test" $disk = Join-Path $out "class-test.d81" $labels = Join-Path $out "class-test.lbl" $c1541 = Get-ViceTool "c1541" $failures = @() $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port ` -Screenshot (Join-Path $out "class-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 8; $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 "NOVA128 CLASS TEST OK")) { $failures += "screen does not contain 'NOVA128 CLASS TEST OK'" } function Read-DiskFile([string]$Name, [string]$Dest, [bool]$Seq) { if (Test-Path -LiteralPath $Dest) { Remove-Item -LiteralPath $Dest -Force } $spec = if ($Seq) { "$Name,s" } else { $Name } & $c1541 -attach $disk -read $spec $Dest 2>&1 | Out-Null if (-not (Test-Path -LiteralPath $Dest)) { throw "could not read $Name from the test disk" } } $mapPath = Join-Path $out "CLASSTEST.MAP" Read-DiskFile "classtest.map" $mapPath $true $mapLines = ([IO.File]::ReadAllText($mapPath)).TrimEnd("`r", "`n") -split "`r`n|`r|`n" $destroy = Get-Nova128Label $labels "destroy_b" $stub = Get-Nova128Label $labels "method_stub" $ifdir = Get-Nova128Label $labels "iface_dir" $expectedMap = @( "NOVA128 MAP 1", "ENTRY 1C0D", "SECTION STUB 1C01 000C", "SECTION START 1C0D 004A", ("CLASS EMPTY 0007 0000 00 0000"), ("CLASS BOX 0023 {0:X4} 01 {1:X4}" -f $destroy, $ifdir), ("METHOD DESTROY {0:X4}" -f $destroy), ("METHOD STUB {0:X4}" -f $stub)) if (($mapLines -join "`n") -ne ($expectedMap -join "`n")) { $failures += ("CLASSTEST.MAP differs:`n got: " + ($mapLines -join "`n ") + "`n want: " + ($expectedMap -join "`n ")) } if ($failures) { throw ("class verification failed:`n " + ($failures -join "`n ")) } Write-Host "screen:" $rows | Where-Object { $_ } | ForEach-Object { Write-Host " |$_" } Write-Host ("mailbox: producer 3, PASS, all 8 descriptor/MAP flags set; destroy {0:X4}, ifdir {1:X4}" -f $destroy, $ifdir) Write-Host "MAP:" $expectedMap | ForEach-Object { Write-Host " |$_" }